| 37 | #include <QtWidgets/QSplitter> |
| 38 | |
| 39 | InputEditorWindow::InputEditorWindow(Context* c, MovieFile *movie, QWidget *parent) : QMainWindow(parent), context(c), movie(movie) |
| 40 | { |
| 41 | setWindowTitle("Input Editor"); |
| 42 | |
| 43 | /* Table */ |
| 44 | inputEditorView = new InputEditorView(c, movie, this); |
| 45 | |
| 46 | /* Panels */ |
| 47 | markerView = new MarkerView(c, movie, this); |
| 48 | |
| 49 | /* Signals */ |
| 50 | connect(markerView, &MarkerView::seekSignal, inputEditorView->inputEditorModel, &InputEditorModel::seekToFrame); |
| 51 | connect(markerView, &MarkerView::scrollSignal, inputEditorView, &InputEditorView::scrollToFrame); |
| 52 | connect(inputEditorView, &InputEditorView::addMarkerSignal, markerView->markerModel, &MarkerModel::addMarker); |
| 53 | connect(inputEditorView, &InputEditorView::removeMarkerSignal, markerView->markerModel, &MarkerModel::removeMarker); |
| 54 | connect(inputEditorView->selectionModel(), &QItemSelectionModel::selectionChanged, this, &InputEditorWindow::updateStatusBar); |
| 55 | connect(inputEditorView->inputEditorModel, &InputEditorModel::stateLoaded, this, &InputEditorWindow::updateProgressBar); |
| 56 | |
| 57 | markerBox = new QGroupBox(tr("Markers")); |
| 58 | QVBoxLayout* markerLayout = new QVBoxLayout; |
| 59 | markerLayout->addWidget(markerView); |
| 60 | markerBox->setLayout(markerLayout); |
| 61 | |
| 62 | /* Side View */ |
| 63 | QVBoxLayout *sideLayout = new QVBoxLayout; |
| 64 | sideLayout->addWidget(markerBox); |
| 65 | |
| 66 | /* Main menu */ |
| 67 | QMenu* inputMenu = menuBar()->addMenu(tr("Inputs")); |
| 68 | inputMenu->addAction(tr("Add boolean input column"), inputEditorView, &InputEditorView::addInputColumn); |
| 69 | inputMenu->addAction(tr("Add analog input column"), this, &InputEditorWindow::showAnalogInputsWindow); |
| 70 | |
| 71 | QMenu* menu = menuBar()->addMenu(tr("Frames")); |
| 72 | inputEditorView->fillMenu(menu); |
| 73 | |
| 74 | QMenu* panelMenu = menuBar()->addMenu(tr("Panels")); |
| 75 | |
| 76 | markerPanelAct = panelMenu->addAction(tr("Markers"), this, |
| 77 | [=, this](bool checked){context->config.editor_panel_marker = checked; markerBox->setVisible(checked);}); |
| 78 | |
| 79 | markerPanelAct->setCheckable(true); |
| 80 | |
| 81 | panelMenu->addAction(tr("Change Log"), this, &InputEditorWindow::showInputChangeLogWindow); |
| 82 | |
| 83 | QMenu* optionMenu = menuBar()->addMenu(tr("Options")); |
| 84 | |
| 85 | scrollingAct = optionMenu->addAction(tr("Disable autoscrolling"), this, |
| 86 | [=, this](bool checked){context->config.editor_autoscroll = !checked;}, QKeySequence("Alt+D")); |
| 87 | scrollingAct->setCheckable(true); |
| 88 | |
| 89 | rewindAct = optionMenu->addAction(tr("Rewind seeks to current frame"), this, |
| 90 | [=, this](bool checked){context->config.editor_rewind_seek = checked;}, QKeySequence("Alt+R")); |
| 91 | |
| 92 | rewindAct->setCheckable(true); |
| 93 | |
| 94 | fastforwardAct = optionMenu->addAction(tr("Disable fastforward during rewind"), this, |
| 95 | [=, this](bool checked){context->config.editor_rewind_fastforward = !checked;}, QKeySequence("Alt+F")); |
| 96 | |