Skip to content

Commit

Permalink
QT6 Migration
Browse files Browse the repository at this point in the history
  • Loading branch information
Meowchestra committed Jan 25, 2025
1 parent fe41412 commit c999197
Show file tree
Hide file tree
Showing 29 changed files with 210 additions and 323 deletions.
36 changes: 0 additions & 36 deletions .github/workflows/cmake.yaml

This file was deleted.

126 changes: 67 additions & 59 deletions .github/workflows/xmake.yaml
Original file line number Diff line number Diff line change
@@ -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
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Makefile
release/**
bin/
cmake-build-debug/
cmake-build-release/

packaging/Install.exe
packaging/org.midieditor.midieditor/data/**
Expand Down
71 changes: 0 additions & 71 deletions CMakeLists.txt

This file was deleted.

11 changes: 0 additions & 11 deletions scripts/xmake/packages.lua
Original file line number Diff line number Diff line change
@@ -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
41 changes: 22 additions & 19 deletions src/Terminal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
#include <QScrollBar>
#include <QTextEdit>
#include <QTimer>
#include <QStringList>
#include <QString>
#include <QtGlobal>

#include "midi/MidiInput.h"
#include "midi/MidiOutput.h"
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/gui/ChannelListWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/gui/ColoredWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
2 changes: 1 addition & 1 deletion src/gui/DataEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
4 changes: 2 additions & 2 deletions src/gui/EventWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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();
Expand Down
Loading

0 comments on commit c999197

Please sign in to comment.