From 6b1a2547dc1bb2202988f78cdbd4fd3807b760b5 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sun, 29 Oct 2017 15:08:51 +0100 Subject: [PATCH] Put the quick-cut keys behind a command-line flag; I hate more switches, but they are just too easy to hit during normal operation. --- flags.cpp | 6 ++++++ flags.h | 1 + mainwindow.cpp | 10 ++++++++++ ui_mainwindow.ui | 19 ++++++++++++++----- 4 files changed, 31 insertions(+), 5 deletions(-) diff --git a/flags.cpp b/flags.cpp index 41365c5..2d8e37f 100644 --- 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 83d1894..147c62a 100644 --- 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]; diff --git a/mainwindow.cpp b/mainwindow.cpp index eb7fb54..d46c87c 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -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); } diff --git a/ui_mainwindow.ui b/ui_mainwindow.ui index 19858aa..1eafc87 100644 --- a/ui_mainwindow.ui +++ b/ui_mainwindow.ui @@ -640,8 +640,8 @@ 0 0 - 505 - 238 + 497 + 235 @@ -1130,8 +1130,8 @@ 0 0 - 46 - 20 + 100 + 30 @@ -1390,7 +1390,7 @@ 0 0 1089 - 20 + 22 @@ -1422,6 +1422,7 @@ + @@ -1520,6 +1521,14 @@ Open frame &analyzer… + + + true + + + Enable &quick-cut keys (Q, W, E, etc.) + + -- 2.39.2