From 00ca23447844114d41bfc0d37cf8823202c082e8 Mon Sep 17 00:00:00 2001 From: Evan Boehs Date: Wed, 28 Feb 2024 17:08:33 -0500 Subject: [PATCH] qt6 tar --- CMakeLists.txt | 105 +++++++++---- README.md | 65 +++++++-- colors/CMakeLists.txt | 2 +- kdecoration/CMakeLists.txt | 93 +++--------- kdecoration/config/lightlyconfigwidget.cpp | 22 +-- kdecoration/config/lightlyconfigwidget.h | 4 +- .../config/lightlydecorationconfig.desktop | 2 +- kdecoration/config/lightlydetectwidget.h | 4 +- kdecoration/config/lightlyexceptiondialog.h | 2 +- .../config/lightlyexceptionlistwidget.cpp | 2 +- .../config/lightlyexceptionlistwidget.h | 2 +- kdecoration/lightly.json | 106 +++++++++++++- kdecoration/lightlybutton.cpp | 36 ++--- kdecoration/lightlydecoration.cpp | 62 ++++---- kdecoration/lightlydecoration.h | 18 +-- kdecoration/lightlysettingsprovider.cpp | 27 ++-- kdecoration/lightlysizegrip.cpp | 4 +- kstyle/CMakeLists.txt | 110 ++++++-------- kstyle/animations/lightlytransitionwidget.cpp | 2 +- kstyle/config/CMakeLists.txt | 49 +++---- kstyle/config/lightlystyleconfig.desktop | 138 ------------------ kstyle/config/lightlystyleconfigmodule.cpp | 16 +- kstyle/config/lightlystyleconfigmodule.h | 2 +- kstyle/config/main.cpp | 5 +- kstyle/debug/lightlywidgetexplorer.cpp | 6 +- kstyle/lightly.themerc | 2 +- kstyle/lightlyblurhelper.cpp | 5 +- kstyle/lightlyhelper.cpp | 24 ++- kstyle/lightlyhelper.h | 2 +- kstyle/lightlystyle.cpp | 14 +- liblightlycommon/CMakeLists.txt | 17 ++- 31 files changed, 460 insertions(+), 488 deletions(-) delete mode 100644 kstyle/config/lightlystyleconfig.desktop diff --git a/CMakeLists.txt b/CMakeLists.txt index b3dfbd3b8..b30451c2a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,59 +1,112 @@ -cmake_minimum_required(VERSION 3.0) +cmake_minimum_required(VERSION 3.16) project(lightly) -set(PROJECT_VERSION "0.43") -set(PROJECT_VERSION_MAJOR 5) +set(PROJECT_VERSION "6.80") +set(PROJECT_VERSION_MAJOR 6) -set(KF5_MIN_VERSION "5.78.0") + +set(KF6_MIN_VERSION "5.240.0") +set(KDE_COMPILERSETTINGS_LEVEL "5.82") +set(QT_MIN_VERSION "6.6.0") include(GenerateExportHeader) include(WriteBasicConfigVersionFile) include(FeatureSummary) +include(GNUInstallDirs) + +find_package(ECM ${KF6_MIN_VERSION} REQUIRED NO_MODULE) +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake) + +set(CMAKE_CXX_STANDARD 20) +set(CMAKE_CXX_STANDARD_REQUIRED ON) -find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE) -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} ${CMAKE_SOURCE_DIR}/cmake) +include(CMakePackageConfigHelpers) include(ECMInstallIcons) -include(KDEInstallDirs) -include(KDECMakeSettings) include(KDECompilerSettings NO_POLICY_SCOPE) include(KDEClangFormat) +include(KDEGitCommitHooks) include(GtkUpdateIconCache) -option(WITH_DECORATIONS "Build Lightly window decorations for KWin" ON) -if(WITH_DECORATIONS) - find_package(KDecoration2 REQUIRED) - add_subdirectory(kdecoration) +if(WIN32 OR APPLE) + set(WITH_DECORATIONS OFF) endif() +set(QT_MAJOR_VERSION 6) +include(KDEInstallDirs6) +include(KDECMakeSettings) + +option(WITH_DECORATIONS "Build Lightly window decorations for KWin" ON) + +find_package(Qt6 ${QT_MIN_VERSION} REQUIRED CONFIG COMPONENTS Widgets DBus) +find_package(KF6 ${KF6_MIN_VERSION} REQUIRED COMPONENTS + CoreAddons + ColorScheme + Config + GuiAddons + I18n + IconThemes + WindowSystem) + if(NOT WIN32 AND NOT APPLE) + find_package(KF6KCMUtils ${KF6_MIN_VERSION}) + set_package_properties(KF6KCMUtils PROPERTIES + TYPE REQUIRED + DESCRIPTION "Helps create configuration modules" + PURPOSE "KCMUtils used for the configuration modules or the decoration and Qt Style" + ) + endif() + +find_package(Qt6 ${QT_MIN_VERSION} OPTIONAL_COMPONENTS Quick) + if(${Qt6Quick_FOUND}) + find_package(KF6KirigamiPlatform ${KF6_MIN_VERSION} REQUIRED) + endif() + +find_package(KF6FrameworkIntegration ${KF6_MIN_VERSION} CONFIG ) + set_package_properties(KF${QT_MAJOR_VERSION}FrameworkIntegration PROPERTIES + DESCRIPTION "KF6 Framework Integration" + URL "https://projects.kde.org/projects/frameworks/frameworkintegration" + TYPE OPTIONAL + PURPOSE "Required to use KStyle convenience functionalities in style") + +set(LIGHTLY_HAVE_KSTYLE ${KF6FrameworkIntegration_FOUND}) +set(LIGHTLY_HAVE_QTQUICK ${Qt6Quick_FOUND}) + + add_subdirectory(colors) -add_subdirectory(liblightlycommon) -add_subdirectory(kstyle) -add_subdirectory(misc) +add_subdirectory(kstyle kstyle6) +add_subdirectory(liblightlycommon liblightlycommon6) +#add_subdirectory(misc) + if(WITH_DECORATIONS) + find_package(KDecoration2 REQUIRED) + add_subdirectory(kdecoration) + endif() +ki18n_install(po) + +# create a Config.cmake and a ConfigVersion.cmake file and install them include(ECMSetupVersion) ecm_setup_version(${PROJECT_VERSION} VARIABLE_PREFIX LIGHTLY - PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/LightlyConfigVersion.cmake" + PACKAGE_VERSION_FILE "${CMAKE_CURRENT_BINARY_DIR}/LightlyConfigVersion.cmake" ) -# create a Config.cmake and a ConfigVersion.cmake file and install them -set(CMAKECONFIG_INSTALL_DIR "${CMAKECONFIG_INSTALL_PREFIX}/Lightly") +set(CMAKECONFIG_INSTALL_DIR "${KDE_INSTALL_CMAKEPACKAGEDIR}/Lightly") -ecm_configure_package_config_file("${CMAKE_CURRENT_SOURCE_DIR}/LightlyConfig.cmake.in" +configure_package_config_file("${CMAKE_CURRENT_SOURCE_DIR}/LightlyConfig.cmake.in" "${CMAKE_CURRENT_BINARY_DIR}/LightlyConfig.cmake" PATH_VARS KDE_INSTALL_FULL_DATADIR INSTALL_DESTINATION ${CMAKECONFIG_INSTALL_DIR} - ) + ) + +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/LightlyConfig.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/LightlyConfigVersion.cmake" + DESTINATION "${CMAKECONFIG_INSTALL_DIR}" + COMPONENT Devel + ) # add clang-format target for all our real source files file(GLOB_RECURSE ALL_CLANG_FORMAT_SOURCE_FILES *.cpp *.h) kde_clang_format(${ALL_CLANG_FORMAT_SOURCE_FILES}) - -install(FILES "${CMAKE_CURRENT_BINARY_DIR}/LightlyConfig.cmake" - "${CMAKE_CURRENT_BINARY_DIR}/LightlyConfigVersion.cmake" - DESTINATION "${CMAKECONFIG_INSTALL_DIR}" - COMPONENT Devel - ) +kde_configure_git_pre_commit_hook(CHECKS CLANG_FORMAT) feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/README.md b/README.md index 9970fb3af..579ef933a 100644 --- a/README.md +++ b/README.md @@ -2,24 +2,15 @@

-**This is a personal fork of Lightly where I merge pull requests sent to [Luwx/Lightly](https://github.com/Luwx/Lightly)** - -*Lightly* is a fork of breeze theme style that aims to be visually modern and minimalistic. - -# Notes about this fork - -- Do not open pull requests directly here unless they change/require some code that has diverged from upstream -- If the pull request can sucessfully be merged into [Luwx/Lightly](https://github.com/Luwx/Lightly), please open it there and I will merge it here. My intention is not for this to be a permanent fork (hopefully Luwx comes back!) -- Similarly, don't open issues here unless the issue was likely caused by some code here that's not in [Luwx/Lightly](https://github.com/Luwx/Lightly) - -These rules are because I don't want to diverge too far from upstream. It should be easy for Luwx to catch up. - -Thanks ❤️🐢 +*Lightly* is a fork of breeze theme style that aims to be visually modern and minimalistic. ## Development ⚠️ Lightly is a work in progress theme, there is still a lot to change, so expect bugs! Some applications may suddenly crash or flicker. +If you have any feedback or encounter some bugs, feel free to open an issue or a pr. + + ## Screenshots ![default](https://github.com/Luwx/Lightly/blob/master/Lightly-default.png) @@ -45,6 +36,45 @@ Most of these options are inherited from Breeze style, but Lightly has a few exc The toolbar and menubar will follow the **titlebar** opacity. To configure the titlebar opacity, you will have to change the color scheme file directly in ~/.local/share/color-schemes. Open your desired color scheme and, in the ```[WM]``` section, add a fourth value to ```activeBackground``` and ```inactiveBackground```, like ```activeBackground=0,0,0,127``` where the last value is the alpha, that ranges from 0 (completely transparent) to 255 (totally opaque). +## Installation + +### Installing Lightly from [chaotic-aur](https://aur.chaotic.cx/) on ArchLinux and its [derivatives](https://wiki.archlinux.org/title/Arch-based_distributions) + 1. Follow the instructions [here](https://aur.chaotic.cx/) on how to setup chaotic-aur + 2. run: ```sudo pacman -Syyu lightly-qt``` + +### Installing Lightly from RPM repository on openSUSE Tumbleweed: + +1. Add "sputnik-look-and-feel" repository: +```sudo zypper ar -ef https://download.opensuse.org/repositories/home:/sputnik:/look-and-feel/openSUSE_Tumbleweed/ sputnik-look-and-feel``` +2. Refresh repository list: +```sudo zypper ref``` +3. You will be notified about received new repository key. And you will be asked if you want to accept the key. This repository is created on OBS. All builds are reproducible. +Type "```a```" and press enter. +4. Install Lightly: +```sudo zypper in Lightly``` + +### Fedora +``` +sudo dnf install Lightly +``` + +### Fedora 32 RPM repository + +1. Create repo file: +``` +echo "[sputnik-look-and-feel] +name=Look And Feel (Fedora_32) +type=rpm-md +baseurl=https://download.opensuse.org/repositories/home:/sputnik:/look-and-feel/Fedora_32/ +gpgcheck=1 +gpgkey=https://download.opensuse.org/repositories/home:/sputnik:/look-and-feel/Fedora_32/repodata/repomd.xml.key +enabled=1" | sudo tee -a /etc/yum.repos.d/sputnik-look-and-feel.repo +``` +2. Install Lightly: +```sudo dnf install Lightly``` + + + ## Manual installation ### Dependencies @@ -80,15 +110,13 @@ sudo eopkg install extra-cmake-modules kdecoration-devel qt5-declarative-devel q ### Build and install ``` -git clone --single-branch --depth=1 https://github.com/boehs/Lightly.git +git clone --single-branch --depth=1 https://github.com/Luwx/Lightly.git cd Lightly && mkdir build && cd build cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=lib -DBUILD_TESTING=OFF .. make sudo make install ``` -For RedHat-based distros (like Fedora and OpenSUSE), run `cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_LIBDIR=lib64 -DBUILD_TESTING=OFF ..` instead (#4) - ### Uninstall In the build folder: @@ -99,3 +127,8 @@ sudo make uninstall ## Acknowledgments Breeze authors and Kvantum developer Pedram Pourang. + + + + + diff --git a/colors/CMakeLists.txt b/colors/CMakeLists.txt index fb93f0604..6e9f1a4ae 100644 --- a/colors/CMakeLists.txt +++ b/colors/CMakeLists.txt @@ -1,2 +1,2 @@ install(FILES Lightly.colors - DESTINATION ${DATA_INSTALL_DIR}/color-schemes/) + DESTINATION ${KDE_INSTALL_DATADIR}/color-schemes/) diff --git a/kdecoration/CMakeLists.txt b/kdecoration/CMakeLists.txt index 7b1deef51..7c365c44f 100644 --- a/kdecoration/CMakeLists.txt +++ b/kdecoration/CMakeLists.txt @@ -1,30 +1,5 @@ add_definitions(-DTRANSLATION_DOMAIN="lightly_kwin_deco") -find_package(KF5 REQUIRED COMPONENTS CoreAddons GuiAddons ConfigWidgets WindowSystem I18n IconThemes) -find_package(Qt5 CONFIG REQUIRED COMPONENTS DBus) - -### XCB -find_package(XCB COMPONENTS XCB) -set_package_properties(XCB PROPERTIES - DESCRIPTION "X protocol C-language Binding" - URL "https://xcb.freedesktop.org" - TYPE OPTIONAL - PURPOSE "Required to pass style properties to native Windows on X11 Platform" -) - -if(UNIX AND NOT APPLE) - - set(LIGHTLY_HAVE_X11 ${XCB_XCB_FOUND}) - if (XCB_XCB_FOUND) - find_package(Qt5 REQUIRED CONFIG COMPONENTS X11Extras) - endif() - -else() - - set(LIGHTLY_HAVE_X11 FALSE) - -endif() - ################# configuration ################# configure_file(config-lightly.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-lightly.h ) @@ -39,59 +14,37 @@ set(lightlydecoration_SRCS lightlydecoration.cpp lightlyexceptionlist.cpp lightlysettingsprovider.cpp - lightlysizegrip.cpp) - -kconfig_add_kcfg_files(lightlydecoration_SRCS lightlysettings.kcfgc) - -### config classes -### they are kept separately because they might move in a separate library in the future -set(lightlydecoration_config_SRCS - config/lightlyconfigwidget.cpp - config/lightlydetectwidget.cpp - config/lightlyexceptiondialog.cpp - config/lightlyexceptionlistwidget.cpp - config/lightlyexceptionmodel.cpp - config/lightlyitemmodel.cpp -) - -set(lightlydecoration_config_PART_FORMS - config/ui/lightlyconfigurationui.ui - config/ui/lightlydetectwidget.ui - config/ui/lightlyexceptiondialog.ui - config/ui/lightlyexceptionlistwidget.ui + lightlysizegrip.cpp ) - -ki18n_wrap_ui(lightlydecoration_config_PART_FORMS_HEADERS ${lightlydecoration_config_PART_FORMS}) - ### build library +kconfig_add_kcfg_files(lightlydecoration_SRCS lightlysettings.kcfgc) add_library(lightlydecoration MODULE ${lightlydecoration_SRCS} ${lightlydecoration_config_SRCS} ${lightlydecoration_config_PART_FORMS_HEADERS}) +set_target_properties(lightlydecoration PROPERTIES + OUTPUT_NAME org.kde.lightly +) + target_link_libraries(lightlydecoration - PUBLIC - Qt5::Core - Qt5::Gui - Qt5::DBus - PRIVATE - lightlycommon5 + PUBLIC + Qt::Core + Qt::Gui + Qt::DBus KDecoration2::KDecoration - KF5::ConfigCore - KF5::CoreAddons - KF5::ConfigWidgets - KF5::GuiAddons - KF5::I18n - KF5::IconThemes - KF5::WindowSystem) - -if(LIGHTLY_HAVE_X11) - target_link_libraries(lightlydecoration - PUBLIC - Qt5::X11Extras - XCB::XCB) -endif() + PRIVATE + lightlycommon6 + KF6::CoreAddons + KF6::ConfigWidgets + KF6::GuiAddons + KF6::I18n + KF6::IconThemes + KF6::WindowSystem + KF6::KCMUtils +) +install(TARGETS lightlydecoration DESTINATION ${KDE_INSTALL_PLUGINDIR}/${KDECORATION_PLUGIN_DIR}) +install(FILES config/lightlydecorationconfig.desktop DESTINATION ${KDE_INSTALL_DATADIR}/kservices6) -install(TARGETS lightlydecoration DESTINATION ${PLUGIN_INSTALL_DIR}/org.kde.kdecoration2) -install(FILES config/lightlydecorationconfig.desktop DESTINATION ${SERVICES_INSTALL_DIR}) +add_subdirectory(config) diff --git a/kdecoration/config/lightlyconfigwidget.cpp b/kdecoration/config/lightlyconfigwidget.cpp index 2f5852c1e..b014d65bc 100644 --- a/kdecoration/config/lightlyconfigwidget.cpp +++ b/kdecoration/config/lightlyconfigwidget.cpp @@ -36,14 +36,14 @@ namespace Lightly { //_________________________________________________________ - ConfigWidget::ConfigWidget( QWidget* parent, const QVariantList &args ): - KCModule(parent, args), - m_configuration( KSharedConfig::openConfig( QStringLiteral( "lightlyrc" ) ) ), - m_changed( false ) + ConfigWidget::ConfigWidget(QObject *parent, const KPluginMetaData &data, const QVariantList & /*args*/) + : KCModule(parent, data) + , m_configuration(KSharedConfig::openConfig(QStringLiteral("lightlyrc"))) + , m_changed(false) { // configuration - m_ui.setupUi( this ); + m_ui.setupUi(widget()); // track ui changes connect( m_ui.titleAlignment, SIGNAL(currentIndexChanged(int)), SLOT(updateChanged()) ); @@ -98,7 +98,7 @@ namespace Lightly ExceptionList exceptions; exceptions.readConfig( m_configuration ); m_ui.exceptions->setExceptions( exceptions.get() ); - setChanged( false ); + setNeedsSave(false); } @@ -134,7 +134,7 @@ namespace Lightly // sync configuration m_configuration->sync(); - setChanged( false ); + setNeedsSave( false ); // needed to tell kwin to reload when running from external kcmshell { @@ -205,14 +205,8 @@ namespace Lightly // exceptions else if( m_ui.exceptions->isChanged() ) modified = true; - setChanged( modified ); + setNeedsSave( modified ); } - //_______________________________________________ - void ConfigWidget::setChanged( bool value ) - { - emit changed( value ); - } - } diff --git a/kdecoration/config/lightlyconfigwidget.h b/kdecoration/config/lightlyconfigwidget.h index 348c414b3..ad9c02813 100644 --- a/kdecoration/config/lightlyconfigwidget.h +++ b/kdecoration/config/lightlyconfigwidget.h @@ -25,7 +25,7 @@ // IN THE SOFTWARE. ////////////////////////////////////////////////////////////////////////////// -#include "ui_lightlyconfigurationui.h" +#include "config/ui_lightlyconfigurationui.h" #include "lightlyexceptionlistwidget.h" #include "lightlysettings.h" #include "lightly.h" @@ -48,7 +48,7 @@ namespace Lightly public: //* constructor - explicit ConfigWidget( QWidget*, const QVariantList& ); + explicit ConfigWidget(QObject *parent, const KPluginMetaData &data, const QVariantList &args); //* destructor virtual ~ConfigWidget() = default; diff --git a/kdecoration/config/lightlydecorationconfig.desktop b/kdecoration/config/lightlydecorationconfig.desktop index 96011ac3a..2a3cdd760 100644 --- a/kdecoration/config/lightlydecorationconfig.desktop +++ b/kdecoration/config/lightlydecorationconfig.desktop @@ -1,5 +1,5 @@ [Desktop Entry] -Exec=kcmshell5 lightlydecorationconfig +Exec=kcmshell6 lightlydecorationconfig Icon=preferences-system-windows Type=Service X-KDE-ServiceTypes=KCModule diff --git a/kdecoration/config/lightlydetectwidget.h b/kdecoration/config/lightlydetectwidget.h index 13122464f..1f009c4b3 100644 --- a/kdecoration/config/lightlydetectwidget.h +++ b/kdecoration/config/lightlydetectwidget.h @@ -31,7 +31,7 @@ ////////////////////////////////////////////////////////////////////////////// #include "lightlysettings.h" -#include "ui_lightlydetectwidget.h" +#include "config/ui_lightlydetectwidget.h" #include #include @@ -40,7 +40,7 @@ #include #include - +#include namespace Lightly { diff --git a/kdecoration/config/lightlyexceptiondialog.h b/kdecoration/config/lightlyexceptiondialog.h index bd7961dbd..d68f4d174 100644 --- a/kdecoration/config/lightlyexceptiondialog.h +++ b/kdecoration/config/lightlyexceptiondialog.h @@ -25,7 +25,7 @@ // IN THE SOFTWARE. ////////////////////////////////////////////////////////////////////////////// -#include "ui_lightlyexceptiondialog.h" +#include "config/ui_lightlyexceptiondialog.h" #include "lightly.h" #include diff --git a/kdecoration/config/lightlyexceptionlistwidget.cpp b/kdecoration/config/lightlyexceptionlistwidget.cpp index 2d2d82bfd..cedce531d 100644 --- a/kdecoration/config/lightlyexceptionlistwidget.cpp +++ b/kdecoration/config/lightlyexceptionlistwidget.cpp @@ -323,7 +323,7 @@ namespace Lightly bool ExceptionListWidget::checkException( InternalSettingsPtr exception ) { - while( exception->exceptionPattern().isEmpty() || !QRegExp( exception->exceptionPattern() ).isValid() ) + while( exception->exceptionPattern().isEmpty() || !QRegularExpression( exception->exceptionPattern() ).isValid() ) { QMessageBox::warning( this, i18n( "Warning - Lightly Settings" ), i18n("Regular Expression syntax is incorrect") ); diff --git a/kdecoration/config/lightlyexceptionlistwidget.h b/kdecoration/config/lightlyexceptionlistwidget.h index 0777140e9..f075b11ed 100644 --- a/kdecoration/config/lightlyexceptionlistwidget.h +++ b/kdecoration/config/lightlyexceptionlistwidget.h @@ -25,7 +25,7 @@ // IN THE SOFTWARE. ////////////////////////////////////////////////////////////////////////////// -#include "ui_lightlyexceptionlistwidget.h" +#include "config/ui_lightlyexceptionlistwidget.h" #include "lightlyexceptionmodel.h" //* QDialog used to commit selected files diff --git a/kdecoration/lightly.json b/kdecoration/lightly.json index 1936967ad..cb8dcfa88 100644 --- a/kdecoration/lightly.json +++ b/kdecoration/lightly.json @@ -1,14 +1,110 @@ { "KPlugin": { + "Description": "Window decoration using the Lightly visual style for the Plasma Desktop", + "Description[ar]": "زخرفة نوافذ تستخدم نمط «نسيم» المرئيّ لسطح مكتب «بلازما»", + "Description[az]": "Plazma Masaüstü üçün Lightly vizual üslubundan istifadə edən pəncərə dekorasiyası", + "Description[bg]": "Декорация на прозорци, използваща Lightly визуален стил за работнаta среда на Plasma", + "Description[ca@valencia]": "Decoració de les finestres que utilitza l'estil visual Lightly per a l'escriptori Plasma", + "Description[ca]": "Decoració de les finestres que usa l'estil visual Lightly per a l'escriptori Plasma", + "Description[cs]": "Dekorace oken pro pracovní plochu Plasma využívající styl Lightly", + "Description[da]": "Vinduesdekoration som bruger den visuelle stil Lightly til Plasma-skrivebordet", + "Description[de]": "Fensterdekoration im Lightly-Design für die Plasma-Arbeitsfläche", + "Description[el]": "Διακοσμήσεις παραθύρων με το στιλ του Lightly για την επιφάνεια εργασίας Plasma", + "Description[en_GB]": "Window decoration using the Lightly visual style for the Plasma Desktop", + "Description[eo]": "Fenestraĵa ornamo", + "Description[es]": "Decoración de ventanas que usa el estilo visual Lightly para el escritorio Plasma", + "Description[et]": "Plasma töölaua akende dekoratsioon Lightly'i visuaalse stiiliga", + "Description[eu]": "Leiho apainketa Plasma mahaigainerako Lightly ikus-estiloa erabiliz", + "Description[fi]": "Lightly-tyyliä käyttävä ikkunan kehys Plasma-työpöydälle", + "Description[fr]": "Décorations de fenêtres utilisant le style visuel Lightly pour le bureau Plasma", + "Description[gl]": "Decoración de xanelas que usa o estilo visual Lightly para o escritorio Plasma.", + "Description[hi]": "प्लाज़्मा डेस्कटॉप के लिए ब्रीज़ दृश्य शैली का उपयोग करके विंडो सजावट", + "Description[hu]": "A Lightly vizuális stílusát használó ablakdekoráció", + "Description[ia]": "Decoration de fenestra usante le stilo visual Lightly (Lightly) per le scriptorio de Plasma", + "Description[id]": "Dekorasi jendela menggunakan gaya visual Lightly untuk Desktop Plasma", + "Description[it]": "Decorazione per finestre che usa lo stile visuale di Brezza per il desktop Plasma", + "Description[ja]": "Plasma デスクトップのための Lightly スタイルを使用したウィンドウ装飾", + "Description[ka]": "ფანჯრების დეკორაცია Lightly-ის ვიზუალის სტილში, Plasma Desktop-სთვის", + "Description[ko]": "Plasma 데스크톱의 Lightly 시각 스타일을 사용하는 창 장식", + "Description[lt]": "Langų dekoracijos, naudojant Lightly vaizdinį stilių, skirtą Plasma darbalaukiui", + "Description[nb]": "Vinduspynt som bruker Lightly-stilen for Plasma-skrivebordet", + "Description[nl]": "Vensterdecoratie met gebruik van de visuele stijl Lightly voor het Plasma bureaublad", + "Description[nn]": "Vindaugspynt som brukar Lightly-stilen for Plasma-skrivebordet", + "Description[pa]": "ਪਲਾਜ਼ਮਾ ਡੈਸਕਟਾਪ ਲਈ ਬਰੀਜ਼ ਦਿੱਖ ਸਟਾਈਲ ਦੀ ਵਰਤੋਂ ਕਰਕੇ ਵਿੰਡੋ ਸਜਾਵਟ", + "Description[pl]": "Okna zgodne ze stylem Bryzy dla Pulpitu Plazmy", + "Description[pt]": "Decoração de janelas que usa o estilo visual Lightly para a Área de Trabalho Plasma", + "Description[pt_BR]": "Decoração de janelas que usa o estilo visual Lightly para o Plasma Desktop", + "Description[ro]": "Decorații de fereastră folosind stilul vizual Briză pentru biroul Plasma", + "Description[ru]": "Оформление окон Lightly", + "Description[sk]": "Dekorácia okien pomocou vizuálneho štýlu Vánok pre plochu Plasma", + "Description[sl]": "Okraski oken, ki uporabljajo vidni slog teme Sapica za namizje Plasma", + "Description[sr@ijekavian]": "Декорација прозора са Поветарцем као визуелним стилом за плазма површ.", + "Description[sr@ijekavianlatin]": "Dekoracija prozora sa Povetarcem kao vizuelnim stilom za plasma površ.", + "Description[sr@latin]": "Dekoracija prozora sa Povetarcem kao vizuelnim stilom za plasma površ.", + "Description[sr]": "Декорација прозора са Поветарцем као визуелним стилом за плазма површ.", + "Description[sv]": "Fönsterdekoration med den visuella stilen Lightly för Plasma skrivbord", + "Description[ta]": "பிரீஸ் பாங்கிலுள்ள பிளாஸ்மா பணிமேடைக்கான விளிம்புத்திட்டம்", + "Description[tg]": "Ороиши равзана бо истифодаи услуби намоёнии Насим барои мизи кории Plasma", + "Description[tr]": "Plasma Masaüstü için Esinti görsel biçemini kullanan pencere dekorasyonu", + "Description[uk]": "Обрамлення вікон з використанням візуального стилю Lightly для стільничного середовища Плазми", + "Description[x-test]": "xxWindow decoration using the Lightly visual style for the Plasma Desktopxx", + "Description[zh_CN]": "Lightly 微风视觉风格的 Plasma 桌面窗口装饰", + "Description[zh_TW]": "使用 Plasma 桌面 Lightly 視覺樣式的視窗裝飾", "EnabledByDefault": true, - "Id": "org.kde.lightly", "Name": "Lightly", - "ServiceTypes": [ - "org.kde.kdecoration2" - ] + "Name[ar]": "نسيم", + "Name[az]": "Lightly", + "Name[bg]": "Lightly", + "Name[ca@valencia]": "Lightly", + "Name[ca]": "Lightly", + "Name[cs]": "Lightly", + "Name[da]": "Lightly", + "Name[de]": "Lightly", + "Name[el]": "Lightly", + "Name[en_GB]": "Lightly", + "Name[eo]": "Lightly", + "Name[es]": "Lightly", + "Name[et]": "Lightly", + "Name[eu]": "Lightly", + "Name[fi]": "Lightly", + "Name[fr]": "Lightly", + "Name[gl]": "Lightly", + "Name[hi]": "ब्रीज़", + "Name[hu]": "Lightly", + "Name[ia]": "Lightly (Lightly)", + "Name[id]": "Lightly", + "Name[it]": "Brezza", + "Name[ja]": "Lightly", + "Name[ka]": "Lightly", + "Name[ko]": "Lightly", + "Name[lt]": "Lightly", + "Name[nb]": "Lightly", + "Name[nl]": "Lightly", + "Name[nn]": "Lightly", + "Name[pa]": "ਬਰੀਜ਼", + "Name[pl]": "Bryza", + "Name[pt]": "Lightly", + "Name[pt_BR]": "Lightly", + "Name[ro]": "Briză", + "Name[ru]": "Lightly", + "Name[sk]": "Vánok", + "Name[sl]": "Sapica", + "Name[sr@ijekavian]": "Поветарац", + "Name[sr@ijekavianlatin]": "Povetarac", + "Name[sr@latin]": "Povetarac", + "Name[sr]": "Поветарац", + "Name[sv]": "Lightly", + "Name[ta]": "பிரீஸ்", + "Name[tg]": "Насим", + "Name[tr]": "Esinti", + "Name[uk]": "Lightly", + "Name[x-test]": "xxLightlyxx", + "Name[zh_CN]": "Lightly 微风", + "Name[zh_TW]": "Lightly" }, + "X-KDE-ConfigModule": "kcm_lightlydecoration", "org.kde.kdecoration2": { - "kcmodule": true, + "blur": false, "recommendedBorderSize": "None" } } diff --git a/kdecoration/lightlybutton.cpp b/kdecoration/lightlybutton.cpp index 50da45cb2..a80f6dfcc 100644 --- a/kdecoration/lightlybutton.cpp +++ b/kdecoration/lightlybutton.cpp @@ -57,8 +57,8 @@ namespace Lightly setIconSize(QSize( height, height )); // connections - connect(decoration->client().data(), SIGNAL(iconChanged(QIcon)), this, SLOT(update())); - connect(decoration->settings().data(), &KDecoration2::DecorationSettings::reconfigured, this, &Button::reconfigure); + connect(decoration->client(), SIGNAL(iconChanged(QIcon)), this, SLOT(update())); + connect(decoration->settings().get(), &KDecoration2::DecorationSettings::reconfigured, this, &Button::reconfigure); connect( this, &KDecoration2::DecorationButton::hoveredChanged, this, &Button::updateAnimationState ); reconfigure(); @@ -85,32 +85,32 @@ namespace Lightly { case DecorationButtonType::Close: - b->setVisible( d->client().data()->isCloseable() ); - QObject::connect(d->client().data(), &KDecoration2::DecoratedClient::closeableChanged, b, &Lightly::Button::setVisible ); + b->setVisible( d->client()->isCloseable() ); + QObject::connect(d->client(), &KDecoration2::DecoratedClient::closeableChanged, b, &Lightly::Button::setVisible ); break; case DecorationButtonType::Maximize: - b->setVisible( d->client().data()->isMaximizeable() ); - QObject::connect(d->client().data(), &KDecoration2::DecoratedClient::maximizeableChanged, b, &Lightly::Button::setVisible ); + b->setVisible( d->client()->isMaximizeable() ); + QObject::connect(d->client(), &KDecoration2::DecoratedClient::maximizeableChanged, b, &Lightly::Button::setVisible ); break; case DecorationButtonType::Minimize: - b->setVisible( d->client().data()->isMinimizeable() ); - QObject::connect(d->client().data(), &KDecoration2::DecoratedClient::minimizeableChanged, b, &Lightly::Button::setVisible ); + b->setVisible( d->client()->isMinimizeable() ); + QObject::connect(d->client(), &KDecoration2::DecoratedClient::minimizeableChanged, b, &Lightly::Button::setVisible ); break; case DecorationButtonType::ContextHelp: - b->setVisible( d->client().data()->providesContextHelp() ); - QObject::connect(d->client().data(), &KDecoration2::DecoratedClient::providesContextHelpChanged, b, &Lightly::Button::setVisible ); + b->setVisible( d->client()->providesContextHelp() ); + QObject::connect(d->client(), &KDecoration2::DecoratedClient::providesContextHelpChanged, b, &Lightly::Button::setVisible ); break; case DecorationButtonType::Shade: - b->setVisible( d->client().data()->isShadeable() ); - QObject::connect(d->client().data(), &KDecoration2::DecoratedClient::shadeableChanged, b, &Lightly::Button::setVisible ); + b->setVisible( d->client()->isShadeable() ); + QObject::connect(d->client(), &KDecoration2::DecoratedClient::shadeableChanged, b, &Lightly::Button::setVisible ); break; case DecorationButtonType::Menu: - QObject::connect(d->client().data(), &KDecoration2::DecoratedClient::iconChanged, b, [b]() { b->update(); }); + QObject::connect(d->client(), &KDecoration2::DecoratedClient::iconChanged, b, [b]() { b->update(); }); break; default: break; @@ -146,17 +146,17 @@ namespace Lightly const QRectF iconRect( geometry().topLeft(), m_iconSize ); if (auto deco = qobject_cast(decoration())) { const QPalette activePalette = KIconLoader::global()->customPalette(); - QPalette palette = decoration()->client().data()->palette(); - palette.setColor(QPalette::Foreground, deco->fontColor()); + QPalette palette = decoration()->client()->palette(); + palette.setColor(QPalette::WindowText, deco->fontColor()); KIconLoader::global()->setCustomPalette(palette); - decoration()->client().data()->icon().paint(painter, iconRect.toRect()); + decoration()->client()->icon().paint(painter, iconRect.toRect()); if (activePalette == QPalette()) { KIconLoader::global()->resetPalette(); } else { KIconLoader::global()->setCustomPalette(palette); } } else { - decoration()->client().data()->icon().paint(painter, iconRect.toRect()); + decoration()->client()->icon().paint(painter, iconRect.toRect()); } } else { @@ -418,7 +418,7 @@ namespace Lightly } - auto c = d->client().data(); + auto c = d->client(); if( isPressed() ) { if( type() == DecorationButtonType::Close ) return c->color( ColorGroup::Warning, ColorRole::Foreground ); diff --git a/kdecoration/lightlydecoration.cpp b/kdecoration/lightlydecoration.cpp index 86dde696b..1e5bfbe58 100644 --- a/kdecoration/lightlydecoration.cpp +++ b/kdecoration/lightlydecoration.cpp @@ -58,8 +58,7 @@ K_PLUGIN_FACTORY_WITH_JSON( "lightly.json", registerPlugin(); registerPlugin(); - registerPlugin(); -) + ) namespace { @@ -155,7 +154,7 @@ namespace Lightly static int g_shadowSizeEnum = InternalSettings::ShadowLarge; static int g_shadowStrength = 255; static QColor g_shadowColor = Qt::black; - static QSharedPointer g_sShadow; + static std::shared_ptr g_sShadow; //________________________________________________________________ Decoration::Decoration(QObject *parent, const QVariantList &args) @@ -171,7 +170,7 @@ namespace Lightly g_sDecoCount--; if (g_sDecoCount == 0) { // last deco destroyed, clean up shadow - g_sShadow.clear(); + g_sShadow.reset(); } deleteSizeGrip(); @@ -192,7 +191,7 @@ namespace Lightly QColor Decoration::titleBarColor() const { - auto c = client().data(); + auto c = client(); if( hideTitleBar() ) return c->color( ColorGroup::Inactive, ColorRole::TitleBar ); else if( m_animation->state() == QAbstractAnimation::Running ) { @@ -208,7 +207,7 @@ namespace Lightly QColor Decoration::outlineColor() const { - auto c( client().data() ); + auto c( client() ); if( !m_internalSettings->drawTitleBarSeparator() ) return QColor(); if( m_animation->state() == QAbstractAnimation::Running ) { @@ -223,7 +222,7 @@ namespace Lightly QColor Decoration::fontColor() const { - auto c = client().data(); + auto c = client(); if( m_animation->state() == QAbstractAnimation::Running ) { return KColorUtils::mix( @@ -235,9 +234,9 @@ namespace Lightly } //________________________________________________________________ - void Decoration::init() + bool Decoration::init() { - auto c = client().data(); + auto c = client(); // active state change animation // It is important start and end value are of the same type, hence 0.0 and not just 0 @@ -252,21 +251,21 @@ namespace Lightly updateTitleBar(); updateBlur(); auto s = settings(); - connect(s.data(), &KDecoration2::DecorationSettings::borderSizeChanged, this, &Decoration::recalculateBorders); + connect(s.get(), &KDecoration2::DecorationSettings::borderSizeChanged, this, &Decoration::recalculateBorders); // a change in font might cause the borders to change - connect(s.data(), &KDecoration2::DecorationSettings::fontChanged, this, &Decoration::recalculateBorders); - connect(s.data(), &KDecoration2::DecorationSettings::spacingChanged, this, &Decoration::recalculateBorders); + connect(s.get(), &KDecoration2::DecorationSettings::fontChanged, this, &Decoration::recalculateBorders); + connect(s.get(), &KDecoration2::DecorationSettings::spacingChanged, this, &Decoration::recalculateBorders); // buttons - connect(s.data(), &KDecoration2::DecorationSettings::spacingChanged, this, &Decoration::updateButtonsGeometryDelayed); - connect(s.data(), &KDecoration2::DecorationSettings::decorationButtonsLeftChanged, this, &Decoration::updateButtonsGeometryDelayed); - connect(s.data(), &KDecoration2::DecorationSettings::decorationButtonsRightChanged, this, &Decoration::updateButtonsGeometryDelayed); + connect(s.get(), &KDecoration2::DecorationSettings::spacingChanged, this, &Decoration::updateButtonsGeometryDelayed); + connect(s.get(), &KDecoration2::DecorationSettings::decorationButtonsLeftChanged, this, &Decoration::updateButtonsGeometryDelayed); + connect(s.get(), &KDecoration2::DecorationSettings::decorationButtonsRightChanged, this, &Decoration::updateButtonsGeometryDelayed); // full reconfiguration - connect(s.data(), &KDecoration2::DecorationSettings::reconfigured, this, &Decoration::reconfigure); - connect(s.data(), &KDecoration2::DecorationSettings::reconfigured, SettingsProvider::self(), &SettingsProvider::reconfigure, Qt::UniqueConnection ); - connect(s.data(), &KDecoration2::DecorationSettings::reconfigured, this, &Decoration::updateButtonsGeometryDelayed); + connect(s.get(), &KDecoration2::DecorationSettings::reconfigured, this, &Decoration::reconfigure); + connect(s.get(), &KDecoration2::DecorationSettings::reconfigured, SettingsProvider::self(), &SettingsProvider::reconfigure, Qt::UniqueConnection ); + connect(s.get(), &KDecoration2::DecorationSettings::reconfigured, this, &Decoration::updateButtonsGeometryDelayed); connect(c, &KDecoration2::DecoratedClient::adjacentScreenEdgesChanged, this, &Decoration::recalculateBorders); connect(c, &KDecoration2::DecoratedClient::maximizedHorizontallyChanged, this, &Decoration::recalculateBorders); @@ -294,12 +293,13 @@ namespace Lightly createButtons(); createShadow(); + return true; } //________________________________________________________________ void Decoration::updateBlur() { - auto c = client().data(); + auto c = client(); const QColor titleBarColor = c->color( c->isActive() ? ColorGroup::Active : ColorGroup::Inactive, ColorRole::TitleBar ); // set opaque to false when non-maximized, regardless of color (prevents kornerbug) @@ -316,7 +316,7 @@ namespace Lightly //________________________________________________________________ void Decoration::calculateWindowAndTitleBarShapes(const bool windowShapeOnly) { - auto c = client().data(); + auto c = client(); auto s = settings(); if (!windowShapeOnly || c->isShaded()) { @@ -363,7 +363,7 @@ namespace Lightly void Decoration::updateTitleBar() { auto s = settings(); - auto c = client().data(); + auto c = client(); const bool maximized = isMaximized(); const int width = maximized ? c->width() : c->width() - 2*s->largeSpacing()*Metrics::TitleBar_SideMargin; const int height = maximized ? borderTop() : borderTop() - s->smallSpacing()*Metrics::TitleBar_TopMargin; @@ -378,7 +378,7 @@ namespace Lightly if( m_internalSettings->animationsEnabled() ) { - auto c = client().data(); + auto c = client(); m_animation->setDirection( c->isActive() ? QAbstractAnimation::Forward : QAbstractAnimation::Backward ); if( m_animation->state() != QAbstractAnimation::Running ) m_animation->start(); @@ -392,7 +392,7 @@ namespace Lightly //________________________________________________________________ void Decoration::updateSizeGripVisibility() { - auto c = client().data(); + auto c = client(); if( m_sizeGrip ) { m_sizeGrip->setVisible( c->isResizeable() && !isMaximized() && !c->isShaded() ); } } @@ -461,7 +461,7 @@ namespace Lightly //________________________________________________________________ void Decoration::recalculateBorders() { - auto c = client().data(); + auto c = client(); auto s = settings(); // left, right and bottom borders @@ -547,7 +547,7 @@ namespace Lightly if( isLeftEdge() ) { // add offsets on the side buttons, to preserve padding, but satisfy Fitts law - auto button = static_cast( m_leftButtons->buttons().front().data() ); + auto button = static_cast( m_leftButtons->buttons().front() ); button->setGeometry( QRectF( QPoint( 0, 0 ), QSizeF( bWidth + hPadding, bHeight ) ) ); button->setFlag( Button::FlagFirstInList ); button->setHorizontalOffset( hPadding ); @@ -571,7 +571,7 @@ namespace Lightly if( isRightEdge() ) { - auto button = static_cast( m_rightButtons->buttons().back().data() ); + auto button = static_cast( m_rightButtons->buttons().back() ); button->setGeometry( QRectF( QPoint( 0, 0 ), QSizeF( bWidth + hPadding, bHeight ) ) ); button->setFlag( Button::FlagLastInList ); @@ -589,7 +589,7 @@ namespace Lightly void Decoration::paint(QPainter *painter, const QRect &repaintRegion) { // TODO: optimize based on repaintRegion - auto c = client().data(); + auto c = client(); auto s = settings(); calculateWindowAndTitleBarShapes(); @@ -632,7 +632,7 @@ namespace Lightly //________________________________________________________________ void Decoration::paintTitleBar(QPainter *painter, const QRect &repaintRegion) { - const auto c = client().data(); + const auto c = client(); if ( !m_titleRect.intersects(repaintRegion) ) return; @@ -742,7 +742,7 @@ namespace Lightly if( hideTitleBar() ) return qMakePair( QRect(), Qt::AlignCenter ); else { - auto c = client().data(); + auto c = client(); const int leftOffset = m_leftButtons->buttons().isEmpty() ? Metrics::TitleBar_SideMargin*settings()->smallSpacing(): m_leftButtons->geometry().x() + m_leftButtons->geometry().width() + Metrics::TitleBar_SideMargin*settings()->smallSpacing(); @@ -804,7 +804,7 @@ namespace Lightly const CompositeShadowParams params = lookupShadowParams(g_shadowSizeEnum); if (params.isNone()) { - g_sShadow.clear(); + g_sShadow.reset(); setShadow(g_sShadow); return; } @@ -867,7 +867,7 @@ namespace Lightly painter.end(); - g_sShadow = QSharedPointer::create(); + g_sShadow = std::make_shared(); g_sShadow->setPadding(padding); g_sShadow->setInnerShadowRect(QRect(outerRect.center(), QSize(1, 1))); g_sShadow->setShadow(shadowTexture); diff --git a/kdecoration/lightlydecoration.h b/kdecoration/lightlydecoration.h index 3ac352569..46bab9560 100644 --- a/kdecoration/lightlydecoration.h +++ b/kdecoration/lightlydecoration.h @@ -109,7 +109,7 @@ namespace Lightly } public Q_SLOTS: - void init() override; + virtual bool init() override; private Q_SLOTS: void reconfigure(); @@ -189,28 +189,28 @@ namespace Lightly } bool Decoration::isMaximized() const - { return client().data()->isMaximized() && !m_internalSettings->drawBorderOnMaximizedWindows(); } + { return client()->isMaximized() && !m_internalSettings->drawBorderOnMaximizedWindows(); } bool Decoration::isMaximizedHorizontally() const - { return client().data()->isMaximizedHorizontally() && !m_internalSettings->drawBorderOnMaximizedWindows(); } + { return client()->isMaximizedHorizontally() && !m_internalSettings->drawBorderOnMaximizedWindows(); } bool Decoration::isMaximizedVertically() const - { return client().data()->isMaximizedVertically() && !m_internalSettings->drawBorderOnMaximizedWindows(); } + { return client()->isMaximizedVertically() && !m_internalSettings->drawBorderOnMaximizedWindows(); } bool Decoration::isLeftEdge() const - { return (client().data()->isMaximizedHorizontally() || client().data()->adjacentScreenEdges().testFlag( Qt::LeftEdge ) ) && !m_internalSettings->drawBorderOnMaximizedWindows(); } + { return (client()->isMaximizedHorizontally() || client()->adjacentScreenEdges().testFlag( Qt::LeftEdge ) ) && !m_internalSettings->drawBorderOnMaximizedWindows(); } bool Decoration::isRightEdge() const - { return (client().data()->isMaximizedHorizontally() || client().data()->adjacentScreenEdges().testFlag( Qt::RightEdge ) ) && !m_internalSettings->drawBorderOnMaximizedWindows(); } + { return (client()->isMaximizedHorizontally() || client()->adjacentScreenEdges().testFlag( Qt::RightEdge ) ) && !m_internalSettings->drawBorderOnMaximizedWindows(); } bool Decoration::isTopEdge() const - { return (client().data()->isMaximizedVertically() || client().data()->adjacentScreenEdges().testFlag( Qt::TopEdge ) ) && !m_internalSettings->drawBorderOnMaximizedWindows(); } + { return (client()->isMaximizedVertically() || client()->adjacentScreenEdges().testFlag( Qt::TopEdge ) ) && !m_internalSettings->drawBorderOnMaximizedWindows(); } bool Decoration::isBottomEdge() const - { return (client().data()->isMaximizedVertically() || client().data()->adjacentScreenEdges().testFlag( Qt::BottomEdge ) ) && !m_internalSettings->drawBorderOnMaximizedWindows(); } + { return (client()->isMaximizedVertically() || client()->adjacentScreenEdges().testFlag( Qt::BottomEdge ) ) && !m_internalSettings->drawBorderOnMaximizedWindows(); } bool Decoration::hideTitleBar() const - { return m_internalSettings->hideTitleBar() && !client().data()->isShaded(); } + { return m_internalSettings->hideTitleBar() && !client()->isShaded(); } } diff --git a/kdecoration/lightlysettingsprovider.cpp b/kdecoration/lightlysettingsprovider.cpp index 2e8484dcf..57458e0c2 100644 --- a/kdecoration/lightlysettingsprovider.cpp +++ b/kdecoration/lightlysettingsprovider.cpp @@ -23,7 +23,7 @@ #include "lightlyexceptionlist.h" #include - +#include #include namespace Lightly @@ -72,10 +72,10 @@ namespace Lightly { QString windowTitle; - QString className; + QString windowClass; // get the client - auto client = decoration->client().data(); + auto client = decoration->client(); foreach( auto internalSettings, m_exceptions ) { @@ -100,26 +100,17 @@ namespace Lightly } default: - case InternalSettings::ExceptionWindowClassName: - { - if( className.isEmpty() ) - { - // retrieve class name - KWindowInfo info( client->windowId(), nullptr, NET::WM2WindowClass ); - QString window_className( QString::fromUtf8(info.windowClassName()) ); - QString window_class( QString::fromUtf8(info.windowClassClass()) ); - className = window_className + QStringLiteral(" ") + window_class; - } - - value = className; + case InternalSettings::ExceptionWindowClassName: { + value = windowClass.isEmpty() ? (windowClass = client->windowClass()) : windowClass; break; } - } // check matching - if( QRegExp( internalSettings->exceptionPattern() ).indexIn( value ) >= 0 ) - { return internalSettings; } + QRegularExpression rx(internalSettings->exceptionPattern()); + if (rx.match(value).hasMatch()) { + return internalSettings; + } } diff --git a/kdecoration/lightlysizegrip.cpp b/kdecoration/lightlysizegrip.cpp index 7ebdd74bf..2772e80f3 100644 --- a/kdecoration/lightlysizegrip.cpp +++ b/kdecoration/lightlysizegrip.cpp @@ -62,7 +62,7 @@ namespace Lightly updatePosition(); // connections - auto c = decoration->client().data(); + auto c = decoration->client(); connect( c, &KDecoration2::DecoratedClient::widthChanged, this, &SizeGrip::updatePosition ); connect( c, &KDecoration2::DecoratedClient::heightChanged, this, &SizeGrip::updatePosition ); connect( c, &KDecoration2::DecoratedClient::activeChanged, this, &SizeGrip::updateActiveState ); @@ -166,7 +166,7 @@ namespace Lightly break; } - case Qt::MidButton: + case Qt::MiddleButton: { hide(); break; diff --git a/kstyle/CMakeLists.txt b/kstyle/CMakeLists.txt index ed36e5676..a46a696c2 100644 --- a/kstyle/CMakeLists.txt +++ b/kstyle/CMakeLists.txt @@ -1,46 +1,3 @@ -################# Qt/KDE ################# -find_package(Qt5 REQUIRED CONFIG COMPONENTS Widgets DBus) -find_package(KF5 REQUIRED COMPONENTS - I18n - Config - GuiAddons - IconThemes - ConfigWidgets - WindowSystem) - -find_package(Qt5 COMPONENTS Quick) -set(LIGHTLY_HAVE_QTQUICK ${Qt5Quick_FOUND}) - -find_package( KF5FrameworkIntegration CONFIG ) -set_package_properties(KF5FrameworkIntegration PROPERTIES - DESCRIPTION "KF5 Framework Integration" - URL "https://projects.kde.org/projects/frameworks/frameworkintegration" - TYPE OPTIONAL - PURPOSE "Required to use KStyle convenience functionalities in style") - -set(LIGHTLY_HAVE_KSTYLE ${KF5FrameworkIntegration_FOUND}) - -find_package(XCB COMPONENTS XCB) -set_package_properties(XCB PROPERTIES - DESCRIPTION "X protocol C-language Binding" - URL "https://xcb.freedesktop.org" - TYPE OPTIONAL - PURPOSE "Required to pass style properties to native Windows on X11 Platform" -) - -find_package(KF5Wayland CONFIG) -set(LIGHTLY_HAVE_KWAYLAND ${KF5Wayland_FOUND}) - -if(UNIX AND NOT APPLE) - set(LIGHTLY_HAVE_X11 ${XCB_XCB_FOUND}) - if (XCB_XCB_FOUND) - find_package(Qt5 REQUIRED CONFIG COMPONENTS X11Extras) - endif() -else() - set(LIGHTLY_HAVE_X11 FALSE) -endif() - - ################# includes ################# include_directories( animations @@ -96,38 +53,67 @@ set(lightly_PART_SRCS lightlywindowmanager.cpp ) +kconfig_add_kcfg_files(lightly_PART_SRCS ../kdecoration/lightlysettings.kcfgc) kconfig_add_kcfg_files(lightly_PART_SRCS lightlystyleconfigdata.kcfgc) -add_library(lightly MODULE ${lightly_PART_SRCS}) -target_link_libraries(lightly Qt5::Core Qt5::Gui Qt5::Widgets Qt5::DBus) + +add_library(lightly${QT_MAJOR_VERSION} MODULE ${lightly_PART_SRCS}) + +target_link_libraries(lightly${QT_MAJOR_VERSION} + Qt${QT_MAJOR_VERSION}::Core + Qt${QT_MAJOR_VERSION}::Gui + Qt${QT_MAJOR_VERSION}::Widgets + Qt${QT_MAJOR_VERSION}::DBus +) + if( LIGHTLY_HAVE_QTQUICK ) - target_link_libraries(lightly Qt5::Quick) + target_link_libraries(lightly${QT_MAJOR_VERSION} + Qt${QT_MAJOR_VERSION}::Quick + KF${QT_MAJOR_VERSION}::CoreAddons + ) +endif() + +target_link_libraries(lightly${QT_MAJOR_VERSION} + KF${QT_MAJOR_VERSION}::CoreAddons + KF${QT_MAJOR_VERSION}::ConfigCore + KF${QT_MAJOR_VERSION}::ConfigGui + KF${QT_MAJOR_VERSION}::GuiAddons + KF${QT_MAJOR_VERSION}::IconThemes + KF${QT_MAJOR_VERSION}::WindowSystem +) + +if(QT_MAJOR_VERSION STREQUAL "5") + target_link_libraries(lightly5 KF5::ConfigWidgets) + if (LIGHTLY_HAVE_QTQUICK) + target_link_libraries(lightly5 KF5::Kirigami2) + endif() +else() + target_link_libraries(lightly6 KF6::ColorScheme) + if (LIGHTLY_HAVE_QTQUICK) + target_link_libraries(lightly6 KF6::KirigamiPlatform) + endif() endif() -target_link_libraries(lightly KF5::ConfigCore KF5::ConfigWidgets KF5::GuiAddons KF5::IconThemes KF5::WindowSystem) -target_link_libraries(lightly lightlycommon5) -if(KF5FrameworkIntegration_FOUND) - target_link_libraries(lightly KF5::Style) + +target_link_libraries(lightly${QT_MAJOR_VERSION} lightlycommon${QT_MAJOR_VERSION}) + +if(KF${QT_MAJOR_VERSION}FrameworkIntegration_FOUND) + target_link_libraries(lightly${QT_MAJOR_VERSION} KF${QT_MAJOR_VERSION}::Style) endif() + if (WIN32) # As stated in https://docs.microsoft.com/en-us/cpp/c-runtime-library/math-constants M_PI only gets defined # when if _USE_MATH_DEFINES is defined target_compile_definitions(lightly PRIVATE _USE_MATH_DEFINES _BSD_SOURCE) endif() -if(LIGHTLY_HAVE_X11) - target_link_libraries(lightly ${XCB_LIBRARIES}) - target_link_libraries(lightly Qt5::X11Extras) -endif() - -if(LIGHTLY_HAVE_KWAYLAND) - target_link_libraries(lightly KF5::WaylandClient) -endif() - ########### install files ############### -install(TARGETS lightly DESTINATION ${QT_PLUGIN_INSTALL_DIR}/styles/) -install(FILES lightly.themerc DESTINATION ${DATA_INSTALL_DIR}/kstyle/themes) +install(TARGETS lightly${QT_MAJOR_VERSION} DESTINATION ${KDE_INSTALL_QTPLUGINDIR}/styles/) +install(FILES lightly.themerc DESTINATION ${KDE_INSTALL_DATADIR}/kstyle/themes) ########### subdirectories ############### -add_subdirectory(config) + +if (QT_MAJOR_VERSION EQUAL "6" AND TARGET "KF6::KCMUtils") + add_subdirectory(config) +endif() diff --git a/kstyle/animations/lightlytransitionwidget.cpp b/kstyle/animations/lightlytransitionwidget.cpp index ab322b79f..2e8dba0d3 100644 --- a/kstyle/animations/lightlytransitionwidget.cpp +++ b/kstyle/animations/lightlytransitionwidget.cpp @@ -258,7 +258,7 @@ namespace Lightly for( int i = widgets.size() - 1; i>=0; i-- ) { QWidget* w = widgets.at(i); - w->render( &p, -widget->mapTo( w, rect.topLeft() ), rect, nullptr ); + w->render( &p, -widget->mapTo( w, rect.topLeft() ), rect, {} ); } // end diff --git a/kstyle/config/CMakeLists.txt b/kstyle/config/CMakeLists.txt index d66e705bc..3d1e6abd8 100644 --- a/kstyle/config/CMakeLists.txt +++ b/kstyle/config/CMakeLists.txt @@ -8,34 +8,31 @@ kconfig_add_kcfg_files(kstyle_lightly_config_PART_SRCS ../lightlystyleconfigdata set(kstyle_lightly_config_PART_FORMS ui/lightlystyleconfig.ui) ki18n_wrap_ui(kstyle_lightly_config_PART_FORMS_HEADERS ${kstyle_lightly_config_PART_FORMS}) -add_library(kstyle_lightly_config MODULE +kcoreaddons_add_plugin(lightlystyleconfig SOURCES ${kstyle_lightly_config_PART_SRCS} ${kstyle_lightly_config_PART_FORMS_HEADERS} + INSTALL_NAMESPACE "kstyle_config" ) -target_link_libraries(kstyle_lightly_config Qt5::Core Qt5::Gui Qt5::Widgets Qt5::DBus) -target_link_libraries(kstyle_lightly_config KF5::ConfigCore KF5::ConfigWidgets KF5::I18n) -install(TARGETS kstyle_lightly_config DESTINATION ${QT_PLUGIN_INSTALL_DIR}) -install(FILES lightlystyleconfig.desktop DESTINATION ${SERVICES_INSTALL_DIR}) - -########### next target ############### -find_package(KF5KCMUtils CONFIG) -set_package_properties(KF5KCMUtils PROPERTIES - DESCRIPTION "KF5 KCM utils Framework" - URL "https://projects.kde.org/projects/frameworks/kcmutils" - TYPE OPTIONAL - PURPOSE "Required for lightly-settings5 application to build") - -if( KF5KCMUtils_FOUND ) - set(lightly_settings_SOURCES main.cpp) - add_executable(lightly-settings5 ${lightly_settings_SOURCES} ) - target_link_libraries(lightly-settings5 Qt5::Core Qt5::Gui Qt5::Widgets ) - target_link_libraries(lightly-settings5 KF5::I18n KF5::KCMUtils) - - install(TARGETS lightly-settings5 ${INSTALL_TARGETS_DEFAULT_ARGS}) - - # icon - ecm_install_icons(ICONS sc-apps-lightly-settings.svgz - DESTINATION ${ICON_INSTALL_DIR} - THEME hicolor ) +target_link_libraries(lightlystyleconfig Qt6::Core Qt6::Gui Qt6::Widgets Qt6::DBus) +target_link_libraries(lightlystyleconfig KF6::CoreAddons KF6::ConfigCore KF6::ConfigWidgets KF6::I18n) +if(QT_MAJOR_VERSION STREQUAL "6") + target_link_libraries(lightlystyleconfig KF6::KCMUtils) endif() +kcmutils_generate_desktop_file(lightlystyleconfig) + +set(lightly_settings_SOURCES main.cpp) +add_executable(lightly-settings ${lightly_settings_SOURCES} ) +target_link_libraries(lightly-settings Qt6::Core Qt6::Gui Qt6::Widgets ) +target_link_libraries(lightly-settings KF6::I18n KF6::KCMUtils KF6::CoreAddons) + +set_target_properties(lightly-settings PROPERTIES OUTPUT_NAME lightly-settings${QT_MAJOR_VERSION}) + +install(TARGETS lightly-settings ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) + +# icon +ecm_install_icons(ICONS sc-apps-lightly-settings.svgz + DESTINATION ${KDE_INSTALL_ICONDIR} + THEME hicolor ) + + diff --git a/kstyle/config/lightlystyleconfig.desktop b/kstyle/config/lightlystyleconfig.desktop deleted file mode 100644 index fb5a32e58..000000000 --- a/kstyle/config/lightlystyleconfig.desktop +++ /dev/null @@ -1,138 +0,0 @@ -[Desktop Entry] -Exec=kcmshell5 lightlystyleconfig -Icon=preferences-desktop-theme -Type=Service -X-KDE-ServiceTypes=KCModule - -X-KDE-Library=kstyle_lightly_config -X-KDE-PluginKeyword=kcmodule -X-KDE-ParentApp=kcontrol -X-KDE-Weight=50 - -Name=Lightly Widget Style -Name[ca]=Estil dels estris Brisa -Name[ca@valencia]=Estil dels ginys («widgets») Brisa -Name[cs]=Styl widgetů Lightly -Name[da]=Lightly kontrolstil -Name[de]=Lightly-Stil der Bedienelemente -Name[el]=Στιλ γραφικών συστατικών Lightly -Name[en_GB]=Lightly Widget Style -Name[es]=Estilo de elementos gráficos Brisa -Name[et]=Lightly vidina stiil -Name[eu]=Lightly trepeten estiloa -Name[fi]=Lightly-elementtityyli -Name[fr]=Style de composant graphique Lightly -Name[gl]=Estilo do trebello de Lightly -Name[hu]=Lightly elemstílus -Name[ia]=Stilo de Elemento Graphic de Fenestra (Widget) de Lightly -Name[id]=Gaya Widget Lightly -Name[it]=Stile degli oggetti di Brezza -Name[ko]=Lightly 위젯 스타일 -Name[lt]=Lightly valdiklių stilius -Name[nl]=Lightly widgetstijl -Name[nn]=Lightly-elementstil -Name[pa]=ਬਰੀਜ਼ ਵਿਜੈਟ ਸਟਾਈਲ -Name[pl]=Wygląd interfejsu Bryzy -Name[pt]=Estilo Gráfico Brisa -Name[pt_BR]=Estilo dos widgets Lightly -Name[ru]=Стиль интерфейса Lightly -Name[sk]=Štýl prvkov Lightly -Name[sl]=Slog gradnikov Sapica -Name[sr]=Поветарчев стил виџета̂ -Name[sr@ijekavian]=Поветарчев стил виџета̂ -Name[sr@ijekavianlatin]=Povetarčev stil vidžetâ̂ -Name[sr@latin]=Povetarčev stil vidžetâ̂ -Name[sv]=Lightly stil för grafiska komponenter -Name[tg]=Услуби виҷети Насим -Name[tr]=Lightly Programcık Biçimi -Name[uk]=Стиль віджетів Lightly -Name[x-test]=xxLightly Widget Stylexx -Name[zh_CN]=微风部件样式 -Name[zh_TW]=Lightly 元件樣式 -Comment=Modify the appearance of widgets -Comment[ar]=عدّل مظهر الودجات -Comment[ca]=Modifica l'aparença dels estris -Comment[ca@valencia]=Modifica l'aparença dels ginys -Comment[cs]=Změnit vzhled widgetů -Comment[da]=Ændr kontrollers udseende -Comment[de]=Das Erscheinungsbild der Bedienelemente ändern -Comment[el]=Τροποποίηση εμφάνισης συστατικών -Comment[en_GB]=Modify the appearance of widgets -Comment[es]=Modificar el aspecto de los elementos gráficos -Comment[et]=Vidinate välimuse muutmine -Comment[eu]=Aldatu trepeten itxura -Comment[fi]=Muuta elementtien ulkoasua -Comment[fr]=Modifier l'apparence des composants graphiques -Comment[gl]=Modifica a aparencia dos trebellos -Comment[he]=התאם את המראה של היישומונים -Comment[hu]=Az elemek megjelenésének módosítása -Comment[ia]=Modifica le apparentia de widgets -Comment[id]=Memodifikasi penampilan widget -Comment[it]=Modifica l'aspetto degli oggetti -Comment[ko]=위젯의 모습을 수정합니다 -Comment[lt]=Keisti valdiklių išvaizdą -Comment[nb]=Endre utseende for skjermelementer -Comment[nl]=Wijzig het uiterlijk van widgets -Comment[nn]=Endra utsjånaden på skjermkontrollar -Comment[pl]=Zmień wygląd interfejsu -Comment[pt]=Modificar a aparência dos elementos gráficos -Comment[pt_BR]=Modifica a aparência dos widgets -Comment[ro]=Modifică aspectul controalelor -Comment[ru]=Настройка элементов интерфейса в стиле Lightly -Comment[sk]=Zmena vzhľadu prvkov -Comment[sl]=Spremenite videz gradnikov -Comment[sr]=Измените изглед виџета̂ -Comment[sr@ijekavian]=Измијените изглед виџета̂ -Comment[sr@ijekavianlatin]=Izmijenite izgled vidžetâ̂ -Comment[sr@latin]=Izmenite izgled vidžetâ̂ -Comment[sv]=Ändra utseende hos grafiska komponenter -Comment[tg]=Тағйир додани намуди зоҳирии виҷетҳо -Comment[tr]=Gereçlerin görünümünü değiştir -Comment[uk]=Зміна вигляду віджетів -Comment[x-test]=xxModify the appearance of widgetsxx -Comment[zh_CN]=修改部件外观 -Comment[zh_TW]=變更元件外觀 - -X-KDE-Keywords=lightly,widget,style -X-KDE-Keywords[ar]=نسيم,ودجة,نمط -X-KDE-Keywords[ca]=lightly,brisa,estri,estil -X-KDE-Keywords[ca@valencia]=lightly,brisa,giny,estil -X-KDE-Keywords[cs]=lightly,widget,styl -X-KDE-Keywords[da]=lightly,kontrol,style -X-KDE-Keywords[de]=Lightly,Bedienelement,Stil -X-KDE-Keywords[el]=lightly,γραφικό συστατικό,στιλ -X-KDE-Keywords[en_GB]=lightly,widget,style -X-KDE-Keywords[es]=lightly,brisa,elemento gráfico,widget,estilo -X-KDE-Keywords[et]=lightly,vidin,stiil -X-KDE-Keywords[eu]=lightly,widget,trepeta,estiloa -X-KDE-Keywords[fi]=lightly,widget,style,käyttöliittymäelementti,tyyli,elementti,kontrolli -X-KDE-Keywords[fr]=lightly,composant graphique, style -X-KDE-Keywords[gl]=lightly,trebello,trebello,estilo -X-KDE-Keywords[he]=lightly,widget,style,עיצוב,יישומון -X-KDE-Keywords[hu]=lightly,elem,stílus -X-KDE-Keywords[ia]=lightly,widget,style -X-KDE-Keywords[id]=lightly,widget,gaya -X-KDE-Keywords[it]=brezza,oggetto,stile -X-KDE-Keywords[ko]=lightly,widget,style,위젯,스타일 -X-KDE-Keywords[lt]=lightly,valdiklis,stilius -X-KDE-Keywords[nb]=lightly,skjermelement,stil -X-KDE-Keywords[nl]=lightly,widget,stijl -X-KDE-Keywords[nn]=lightly,skjermelement,skjermkontrollar,stil,utsjånad -X-KDE-Keywords[pl]=lightly,widget,styl,bryza,element interfejsu -X-KDE-Keywords[pt]=brisa,elemento,estilo -X-KDE-Keywords[pt_BR]=lightly,widget,estilo -X-KDE-Keywords[ro]=briză,lightly,widget,stil -X-KDE-Keywords[ru]=lightly,widget,style,бриз,элемент интерфейса,виджет,внешний вид,визуальное представление,стиль,тема,оформление -X-KDE-Keywords[sk]=vánok,widget,štýl -X-KDE-Keywords[sl]=sapica,gradnik,slog -X-KDE-Keywords[sr]=lightly,widget,style,Поветарац,виџет,стил -X-KDE-Keywords[sr@ijekavian]=lightly,widget,style,Поветарац,виџет,стил -X-KDE-Keywords[sr@ijekavianlatin]=lightly,widget,style,Povetarac,vidžet,stil -X-KDE-Keywords[sr@latin]=lightly,widget,style,Povetarac,vidžet,stil -X-KDE-Keywords[sv]=lightly,grafisk komponent,stil -X-KDE-Keywords[tg]=насим,виҷет,услуб -X-KDE-Keywords[tr]=esinti,gereç,biçem -X-KDE-Keywords[uk]=lightly,widget,style,бриз,віджет,стиль,вигляд -X-KDE-Keywords[x-test]=xxlightlyxx,xxwidgetxx,xxstylexx -X-KDE-Keywords[zh_CN]=微风,部件,样式 -X-KDE-Keywords[zh_TW]=lightly,widget,style diff --git a/kstyle/config/lightlystyleconfigmodule.cpp b/kstyle/config/lightlystyleconfigmodule.cpp index 8778c057d..8a1fcabca 100644 --- a/kstyle/config/lightlystyleconfigmodule.cpp +++ b/kstyle/config/lightlystyleconfigmodule.cpp @@ -22,11 +22,7 @@ #include - -K_PLUGIN_FACTORY( - LightlyStyleConfigFactory, - registerPlugin(QStringLiteral("kcmodule")); -) +K_PLUGIN_CLASS_WITH_JSON(Lightly::ConfigurationModule, "lightlystyleconfig.json") #include "lightlystyleconfigmodule.moc" @@ -34,12 +30,12 @@ namespace Lightly { //_______________________________________________________________________ - ConfigurationModule::ConfigurationModule(QWidget *parent, const QVariantList &args): - KCModule(parent, args) + ConfigurationModule::ConfigurationModule(QObject *parent, const KPluginMetaData &data) + : KCModule(parent, data) { - setLayout(new QVBoxLayout(this)); - layout()->addWidget( m_config = new StyleConfig( this ) ); - connect(m_config, static_cast(&StyleConfig::changed), this, static_cast(&KCModule::changed)); + widget()->setLayout(new QVBoxLayout); + widget()->layout()->addWidget( m_config = new StyleConfig(widget())); + connect(m_config, &StyleConfig::changed, this, &KCModule::setNeedsSave); } //_______________________________________________________________________ diff --git a/kstyle/config/lightlystyleconfigmodule.h b/kstyle/config/lightlystyleconfigmodule.h index 3993d15cc..a443913d6 100644 --- a/kstyle/config/lightlystyleconfigmodule.h +++ b/kstyle/config/lightlystyleconfigmodule.h @@ -34,7 +34,7 @@ namespace Lightly Q_OBJECT public: - ConfigurationModule(QWidget *parent, const QVariantList &args); + ConfigurationModule(QObject *parent, const KPluginMetaData &data); public Q_SLOTS: diff --git a/kstyle/config/main.cpp b/kstyle/config/main.cpp index 9926394dd..0dee650ba 100644 --- a/kstyle/config/main.cpp +++ b/kstyle/config/main.cpp @@ -30,6 +30,7 @@ #include #include +#include //__________________________________________ int main(int argc, char *argv[]) @@ -42,8 +43,8 @@ int main(int argc, char *argv[]) KCMultiDialog dialog; dialog.setWindowTitle( i18n( "Lightly Settings" ) ); - dialog.addModule( QStringLiteral( "lightlystyleconfig" ) ); - dialog.addModule( QStringLiteral( "lightlydecorationconfig" ) ); + dialog.addModule(KPluginMetaData(QStringLiteral("kstyle_config/lightlystyleconfig"))); + dialog.addModule(KPluginMetaData(QStringLiteral("org.kde.kdecoration2.kcm/kcm_lightlydecoration.so"))); dialog.show(); foreach( auto child, dialog.findChildren() ) diff --git a/kstyle/debug/lightlywidgetexplorer.cpp b/kstyle/debug/lightlywidgetexplorer.cpp index b60122cf2..68c5d2266 100644 --- a/kstyle/debug/lightlywidgetexplorer.cpp +++ b/kstyle/debug/lightlywidgetexplorer.cpp @@ -108,16 +108,16 @@ namespace Lightly << "Lightly::WidgetExplorer::eventFilter -" << " event: " << event << " type: " << eventType( event->type() ) << " widget: " << widgetInformation( widget ) - << endl; + <parentWidget() ); while( parent ) { - QTextStream( stdout ) << " parent: " << widgetInformation( parent ) << endl; + QTextStream( stdout ) << " parent: " << widgetInformation( parent ) << Qt::endl; parent = parent->parentWidget(); } - QTextStream( stdout ) << "" << endl; + QTextStream( stdout ) << "" << Qt::endl; } break; diff --git a/kstyle/lightly.themerc b/kstyle/lightly.themerc index 2b9462d36..d295f24d9 100644 --- a/kstyle/lightly.themerc +++ b/kstyle/lightly.themerc @@ -1,6 +1,6 @@ [Misc] Name=Lightly -ConfigPage=kstyle_lightly_config +ConfigPage=kstyle_config/lightlystyleconfig Comment=Widget style for Qt Applications [KDE] WidgetStyle=Lightly diff --git a/kstyle/lightlyblurhelper.cpp b/kstyle/lightlyblurhelper.cpp index d82afbd1d..41653888b 100644 --- a/kstyle/lightlyblurhelper.cpp +++ b/kstyle/lightlyblurhelper.cpp @@ -358,8 +358,9 @@ namespace Lightly QRegion region = blurRegion(widget); if (region.isNull()) return; - KWindowEffects::enableBlurBehind(widget->isWindow() ? widget->winId() : widget->window()->winId(), true, region); - //KWindowEffects::enableBackgroundContrast (widget->isWindow() ? widget->winId() : widget->window()->winId(), true, 1.0, 1.2, 1.3, region ); + widget->winId(); // force creation of the window handle + KWindowEffects::enableBlurBehind(widget->windowHandle(), true); + // force update if (widget->isVisible()) { diff --git a/kstyle/lightlyhelper.cpp b/kstyle/lightlyhelper.cpp index 5c9077a16..6bbdcc70e 100644 --- a/kstyle/lightlyhelper.cpp +++ b/kstyle/lightlyhelper.cpp @@ -29,6 +29,10 @@ #include #include +#if __has_include() +#include +#endif + #if LIGHTLY_HAVE_X11 #include #endif @@ -416,7 +420,7 @@ namespace Lightly QPalette copy( source ); - const QList roles = { QPalette::Background, QPalette::Highlight, QPalette::WindowText, QPalette::ButtonText, QPalette::Text, QPalette::Button }; + const QList roles = { QPalette::Window, QPalette::Highlight, QPalette::WindowText, QPalette::ButtonText, QPalette::Text, QPalette::Button }; foreach( const QPalette::ColorRole& role, roles ) { copy.setColor( role, KColorUtils::mix( source.color( QPalette::Active, role ), source.color( QPalette::Disabled, role ), 1.0-ratio ) ); } @@ -1881,15 +1885,19 @@ namespace Lightly bool Helper::compositingActive() const { - #if LIGHTLY_HAVE_X11 - if( isX11() ) - { return QX11Info::isCompositingManagerRunning( QX11Info::appScreen() ); } - #endif + #if LIGHTLY_HAVE_X11 + if( isX11()) { + #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + return KWindowSystem::compositingActive(); + #elif __has_include() + return KX11Extras::compositingActive(); + #endif + } + #endif - // use KWindowSystem - return KWindowSystem::compositingActive(); + return true; - } + } //____________________________________________________________________ bool Helper::hasAlphaChannel( const QWidget* widget ) const diff --git a/kstyle/lightlyhelper.h b/kstyle/lightlyhelper.h index 9e496a14d..ae51f4944 100644 --- a/kstyle/lightlyhelper.h +++ b/kstyle/lightlyhelper.h @@ -30,7 +30,7 @@ #include #include - +#include #include #include #include diff --git a/kstyle/lightlystyle.cpp b/kstyle/lightlystyle.cpp index d35f75b36..bdc706169 100644 --- a/kstyle/lightlystyle.cpp +++ b/kstyle/lightlystyle.cpp @@ -155,7 +155,7 @@ namespace LightlyPrivate //_______________________________________________________________ bool isProgressBarHorizontal( const QStyleOptionProgressBar* option ) - { return option && ( (option->state & QStyle::State_Horizontal ) || option->orientation == Qt::Horizontal ); } + {return option && (option->state & QStyle::State_Horizontal);} //* list of possible valid toolbars to be translucent //* only one can be at time @@ -1004,7 +1004,7 @@ namespace Lightly case PE_IndicatorToolBarHandle: fcn = &Style::drawIndicatorToolBarHandlePrimitive; break; case PE_IndicatorToolBarSeparator: fcn = &Style::drawIndicatorToolBarSeparatorPrimitive; break; case PE_IndicatorBranch: fcn = &Style::drawIndicatorBranchPrimitive; break; - case PE_FrameStatusBar: fcn = &Style::emptyPrimitive; break; + case PE_FrameStatusBarItem: fcn = &Style::emptyPrimitive; break; case PE_Frame: fcn = &Style::drawFramePrimitive; break; case PE_FrameLineEdit: fcn = &Style::drawFrameLineEditPrimitive; break; case PE_FrameMenu: fcn = &Style::drawFrameMenuPrimitive; break; @@ -1471,8 +1471,8 @@ namespace Lightly { _helper->renderMenuFrame( &painter, rect, background, outline, false ); - } else if( StyleConfigData::dockWidgetDrawFrame() || (dockWidget->features()&QDockWidget::AllDockWidgetFeatures) ) { - + } else if( StyleConfigData::dockWidgetDrawFrame() && (dockWidget->features() & (QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable))){ + _helper->renderFrame( &painter, rect, background, palette, windowActive ); } else { @@ -4966,7 +4966,7 @@ namespace Lightly // draw background int opacity = _helper->titleBarColor( windowActive ).alphaF()*100.0; - painter->fillRect(rect, _helper->alphaColor(option->palette.color( QPalette::Window ), opacity/100.0) ); + painter->fillRect(rect, _helper->alphaColor(option->palette.color( QPalette::Window ), opacity) ); bool shouldDrawShadow = false; if ( LightlyPrivate::possibleTranslucentToolBars.isEmpty() ) shouldDrawShadow = true; @@ -5024,14 +5024,14 @@ namespace Lightly const auto& rect( option->rect ); const auto& palette( option->palette ); - if ( widget && _helper->titleBarColor( windowActive ).alphaF()*100.0 < 100 && _translucentWidgets.contains( widget->window() ) && StyleConfigData::widgetDrawShadow() ) + if ( widget && _helper->titleBarColor( windowActive ).alphaF()*100.0 < 100 && _translucentWidgets.contains( widget->window() ) ) { _helper->renderTransparentArea( painter, rect ); // draw background int opacity = _helper->titleBarColor( windowActive ).alphaF()*100.0; - painter->fillRect(rect, _helper->alphaColor(option->palette.color( QPalette::Window ), opacity/100.0) ); + painter->fillRect(rect, _helper->alphaColor(option->palette.color( QPalette::Window ), opacity) ); bool shouldDrawShadow = false; int shadow_xoffset = 0; diff --git a/liblightlycommon/CMakeLists.txt b/liblightlycommon/CMakeLists.txt index f3ae495d4..6a6711f6f 100644 --- a/liblightlycommon/CMakeLists.txt +++ b/liblightlycommon/CMakeLists.txt @@ -1,25 +1,26 @@ ################# dependencies ################# ### Qt/KDE -find_package(Qt5 REQUIRED CONFIG COMPONENTS Widgets) +find_package(Qt${QT_MAJOR_VERSION} REQUIRED CONFIG COMPONENTS Widgets) ################# lightlystyle target ################# set(lightlycommon_LIB_SRCS lightlyboxshadowrenderer.cpp ) -add_library(lightlycommon5 ${lightlycommon_LIB_SRCS}) +add_library(lightlycommon${QT_MAJOR_VERSION} ${lightlycommon_LIB_SRCS}) -generate_export_header(lightlycommon5 +generate_export_header(lightlycommon${QT_MAJOR_VERSION} BASE_NAME lightlycommon EXPORT_FILE_NAME lightlycommon_export.h) -target_link_libraries(lightlycommon5 +target_link_libraries(lightlycommon${QT_MAJOR_VERSION} PUBLIC - Qt5::Core - Qt5::Gui) + Qt::Core + Qt::Gui) -set_target_properties(lightlycommon5 PROPERTIES +set_target_properties(lightlycommon${QT_MAJOR_VERSION} PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION ${PROJECT_VERSION_MAJOR}) -install(TARGETS lightlycommon5 ${INSTALL_TARGETS_DEFAULT_ARGS} LIBRARY NAMELINK_SKIP) + +install(TARGETS lightlycommon${QT_MAJOR_VERSION} ${KDE_INSTALL_TARGETS_DEFAULT_ARGS} LIBRARY NAMELINK_SKIP)