From 9dcb7b49fa6752c920f4b08ff4989787d60fc6ea Mon Sep 17 00:00:00 2001 From: Tobias Fella Date: Mon, 23 Oct 2023 21:59:40 +0200 Subject: [PATCH] Use KColorScheme --- .kde-ci.yml | 2 +- CMakeLists.txt | 4 ++-- src/CMakeLists.txt | 8 ++++---- src/main.cpp | 7 +------ 4 files changed, 8 insertions(+), 13 deletions(-) diff --git a/.kde-ci.yml b/.kde-ci.yml index fab822fe4..82171a720 100644 --- a/.kde-ci.yml +++ b/.kde-ci.yml @@ -13,6 +13,7 @@ Dependencies: 'frameworks/kitemmodels': '@latest-kf6' 'frameworks/kquickcharts': '@latest-kf6' 'frameworks/knotifications': '@latest-kf6' + 'frameworks/kcolorscheme': '@latest-kf6' 'libraries/kquickimageeditor': '@latest-kf6' 'frameworks/sonnet': '@latest-kf6' 'libraries/kirigami-addons': '@latest-kf6' @@ -25,7 +26,6 @@ Dependencies: 'frameworks/qqc2-desktop-style': '@latest-kf6' 'frameworks/kio': '@latest-kf6' 'frameworks/kwindowsystem': '@latest-kf6' - 'frameworks/kconfigwidgets': '@latest-kf6' - 'on': ['Linux', 'FreeBSD'] 'require': 'frameworks/kdbusaddons': '@latest-kf6' diff --git a/CMakeLists.txt b/CMakeLists.txt index cf2c98fd2..17de72bbd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -57,7 +57,7 @@ set_package_properties(Qt6 PROPERTIES TYPE REQUIRED PURPOSE "Basic application components" ) -find_package(KF6 ${KF_MIN_VERSION} COMPONENTS Kirigami2 I18n Notifications Config CoreAddons Sonnet ItemModels) +find_package(KF6 ${KF_MIN_VERSION} COMPONENTS Kirigami2 I18n Notifications Config CoreAddons Sonnet ItemModels ColorScheme) set_package_properties(KF6 PROPERTIES TYPE REQUIRED PURPOSE "Basic application components" @@ -76,7 +76,7 @@ if(ANDROID) ) else() find_package(Qt6 ${QT_MIN_VERSION} COMPONENTS Widgets) - find_package(KF6 ${KF_MIN_VERSION} REQUIRED COMPONENTS QQC2DesktopStyle ConfigWidgets KIO WindowSystem StatusNotifierItem) + find_package(KF6 ${KF_MIN_VERSION} REQUIRED COMPONENTS QQC2DesktopStyle KIO WindowSystem StatusNotifierItem) set_package_properties(KF6QQC2DesktopStyle PROPERTIES TYPE RUNTIME ) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 9bfb80601..adecb56aa 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -137,6 +137,8 @@ add_library(neochat STATIC roomlastmessageprovider.h chatbarcache.cpp chatbarcache.h + colorschemer.cpp + colorschemer.h ) qt_add_qml_module(neochat URI org.kde.neochat NO_PLUGIN @@ -326,15 +328,13 @@ ecm_add_app_icon(NEOCHAT_ICON ICONS ${CMAKE_SOURCE_DIR}/128-logo.png) target_sources(neochat-app PRIVATE ${NEOCHAT_ICON}) if(NOT ANDROID) - target_sources(neochat PRIVATE colorschemer.cpp colorschemer.h) if (NOT WIN32 AND NOT APPLE) target_sources(neochat PRIVATE trayicon_sni.cpp trayicon_sni.h) target_link_libraries(neochat PRIVATE KF6::StatusNotifierItem) else() target_sources(neochat PRIVATE trayicon.cpp trayicon.h) endif() - target_link_libraries(neochat PUBLIC KF6::ConfigWidgets KF6::WindowSystem ICU::uc) - target_compile_definitions(neochat PUBLIC -DHAVE_COLORSCHEME) + target_link_libraries(neochat PUBLIC KF6::WindowSystem ICU::uc) target_compile_definitions(neochat PUBLIC -DHAVE_WINDOWSYSTEM) target_compile_definitions(neochat PUBLIC -DHAVE_ICU) endif() @@ -346,7 +346,7 @@ if (NOT ANDROID AND NOT WIN32 AND NOT APPLE) endif() target_include_directories(neochat PRIVATE ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/models ${CMAKE_CURRENT_SOURCE_DIR}/enums) -target_link_libraries(neochat PUBLIC Qt::Core Qt::Quick Qt::Qml Qt::Gui Qt::Multimedia Qt::Network Qt::QuickControls2 KF6::I18n KF6::Kirigami2 KF6::Notifications KF6::ConfigCore KF6::ConfigGui KF6::CoreAddons KF6::SonnetCore KF6::ItemModels QuotientQt6 cmark::cmark QCoro::Core) +target_link_libraries(neochat PUBLIC Qt::Core Qt::Quick Qt::Qml Qt::Gui Qt::Multimedia Qt::Network Qt::QuickControls2 KF6::I18n KF6::Kirigami2 KF6::Notifications KF6::ConfigCore KF6::ConfigGui KF6::CoreAddons KF6::SonnetCore KF6::ColorScheme KF6::ItemModels QuotientQt6 cmark::cmark QCoro::Core) kconfig_add_kcfg_files(neochat GENERATE_MOC neochatconfig.kcfgc) diff --git a/src/main.cpp b/src/main.cpp index 747cfb4ac..6ea7c178b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -38,6 +38,7 @@ #include #include "blurhashimageprovider.h" +#include "colorschemer.h" #include "controller.h" #include "logger.h" #include "matriximageprovider.h" @@ -45,10 +46,6 @@ #include "roommanager.h" #include "windowcontroller.h" -#ifdef HAVE_COLORSCHEME -#include "colorschemer.h" -#endif - #ifdef HAVE_RUNNER #include "runner.h" #include @@ -166,12 +163,10 @@ int main(int argc, char *argv[]) QStringLiteral("/var/config/fontconfig/conf.d/99-noto-mono-color-emoji.conf")); #endif -#ifdef HAVE_COLORSCHEME ColorSchemer colorScheme; if (!NeoChatConfig::self()->colorScheme().isEmpty()) { colorScheme.apply(NeoChatConfig::self()->colorScheme()); } -#endif qml_register_types_org_kde_neochat(); qmlRegisterSingletonInstance("org.kde.neochat.config", 1, 0, "Config", NeoChatConfig::self());