From 3e7ac98f280bbae7472410c92d46fc388af3c19a Mon Sep 17 00:00:00 2001 From: Nicolas Fella Date: Mon, 8 Mar 2021 21:25:47 +0100 Subject: [PATCH] Default to qqc2-desktop-style and add it as runtime dependency On Plasma qqc2-desktop-style is used automatically, but not on other DEs. Set it as a default and allow overriding it via environment variables. Also add it as a runtime dep so distros actually ship it. --- CMakeLists.txt | 6 +++++- app/CMakeLists.txt | 2 +- app/main.cpp | 6 ++++++ smsapp/CMakeLists.txt | 1 + smsapp/main.cpp | 6 ++++++ 5 files changed, 19 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2412bc99a..fbf5fab5a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -87,7 +87,7 @@ endif() add_definitions(-DQT_NO_URL_CAST_FROM_STRING -DQT_NO_KEYWORDS -DQT_NO_CAST_FROM_ASCII) -find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS DBus Quick Network Multimedia) +find_package(Qt5 ${QT_MIN_VERSION} REQUIRED COMPONENTS DBus Quick QuickControls2 Network Multimedia) find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS ${KF5_REQUIRED_COMPONENTS}) if (KF5_OPTIONAL_COMPONENTS) find_package(KF5 ${KF5_MIN_VERSION} COMPONENTS ${KF5_OPTIONAL_COMPONENTS}) @@ -107,6 +107,10 @@ add_subdirectory(plugins) add_subdirectory(interfaces) if (NOT SAILFISHOS) + + find_package(KF5QQC2DesktopStyle ${KF5_MIN_VERSION} REQUIRED) + set_package_properties(KF5QQC2DesktopStyle PROPERTIES TYPE RUNTIME) + add_subdirectory(icons) add_subdirectory(data) add_subdirectory(cli) diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index d75b2fbfc..06c369907 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -1,7 +1,7 @@ qt5_add_resources(kdeconnect_SRCS resources.qrc) add_executable(kdeconnect-app main.cpp ${kdeconnect_SRCS}) -target_link_libraries(kdeconnect-app Qt5::Quick Qt5::Widgets KF5::CoreAddons KF5::I18n) +target_link_libraries(kdeconnect-app Qt5::Quick Qt5::QuickControls2 Qt5::Widgets KF5::CoreAddons KF5::I18n) install(TARGETS kdeconnect-app ${INSTALL_TARGETS_DEFAULT_ARGS}) install(PROGRAMS org.kde.kdeconnect.app.desktop DESTINATION ${XDG_APPS_INSTALL_DIR}) diff --git a/app/main.cpp b/app/main.cpp index 9848280d1..f1ed12e5e 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -24,6 +25,11 @@ int main(int argc, char* argv[]) aboutData.addAuthor(i18n("Aleix Pol Gonzalez"), i18n("Maintainer"), QStringLiteral("aleixpol@kde.org")); KAboutData::setApplicationData(aboutData); + // Default to org.kde.desktop style unless the user forces another style + if (qEnvironmentVariableIsEmpty("QT_QUICK_CONTROLS_STYLE")) { + QQuickStyle::setStyle(QStringLiteral("org.kde.desktop")); + } + { QCommandLineParser parser; aboutData.setupCommandLine(&parser); diff --git a/smsapp/CMakeLists.txt b/smsapp/CMakeLists.txt index df22fb6e3..1913ff1ab 100644 --- a/smsapp/CMakeLists.txt +++ b/smsapp/CMakeLists.txt @@ -50,6 +50,7 @@ target_link_libraries(kdeconnect-sms kdeconnectinterfaces kdeconnectversion Qt5::Quick + Qt5::QuickControls2 Qt5::Widgets KF5::CoreAddons KF5::DBusAddons diff --git a/smsapp/main.cpp b/smsapp/main.cpp index d28f133e0..f8142213c 100644 --- a/smsapp/main.cpp +++ b/smsapp/main.cpp @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -39,6 +40,11 @@ int main(int argc, char *argv[]) aboutData.addAuthor(i18n("Nicolas Fella"), {}, QStringLiteral("nicolas.fella@gmx.de")); KAboutData::setApplicationData(aboutData); + // Default to org.kde.desktop style unless the user forces another style + if (qEnvironmentVariableIsEmpty("QT_QUICK_CONTROLS_STYLE")) { + QQuickStyle::setStyle(QStringLiteral("org.kde.desktop")); + } + QString initialMessage, deviceid; {