Upgrade to C++20 (#7554)

* Compile in C++20 mode

* Fix implicit lambda captures of `this` by `[=]`

Those implicit captures were deprecated in C++20

* Silence MSVC atomic std::shared_ptr warning

Unfortunately std::atomic<std::shared_ptr> (P0718R2) is not supported by
GCC until GCC 12 and still is not supported by Clang or Apple Clang, so
it looks like we will continue using std::atomic_load for the time being

* Use C++20 in RemoteVstPlugin

* Simplification

* Add comment

* Fix bitwise operations between different enumeration types

* Revert "Fix bitwise operations between different enumeration types"

This reverts commit d45792cd72.

* Use a helper function to combine keys and modifiers

* Remove AnalyzeTemporaryDtors from .clang-tidy

AnalyzeTemporaryDtors was deprecated in clang-tidy 16 and fully removed
in clang-tidy 18

* Use C++20 in .clang-format

* Use bitwise OR

Prevents issues if any enum flags in `args` have bits in common
This commit is contained in:
Dalton Messmer
2024-11-22 23:11:39 -05:00
committed by GitHub
parent 72b30b1d00
commit c21a7cd487
23 changed files with 109 additions and 73 deletions

View File

@@ -38,6 +38,7 @@
#include "AboutDialog.h"
#include "AutomationEditor.h"
#include "ControllerRackView.h"
#include "DeprecationHelper.h"
#include "embed.h"
#include "Engine.h"
#include "ExportProjectDialog.h"
@@ -293,11 +294,11 @@ void MainWindow::finalize()
project_menu->addAction( embed::getIconPixmap( "project_save" ),
tr( "Save &As..." ),
this, SLOT(saveProjectAs()),
Qt::CTRL + Qt::SHIFT + Qt::Key_S );
combine(Qt::CTRL, Qt::SHIFT, Qt::Key_S));
project_menu->addAction( embed::getIconPixmap( "project_save" ),
tr( "Save as New &Version" ),
this, SLOT(saveProjectAsNewVersion()),
Qt::CTRL + Qt::ALT + Qt::Key_S );
combine(Qt::CTRL, Qt::ALT, Qt::Key_S));
project_menu->addAction( embed::getIconPixmap( "project_save" ),
tr( "Save as default template" ),
@@ -312,23 +313,23 @@ void MainWindow::finalize()
tr( "E&xport..." ),
this,
SLOT(onExportProject()),
Qt::CTRL + Qt::Key_E );
combine(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 );
combine(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 );
combine(Qt::CTRL, Qt::Key_M));
project_menu->addSeparator();
project_menu->addAction( embed::getIconPixmap( "exit" ), tr( "&Quit" ),
qApp, SLOT(closeAllWindows()),
Qt::CTRL + Qt::Key_Q );
combine(Qt::CTRL, Qt::Key_Q));
auto edit_menu = new QMenu(this);
menuBar()->addMenu( edit_menu )->setText( tr( "&Edit" ) );
@@ -341,13 +342,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(combine(Qt::CTRL, Qt::Key_Y)))
{
new QShortcut( QKeySequence( Qt::CTRL + Qt::Key_Y ), this, SLOT(redo()));
new QShortcut(QKeySequence(combine(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(combine(Qt::CTRL, Qt::SHIFT, Qt::Key_Z)))
{
new QShortcut( QKeySequence( Qt::CTRL + Qt::SHIFT + Qt::Key_Z ), this, SLOT(redo()));
new QShortcut(QKeySequence(combine(Qt::CTRL, Qt::SHIFT, Qt::Key_Z)), this, SLOT(redo()));
}
edit_menu->addSeparator();
@@ -446,31 +447,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(combine(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(combine(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(combine(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(combine(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(combine(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(combine(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(combine(Qt::CTRL, Qt::Key_7));
m_toolBarLayout->addWidget( song_editor_window, 1, 1 );
m_toolBarLayout->addWidget( pattern_editor_window, 1, 2 );