add showInMenu and activities in layout

pull/1/head
Michail Vourlakos 8 years ago
parent eac9e649aa
commit 291288c765

@ -58,9 +58,11 @@ LayoutSettings::~LayoutSettings()
void LayoutSettings::init()
{
connect(this, &LayoutSettings::activitiesChanged, this, &LayoutSettings::saveConfig);
connect(this, &LayoutSettings::versionChanged, this, &LayoutSettings::saveConfig);
connect(this, &LayoutSettings::colorChanged, this, &LayoutSettings::saveConfig);
connect(this, &LayoutSettings::syncLaunchersChanged, this, &LayoutSettings::saveConfig);
connect(this, &LayoutSettings::showInMenuChanged, this, &LayoutSettings::saveConfig);
connect(this, &LayoutSettings::globalLaunchersChanged, this, &LayoutSettings::saveConfig);
}
@ -80,6 +82,21 @@ void LayoutSettings::setVersion(int ver)
emit versionChanged();
}
bool LayoutSettings::showInMenu() const
{
return m_showInMenu;
}
void LayoutSettings::setShowInMenu(bool show)
{
if (m_showInMenu == show) {
return;
}
m_showInMenu = show;
emit showInMenuChanged();
}
QString LayoutSettings::name() const
{
return m_layoutName;
@ -160,11 +177,29 @@ void LayoutSettings::setGlobalLaunchers(QStringList launchers)
emit globalLaunchersChanged();
}
QStringList LayoutSettings::activities() const
{
return m_activities;
}
void LayoutSettings::setActivities(QStringList activities)
{
if (m_activities == activities) {
return;
}
m_activities = activities;
emit activitiesChanged();
}
void LayoutSettings::loadConfig()
{
m_version = m_layoutGroup.readEntry("version", 2);
m_color = m_layoutGroup.readEntry("color", QString("blue"));
m_showInMenu = m_layoutGroup.readEntry("showInMenu", false);
m_syncLaunchers = m_layoutGroup.readEntry("syncLaunchers", false);
m_activities = m_layoutGroup.readEntry("activities", QStringList());
m_globalLaunchers = m_layoutGroup.readEntry("globalLaunchers", QStringList());
}
@ -172,9 +207,11 @@ void LayoutSettings::saveConfig()
{
qDebug() << "layout is saving... for layout:" << m_layoutName;
m_layoutGroup.writeEntry("version", m_version);
m_layoutGroup.writeEntry("showInMenu", m_showInMenu);
m_layoutGroup.writeEntry("color", m_color);
m_layoutGroup.writeEntry("syncLaunchers", m_syncLaunchers);
m_layoutGroup.writeEntry("globalLaunchers", m_globalLaunchers);
m_layoutGroup.writeEntry("activities", m_activities);
}
}

@ -37,36 +37,46 @@ namespace Latte {
//! its general settings (no the containments)
class LayoutSettings : public QObject {
Q_OBJECT
Q_PROPERTY(bool showInMenu READ showInMenu WRITE setShowInMenu NOTIFY showInMenuChanged)
Q_PROPERTY(bool syncLaunchers READ syncLaunchers WRITE setSyncLaunchers NOTIFY syncLaunchersChanged)
Q_PROPERTY(QString color READ color WRITE setColor NOTIFY colorChanged)
Q_PROPERTY(QString name READ name NOTIFY nameChanged)
Q_PROPERTY(QStringList globalLaunchers READ globalLaunchers WRITE setGlobalLaunchers NOTIFY globalLaunchersChanged)
Q_PROPERTY(QStringList activities READ activities WRITE setActivities NOTIFY activitiesChanged)
public:
LayoutSettings(QObject *parent, QString layoutFile, QString layoutName = QString());
~LayoutSettings() override;
bool showInMenu() const;
void setShowInMenu(bool show);
bool syncLaunchers() const;
void setSyncLaunchers(bool sync);
int version() const;
void setVersion(int ver);
QString name() const;
QString file() const;
QString color() const;
void setColor(QString color);
QStringList activities() const;
void setActivities(QStringList activities);
QStringList globalLaunchers() const;
void setGlobalLaunchers(QStringList launchers);
int version() const;
void setVersion(int ver);
bool syncLaunchers() const;
void setSyncLaunchers(bool sync);
signals:
void activitiesChanged();
void colorChanged();
void fileChanged();
void globalLaunchersChanged();
void nameChanged();
void versionChanged();
void showInMenuChanged();
void syncLaunchersChanged();
private slots:
@ -79,6 +89,7 @@ private:
void setFile(QString file);
private:
bool m_showInMenu{false};
bool m_syncLaunchers{false};
//if version doesnt exist it is and old layout file
int m_version{2};
@ -86,6 +97,7 @@ private:
QString m_color;
QString m_layoutFile;
QString m_layoutName;
QStringList m_activities;
QStringList m_globalLaunchers;
DockCorona *m_corona{nullptr};

Loading…
Cancel
Save