Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F85914394
D369.1794186451.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
4 KB
Referenced Files
None
Subscribers
None
D369.1794186451.diff
View Options
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" "")
+option(kazv_USE_KCONFIGWIDGETS "Use KConfigWdigets to set fallback platform theme" "")
set(kazv_LINK_BREEZE_ICONS_MACRO 0)
if(kazv_LINK_BREEZE_ICONS)
set(kazv_LINK_BREEZE_ICONS_MACRO 1)
@@ -72,6 +73,23 @@
find_package(KF${KF_MAJOR_VERSION} ${KF_MIN_VERSION} REQUIRED COMPONENTS Kirigami Config Notifications CoreAddons ${kazv_KF_EXTRA_MODULES})
find_package(KF6KirigamiAddons)
+if((${ANDROID}) AND ("${kazv_USE_KCONFIGWIDGETS}" STREQUAL ""))
+ set(kazv_USE_KCONFIGWIDGETS OFF)
+endif()
+if("${kazv_USE_KCONFIGWIDGETS}" STREQUAL "")
+ find_package(KF6ConfigWidgets)
+ set(kazv_USE_KCONFIGWIDGETS ${KF6ConfigWidgets_FOUND})
+else()
+ if(kazv_USE_KCONFIGWIDGETS)
+ find_package(KF6ConfigWidgets REQUIRED)
+ endif()
+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
Details
Attached
Mime Type
text/plain
Expires
Sun, Nov 8, 5:07 PM (23 h, 42 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1831897
Default Alt Text
D369.1794186451.diff (4 KB)
Attached To
Mode
D369: Have a reasonable default application style
Attached
Detach File
Event Timeline