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.
This commit is contained in:
Nicolas Fella 2021-03-08 21:25:47 +01:00
parent 5d037396ee
commit 3e7ac98f28
5 changed files with 19 additions and 2 deletions

View file

@ -87,7 +87,7 @@ endif()
add_definitions(-DQT_NO_URL_CAST_FROM_STRING -DQT_NO_KEYWORDS -DQT_NO_CAST_FROM_ASCII) 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}) find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS ${KF5_REQUIRED_COMPONENTS})
if (KF5_OPTIONAL_COMPONENTS) if (KF5_OPTIONAL_COMPONENTS)
find_package(KF5 ${KF5_MIN_VERSION} COMPONENTS ${KF5_OPTIONAL_COMPONENTS}) find_package(KF5 ${KF5_MIN_VERSION} COMPONENTS ${KF5_OPTIONAL_COMPONENTS})
@ -107,6 +107,10 @@ add_subdirectory(plugins)
add_subdirectory(interfaces) add_subdirectory(interfaces)
if (NOT SAILFISHOS) if (NOT SAILFISHOS)
find_package(KF5QQC2DesktopStyle ${KF5_MIN_VERSION} REQUIRED)
set_package_properties(KF5QQC2DesktopStyle PROPERTIES TYPE RUNTIME)
add_subdirectory(icons) add_subdirectory(icons)
add_subdirectory(data) add_subdirectory(data)
add_subdirectory(cli) add_subdirectory(cli)

View file

@ -1,7 +1,7 @@
qt5_add_resources(kdeconnect_SRCS resources.qrc) qt5_add_resources(kdeconnect_SRCS resources.qrc)
add_executable(kdeconnect-app main.cpp ${kdeconnect_SRCS}) 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(TARGETS kdeconnect-app ${INSTALL_TARGETS_DEFAULT_ARGS})
install(PROGRAMS org.kde.kdeconnect.app.desktop DESTINATION ${XDG_APPS_INSTALL_DIR}) install(PROGRAMS org.kde.kdeconnect.app.desktop DESTINATION ${XDG_APPS_INSTALL_DIR})

View file

@ -9,6 +9,7 @@
#include <QQmlApplicationEngine> #include <QQmlApplicationEngine>
#include <QCommandLineParser> #include <QCommandLineParser>
#include <QQmlContext> #include <QQmlContext>
#include <QQuickStyle>
#include <QStandardPaths> #include <QStandardPaths>
#include <KAboutData> #include <KAboutData>
@ -24,6 +25,11 @@ int main(int argc, char* argv[])
aboutData.addAuthor(i18n("Aleix Pol Gonzalez"), i18n("Maintainer"), QStringLiteral("aleixpol@kde.org")); aboutData.addAuthor(i18n("Aleix Pol Gonzalez"), i18n("Maintainer"), QStringLiteral("aleixpol@kde.org"));
KAboutData::setApplicationData(aboutData); 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; QCommandLineParser parser;
aboutData.setupCommandLine(&parser); aboutData.setupCommandLine(&parser);

View file

@ -50,6 +50,7 @@ target_link_libraries(kdeconnect-sms
kdeconnectinterfaces kdeconnectinterfaces
kdeconnectversion kdeconnectversion
Qt5::Quick Qt5::Quick
Qt5::QuickControls2
Qt5::Widgets Qt5::Widgets
KF5::CoreAddons KF5::CoreAddons
KF5::DBusAddons KF5::DBusAddons

View file

@ -15,6 +15,7 @@
#include <QQmlApplicationEngine> #include <QQmlApplicationEngine>
#include <QCommandLineParser> #include <QCommandLineParser>
#include <QQmlContext> #include <QQmlContext>
#include <QQuickStyle>
#include <KAboutData> #include <KAboutData>
#include <KLocalizedString> #include <KLocalizedString>
#include <KLocalizedContext> #include <KLocalizedContext>
@ -39,6 +40,11 @@ int main(int argc, char *argv[])
aboutData.addAuthor(i18n("Nicolas Fella"), {}, QStringLiteral("nicolas.fella@gmx.de")); aboutData.addAuthor(i18n("Nicolas Fella"), {}, QStringLiteral("nicolas.fella@gmx.de"));
KAboutData::setApplicationData(aboutData); 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; QString initialMessage, deviceid;
{ {