Skip to content

Commit 48e2899

Browse files
authored
[Linux] Use Qt 6.4 for compatibility with Debian Stable (#116)
2 parents 91675de + 7f7b439 commit 48e2899

File tree

4 files changed

+20
-10
lines changed

4 files changed

+20
-10
lines changed

linux/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ project(linux VERSION 0.1 LANGUAGES CXX)
44

55
set(CMAKE_CXX_STANDARD_REQUIRED ON)
66

7-
find_package(Qt6 6.5 REQUIRED COMPONENTS Quick Widgets Bluetooth DBus)
7+
find_package(Qt6 6.4 REQUIRED COMPONENTS Quick Widgets Bluetooth DBus)
88

9-
qt_standard_project_setup(REQUIRES 6.5)
9+
qt_standard_project_setup(REQUIRES 6.4)
1010

1111
qt_add_executable(applinux
1212
main.cpp

linux/README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,13 @@ A native Linux application to control your AirPods, with support for:
1414
2. Qt6 packages
1515

1616
```bash
17-
sudo pacman -S qt6-base qt6-connectivity qt6-multimedia-ffmpeg qt6-multimedia # Arch Linux / EndeavourOS
17+
# For Arch Linux / EndeavourOS
18+
sudo pacman -S qt6-base qt6-connectivity qt6-multimedia-ffmpeg qt6-multimedia
19+
20+
# For Debian
21+
sudo apt-get install qt6-base-dev qt6-declarative-dev qt6-connectivity-dev qt6-multimedia-dev \
22+
qml6-module-qtquick-controls qml6-module-qtqml-workerscript qml6-module-qtquick-templates \
23+
qml6-module-qtquick-window qml6-module-qtquick-layouts
1824
```
1925

2026
## Setup

linux/ble/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ set(CMAKE_AUTOMOC ON)
88
set(CMAKE_AUTORCC ON)
99
set(CMAKE_AUTOUIC ON)
1010

11-
find_package(Qt6 6.5 REQUIRED COMPONENTS Core Bluetooth Widgets)
11+
find_package(Qt6 6.4 REQUIRED COMPONENTS Core Bluetooth Widgets)
1212

1313
qt_add_executable(ble_monitor
1414
main.cpp
@@ -26,4 +26,4 @@ install(TARGETS ble_monitor
2626
BUNDLE DESTINATION .
2727
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
2828
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
29-
)
29+
)

linux/main.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ private slots:
367367
}
368368
else
369369
{
370-
parent->loadFromModule("linux", "Main");
370+
loadMainModule();
371371
}
372372
}
373373

@@ -379,7 +379,7 @@ private slots:
379379
}
380380
else
381381
{
382-
parent->loadFromModule("linux", "Main");
382+
loadMainModule();
383383
}
384384
}
385385

@@ -908,6 +908,10 @@ private slots:
908908
connectToPhone();
909909
}
910910

911+
void loadMainModule() {
912+
parent->load(QUrl(QStringLiteral("qrc:/linux/Main.qml")));
913+
}
914+
911915
signals:
912916
void noiseControlModeChanged(NoiseControlMode mode);
913917
void earDetectionStatusChanged(const QString &status);
@@ -995,7 +999,7 @@ int main(int argc, char *argv[]) {
995999
qmlRegisterType<Battery>("me.kavishdevar.Battery", 1, 0, "Battery");
9961000
AirPodsTrayApp *trayApp = new AirPodsTrayApp(debugMode, hideOnStart, &engine);
9971001
engine.rootContext()->setContextProperty("airPodsTrayApp", trayApp);
998-
engine.loadFromModule("linux", "Main");
1002+
trayApp->loadMainModule();
9991003

10001004
QLocalServer server;
10011005
QLocalServer::removeServer("app_server");
@@ -1012,7 +1016,7 @@ int main(int argc, char *argv[]) {
10121016
QObject::connect(&server, &QLocalServer::newConnection, [&]() {
10131017
QLocalSocket* socket = server.nextPendingConnection();
10141018
// Handles Proper Connection
1015-
QObject::connect(socket, &QLocalSocket::readyRead, [socket, &engine]() {
1019+
QObject::connect(socket, &QLocalSocket::readyRead, [socket, &engine, &trayApp]() {
10161020
QString msg = socket->readAll();
10171021
// Check if the message is "reopen", if so, trigger onOpenApp function
10181022
if (msg == "reopen") {
@@ -1023,7 +1027,7 @@ int main(int argc, char *argv[]) {
10231027
}
10241028
else
10251029
{
1026-
engine.loadFromModule("linux", "Main");
1030+
trayApp->loadMainModule();
10271031
}
10281032
}
10291033
else

0 commit comments

Comments
 (0)