From d45792cd72ad35411229add69ea89d2e17b710d7 Mon Sep 17 00:00:00 2001 From: Dalton Messmer Date: Thu, 7 Nov 2024 02:44:27 -0500 Subject: [PATCH] Fix bitwise operations between different enumeration types --- src/gui/ControllerRackView.cpp | 4 ++-- src/gui/EffectRackView.cpp | 4 ++-- src/gui/MainWindow.cpp | 30 ++++++++++++++-------------- src/gui/editors/AutomationEditor.cpp | 8 ++++---- src/gui/editors/Editor.cpp | 4 ++-- src/gui/editors/PianoRoll.cpp | 22 ++++++++++---------- 6 files changed, 36 insertions(+), 36 deletions(-) diff --git a/src/gui/ControllerRackView.cpp b/src/gui/ControllerRackView.cpp index e7d2efebd06..4ecb1ebfc80 100644 --- a/src/gui/ControllerRackView.cpp +++ b/src/gui/ControllerRackView.cpp @@ -167,13 +167,13 @@ void ControllerRackView::addController(Controller* controller) connect(controllerView, &ControllerView::removedController, this, &ControllerRackView::deleteController, Qt::QueuedConnection); auto moveUpAction = new QAction(controllerView); - moveUpAction->setShortcut(Qt::Key_Up | Qt::AltModifier); + moveUpAction->setShortcut(QKeySequence{Qt::Key_Up, Qt::AltModifier}); moveUpAction->setShortcutContext(Qt::WidgetShortcut); connect(moveUpAction, &QAction::triggered, controllerView, &ControllerView::moveUp); controllerView->addAction(moveUpAction); auto moveDownAction = new QAction(controllerView); - moveDownAction->setShortcut(Qt::Key_Down | Qt::AltModifier); + moveDownAction->setShortcut(QKeySequence{Qt::Key_Down, Qt::AltModifier}); moveDownAction->setShortcutContext(Qt::WidgetShortcut); connect(moveDownAction, &QAction::triggered, controllerView, &ControllerView::moveDown); controllerView->addAction(moveDownAction); diff --git a/src/gui/EffectRackView.cpp b/src/gui/EffectRackView.cpp index b43ec7648b0..81dad597db8 100644 --- a/src/gui/EffectRackView.cpp +++ b/src/gui/EffectRackView.cpp @@ -176,13 +176,13 @@ void EffectRackView::update() connect(view, &EffectView::deletedPlugin, this, &EffectRackView::deletePlugin, Qt::QueuedConnection); QAction* moveUpAction = new QAction(view); - moveUpAction->setShortcut(Qt::Key_Up | Qt::AltModifier); + moveUpAction->setShortcut(QKeySequence{Qt::Key_Up, Qt::AltModifier}); moveUpAction->setShortcutContext(Qt::WidgetShortcut); connect(moveUpAction, &QAction::triggered, view, &EffectView::moveUp); view->addAction(moveUpAction); QAction* moveDownAction = new QAction(view); - moveDownAction->setShortcut(Qt::Key_Down | Qt::AltModifier); + moveDownAction->setShortcut(QKeySequence{Qt::Key_Down, Qt::AltModifier}); moveDownAction->setShortcutContext(Qt::WidgetShortcut); connect(moveDownAction, &QAction::triggered, view, &EffectView::moveDown); view->addAction(moveDownAction); diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index c45ea14aca1..cb3f18e9764 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -312,23 +312,23 @@ void MainWindow::finalize() tr( "E&xport..." ), this, SLOT(onExportProject()), - Qt::CTRL + Qt::Key_E ); + QKeySequence{Qt::CTRL, Qt::Key_E}); project_menu->addAction( embed::getIconPixmap( "project_export" ), tr( "E&xport Tracks..." ), this, SLOT(onExportProjectTracks()), - Qt::CTRL + Qt::SHIFT + Qt::Key_E ); + QKeySequence{Qt::CTRL, Qt::SHIFT, Qt::Key_E}); project_menu->addAction( embed::getIconPixmap( "midi_file" ), tr( "Export &MIDI..." ), this, SLOT(onExportProjectMidi()), - Qt::CTRL + Qt::Key_M ); + QKeySequence{Qt::CTRL, Qt::Key_M}); project_menu->addSeparator(); project_menu->addAction( embed::getIconPixmap( "exit" ), tr( "&Quit" ), qApp, SLOT(closeAllWindows()), - Qt::CTRL + Qt::Key_Q ); + QKeySequence{Qt::CTRL, Qt::Key_Q}); auto edit_menu = new QMenu(this); menuBar()->addMenu( edit_menu )->setText( tr( "&Edit" ) ); @@ -341,13 +341,13 @@ void MainWindow::finalize() this, SLOT(redo()), QKeySequence::Redo ); // Ensure that both (Ctrl+Y) and (Ctrl+Shift+Z) activate redo shortcut regardless of OS defaults - if (QKeySequence(QKeySequence::Redo) != QKeySequence(Qt::CTRL + Qt::Key_Y)) + if (QKeySequence(QKeySequence::Redo) != QKeySequence(Qt::CTRL, Qt::Key_Y)) { - new QShortcut( QKeySequence( Qt::CTRL + Qt::Key_Y ), this, SLOT(redo())); + new QShortcut(QKeySequence(Qt::CTRL, Qt::Key_Y), this, SLOT(redo())); } - if (QKeySequence(QKeySequence::Redo) != QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Z )) + if (QKeySequence(QKeySequence::Redo) != QKeySequence(Qt::CTRL, Qt::SHIFT, Qt::Key_Z)) { - new QShortcut( QKeySequence( Qt::CTRL + Qt::SHIFT + Qt::Key_Z ), this, SLOT(redo())); + new QShortcut(QKeySequence(Qt::CTRL, Qt::SHIFT, Qt::Key_Z), this, SLOT(redo())); } edit_menu->addSeparator(); @@ -446,31 +446,31 @@ void MainWindow::finalize() // window-toolbar auto song_editor_window = new ToolButton(embed::getIconPixmap("songeditor"), tr("Song Editor") + " (Ctrl+1)", this, SLOT(toggleSongEditorWin()), m_toolBar); - song_editor_window->setShortcut( Qt::CTRL + Qt::Key_1 ); + song_editor_window->setShortcut(QKeySequence{Qt::CTRL, Qt::Key_1}); auto pattern_editor_window = new ToolButton(embed::getIconPixmap("pattern_track_btn"), tr("Pattern Editor") + " (Ctrl+2)", this, SLOT(togglePatternEditorWin()), m_toolBar); - pattern_editor_window->setShortcut(Qt::CTRL + Qt::Key_2); + pattern_editor_window->setShortcut(QKeySequence{Qt::CTRL, Qt::Key_2}); auto piano_roll_window = new ToolButton( embed::getIconPixmap("piano"), tr("Piano Roll") + " (Ctrl+3)", this, SLOT(togglePianoRollWin()), m_toolBar); - piano_roll_window->setShortcut( Qt::CTRL + Qt::Key_3 ); + piano_roll_window->setShortcut(QKeySequence{Qt::CTRL, Qt::Key_3}); auto automation_editor_window = new ToolButton(embed::getIconPixmap("automation"), tr("Automation Editor") + " (Ctrl+4)", this, SLOT(toggleAutomationEditorWin()), m_toolBar); - automation_editor_window->setShortcut( Qt::CTRL + Qt::Key_4 ); + automation_editor_window->setShortcut(QKeySequence{Qt::CTRL, Qt::Key_4}); auto mixer_window = new ToolButton( embed::getIconPixmap("mixer"), tr("Mixer") + " (Ctrl+5)", this, SLOT(toggleMixerWin()), m_toolBar); - mixer_window->setShortcut( Qt::CTRL + Qt::Key_5 ); + mixer_window->setShortcut(QKeySequence{Qt::CTRL, Qt::Key_5}); auto controllers_window = new ToolButton(embed::getIconPixmap("controller"), tr("Show/hide controller rack") + " (Ctrl+6)", this, SLOT(toggleControllerRack()), m_toolBar); - controllers_window->setShortcut( Qt::CTRL + Qt::Key_6 ); + controllers_window->setShortcut(QKeySequence{Qt::CTRL, Qt::Key_6}); auto project_notes_window = new ToolButton(embed::getIconPixmap("project_notes"), tr("Show/hide project notes") + " (Ctrl+7)", this, SLOT(toggleProjectNotesWin()), m_toolBar); - project_notes_window->setShortcut( Qt::CTRL + Qt::Key_7 ); + project_notes_window->setShortcut(QKeySequence{Qt::CTRL, Qt::Key_7}); m_toolBarLayout->addWidget( song_editor_window, 1, 1 ); m_toolBarLayout->addWidget( pattern_editor_window, 1, 2 ); diff --git a/src/gui/editors/AutomationEditor.cpp b/src/gui/editors/AutomationEditor.cpp index 3dc0285d282..ca6c5d3324b 100644 --- a/src/gui/editors/AutomationEditor.cpp +++ b/src/gui/editors/AutomationEditor.cpp @@ -2037,17 +2037,17 @@ AutomationEditorWindow::AutomationEditorWindow() : auto editModeGroup = new ActionGroup(this); m_drawAction = editModeGroup->addAction(embed::getIconPixmap("edit_draw"), tr("Draw mode (Shift+D)")); - m_drawAction->setShortcut(Qt::SHIFT | Qt::Key_D); + m_drawAction->setShortcut(QKeySequence{Qt::SHIFT, Qt::Key_D}); m_drawAction->setChecked(true); m_eraseAction = editModeGroup->addAction(embed::getIconPixmap("edit_erase"), tr("Erase mode (Shift+E)")); - m_eraseAction->setShortcut(Qt::SHIFT | Qt::Key_E); + m_eraseAction->setShortcut(QKeySequence{Qt::SHIFT, Qt::Key_E}); m_drawOutAction = editModeGroup->addAction(embed::getIconPixmap("edit_draw_outvalue"), tr("Draw outValues mode (Shift+C)")); - m_drawOutAction->setShortcut(Qt::SHIFT | Qt::Key_C); + m_drawOutAction->setShortcut(QKeySequence{Qt::SHIFT, Qt::Key_C}); m_editTanAction = editModeGroup->addAction(embed::getIconPixmap("edit_tangent"), tr("Edit tangents mode (Shift+T)")); - m_editTanAction->setShortcut(Qt::SHIFT | Qt::Key_T); + m_editTanAction->setShortcut(QKeySequence{Qt::SHIFT, Qt::Key_T}); m_editTanAction->setEnabled(false); m_flipYAction = new QAction(embed::getIconPixmap("flip_y"), tr("Flip vertically"), this); diff --git a/src/gui/editors/Editor.cpp b/src/gui/editors/Editor.cpp index ab12e3fb90b..3fdb1d4c309 100644 --- a/src/gui/editors/Editor.cpp +++ b/src/gui/editors/Editor.cpp @@ -118,8 +118,8 @@ Editor::Editor(bool record, bool stepRecord) : connect(m_toggleStepRecordingAction, SIGNAL(triggered()), this, SLOT(toggleStepRecording())); connect(m_stopAction, SIGNAL(triggered()), this, SLOT(stop())); new QShortcut(Qt::Key_Space, this, SLOT(togglePlayStop())); - new QShortcut(QKeySequence(Qt::SHIFT + Qt::Key_Space), this, SLOT(togglePause())); - new QShortcut(QKeySequence(Qt::SHIFT + Qt::Key_F11), this, SLOT(toggleMaximize())); + new QShortcut(QKeySequence(Qt::SHIFT, Qt::Key_Space), this, SLOT(togglePause())); + new QShortcut(QKeySequence(Qt::SHIFT, Qt::Key_F11), this, SLOT(toggleMaximize())); // Add actions to toolbar addButton(m_playAction, "playButton"); diff --git a/src/gui/editors/PianoRoll.cpp b/src/gui/editors/PianoRoll.cpp index 60403e41a01..bc7dc84fd2c 100644 --- a/src/gui/editors/PianoRoll.cpp +++ b/src/gui/editors/PianoRoll.cpp @@ -4764,10 +4764,10 @@ PianoRollWindow::PianoRollWindow() : drawAction->setChecked( true ); - drawAction->setShortcut( Qt::SHIFT | Qt::Key_D ); - eraseAction->setShortcut( Qt::SHIFT | Qt::Key_E ); - selectAction->setShortcut( Qt::SHIFT | Qt::Key_S ); - pitchBendAction->setShortcut( Qt::SHIFT | Qt::Key_T ); + drawAction->setShortcut(QKeySequence{Qt::SHIFT, Qt::Key_D}); + eraseAction->setShortcut(QKeySequence{Qt::SHIFT, Qt::Key_E}); + selectAction->setShortcut(QKeySequence{Qt::SHIFT, Qt::Key_S}); + pitchBendAction->setShortcut(QKeySequence{Qt::SHIFT, Qt::Key_T}); connect( editModeGroup, SIGNAL(triggered(int)), m_editor, SLOT(setEditMode(int))); @@ -4826,9 +4826,9 @@ PianoRollWindow::PianoRollWindow() : auto pasteAction = new QAction(embed::getIconPixmap("edit_paste"), tr("Paste (%1+V)").arg(UI_CTRL_KEY), this); - cutAction->setShortcut( Qt::CTRL | Qt::Key_X ); - copyAction->setShortcut( Qt::CTRL | Qt::Key_C ); - pasteAction->setShortcut( Qt::CTRL | Qt::Key_V ); + cutAction->setShortcut(QKeySequence{Qt::CTRL, Qt::Key_X}); + copyAction->setShortcut(QKeySequence{Qt::CTRL, Qt::Key_C}); + pasteAction->setShortcut(QKeySequence{Qt::CTRL, Qt::Key_V}); connect( cutAction, SIGNAL(triggered()), m_editor, SLOT(cutSelectedNotes())); connect( copyAction, SIGNAL(triggered()), m_editor, SLOT(copySelectedNotes())); @@ -4849,19 +4849,19 @@ PianoRollWindow::PianoRollWindow() : auto glueAction = new QAction(embed::getIconPixmap("glue"), tr("Glue"), noteToolsButton); connect(glueAction, SIGNAL(triggered()), m_editor, SLOT(glueNotes())); - glueAction->setShortcut( Qt::SHIFT | Qt::Key_G ); + glueAction->setShortcut(QKeySequence{Qt::SHIFT, Qt::Key_G}); auto knifeAction = new QAction(embed::getIconPixmap("edit_knife"), tr("Knife"), noteToolsButton); connect(knifeAction, &QAction::triggered, m_editor, &PianoRoll::setKnifeAction); - knifeAction->setShortcut( Qt::SHIFT | Qt::Key_K ); + knifeAction->setShortcut(QKeySequence{Qt::SHIFT, Qt::Key_K}); auto fillAction = new QAction(embed::getIconPixmap("fill"), tr("Fill"), noteToolsButton); connect(fillAction, &QAction::triggered, [this](){ m_editor->fitNoteLengths(true); }); - fillAction->setShortcut(Qt::SHIFT | Qt::Key_F); + fillAction->setShortcut(QKeySequence{Qt::SHIFT, Qt::Key_F}); auto cutOverlapsAction = new QAction(embed::getIconPixmap("cut_overlaps"), tr("Cut overlaps"), noteToolsButton); connect(cutOverlapsAction, &QAction::triggered, [this](){ m_editor->fitNoteLengths(false); }); - cutOverlapsAction->setShortcut(Qt::SHIFT | Qt::Key_C); + cutOverlapsAction->setShortcut(QKeySequence{Qt::SHIFT, Qt::Key_C}); auto minLengthAction = new QAction(embed::getIconPixmap("min_length"), tr("Min length as last"), noteToolsButton); connect(minLengthAction, &QAction::triggered, [this](){ m_editor->constrainNoteLengths(false); });