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:
parent
a9ed71b837
commit
bf58c753ee
@ -17,6 +17,7 @@
|
||||
#include "../layouts/synchronizer.h"
|
||||
#include "../settings/universalsettings.h"
|
||||
#include "../view/view.h"
|
||||
#include "../wm/tracker/schemes.h"
|
||||
|
||||
// KDE
|
||||
#include <KConfigGroup>
|
||||
@ -48,8 +49,12 @@ void CentralLayout::init()
|
||||
void CentralLayout::initToCorona(Latte::Corona *corona)
|
||||
{
|
||||
if (GenericLayout::initToCorona(corona)) {
|
||||
onSchemeFileChanged();
|
||||
|
||||
connect(this, &CentralLayout::disableBordersForMaximizedWindowsChanged,
|
||||
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();
|
||||
}
|
||||
|
||||
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 cdata;
|
||||
@ -148,6 +168,11 @@ Data::Layout CentralLayout::data() const
|
||||
return cdata;
|
||||
}
|
||||
|
||||
void CentralLayout::onSchemeFileChanged()
|
||||
{
|
||||
setScheme(m_corona->wm()->schemesTracker()->schemeForFile(schemeFile()));
|
||||
}
|
||||
|
||||
void CentralLayout::loadConfig()
|
||||
{
|
||||
m_disableBordersForMaximizedWindows = m_layoutGroup.readEntry("disableBordersForMaximizedWindows", false);
|
||||
|
@ -11,6 +11,7 @@
|
||||
// local
|
||||
#include "genericlayout.h"
|
||||
#include "../data/layoutdata.h"
|
||||
#include "../wm/schemecolors.h"
|
||||
|
||||
// Qt
|
||||
#include <QObject>
|
||||
@ -34,6 +35,7 @@ namespace Latte {
|
||||
class CentralLayout : public Layout::GenericLayout
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(Latte::WindowSystem::SchemeColors *scheme READ scheme NOTIFY schemeChanged)
|
||||
|
||||
public:
|
||||
CentralLayout(QObject *parent, QString layoutFile, QString layoutName = QString());
|
||||
@ -59,25 +61,34 @@ public:
|
||||
Layout::Type type() const override;
|
||||
Data::Layout data() const;
|
||||
|
||||
Latte::WindowSystem::SchemeColors *scheme() const;
|
||||
|
||||
public:
|
||||
Q_INVOKABLE bool isCurrent() override;
|
||||
|
||||
signals:
|
||||
void disableBordersForMaximizedWindowsChanged();
|
||||
void schemeChanged();
|
||||
void showInMenuChanged();
|
||||
|
||||
private slots:
|
||||
void loadConfig();
|
||||
void saveConfig();
|
||||
|
||||
void onSchemeFileChanged();
|
||||
|
||||
private:
|
||||
void init();
|
||||
void importLocalLayout(QString file);
|
||||
|
||||
void setScheme(Latte::WindowSystem::SchemeColors *_scheme);
|
||||
|
||||
private:
|
||||
bool m_disableBordersForMaximizedWindows{false};
|
||||
bool m_showInMenu{false};
|
||||
QStringList m_activities;
|
||||
|
||||
Latte::WindowSystem::SchemeColors *m_scheme{nullptr};
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user