From 6248a0ccae9f94c7d9dd114acf4a8918b011269b Mon Sep 17 00:00:00 2001 From: Michail Vourlakos Date: Thu, 9 May 2019 18:12:46 +0300 Subject: [PATCH] refactor:move schemecolors under "wm" folder --- app/CMakeLists.txt | 1 - app/plasma/extended/theme.cpp | 24 ++++++++++++------------ app/plasma/extended/theme.h | 20 +++++++++----------- app/view/visibilitymanager.h | 1 - app/view/windowstracker.cpp | 9 +++++---- app/view/windowstracker.h | 24 ++++++++++++------------ app/wm/CMakeLists.txt | 1 + app/{ => wm}/schemecolors.cpp | 2 +- app/{ => wm}/schemecolors.h | 0 9 files changed, 40 insertions(+), 42 deletions(-) rename app/{ => wm}/schemecolors.cpp (99%) rename app/{ => wm}/schemecolors.h (100%) diff --git a/app/CMakeLists.txt b/app/CMakeLists.txt index 52889cc72..c6eeb4ee7 100644 --- a/app/CMakeLists.txt +++ b/app/CMakeLists.txt @@ -4,7 +4,6 @@ set(lattedock-app_SRCS alternativeshelper.cpp infoview.cpp lattecorona.cpp - schemecolors.cpp screenpool.cpp main.cpp ) diff --git a/app/plasma/extended/theme.cpp b/app/plasma/extended/theme.cpp index c2fbf53d0..9d3d44546 100644 --- a/app/plasma/extended/theme.cpp +++ b/app/plasma/extended/theme.cpp @@ -22,9 +22,9 @@ // local #include "lattecorona.h" -#include "schemecolors.h" #include "../../layouts/importer.h" #include "../../view/panelshadows_p.h" +#include "../../wm/schemecolors.h" #include "../../../liblatte2/commontools.h" // Qt @@ -149,17 +149,17 @@ float Theme::backgroundMaxOpacity() const return m_backgroundMaxOpacity; } -SchemeColors *Theme::defaultTheme() const +Latte::SchemeColors *Theme::defaultTheme() const { return m_defaultScheme; } -SchemeColors *Theme::lightTheme() const +Latte::SchemeColors *Theme::lightTheme() const { return m_isLightTheme ? m_defaultScheme : m_reversedScheme; } -SchemeColors *Theme::darkTheme() const +Latte::SchemeColors *Theme::darkTheme() const { return !m_isLightTheme ? m_defaultScheme : m_reversedScheme; } @@ -200,12 +200,12 @@ void Theme::updateDefaultScheme() updateDefaultSchemeValues(); if (m_defaultScheme) { - disconnect(m_defaultScheme, &SchemeColors::colorsChanged, this, &Theme::loadThemeLightness); + disconnect(m_defaultScheme, &Latte::SchemeColors::colorsChanged, this, &Theme::loadThemeLightness); m_defaultScheme->deleteLater(); } - m_defaultScheme = new SchemeColors(this, m_defaultSchemePath, true); - connect(m_defaultScheme, &SchemeColors::colorsChanged, this, &Theme::loadThemeLightness); + m_defaultScheme = new Latte::SchemeColors(this, m_defaultSchemePath, true); + connect(m_defaultScheme, &Latte::SchemeColors::colorsChanged, this, &Theme::loadThemeLightness); qDebug() << "plasma theme default colors ::: " << m_defaultSchemePath; } @@ -244,7 +244,7 @@ void Theme::updateReversedScheme() m_reversedScheme->deleteLater(); } - m_reversedScheme = new SchemeColors(this, m_reversedSchemePath, true); + m_reversedScheme = new Latte::SchemeColors(this, m_reversedSchemePath, true); qDebug() << "plasma theme reversed colors ::: " << m_reversedSchemePath; } @@ -299,7 +299,7 @@ void Theme::updateReversedSchemeValues() } //! update scheme name - QString originalSchemeName = SchemeColors::schemeName(m_originalSchemePath); + QString originalSchemeName = Latte::SchemeColors::schemeName(m_originalSchemePath); KConfigGroup generalGroup(reversedPtr, "General"); generalGroup.writeEntry("Name", originalSchemeName + "_reversed"); generalGroup.sync(); @@ -426,17 +426,17 @@ void Theme::loadThemePaths() m_kdeConnections[0] = connect(KDirWatch::self(), &KDirWatch::dirty, this, [ &, kdeSettingsFile](const QString & path) { if (path == kdeSettingsFile) { - this->setOriginalSchemeFile(SchemeColors::possibleSchemeFile("kdeglobals")); + this->setOriginalSchemeFile(Latte::SchemeColors::possibleSchemeFile("kdeglobals")); } }); m_kdeConnections[1] = connect(KDirWatch::self(), &KDirWatch::created, this, [ &, kdeSettingsFile](const QString & path) { if (path == kdeSettingsFile) { - this->setOriginalSchemeFile(SchemeColors::possibleSchemeFile("kdeglobals")); + this->setOriginalSchemeFile(Latte::SchemeColors::possibleSchemeFile("kdeglobals")); } }); - setOriginalSchemeFile(SchemeColors::possibleSchemeFile("kdeglobals")); + setOriginalSchemeFile(Latte::SchemeColors::possibleSchemeFile("kdeglobals")); } //! this is probably not needed at all in order to provide full transparency for all diff --git a/app/plasma/extended/theme.h b/app/plasma/extended/theme.h index ade00620c..abcb86d48 100644 --- a/app/plasma/extended/theme.h +++ b/app/plasma/extended/theme.h @@ -21,9 +21,6 @@ #ifndef PLASMATHEMEEXTENDED_H #define PLASMATHEMEEXTENDED_H -// local -#include "schemecolors.h" - // C++ #include @@ -41,6 +38,7 @@ namespace Latte { class Corona; +class SchemeColors; } namespace Latte { @@ -62,9 +60,9 @@ class Theme: public QObject Q_PROPERTY(float backgroundMaxOpacity READ backgroundMaxOpacity NOTIFY backgroundMaxOpacityChanged) - Q_PROPERTY(SchemeColors *defaultTheme READ defaultTheme NOTIFY themeChanged) - Q_PROPERTY(SchemeColors *lightTheme READ lightTheme NOTIFY themeChanged) - Q_PROPERTY(SchemeColors *darkTheme READ darkTheme NOTIFY themeChanged) + Q_PROPERTY(Latte::SchemeColors *defaultTheme READ defaultTheme NOTIFY themeChanged) + Q_PROPERTY(Latte::SchemeColors *lightTheme READ lightTheme NOTIFY themeChanged) + Q_PROPERTY(Latte::SchemeColors *darkTheme READ darkTheme NOTIFY themeChanged) public: Theme(KSharedConfig::Ptr config, QObject *parent); @@ -84,9 +82,9 @@ public: float backgroundMaxOpacity() const; - SchemeColors *defaultTheme() const; - SchemeColors *lightTheme() const; - SchemeColors *darkTheme() const; + Latte::SchemeColors *defaultTheme() const; + Latte::SchemeColors *lightTheme() const; + Latte::SchemeColors *darkTheme() const; void load(); @@ -142,8 +140,8 @@ private: Plasma::Theme m_theme; Latte::Corona *m_corona{nullptr}; - SchemeColors *m_defaultScheme{nullptr}; - SchemeColors *m_reversedScheme{nullptr}; + Latte::SchemeColors *m_defaultScheme{nullptr}; + Latte::SchemeColors *m_reversedScheme{nullptr}; }; } diff --git a/app/view/visibilitymanager.h b/app/view/visibilitymanager.h index f98170cb8..8c600969c 100644 --- a/app/view/visibilitymanager.h +++ b/app/view/visibilitymanager.h @@ -23,7 +23,6 @@ // local #include "../plasma/quick/containmentview.h" -#include "../schemecolors.h" #include "../wm/abstractwindowinterface.h" #include "../wm/windowinfowrap.h" #include "../../liblatte2/types.h" diff --git a/app/view/windowstracker.cpp b/app/view/windowstracker.cpp index ed136da36..b6cabb935 100644 --- a/app/view/windowstracker.cpp +++ b/app/view/windowstracker.cpp @@ -24,6 +24,7 @@ #include "view.h" #include "../lattecorona.h" #include "../layouts/manager.h" +#include "../wm/schemecolors.h" #include "../../liblatte2/types.h" namespace Latte { @@ -119,12 +120,12 @@ void WindowsTracker::setExistsWindowTouching(bool windowTouching) emit existsWindowTouchingChanged(); } -SchemeColors *WindowsTracker::activeWindowScheme() const +Latte::SchemeColors *WindowsTracker::activeWindowScheme() const { return m_activeScheme; } -void WindowsTracker::setActiveWindowScheme(SchemeColors *scheme) +void WindowsTracker::setActiveWindowScheme(Latte::SchemeColors *scheme) { if (m_activeScheme == scheme) { return; @@ -135,12 +136,12 @@ void WindowsTracker::setActiveWindowScheme(SchemeColors *scheme) emit activeWindowSchemeChanged(); } -SchemeColors *WindowsTracker::touchingWindowScheme() const +Latte::SchemeColors *WindowsTracker::touchingWindowScheme() const { return m_touchingScheme; } -void WindowsTracker::setTouchingWindowScheme(SchemeColors *scheme) +void WindowsTracker::setTouchingWindowScheme(Latte::SchemeColors *scheme) { if (m_touchingScheme == scheme) { return; diff --git a/app/view/windowstracker.h b/app/view/windowstracker.h index ff622ce11..cb4d2600d 100644 --- a/app/view/windowstracker.h +++ b/app/view/windowstracker.h @@ -21,7 +21,6 @@ #define WINDOWSTRACKER_H // local -#include "../schemecolors.h" #include "../wm/abstractwindowinterface.h" #include "../wm/windowinfowrap.h" @@ -29,9 +28,10 @@ #include namespace Latte{ - class AbstractWindowInterface; - class Corona; - class View; +class AbstractWindowInterface; +class Corona; +class SchemeColors; +class View; } namespace Latte { @@ -45,8 +45,8 @@ class WindowsTracker : public QObject { Q_PROPERTY(bool existsWindowActive READ existsWindowActive NOTIFY existsWindowActiveChanged) Q_PROPERTY(bool existsWindowMaximized READ existsWindowMaximized NOTIFY existsWindowMaximizedChanged) Q_PROPERTY(bool existsWindowTouching READ existsWindowTouching NOTIFY existsWindowTouchingChanged) - Q_PROPERTY(SchemeColors *activeWindowScheme READ activeWindowScheme NOTIFY activeWindowSchemeChanged) - Q_PROPERTY(SchemeColors *touchingWindowScheme READ touchingWindowScheme NOTIFY touchingWindowSchemeChanged) + Q_PROPERTY(Latte::SchemeColors *activeWindowScheme READ activeWindowScheme NOTIFY activeWindowSchemeChanged) + Q_PROPERTY(Latte::SchemeColors *touchingWindowScheme READ touchingWindowScheme NOTIFY touchingWindowSchemeChanged) public: explicit WindowsTracker(Latte::View *parent); @@ -61,8 +61,8 @@ public: bool existsWindowMaximized() const; bool existsWindowTouching() const; - SchemeColors *activeWindowScheme() const; - SchemeColors *touchingWindowScheme() const; + Latte::SchemeColors *activeWindowScheme() const; + Latte::SchemeColors *touchingWindowScheme() const; void setWindowOnActivities(QWindow &window, const QStringList &activities); @@ -88,8 +88,8 @@ private: void setExistsWindowActive(bool windowActive); void setExistsWindowMaximized(bool windowMaximized); void setExistsWindowTouching(bool windowTouching); - void setActiveWindowScheme(SchemeColors *scheme); - void setTouchingWindowScheme(SchemeColors *scheme); + void setActiveWindowScheme(Latte::SchemeColors *scheme); + void setTouchingWindowScheme(Latte::SchemeColors *scheme); void updateAvailableScreenGeometry(); void updateFlags(); @@ -120,8 +120,8 @@ private: std::array m_connections; QMap m_windows; - SchemeColors *m_activeScheme{nullptr}; - SchemeColors *m_touchingScheme{nullptr}; + Latte::SchemeColors *m_activeScheme{nullptr}; + Latte::SchemeColors *m_touchingScheme{nullptr}; Latte::AbstractWindowInterface *m_wm; Latte::Corona *m_corona{nullptr}; diff --git a/app/wm/CMakeLists.txt b/app/wm/CMakeLists.txt index 58d52791c..83b7895b7 100644 --- a/app/wm/CMakeLists.txt +++ b/app/wm/CMakeLists.txt @@ -1,6 +1,7 @@ set(lattedock-app_SRCS ${lattedock-app_SRCS} ${CMAKE_CURRENT_SOURCE_DIR}/abstractwindowinterface.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/schemecolors.cpp ${CMAKE_CURRENT_SOURCE_DIR}/waylandinterface.cpp ${CMAKE_CURRENT_SOURCE_DIR}/windowinfowrap.cpp ${CMAKE_CURRENT_SOURCE_DIR}/xwindowinterface.cpp diff --git a/app/schemecolors.cpp b/app/wm/schemecolors.cpp similarity index 99% rename from app/schemecolors.cpp rename to app/wm/schemecolors.cpp index 6ceb66f70..7bc3db41e 100644 --- a/app/schemecolors.cpp +++ b/app/wm/schemecolors.cpp @@ -21,7 +21,7 @@ #include "schemecolors.h" // local -#include "layouts/importer.h" +#include "../layouts/importer.h" // Qt #include diff --git a/app/schemecolors.h b/app/wm/schemecolors.h similarity index 100% rename from app/schemecolors.h rename to app/wm/schemecolors.h