]> git.sesse.net Git - nageru/commitdiff
Put the quick-cut keys behind a command-line flag; I hate more switches, but they...
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 29 Oct 2017 14:08:51 +0000 (15:08 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 29 Oct 2017 14:08:51 +0000 (15:08 +0100)
flags.cpp
flags.h
mainwindow.cpp
ui_mainwindow.ui

index 41365c5284c2d1d5a17776fcb6afef4080fae483..2d8e37f5d8ff25944ce99e6942bfa2fe3aba0e60 100644 (file)
--- a/flags.cpp
+++ b/flags.cpp
@@ -57,6 +57,7 @@ enum LongOption {
        OPTION_OUTPUT_SLOP_FRAMES,
        OPTION_TIMECODE_STREAM,
        OPTION_TIMECODE_STDOUT,
+       OPTION_QUICK_CUT_KEYS,
        OPTION_10_BIT_INPUT,
        OPTION_10_BIT_OUTPUT,
        OPTION_INPUT_YCBCR_INTERPRETATION,
@@ -147,6 +148,7 @@ void usage(Program program)
                fprintf(stderr, "                                    dropping the frame (default 0.5)\n");
                fprintf(stderr, "      --timecode-stream           show timestamp and timecode in stream\n");
                fprintf(stderr, "      --timecode-stdout           show timestamp and timecode on standard output\n");
+               fprintf(stderr, "      --quick-cut-keys            enable direct cutting by Q, W, E, ... keys\n");
                fprintf(stderr, "      --10-bit-input              use 10-bit video input (requires compute shaders)\n");
                fprintf(stderr, "      --10-bit-output             use 10-bit video output (requires compute shaders,\n");
                fprintf(stderr, "                                    implies --record-x264-video)\n");
@@ -214,6 +216,7 @@ void parse_flags(Program program, int argc, char * const argv[])
                { "output-slop-frames", required_argument, 0, OPTION_OUTPUT_SLOP_FRAMES },
                { "timecode-stream", no_argument, 0, OPTION_TIMECODE_STREAM },
                { "timecode-stdout", no_argument, 0, OPTION_TIMECODE_STDOUT },
+               { "quick-cut-keys", no_argument, 0, OPTION_QUICK_CUT_KEYS },
                { "10-bit-input", no_argument, 0, OPTION_10_BIT_INPUT },
                { "10-bit-output", no_argument, 0, OPTION_10_BIT_OUTPUT },
                { "input-ycbcr-interpretation", required_argument, 0, OPTION_INPUT_YCBCR_INTERPRETATION },
@@ -410,6 +413,9 @@ void parse_flags(Program program, int argc, char * const argv[])
                case OPTION_TIMECODE_STDOUT:
                        global_flags.display_timecode_on_stdout = true;
                        break;
+               case OPTION_QUICK_CUT_KEYS:
+                       global_flags.enable_quick_cut_keys = true;
+                       break;
                case OPTION_10_BIT_INPUT:
                        global_flags.ten_bit_input = true;
                        break;
diff --git a/flags.h b/flags.h
index 83d1894b472e67a0b09688e472f2bb0e055b5dc2..147c62a0b1b80c3406ce69fa01bd3fdbe5e480e2 100644 (file)
--- a/flags.h
+++ b/flags.h
@@ -57,6 +57,7 @@ struct Flags {
        int http_port = DEFAULT_HTTPD_PORT;
        bool display_timecode_in_stream = false;
        bool display_timecode_on_stdout = false;
+       bool enable_quick_cut_keys = false;
        bool ten_bit_input = false;
        bool ten_bit_output = false;  // Implies x264_video_to_disk == true and x264_bit_depth == 10.
        YCbCrInterpretation ycbcr_interpretation[MAX_VIDEO_CARDS];
index eb7fb54a769d9f30022ef581fe82efc77ffc3b85..d46c87c38e7766b667230057482814f8879646ca 100644 (file)
@@ -253,6 +253,13 @@ MainWindow::MainWindow()
        connect(new QShortcut(QKeySequence::MoveToNextPage, this), &QShortcut::activated, switch_page);
        connect(new QShortcut(QKeySequence::MoveToPreviousPage, this), &QShortcut::activated, switch_page);
 
+       if (global_flags.enable_quick_cut_keys) {
+               ui->quick_cut_enable_action->setChecked(true);
+       }
+       connect(ui->quick_cut_enable_action, &QAction::changed, [this](){
+               global_flags.enable_quick_cut_keys = ui->quick_cut_enable_action->isChecked();
+       });
+
        last_audio_level_callback = steady_clock::now() - seconds(1);
 
        if (!global_flags.midi_mapping_filename.empty()) {
@@ -1290,6 +1297,9 @@ void MainWindow::channel_clicked(int channel_number)
 
 void MainWindow::quick_cut_activated(int channel_number)
 {
+       if (!global_flags.enable_quick_cut_keys) {
+               return;
+       }
        global_mixer->channel_clicked(channel_number);
        global_mixer->transition_clicked(0);
 }
index 19858aa1de2f1e8e68ba899926e3928dd75d016c..1eafc87a88b467d43d7ce5a6dfd9e22b9436ad73 100644 (file)
                 <rect>
                  <x>0</x>
                  <y>0</y>
-                 <width>505</width>
-                 <height>238</height>
+                 <width>497</width>
+                 <height>235</height>
                 </rect>
                </property>
                <layout class="QHBoxLayout" name="horizontalLayout_4">
                 <rect>
                  <x>0</x>
                  <y>0</y>
-                 <width>46</width>
-                 <height>20</height>
+                 <width>100</width>
+                 <height>30</height>
                 </rect>
                </property>
                <layout class="QHBoxLayout" name="horizontalLayout_5">
      <x>0</x>
      <y>0</y>
      <width>1089</width>
-     <height>20</height>
+     <height>22</height>
     </rect>
    </property>
    <widget class="QMenu" name="video_menu">
     <addaction name="hdmi_sdi_output_device_menu"/>
     <addaction name="hdmi_sdi_output_resolution_menu"/>
     <addaction name="display_timecode_menu"/>
+    <addaction name="quick_cut_enable_action"/>
     <addaction name="exit_action"/>
    </widget>
    <widget class="QMenu" name="menu_Help">
     <string>Open frame &amp;analyzer…</string>
    </property>
   </action>
+  <action name="quick_cut_enable_action">
+   <property name="checkable">
+    <bool>true</bool>
+   </property>
+   <property name="text">
+    <string>Enable &amp;quick-cut keys (Q, W, E, etc.)</string>
+   </property>
+  </action>
  </widget>
  <layoutdefault spacing="6" margin="11"/>
  <customwidgets>