diff --git a/.github/workflows/cmake.yaml b/.github/workflows/cmake.yaml deleted file mode 100644 index 27762d16..00000000 --- a/.github/workflows/cmake.yaml +++ /dev/null @@ -1,36 +0,0 @@ -name: Build with CMake on Windows -on: - push: - branches: - - 'main' - paths: - - '**.c' - - '**.cpp' - - '**.h' - - '**.hpp' - - '**.rc' - - '**.qrc' - - '**.ts' - - 'CMakeLists.txt' - - '.github/workflows/cmake.yml' - -jobs: - build: - runs-on: windows-latest - steps: - - uses: actions/checkout@v4 - with: - submodules: 'recursive' - - - name: Install Qt - uses: jurplel/install-qt-action@v4 - with: - version: '6.8.1' - arch: 'win64_msvc2022_64' - modules: 'qtmultimedia' - - - name: Configure CMake - run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=Release - - - name: Build - run: cmake --build ${{github.workspace}}/build --config Release \ No newline at end of file diff --git a/.github/workflows/xmake.yaml b/.github/workflows/xmake.yaml index 4abf961f..4cad3944 100644 --- a/.github/workflows/xmake.yaml +++ b/.github/workflows/xmake.yaml @@ -1,59 +1,67 @@ -# name: Build with xmake on windows -# on: - # push: - # branches: - # - 'main' - # paths: - # - '**.c' - # - '**.cpp' - # - '**.h' - # - '**.hpp' - # - '**.rc' - # - '**.qrc' - # - '**.ts' - # - '**.lua' - # - '.github/workflows/xmake.yaml' - -# jobs: - # build: - # runs-on: windows-latest - # if: always() - - # steps: - # - uses: xmake-io/github-action-setup-xmake@v1 - # with: - # xmake-version: latest - - # - name: update repo - # run: | - # xrepo update-repo - - # - uses: actions/checkout@v4 - # with: - # fetch-depth: 1 - - # - name: cache packages from xrepo - # uses: actions/cache@v4 - # with: - # path: | - # ${{ env.XMAKE_GLOBALDIR }}/.xmake/packages - # key: ${{ runner.os }}-xrepo-qt-${{ hashFiles('scripts/xmake/packages.lua') }} - - # - name: cache xmake - # uses: actions/cache@v4 - # with: - # path: | - # ${{ github.workspace }}/.xmake/**/cache - # ${{ github.workspace }}/build/.build_cache - # ${{ github.workspace }}/build/.deps - # ${{ github.workspace }}/build/.gens - # ${{ github.workspace }}/build/.objs - # key: ${{ runner.os }}-xmake-build-${{ hashFiles('**/xmake.lua') }} - - # - name: config by xmake - # run: | - # xmake config --yes --verbose --diagnosis - - # - name: build by xmake - # run: | - # xmake build --verbose --diagnosis --jobs=2 \ No newline at end of file +name: Build with xmake on windows +on: + push: + branches: + - 'main' + paths: + - '**.c' + - '**.cpp' + - '**.h' + - '**.hpp' + - '**.rc' + - '**.qrc' + - '**.ts' + - '**.lua' + - '.github/workflows/xmake.yaml' + +jobs: + build: + runs-on: windows-latest + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 1 + + - uses: xmake-io/github-action-setup-xmake@v1 + with: + xmake-version: latest + + - name: Install Qt + uses: jurplel/install-qt-action@v4 + with: + version: '6.8.1' + host: 'windows' + target: 'desktop' + arch: 'win64_msvc2022_64' + modules: 'qtmultimedia' + + - name: update repo + run: | + xrepo update-repo + + - name: cache packages from xrepo + uses: actions/cache@v4 + with: + path: | + ${{ env.XMAKE_GLOBALDIR }}/.xmake/packages + key: ${{ runner.os }}-xrepo-qt-${{ hashFiles('scripts/xmake/packages.lua') }} + + - name: cache xmake + uses: actions/cache@v4 + with: + path: | + ${{ github.workspace }}/.xmake/**/cache + ${{ github.workspace }}/build/.build_cache + ${{ github.workspace }}/build/.deps + ${{ github.workspace }}/build/.gens + ${{ github.workspace }}/build/.objs + key: ${{ runner.os }}-xmake-build-${{ hashFiles('**/xmake.lua') }} + + - name: config by xmake + run: | + xmake config --yes --verbose --diagnosis + + - name: build by xmake + run: | + xmake build --verbose --diagnosis --jobs=2 \ No newline at end of file diff --git a/.gitignore b/.gitignore index ab9ee0d1..3884e0a3 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,7 @@ Makefile release/** bin/ cmake-build-debug/ +cmake-build-release/ packaging/Install.exe packaging/org.midieditor.midieditor/data/** diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index a7b2073e..00000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,71 +0,0 @@ -cmake_minimum_required(VERSION 3.16) -project(ProMidEdit VERSION 3.9.0) - -set(CMAKE_CXX_STANDARD 17) -set(CMAKE_CXX_STANDARD_REQUIRED ON) - -# Add this section to help find Qt6 -set(CMAKE_PREFIX_PATH "C:/Qt/6.8.1/msvc2022_64/lib/cmake") - -find_package(Qt6 REQUIRED COMPONENTS - Core - Gui - Widgets - Network - Xml - Multimedia - MultimediaWidgets -) - -# Collect source files -file(GLOB_RECURSE SOURCES - "src/*.cpp" - "src/*.h" -) - -# Add Qt resource files -set(RESOURCE_FILES resources.qrc) -qt_add_resources(RESOURCES ${RESOURCE_FILES}) - -# Add Windows RC file if on Windows -if(WIN32) - set(RC_FILE midieditor.rc) -endif() - -# Create executable -add_executable(${PROJECT_NAME} - ${SOURCES} - ${RESOURCES} - ${RC_FILE} -) - -target_compile_definitions(${PROJECT_NAME} PRIVATE - MIDIEDITOR_RELEASE_VERSION_ID_DEF=0 - MIDIEDITOR_RELEASE_DATE_DEF="${CMAKE_SYSTEM_TIME}" - MIDIEDITOR_RELEASE_VERSION_STRING_DEF="${PROJECT_VERSION}" -) - -if(CMAKE_SIZEOF_VOID_P EQUAL 8) - target_compile_definitions(${PROJECT_NAME} PRIVATE __ARCH64__) -endif() - -# Link libraries -target_link_libraries(${PROJECT_NAME} PRIVATE - Qt6::Core - Qt6::Gui - Qt6::Widgets - Qt6::Network - Qt6::Xml - Qt6::Multimedia - Qt6::MultimediaWidgets -) - -# Installation rules -set(INSTALL_DIR "packaging/org.midieditor.midieditor/data") -set(BIN_DIR "${INSTALL_DIR}/bin") -set(PLUGIN_DIR "${BIN_DIR}/plugins") - -install(TARGETS ${PROJECT_NAME} - RUNTIME DESTINATION ${BIN_DIR} - LIBRARY DESTINATION ${BIN_DIR} -) \ No newline at end of file diff --git a/scripts/xmake/packages.lua b/scripts/xmake/packages.lua index e08ffc94..8b137891 100644 --- a/scripts/xmake/packages.lua +++ b/scripts/xmake/packages.lua @@ -1,12 +1 @@ -function add_all_requires() - local qt_configs = { - shared = true, - vs_runtime = "MD" - } - - add_requires("qt6base", {configs = qt_configs}) - add_requires("qt6widgets", {configs = qt_configs}) - add_requires("qtifw") - add_requires("rtmidi") -end \ No newline at end of file diff --git a/src/Terminal.cpp b/src/Terminal.cpp index d0a33769..696ef78e 100644 --- a/src/Terminal.cpp +++ b/src/Terminal.cpp @@ -22,6 +22,9 @@ #include #include #include +#include +#include +#include #include "midi/MidiInput.h" #include "midi/MidiOutput.h" @@ -102,44 +105,44 @@ void Terminal::processStarted() { } outputVariants.append(outPort); - if (MidiInput::inputPort() == "" && _inPort != "") { + if (MidiInput::inputPort().isEmpty() && !_inPort.isEmpty()) { writeString(QObject::tr("Trying to set Input Port to ") + _inPort); - foreach (QString portVariant, inputVariants) { - foreach (QString port, MidiInput::inputPorts()) { - if (port.startsWith(portVariant)) { + QStringList inputPorts = MidiInput::inputPorts(); + for (int i = 0; i < inputVariants.size(); i++) { + QString variant = inputVariants.at(i); + for (int j = 0; j < inputPorts.size(); j++) { + QString port = inputPorts.at(j); + if (port.startsWith(variant)) { writeString(QObject::tr("Found port ") + port); MidiInput::setInputPort(port); - _inPort = ""; + _inPort.clear(); break; } } - if (_inPort == "") { + if (_inPort.isEmpty()) { break; } } } - if (MidiOutput::outputPort() == "" && _outPort != "") { + if (MidiOutput::outputPort().isEmpty() && !_outPort.isEmpty()) { writeString(QObject::tr("Trying to set Output Port to ") + _outPort); - foreach (QString portVariant, outputVariants) { - foreach (QString port, MidiOutput::outputPorts()) { - if (port.startsWith(portVariant)) { - writeString(QObject::tr("Found port ") + port); - MidiOutput::setOutputPort(port); - _outPort = ""; - break; - } - } - if (_outPort == "") { + QStringList ports = MidiOutput::outputPorts(); + for (int i = 0; i < ports.size(); i++) { + QString port = ports.at(i); + if (port.startsWith(outPort)) { + writeString(QObject::tr("Found port ") + port); + MidiOutput::setOutputPort(port); + _outPort.clear(); break; } } } - // if not both are set, try again in 1 second - if ((MidiOutput::outputPort() == "" && _outPort != "") || (MidiInput::inputPort() == "" && _inPort != "")) { + if ((MidiOutput::outputPort().isEmpty() && !_outPort.isEmpty()) || + (MidiInput::inputPort().isEmpty() && !_inPort.isEmpty())) { QTimer* timer = new QTimer(); connect(timer, SIGNAL(timeout()), this, SLOT(processStarted())); timer->setSingleShot(true); diff --git a/src/gui/ChannelListWidget.cpp b/src/gui/ChannelListWidget.cpp index e911a405..be077477 100644 --- a/src/gui/ChannelListWidget.cpp +++ b/src/gui/ChannelListWidget.cpp @@ -62,7 +62,7 @@ ChannelListItem::ChannelListItem(int ch, ChannelListWidget* parent) QToolBar* toolBar = new QToolBar(this); toolBar->setIconSize(QSize(12, 12)); QPalette palette = toolBar->palette(); - palette.setColor(QPalette::Background, Qt::white); + palette.setColor(QPalette::Window, Qt::white); toolBar->setPalette(palette); // visibility diff --git a/src/gui/ColoredWidget.cpp b/src/gui/ColoredWidget.cpp index 0337aa46..c3d5d8c4 100644 --- a/src/gui/ColoredWidget.cpp +++ b/src/gui/ColoredWidget.cpp @@ -28,6 +28,6 @@ void ColoredWidget::paintEvent(QPaintEvent* event) p.fillRect(0, 0, width(), height(), Qt::white); p.setPen(Qt::lightGray); p.setBrush(_color); - p.drawRoundRect(x, y, l, l, 30, 30); + p.drawRoundedRect(x, y, l, l, 30, 30); p.end(); } diff --git a/src/gui/DataEditor.cpp b/src/gui/DataEditor.cpp index 190b4f63..eec147ee 100644 --- a/src/gui/DataEditor.cpp +++ b/src/gui/DataEditor.cpp @@ -84,7 +84,7 @@ void DataEditor::rebuild() QLineEdit* edit = new QLineEdit(_central); edit->setInputMask("HH"); QString text; - text.sprintf("%02X", c); + text.number(c, 16); edit->setText(text); layout->addWidget(edit, row, 1, 1, 1); diff --git a/src/gui/EventWidget.cpp b/src/gui/EventWidget.cpp index 240543fa..fa0078fe 100644 --- a/src/gui/EventWidget.cpp +++ b/src/gui/EventWidget.cpp @@ -1194,7 +1194,7 @@ QVariant EventWidget::fieldContent(EditorField field) { return QVariant(""); } QString s; - s.sprintf("%02X", n); + s.asprintf("%02X", n); s = "0x" + s; return QVariant(s); } @@ -1262,7 +1262,7 @@ QString EventWidget::dataToString(QByteArray data) { QString s; foreach (unsigned char b, data) { QString t; - t.sprintf("%02X", b); + t.asprintf("%02X", b); s = s + "0x" + t + "\n"; } return s.trimmed(); diff --git a/src/gui/MainWindow.cpp b/src/gui/MainWindow.cpp index 5ab9b505..cab70465 100644 --- a/src/gui/MainWindow.cpp +++ b/src/gui/MainWindow.cpp @@ -37,6 +37,7 @@ #include #include #include +#include #include #include #include @@ -96,6 +97,7 @@ #include "CompleteMidiSetupDialog.h" #include +#include MainWindow::MainWindow(QString initFile) : QMainWindow() @@ -2178,31 +2180,31 @@ QWidget* MainWindow::setupActions(QWidget* parent) { QMenu* tweakMenu = new QMenu(tr("Tweak..."), toolsMB); QAction* tweakTimeAction = new QAction(tr("Time"), tweakMenu); - tweakTimeAction->setShortcut(Qt::Key_1 + Qt::CTRL); + tweakTimeAction->setShortcut(Qt::Key_1 | Qt::ControlModifier); tweakTimeAction->setCheckable(true); connect(tweakTimeAction, SIGNAL(triggered()), this, SLOT(tweakTime())); tweakMenu->addAction(tweakTimeAction); QAction* tweakStartTimeAction = new QAction(tr("Start time"), tweakMenu); - tweakStartTimeAction->setShortcut(Qt::Key_2 + Qt::CTRL); + tweakStartTimeAction->setShortcut(Qt::Key_2 | Qt::ControlModifier); tweakStartTimeAction->setCheckable(true); connect(tweakStartTimeAction, SIGNAL(triggered()), this, SLOT(tweakStartTime())); tweakMenu->addAction(tweakStartTimeAction); QAction* tweakEndTimeAction = new QAction(tr("End time"), tweakMenu); - tweakEndTimeAction->setShortcut(Qt::Key_3 + Qt::CTRL); + tweakEndTimeAction->setShortcut(Qt::Key_3 | Qt::ControlModifier); tweakEndTimeAction->setCheckable(true); connect(tweakEndTimeAction, SIGNAL(triggered()), this, SLOT(tweakEndTime())); tweakMenu->addAction(tweakEndTimeAction); QAction* tweakNoteAction = new QAction(tr("Note"), tweakMenu); - tweakNoteAction->setShortcut(Qt::Key_4 + Qt::CTRL); + tweakNoteAction->setShortcut(Qt::Key_4 | Qt::ControlModifier); tweakNoteAction->setCheckable(true); connect(tweakNoteAction, SIGNAL(triggered()), this, SLOT(tweakNote())); tweakMenu->addAction(tweakNoteAction); QAction* tweakValueAction = new QAction(tr("Value"), tweakMenu); - tweakValueAction->setShortcut(Qt::Key_5 + Qt::CTRL); + tweakValueAction->setShortcut(Qt::Key_5 | Qt::ControlModifier); tweakValueAction->setCheckable(true); connect(tweakValueAction, SIGNAL(triggered()), this, SLOT(tweakValue())); tweakMenu->addAction(tweakValueAction); @@ -2219,32 +2221,32 @@ QWidget* MainWindow::setupActions(QWidget* parent) { tweakMenu->addSeparator(); QAction* tweakSmallDecreaseAction = new QAction(tr("Small decrease"), tweakMenu); - tweakSmallDecreaseAction->setShortcut(Qt::Key_9 + Qt::CTRL); + tweakSmallDecreaseAction->setShortcut(Qt::Key_9 | Qt::ControlModifier); connect(tweakSmallDecreaseAction, SIGNAL(triggered()), this, SLOT(tweakSmallDecrease())); tweakMenu->addAction(tweakSmallDecreaseAction); QAction* tweakSmallIncreaseAction = new QAction(tr("Small increase"), tweakMenu); - tweakSmallIncreaseAction->setShortcut(Qt::Key_0 + Qt::CTRL); + tweakSmallIncreaseAction->setShortcut(Qt::Key_0 | Qt::ControlModifier); connect(tweakSmallIncreaseAction, SIGNAL(triggered()), this, SLOT(tweakSmallIncrease())); tweakMenu->addAction(tweakSmallIncreaseAction); QAction* tweakMediumDecreaseAction = new QAction(tr("Medium decrease"), tweakMenu); - tweakMediumDecreaseAction->setShortcut(Qt::Key_9 + Qt::CTRL + Qt::ALT); + tweakMediumDecreaseAction->setShortcut(Qt::Key_9 | Qt::ControlModifier | Qt::AltModifier); connect(tweakMediumDecreaseAction, SIGNAL(triggered()), this, SLOT(tweakMediumDecrease())); tweakMenu->addAction(tweakMediumDecreaseAction); QAction* tweakMediumIncreaseAction = new QAction(tr("Medium increase"), tweakMenu); - tweakMediumIncreaseAction->setShortcut(Qt::Key_0 + Qt::CTRL + Qt::ALT); + tweakMediumIncreaseAction->setShortcut(Qt::Key_0 | Qt::ControlModifier | Qt::AltModifier); connect(tweakMediumIncreaseAction, SIGNAL(triggered()), this, SLOT(tweakMediumIncrease())); tweakMenu->addAction(tweakMediumIncreaseAction); QAction* tweakLargeDecreaseAction = new QAction(tr("Large decrease"), tweakMenu); - tweakLargeDecreaseAction->setShortcut(Qt::Key_9 + Qt::ALT + Qt::SHIFT); + tweakLargeDecreaseAction->setShortcut(Qt::Key_9 | Qt::AltModifier | Qt::ShiftModifier); connect(tweakLargeDecreaseAction, SIGNAL(triggered()), this, SLOT(tweakLargeDecrease())); tweakMenu->addAction(tweakLargeDecreaseAction); QAction* tweakLargeIncreaseAction = new QAction(tr("Large increase"), tweakMenu); - tweakLargeIncreaseAction->setShortcut(Qt::Key_0 + Qt::ALT + Qt::SHIFT); + tweakLargeIncreaseAction->setShortcut(Qt::Key_0 | Qt::AltModifier | Qt::ShiftModifier); connect(tweakLargeIncreaseAction, SIGNAL(triggered()), this, SLOT(tweakLargeIncrease())); tweakMenu->addAction(tweakLargeIncreaseAction); @@ -2262,7 +2264,7 @@ QWidget* MainWindow::setupActions(QWidget* parent) { QAction* alignLeftAction = new QAction(tr("Align left"), this); _activateWithSelections.append(alignLeftAction); - alignLeftAction->setShortcut(QKeySequence(Qt::Key_Left + Qt::CTRL)); + alignLeftAction->setShortcut(QKeySequence(Qt::Key_Left | Qt::ControlModifier)); alignLeftAction->setIcon(QIcon(":/run_environment/graphics/tool/align_left.png")); connect(alignLeftAction, SIGNAL(triggered()), this, SLOT(alignLeft())); toolsMB->addAction(alignLeftAction); @@ -2270,14 +2272,14 @@ QWidget* MainWindow::setupActions(QWidget* parent) { QAction* alignRightAction = new QAction(tr("Align right"), this); _activateWithSelections.append(alignRightAction); alignRightAction->setIcon(QIcon(":/run_environment/graphics/tool/align_right.png")); - alignRightAction->setShortcut(QKeySequence(Qt::Key_Right + Qt::CTRL)); + alignRightAction->setShortcut(QKeySequence(Qt::Key_Right | Qt::ControlModifier)); connect(alignRightAction, SIGNAL(triggered()), this, SLOT(alignRight())); toolsMB->addAction(alignRightAction); QAction* equalizeAction = new QAction(tr("Equalize selection"), this); _activateWithSelections.append(equalizeAction); equalizeAction->setIcon(QIcon(":/run_environment/graphics/tool/equalize.png")); - equalizeAction->setShortcut(QKeySequence(Qt::Key_Up + Qt::CTRL)); + equalizeAction->setShortcut(QKeySequence(Qt::Key_Up | Qt::ControlModifier)); connect(equalizeAction, SIGNAL(triggered()), this, SLOT(equalize())); toolsMB->addAction(equalizeAction); @@ -2286,7 +2288,7 @@ QWidget* MainWindow::setupActions(QWidget* parent) { QAction* quantizeAction = new QAction(tr("Quantify selection"), this); _activateWithSelections.append(quantizeAction); quantizeAction->setIcon(QIcon(":/run_environment/graphics/tool/quantize.png")); - quantizeAction->setShortcut(QKeySequence(Qt::Key_G + Qt::CTRL)); + quantizeAction->setShortcut(QKeySequence(Qt::Key_G | Qt::ControlModifier)); connect(quantizeAction, SIGNAL(triggered()), this, SLOT(quantizeSelection())); toolsMB->addAction(quantizeAction); @@ -2320,13 +2322,13 @@ QWidget* MainWindow::setupActions(QWidget* parent) { QAction* quantizeNToleAction = new QAction(tr("Quantify tuplet..."), this); _activateWithSelections.append(quantizeNToleAction); - quantizeNToleAction->setShortcut(QKeySequence(Qt::Key_H + Qt::CTRL + Qt::SHIFT)); + quantizeNToleAction->setShortcut(QKeySequence(Qt::Key_H | Qt::ControlModifier | Qt::ShiftModifier)); connect(quantizeNToleAction, SIGNAL(triggered()), this, SLOT(quantizeNtoleDialog())); toolsMB->addAction(quantizeNToleAction); QAction* quantizeNToleActionRepeat = new QAction(tr("Repeat tuplet quantization"), this); _activateWithSelections.append(quantizeNToleActionRepeat); - quantizeNToleActionRepeat->setShortcut(QKeySequence(Qt::Key_H + Qt::CTRL)); + quantizeNToleActionRepeat->setShortcut(QKeySequence(Qt::Key_H | Qt::ControlModifier)); connect(quantizeNToleActionRepeat, SIGNAL(triggered()), this, SLOT(quantizeNtole())); toolsMB->addAction(quantizeNToleActionRepeat); @@ -2375,7 +2377,7 @@ QWidget* MainWindow::setupActions(QWidget* parent) { QAction* transposeAction = new QAction(tr("Transpose selection..."), this); _activateWithSelections.append(transposeAction); - transposeAction->setShortcut(QKeySequence(Qt::Key_T + Qt::CTRL)); + transposeAction->setShortcut(QKeySequence(Qt::Key_T | Qt::ControlModifier)); connect(transposeAction, SIGNAL(triggered()), this, SLOT(transposeNSemitones())); toolsMB->addAction(transposeAction); @@ -2394,7 +2396,7 @@ QWidget* MainWindow::setupActions(QWidget* parent) { QAction* magnetAction = new QAction(tr("Magnet"), editMB); toolsMB->addAction(magnetAction); - magnetAction->setShortcut(QKeySequence(Qt::Key_M + Qt::CTRL)); + magnetAction->setShortcut(QKeySequence(Qt::Key_M | Qt::ControlModifier)); magnetAction->setIcon(QIcon(":/run_environment/graphics/tool/magnet.png")); magnetAction->setCheckable(true); magnetAction->setChecked(false); @@ -2404,7 +2406,7 @@ QWidget* MainWindow::setupActions(QWidget* parent) { // View QMenu* zoomMenu = new QMenu(tr("Zoom..."), viewMB); QAction* zoomHorOutAction = new QAction(tr("Horizontal out"), this); - zoomHorOutAction->setShortcut(QKeySequence(Qt::Key_Minus + Qt::CTRL)); + zoomHorOutAction->setShortcut(QKeySequence(Qt::Key_Minus | Qt::ControlModifier)); zoomHorOutAction->setIcon(QIcon(":/run_environment/graphics/tool/zoom_hor_out.png")); connect(zoomHorOutAction, SIGNAL(triggered()), mw_matrixWidget, SLOT(zoomHorOut())); @@ -2412,21 +2414,21 @@ QWidget* MainWindow::setupActions(QWidget* parent) { QAction* zoomHorInAction = new QAction(tr("Horizontal in"), this); zoomHorInAction->setIcon(QIcon(":/run_environment/graphics/tool/zoom_hor_in.png")); - zoomHorInAction->setShortcut(QKeySequence(Qt::Key_Plus + Qt::CTRL)); + zoomHorInAction->setShortcut(QKeySequence(Qt::Key_Plus | Qt::ControlModifier)); connect(zoomHorInAction, SIGNAL(triggered()), mw_matrixWidget, SLOT(zoomHorIn())); zoomMenu->addAction(zoomHorInAction); QAction* zoomVerOutAction = new QAction(tr("Vertical out"), this); zoomVerOutAction->setIcon(QIcon(":/run_environment/graphics/tool/zoom_ver_out.png")); - zoomVerOutAction->setShortcut(QKeySequence(Qt::Key_Minus + Qt::CTRL + Qt::ALT)); + zoomVerOutAction->setShortcut(QKeySequence(Qt::Key_Minus | Qt::ControlModifier | Qt::AltModifier)); connect(zoomVerOutAction, SIGNAL(triggered()), mw_matrixWidget, SLOT(zoomVerOut())); zoomMenu->addAction(zoomVerOutAction); QAction* zoomVerInAction = new QAction(tr("Vertical in"), this); zoomVerInAction->setIcon(QIcon(":/run_environment/graphics/tool/zoom_ver_in.png")); - zoomVerInAction->setShortcut(QKeySequence(Qt::Key_Plus + Qt::CTRL + Qt::ALT)); + zoomVerInAction->setShortcut(QKeySequence(Qt::Key_Plus | Qt::ControlModifier | Qt::AltModifier)); connect(zoomVerInAction, SIGNAL(triggered()), mw_matrixWidget, SLOT(zoomVerIn())); zoomMenu->addAction(zoomVerInAction); @@ -2434,7 +2436,7 @@ QWidget* MainWindow::setupActions(QWidget* parent) { zoomMenu->addSeparator(); QAction* zoomStdAction = new QAction(tr("Restore default"), this); - zoomStdAction->setShortcut(QKeySequence(Qt::Key_0 + Qt::CTRL)); + zoomStdAction->setShortcut(QKeySequence(Qt::Key_0 | Qt::ControlModifier)); connect(zoomStdAction, SIGNAL(triggered()), mw_matrixWidget, SLOT(zoomStd())); zoomMenu->addAction(zoomStdAction); @@ -2495,7 +2497,7 @@ QWidget* MainWindow::setupActions(QWidget* parent) { QAction* playStopAction = new QAction("PlayStop", this); QList playStopActionShortcuts; playStopActionShortcuts << QKeySequence(Qt::Key_Space) - << QKeySequence(Qt::Key_P + Qt::CTRL); + << QKeySequence(Qt::Key_P | Qt::ControlModifier); playStopAction->setShortcuts(playStopActionShortcuts); connect(playStopAction, SIGNAL(triggered()), this, SLOT(playStop())); playbackMB->addAction(playStopAction); @@ -2508,16 +2510,16 @@ QWidget* MainWindow::setupActions(QWidget* parent) { QAction* pauseAction = new QAction(tr("Pause"), this); pauseAction->setIcon(QIcon(":/run_environment/graphics/tool/pause.png")); #ifdef Q_OS_MAC - pauseAction->setShortcut(QKeySequence(Qt::Key_Space + Qt::META)); + pauseAction->setShortcut(QKeySequence(Qt::Key_Space | Qt::ShiftModifier)); #else - pauseAction->setShortcut(QKeySequence(Qt::Key_Space + Qt::CTRL)); + pauseAction->setShortcut(QKeySequence(Qt::Key_Space | Qt::ControlModifier)); #endif connect(pauseAction, SIGNAL(triggered()), this, SLOT(pause())); playbackMB->addAction(pauseAction); QAction* recAction = new QAction(tr("Record"), this); recAction->setIcon(QIcon(":/run_environment/graphics/tool/record.png")); - recAction->setShortcut(QKeySequence(Qt::Key_R + Qt::CTRL)); + recAction->setShortcut(QKeySequence(Qt::Key_R | Qt::ControlModifier)); connect(recAction, SIGNAL(triggered()), this, SLOT(record())); playbackMB->addAction(recAction); @@ -2531,9 +2533,9 @@ QWidget* MainWindow::setupActions(QWidget* parent) { QAction* backToBeginAction = new QAction(tr("Back to begin"), this); backToBeginAction->setIcon(QIcon(":/run_environment/graphics/tool/back_to_begin.png")); QList backToBeginActionShortcuts; - backToBeginActionShortcuts << QKeySequence(Qt::Key_Up + Qt::ALT) - << QKeySequence(Qt::Key_Home + Qt::ALT) - << QKeySequence(Qt::Key_J + Qt::SHIFT); + backToBeginActionShortcuts << QKeySequence(Qt::Key_Up | Qt::AltModifier) + << QKeySequence(Qt::Key_Home | Qt::AltModifier) + << QKeySequence(Qt::Key_J | Qt::ShiftModifier); backToBeginAction->setShortcuts(backToBeginActionShortcuts); connect(backToBeginAction, SIGNAL(triggered()), this, SLOT(backToBegin())); playbackMB->addAction(backToBeginAction); @@ -2541,7 +2543,7 @@ QWidget* MainWindow::setupActions(QWidget* parent) { QAction* backAction = new QAction(tr("Previous measure"), this); backAction->setIcon(QIcon(":/run_environment/graphics/tool/back.png")); QList backActionShortcuts; - backActionShortcuts << QKeySequence(Qt::Key_Left + Qt::ALT); + backActionShortcuts << QKeySequence(Qt::Key_Left | Qt::AltModifier); backAction->setShortcuts(backActionShortcuts); connect(backAction, SIGNAL(triggered()), this, SLOT(back())); playbackMB->addAction(backAction); @@ -2549,7 +2551,7 @@ QWidget* MainWindow::setupActions(QWidget* parent) { QAction* forwAction = new QAction(tr("Next measure"), this); forwAction->setIcon(QIcon(":/run_environment/graphics/tool/forward.png")); QList forwActionShortcuts; - forwActionShortcuts << QKeySequence(Qt::Key_Right + Qt::ALT); + forwActionShortcuts << QKeySequence(Qt::Key_Right | Qt::AltModifier); forwAction->setShortcuts(forwActionShortcuts); connect(forwAction, SIGNAL(triggered()), this, SLOT(forward())); playbackMB->addAction(forwAction); @@ -2559,14 +2561,14 @@ QWidget* MainWindow::setupActions(QWidget* parent) { QAction* backMarkerAction = new QAction(tr("Previous marker"), this); backMarkerAction->setIcon(QIcon(":/run_environment/graphics/tool/back_marker.png")); QList backMarkerActionShortcuts; - backMarkerAction->setShortcut(QKeySequence(Qt::Key_Comma + Qt::ALT)); + backMarkerAction->setShortcut(QKeySequence(Qt::Key_Comma | Qt::AltModifier)); connect(backMarkerAction, SIGNAL(triggered()), this, SLOT(backMarker())); playbackMB->addAction(backMarkerAction); QAction* forwMarkerAction = new QAction(tr("Next marker"), this); forwMarkerAction->setIcon(QIcon(":/run_environment/graphics/tool/forward_marker.png")); QList forwMarkerActionShortcuts; - forwMarkerAction->setShortcut(QKeySequence(Qt::Key_Period + Qt::ALT)); + forwMarkerAction->setShortcut(QKeySequence(Qt::Key_Period | Qt::AltModifier)); connect(forwMarkerAction, SIGNAL(triggered()), this, SLOT(forwardMarker())); playbackMB->addAction(forwMarkerAction); diff --git a/src/gui/MatrixWidget.cpp b/src/gui/MatrixWidget.cpp index 66029f74..97f4f6e2 100644 --- a/src/gui/MatrixWidget.cpp +++ b/src/gui/MatrixWidget.cpp @@ -38,6 +38,7 @@ #include #include +#include #define NUM_LINES 139 #define PIXEL_PER_S 100 @@ -317,7 +318,7 @@ void MatrixWidget::paintEvent(QPaintEvent* event) { text += QString("%1:").arg(minutes, 2, 10, QChar('0')); text += QString("%1").arg(seconds, 2, 10, QChar('0')); text += QString(".%1").arg(ms / 10, 2, 10, QChar('0')); - int textlength = QFontMetrics(pixpainter->font()).width(text); + int textlength = QFontMetrics(pixpainter->font()).horizontalAdvance(text); if (startNumber > 0) { pixpainter->drawText(pos - textlength / 2, timeHeight / 2 - 6, text); } @@ -360,10 +361,10 @@ void MatrixWidget::paintEvent(QPaintEvent* event) { pixpainter->setPen(Qt::gray); pixpainter->drawLine(xfrom, timeHeight / 2, xfrom, height()); QString text = tr("Measure ") + QString::number(measure - 1); - int textlength = QFontMetrics(pixpainter->font()).width(text); + int textlength = QFontMetrics(pixpainter->font()).horizontalAdvance(text); if (textlength > xto - xfrom) { text = QString::number(measure - 1); - textlength = QFontMetrics(pixpainter->font()).width(text); + textlength = QFontMetrics(pixpainter->font()).horizontalAdvance(text); } int pos = (xfrom + xto) / 2; pixpainter->setPen(Qt::white); @@ -470,7 +471,7 @@ void MatrixWidget::paintEvent(QPaintEvent* event) { font = painter->font(); font.setPixelSize(10); painter->setFont(font); - int textlength = QFontMetrics(font).width(text); + int textlength = QFontMetrics(font).horizontalAdvance(text); painter->drawText(lineNameWidth - 15 - textlength, startLine + lineHeight(), text); } } @@ -557,7 +558,7 @@ void MatrixWidget::paintChannel(QPainter* painter, int channel) { // filter events QMultiMap* map = file->channelEvents(channel); - QMap::iterator it = map->lowerBound(startTick); + QMultiMap::iterator it = map->lowerBound(startTick); while (it != map->end() && it.key() <= endTick) { MidiEvent* event = it.value(); if (eventInWidget(event)) { @@ -805,7 +806,7 @@ void MatrixWidget::paintPianoKey(QPainter* painter, int number, int x, int y, if (name != "") { painter->setPen(Qt::gray); - int textlength = QFontMetrics(painter->font()).width(name); + int textlength = QFontMetrics(painter->font()).horizontalAdvance(name); painter->drawText(x + width - textlength - 2, y + height - 1, name); painter->setPen(Qt::black); } @@ -841,7 +842,7 @@ void MatrixWidget::setFile(MidiFile* f) { QMultiMap* map = file->channelEvents(channel); - QMap::iterator it = map->lowerBound(0); + QMultiMap::iterator it = map->lowerBound(0); while (it != map->end()) { NoteOnEvent* onev = dynamic_cast(it.value()); if (onev && eventInWidget(onev)) { diff --git a/src/gui/MidiSettingsWidget.cpp b/src/gui/MidiSettingsWidget.cpp index 21382856..d9f4811e 100644 --- a/src/gui/MidiSettingsWidget.cpp +++ b/src/gui/MidiSettingsWidget.cpp @@ -33,6 +33,8 @@ #include #include #include +#include +#include AdditionalMidiSettingsWidget::AdditionalMidiSettingsWidget(QSettings* settings, QWidget* parent) : SettingsWidget(tr("Additional Midi Settings"), parent) { @@ -154,53 +156,33 @@ MidiSettingsWidget::MidiSettingsWidget(QWidget* parent) } void MidiSettingsWidget::reloadInputPorts() { - - disconnect(_inList, SIGNAL(itemChanged(QListWidgetItem*)), this, - SLOT(inputChanged(QListWidgetItem*))); - - // clear the list _inList->clear(); + *_inputPorts = MidiInput::inputPorts(); - foreach (QString name, MidiInput::inputPorts()) { - - QListWidgetItem* item = new QListWidgetItem(name, _inList, - QListWidgetItem::UserType); - item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsUserCheckable); - - if (name == MidiInput::inputPort()) { + for (const QString& portName : *_inputPorts) { + QListWidgetItem* item = new QListWidgetItem(portName); + if (portName == MidiInput::inputPort()) { item->setCheckState(Qt::Checked); } else { item->setCheckState(Qt::Unchecked); } _inList->addItem(item); } - connect(_inList, SIGNAL(itemChanged(QListWidgetItem*)), this, - SLOT(inputChanged(QListWidgetItem*))); } void MidiSettingsWidget::reloadOutputPorts() { - - disconnect(_outList, SIGNAL(itemChanged(QListWidgetItem*)), this, - SLOT(outputChanged(QListWidgetItem*))); - - // clear the list _outList->clear(); + *_outputPorts = MidiOutput::outputPorts(); - foreach (QString name, MidiOutput::outputPorts()) { - - QListWidgetItem* item = new QListWidgetItem(name, _outList, - QListWidgetItem::UserType); - item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsUserCheckable); - - if (name == MidiOutput::outputPort()) { + for (const QString& portName : *_outputPorts) { + QListWidgetItem* item = new QListWidgetItem(portName); + if (portName == MidiOutput::outputPort()) { item->setCheckState(Qt::Checked); } else { item->setCheckState(Qt::Unchecked); } _outList->addItem(item); } - connect(_outList, SIGNAL(itemChanged(QListWidgetItem*)), this, - SLOT(outputChanged(QListWidgetItem*))); } void MidiSettingsWidget::inputChanged(QListWidgetItem* item) { diff --git a/src/gui/TempoDialog.cpp b/src/gui/TempoDialog.cpp index e0791b97..1f788a86 100644 --- a/src/gui/TempoDialog.cpp +++ b/src/gui/TempoDialog.cpp @@ -47,8 +47,8 @@ TempoDialog::TempoDialog(MidiFile *file, int startTick, int endTick, QWidget *p tip->setStyleSheet("color: black; background-color: white; padding: 5px"); // identify tempo at start tick - QMap *events = file->tempoEvents(); - QMap::iterator it = events->begin(); + QMultiMap *events = file->tempoEvents(); + QMultiMap::iterator it = events->begin(); int tick = -1; MidiEvent *ev = 0; while(it != events->end()) { @@ -120,8 +120,8 @@ void TempoDialog::accept() // Delete all events in range QList toRemove; - QMap *events = _file->tempoEvents(); - QMap::iterator it = events->begin(); + QMultiMap *events = _file->tempoEvents(); + QMultiMap::iterator it = events->begin(); int fromTick = _startTick; int toTick = _startTick; if (_endTick > -1) { diff --git a/src/gui/TimeSignatureDialog.cpp b/src/gui/TimeSignatureDialog.cpp index 7033d48f..b8c96a41 100644 --- a/src/gui/TimeSignatureDialog.cpp +++ b/src/gui/TimeSignatureDialog.cpp @@ -99,7 +99,7 @@ void TimeSignatureDialog::accept() MidiTrack* generalTrack = _file->track(0); _file->protocol()->startNewAction("Change Time Signature"); - QMap *timeSignatureEvents = _file->timeSignatureEvents(); + QMultiMap *timeSignatureEvents = _file->timeSignatureEvents(); bool hasTimeSignatureChangesAfter = false; foreach(int tick, timeSignatureEvents->keys()) { if (tick > _startTickOfMeasure) { @@ -114,7 +114,7 @@ void TimeSignatureDialog::accept() if (_endOfPiece->isChecked() || (_untilNextMeterChange->isChecked() && !hasTimeSignatureChangesAfter)){ // We delete all events after and insert a single new one. - QMap::Iterator it = timeSignatureEvents->begin(); + QMultiMap::Iterator it = timeSignatureEvents->begin(); while(it != timeSignatureEvents->end()) { if (it.key() >= _startTickOfMeasure) { eventsToDelete.append(it.value()); diff --git a/src/gui/TrackListWidget.cpp b/src/gui/TrackListWidget.cpp index 98424aaf..eedb3d91 100644 --- a/src/gui/TrackListWidget.cpp +++ b/src/gui/TrackListWidget.cpp @@ -60,7 +60,7 @@ TrackListItem::TrackListItem(MidiTrack* track, TrackListWidget* parent) QToolBar* toolBar = new QToolBar(this); toolBar->setIconSize(QSize(12, 12)); QPalette palette = toolBar->palette(); - palette.setColor(QPalette::Background, Qt::white); + palette.setColor(QPalette::Window, Qt::white); toolBar->setPalette(palette); // visibility visibleAction = new QAction(QIcon(":/run_environment/graphics/trackwidget/visible.png"), tr("Track visible"), toolBar); diff --git a/src/main.cpp b/src/main.cpp index 1fb16667..f2d7adff 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -28,6 +28,8 @@ #include #include +#include + #ifdef NO_CONSOLE_MODE #include #include diff --git a/src/midi/Metronome.cpp b/src/midi/Metronome.cpp index 1af40538..b7e932d3 100644 --- a/src/midi/Metronome.cpp +++ b/src/midi/Metronome.cpp @@ -6,7 +6,8 @@ #include #include -#include +#include +#include #include #include diff --git a/src/midi/MidiChannel.cpp b/src/midi/MidiChannel.cpp index 19a15492..c3a65923 100644 --- a/src/midi/MidiChannel.cpp +++ b/src/midi/MidiChannel.cpp @@ -128,7 +128,7 @@ int MidiChannel::number() return _num; } -QMultiMap* MidiChannel::eventMap() +QMultiMap *MidiChannel::eventMap() { return _events; } diff --git a/src/midi/MidiChannel.h b/src/midi/MidiChannel.h index d66ec3fb..879586c9 100644 --- a/src/midi/MidiChannel.h +++ b/src/midi/MidiChannel.h @@ -91,7 +91,7 @@ class MidiChannel : public ProtocolEntry { * * This contains all MidiEvents of the channel. */ - QMultiMap* eventMap(); + QMultiMap *eventMap(); /** * \brief inserts a note to this channel. @@ -172,7 +172,7 @@ class MidiChannel : public ProtocolEntry { /** * \brief contains all MidiEvents of the channel sorted by their tick. */ - QMultiMap* _events; + QMultiMap *_events; /** * \brief the channels number. diff --git a/src/midi/MidiFile.cpp b/src/midi/MidiFile.cpp index a9d4c2ab..1a697a35 100644 --- a/src/midi/MidiFile.cpp +++ b/src/midi/MidiFile.cpp @@ -20,6 +20,8 @@ #include #include +#include +#include #include "../MidiEvent/ControlChangeEvent.h" #include "../MidiEvent/KeySignatureEvent.h" @@ -346,11 +348,11 @@ int MidiFile::variableLengthvalue(QDataStream* content) { return (int)v; } -QMap* MidiFile::timeSignatureEvents() { +QMultiMap *MidiFile::timeSignatureEvents() { return channels[18]->eventMap(); } -QMap* MidiFile::tempoEvents() { +QMultiMap *MidiFile::tempoEvents() { return channels[17]->eventMap(); } @@ -1696,8 +1698,8 @@ int MidiFile::tonalityAt(int tick) { void MidiFile::meterAt(int tick, int* num, int* denum, TimeSignatureEvent **lastTimeSigEvent) { - QMap* meterEvents = timeSignatureEvents(); - QMap::iterator it = meterEvents->begin(); + QMultiMap* meterEvents = timeSignatureEvents(); + QMultiMap::iterator it = meterEvents->begin(); TimeSignatureEvent* event = 0; while (it != meterEvents->end()) { TimeSignatureEvent* timeSig = dynamic_cast(it.value()); @@ -1728,11 +1730,6 @@ void MidiFile::printLog(QStringList* log) { } void MidiFile::registerCopiedTrack(MidiTrack* source, MidiTrack* destination, MidiFile* fileFrom) { - - // if(fileFrom == this){ - // return; - // } - ProtocolEntry* toCopy = copy(); QMap list; @@ -1747,11 +1744,6 @@ void MidiFile::registerCopiedTrack(MidiTrack* source, MidiTrack* destination, Mi } MidiTrack* MidiFile::getPasteTrack(MidiTrack* source, MidiFile* fileFrom) { - - // if(fileFrom == this){ - // return source; - // } - if (!pasteTracks.contains(fileFrom) || !pasteTracks.value(fileFrom).contains(source)) { return 0; } @@ -1795,8 +1787,8 @@ QList MidiFile::quantization(int fractionSize) { int MidiFile::startTickOfMeasure(int measure) { - QMap *timeSigs = timeSignatureEvents(); - QMap::iterator it = timeSigs->begin(); + QMultiMap *timeSigs = timeSignatureEvents(); + QMultiMap::iterator it = timeSigs->begin(); // Find the time signature event the measure is in and its start measure int currentMeasure = 1; @@ -1828,7 +1820,7 @@ void MidiFile::deleteMeasures(int from, int to) { // Delete all events. For notes, only delete if starting within the given tick range. for (int ch = 0; ch < 19; ch++) { - QMap::Iterator it = channel(ch)->eventMap()->begin(); + QMultiMap::Iterator it = channel(ch)->eventMap()->begin(); QList toRemove; while(it != channel(ch)->eventMap()->end()) { if (it.key() >= tickFrom && it.key() <= tickTo) { @@ -1857,7 +1849,7 @@ void MidiFile::deleteMeasures(int from, int to) { // duration. for (int ch = 0; ch < 19; ch++) { QList toUpdate; - QMap::Iterator it = channel(ch)->eventMap()->begin(); + QMultiMap::Iterator it = channel(ch)->eventMap()->begin(); while(it != channel(ch)->eventMap()->end()) { if (it.key() > tickTo) { toUpdate.append(it.value()); @@ -1911,7 +1903,7 @@ void MidiFile::insertMeasures(int after, int numMeasures) { // Shift all ticks. for (int ch = 0; ch < 19; ch++) { QList toUpdate; - QMap::Iterator it = channel(ch)->eventMap()->begin(); + QMultiMap::Iterator it = channel(ch)->eventMap()->begin(); while(it != channel(ch)->eventMap()->end()) { if (it.key() >= tick) { toUpdate.append(it.value()); diff --git a/src/midi/MidiFile.h b/src/midi/MidiFile.h index e1f442bd..ca70b24b 100644 --- a/src/midi/MidiFile.h +++ b/src/midi/MidiFile.h @@ -48,8 +48,10 @@ class MidiFile : public QObject, public ProtocolEntry { int endTick(); int timeMS(int midiTime); int measure(int startTick, int* startTickOfMeasure ,int* endTickOfMeasure); - QMap* tempoEvents(); - QMap* timeSignatureEvents(); + + QMultiMap *tempoEvents(); + + QMultiMap *timeSignatureEvents(); void calcMaxTime(); int tick(int ms); int tick(int startms, int endms, QList** events, int* endTick, int* msOfFirstEvent); diff --git a/src/midi/MidiInput.h b/src/midi/MidiInput.h index 406bdf6d..948b9caa 100644 --- a/src/midi/MidiInput.h +++ b/src/midi/MidiInput.h @@ -23,13 +23,13 @@ #include #include #include +#include #include class MidiEvent; class RtMidiIn; class RtMidiOut; -class QStringList; class MidiTrack; class MidiInput : public QObject { diff --git a/src/midi/MidiOutput.h b/src/midi/MidiOutput.h index 3a2cadef..1b7ae386 100644 --- a/src/midi/MidiOutput.h +++ b/src/midi/MidiOutput.h @@ -19,14 +19,15 @@ #ifndef MIDIOUTPUT_H_ #define MIDIOUTPUT_H_ -#include -#include #include +#include +#include +#include +#include class MidiEvent; class RtMidiIn; class RtMidiOut; -class QStringList; class SenderThread; class MidiOutput : public QObject { diff --git a/src/midi/PlayerThread.cpp b/src/midi/PlayerThread.cpp index bb6ece4d..801cc15b 100644 --- a/src/midi/PlayerThread.cpp +++ b/src/midi/PlayerThread.cpp @@ -26,7 +26,8 @@ #include "MidiOutput.h" #include "MidiPlayer.h" #include -#include +#include +#include #define INTERVAL_TIME 15 #define TIMEOUTS_PER_SIGNAL 1 @@ -61,6 +62,9 @@ void PlayerThread::run() if (!timer) { timer = new QTimer(); } + if (!time) { + time = new QElapsedTimer(); + } if (time) { delete time; time = 0; @@ -119,7 +123,7 @@ void PlayerThread::timeout() { if (!time) { - time = new QTime(); + time = new QElapsedTimer(); time->start(); } diff --git a/src/midi/PlayerThread.h b/src/midi/PlayerThread.h index d0b1109a..c87dd1bf 100644 --- a/src/midi/PlayerThread.h +++ b/src/midi/PlayerThread.h @@ -26,7 +26,7 @@ class MidiFile; class MidiEvent; -class QTime; +class QElapsedTimer; class PlayerThread : public QThread { @@ -60,7 +60,7 @@ public slots: int interval, position, timeoutSinceLastSignal; volatile bool stopped; QTimer* timer; - QTime* time; + QElapsedTimer* time; int measure, posInMeasure; }; diff --git a/src/tool/ToolButton.cpp b/src/tool/ToolButton.cpp index 5c73b223..f6f54380 100644 --- a/src/tool/ToolButton.cpp +++ b/src/tool/ToolButton.cpp @@ -20,7 +20,7 @@ #include "Tool.h" ToolButton::ToolButton(Tool* tool, QKeySequence sequence, QWidget* parent) - : QAction(parent) + : QAction(qobject_cast(parent)) { button_tool = tool; tool->setButton(this); @@ -40,4 +40,4 @@ void ToolButton::buttonClick() void ToolButton::releaseButton() { button_tool->buttonClick(); -} +} \ No newline at end of file diff --git a/src/tool/ToolButton.h b/src/tool/ToolButton.h index 26ff9f0b..2828f7b1 100644 --- a/src/tool/ToolButton.h +++ b/src/tool/ToolButton.h @@ -29,7 +29,7 @@ class ToolButton : public QAction { Q_OBJECT public: - ToolButton(Tool* tool, QKeySequence sequence = QKeySequence(), QWidget* parent = 0); + ToolButton(Tool* tool, QKeySequence sequence = QKeySequence(), QWidget* parent = nullptr); public slots: void buttonClick(); diff --git a/xmake.lua b/xmake.lua index 3acbe12d..36d941a9 100644 --- a/xmake.lua +++ b/xmake.lua @@ -10,21 +10,27 @@ option("generate-repository", { showmenu = true, }) -includes("scripts/xmake/packages.lua") -add_all_requires() - local installdir = "packaging/org.midieditor.midieditor/data/" target("ProMidEdit") do set_languages("cxx17") - add_packages({ - "rtmidi", - "qt6base", - "qt6widgets" - }) add_rules("qt.widgetapp") + + -- Use system Qt6 + add_includedirs("$(env QTDIR)/include") + add_linkdirs("$(env QTDIR)/lib") + + -- Add Qt6 multimedia include paths explicitly + after_load(function (target) + local qt_dir = os.getenv("QTDIR") + if qt_dir then + target:add("includedirs", path.join(qt_dir, "include/QtMultimedia")) + target:add("includedirs", path.join(qt_dir, "include/QtMultimediaWidgets")) + end + end) + add_frameworks({ "QtGui", - "QtWidgets", + "QtWidgets", "QtCore", "QtNetwork", "QtXml",