Page MenuHomePhorge

D369.1794158867.diff
No OneTemporary

Authored By
Unknown
Size
4 KB
Referenced Files
None
Subscribers
None

D369.1794158867.diff

diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -27,6 +27,7 @@
option(kazv_LINK_BREEZE_ICONS "Link to Breeze icons library" OFF)
option(kazv_BUILD_TESTS "Build tests" ON)
option(kazv_ENABLE_APPIUM_TESTS "Run appium tests" "")
+
set(kazv_LINK_BREEZE_ICONS_MACRO 0)
if(kazv_LINK_BREEZE_ICONS)
set(kazv_LINK_BREEZE_ICONS_MACRO 1)
@@ -72,6 +73,19 @@
find_package(KF${KF_MAJOR_VERSION} ${KF_MIN_VERSION} REQUIRED COMPONENTS Kirigami Config Notifications CoreAddons ${kazv_KF_EXTRA_MODULES})
find_package(KF6KirigamiAddons)
+if(NOT ANDROID)
+ find_package(KF6ConfigWidgets)
+ option(kazv_USE_KCONFIGWIDGETS "Use KConfigWdigets to set fallback platform theme" ${KF6ConfigWidgets_FOUND})
+else()
+ option(kazv_USE_KCONFIGWIDGETS "Use KConfigWdigets to set fallback platform theme" OFF)
+endif()
+
+if(kazv_USE_KCONFIGWIDGETS)
+ message(STATUS "kazv will use KConfigWidgets to set fallback style")
+else()
+ message(STATUS "kazv will NOT use KConfigWidgets to set fallback style")
+endif()
+
find_package(Threads REQUIRED)
find_package(nlohmann_json REQUIRED)
find_package(libkazv REQUIRED)
diff --git a/packaging/GNU-Linux/appimage/build.sh b/packaging/GNU-Linux/appimage/build.sh
--- a/packaging/GNU-Linux/appimage/build.sh
+++ b/packaging/GNU-Linux/appimage/build.sh
@@ -46,6 +46,7 @@
qml6-module-org-kde-notification
kf6-kirigami-addons-dev
kf6-kcoreaddons-dev
+ kf6-kconfigwidgets-dev
qml6-module-org-kde-qqc2desktopstyle
kf6-qqc2-desktop-style-dev
kf6-breeze-icon-theme-dev
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -32,6 +32,11 @@
else()
set(KAZV_IS_ANDROID 0)
endif()
+if(kazv_USE_KCONFIGWIDGETS)
+ set(KAZV_USE_KCONFIGWIDGETS 1)
+else()
+ set(KAZV_USE_KCONFIGWIDGETS 0)
+endif()
configure_file(kazv-version.cpp.in kazv-version.cpp)
configure_file(kazv-platform.hpp.in kazv-platform.hpp)
configure_file(kazv-defs.hpp.in kazv-defs.hpp)
@@ -146,6 +151,7 @@
OpenSSL::SSL
)
endif()
+
target_link_libraries(kazvqmlmodule PRIVATE kazvsanitizer)
target_include_directories(kazvqmlmodule PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
@@ -347,6 +353,12 @@
if(kazv_LINK_BREEZE_ICONS)
target_link_libraries(kazv PRIVATE KF${KF_MAJOR_VERSION}::BreezeIcons)
endif()
+if(kazv_USE_KCONFIGWIDGETS)
+ target_link_libraries(kazv PRIVATE
+ KF${KF_MAJOR_VERSION}::ConfigWidgets
+ )
+endif()
+
if(ANDROID)
message(STATUS "Collecting icons for apk deployment")
execute_process(
diff --git a/src/kazv-platform.hpp.in b/src/kazv-platform.hpp.in
--- a/src/kazv-platform.hpp.in
+++ b/src/kazv-platform.hpp.in
@@ -10,3 +10,4 @@
#define KAZV_IS_WINDOWS ${KAZV_IS_WINDOWS}
#define KAZV_IS_ANDROID ${KAZV_IS_ANDROID}
+#define KAZV_USE_KCONFIGWIDGETS ${KAZV_USE_KCONFIGWIDGETS}
diff --git a/src/main.cpp b/src/main.cpp
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -24,6 +24,9 @@
#if KAZV_LINK_BREEZE_ICONS
#include <BreezeIcons>
#endif
+#if KAZV_USE_KCONFIGWIDGETS
+#include <KStyleManager>
+#endif
#include "meta-types.hpp"
#include "kazv-platform.hpp"
#include "kazv-path-config.hpp"
@@ -55,14 +58,26 @@
.setHomepage(u"https://kazv.chat"_s);
KAboutData::setApplicationData(aboutData);
-#if KAZV_IS_WINDOWS
+#if KAZV_USE_KCONFIGWIDGETS
+ // Do not override user-set theme, even if we are running under Plasma
+ if (qEnvironmentVariableIsEmpty("QT_QPA_PLATFORMTHEME")) {
+ KStyleManager::initStyle();
+ }
+#endif
+
if (qEnvironmentVariableIsEmpty("QT_QUICK_CONTROLS_STYLE")) {
+ // Without a supporting style, Kirigami.Theme's color set
+ // will not behave well and lead to weird results (e.g. background
+ // and foreground are the same color).
+ // Thus, unless the user says otherwise, use either
+ // desktop style or breeze style by default.
+#if !KAZV_IS_ANDROID
QQuickStyle::setStyle(QStringLiteral("org.kde.desktop"));
- }
#endif
#if KAZV_IS_ANDROID
- QQuickStyle::setStyle(QStringLiteral("org.kde.breeze"));
+ QQuickStyle::setStyle(QStringLiteral("org.kde.breeze"));
#endif
+ }
QQmlApplicationEngine engine;

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 8, 9:27 AM (16 h, 21 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1807383
Default Alt Text
D369.1794158867.diff (4 KB)

Event Timeline