1
0
mirror of https://github.com/KDE/latte-dock.git synced 2024-12-23 01:33:50 +03:00

expose scheme for central layouts

This commit is contained in:
Michail Vourlakos 2021-06-16 10:01:16 +03:00
parent a9ed71b837
commit bf58c753ee
2 changed files with 36 additions and 0 deletions

View File

@ -17,6 +17,7 @@
#include "../layouts/synchronizer.h" #include "../layouts/synchronizer.h"
#include "../settings/universalsettings.h" #include "../settings/universalsettings.h"
#include "../view/view.h" #include "../view/view.h"
#include "../wm/tracker/schemes.h"
// KDE // KDE
#include <KConfigGroup> #include <KConfigGroup>
@ -48,8 +49,12 @@ void CentralLayout::init()
void CentralLayout::initToCorona(Latte::Corona *corona) void CentralLayout::initToCorona(Latte::Corona *corona)
{ {
if (GenericLayout::initToCorona(corona)) { if (GenericLayout::initToCorona(corona)) {
onSchemeFileChanged();
connect(this, &CentralLayout::disableBordersForMaximizedWindowsChanged, connect(this, &CentralLayout::disableBordersForMaximizedWindowsChanged,
m_corona->layoutsManager()->synchronizer(), &Layouts::Synchronizer::updateKWinDisabledBorders); m_corona->layoutsManager()->synchronizer(), &Layouts::Synchronizer::updateKWinDisabledBorders);
connect(this, &Layout::AbstractLayout::schemeFileChanged, this, &CentralLayout::onSchemeFileChanged);
} }
} }
@ -123,6 +128,21 @@ void CentralLayout::setActivities(QStringList activities)
emit activitiesChanged(); emit activitiesChanged();
} }
Latte::WindowSystem::SchemeColors *CentralLayout::scheme() const
{
return m_scheme;
}
void CentralLayout::setScheme(Latte::WindowSystem::SchemeColors *_scheme)
{
if (m_scheme == _scheme) {
return;
}
m_scheme = _scheme;
emit schemeChanged();
}
Data::Layout CentralLayout::data() const Data::Layout CentralLayout::data() const
{ {
Data::Layout cdata; Data::Layout cdata;
@ -148,6 +168,11 @@ Data::Layout CentralLayout::data() const
return cdata; return cdata;
} }
void CentralLayout::onSchemeFileChanged()
{
setScheme(m_corona->wm()->schemesTracker()->schemeForFile(schemeFile()));
}
void CentralLayout::loadConfig() void CentralLayout::loadConfig()
{ {
m_disableBordersForMaximizedWindows = m_layoutGroup.readEntry("disableBordersForMaximizedWindows", false); m_disableBordersForMaximizedWindows = m_layoutGroup.readEntry("disableBordersForMaximizedWindows", false);

View File

@ -11,6 +11,7 @@
// local // local
#include "genericlayout.h" #include "genericlayout.h"
#include "../data/layoutdata.h" #include "../data/layoutdata.h"
#include "../wm/schemecolors.h"
// Qt // Qt
#include <QObject> #include <QObject>
@ -34,6 +35,7 @@ namespace Latte {
class CentralLayout : public Layout::GenericLayout class CentralLayout : public Layout::GenericLayout
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(Latte::WindowSystem::SchemeColors *scheme READ scheme NOTIFY schemeChanged)
public: public:
CentralLayout(QObject *parent, QString layoutFile, QString layoutName = QString()); CentralLayout(QObject *parent, QString layoutFile, QString layoutName = QString());
@ -59,25 +61,34 @@ public:
Layout::Type type() const override; Layout::Type type() const override;
Data::Layout data() const; Data::Layout data() const;
Latte::WindowSystem::SchemeColors *scheme() const;
public: public:
Q_INVOKABLE bool isCurrent() override; Q_INVOKABLE bool isCurrent() override;
signals: signals:
void disableBordersForMaximizedWindowsChanged(); void disableBordersForMaximizedWindowsChanged();
void schemeChanged();
void showInMenuChanged(); void showInMenuChanged();
private slots: private slots:
void loadConfig(); void loadConfig();
void saveConfig(); void saveConfig();
void onSchemeFileChanged();
private: private:
void init(); void init();
void importLocalLayout(QString file); void importLocalLayout(QString file);
void setScheme(Latte::WindowSystem::SchemeColors *_scheme);
private: private:
bool m_disableBordersForMaximizedWindows{false}; bool m_disableBordersForMaximizedWindows{false};
bool m_showInMenu{false}; bool m_showInMenu{false};
QStringList m_activities; QStringList m_activities;
Latte::WindowSystem::SchemeColors *m_scheme{nullptr};
}; };
} }