mirror of
https://github.com/KDE/latte-dock.git
synced 2024-12-23 01:33:50 +03:00
layout:provide popUpMargin
This commit is contained in:
parent
f36bba7d02
commit
99382184ff
@ -44,6 +44,7 @@ Layout::Layout(Layout &&o)
|
||||
isShownInMenu(o.isShownInMenu),
|
||||
isTemplate(o.isTemplate),
|
||||
hasDisabledBorders(o.hasDisabledBorders),
|
||||
popUpMargin(o.popUpMargin),
|
||||
activities(o.activities),
|
||||
backgroundStyle(o.backgroundStyle),
|
||||
errors(o.errors),
|
||||
@ -65,6 +66,7 @@ Layout::Layout(const Layout &o)
|
||||
isShownInMenu(o.isShownInMenu),
|
||||
isTemplate(o.isTemplate),
|
||||
hasDisabledBorders(o.hasDisabledBorders),
|
||||
popUpMargin(o.popUpMargin),
|
||||
activities(o.activities),
|
||||
backgroundStyle(o.backgroundStyle),
|
||||
errors(o.errors),
|
||||
@ -88,6 +90,7 @@ Layout &Layout::operator=(Layout &&rhs)
|
||||
isShownInMenu = rhs.isShownInMenu;
|
||||
isTemplate = rhs.isTemplate;
|
||||
hasDisabledBorders = rhs.hasDisabledBorders;
|
||||
popUpMargin = rhs.popUpMargin;
|
||||
activities = rhs.activities;
|
||||
backgroundStyle = rhs.backgroundStyle;
|
||||
errors = rhs.errors;
|
||||
@ -112,6 +115,7 @@ Layout &Layout::operator=(const Layout &rhs)
|
||||
isShownInMenu = rhs.isShownInMenu;
|
||||
isTemplate = rhs.isTemplate;
|
||||
hasDisabledBorders = rhs.hasDisabledBorders;
|
||||
popUpMargin = rhs.popUpMargin;
|
||||
activities = rhs.activities;
|
||||
backgroundStyle = rhs.backgroundStyle;
|
||||
errors = rhs.errors;
|
||||
@ -136,6 +140,7 @@ bool Layout::operator==(const Layout &rhs) const
|
||||
&& (isShownInMenu == rhs.isShownInMenu)
|
||||
&& (isTemplate == rhs.isTemplate)
|
||||
&& (hasDisabledBorders == rhs.hasDisabledBorders)
|
||||
&& (popUpMargin == rhs.popUpMargin)
|
||||
&& (activities == rhs.activities)
|
||||
&& (backgroundStyle == rhs.backgroundStyle)
|
||||
//&& (errors == rhs.errors) /*Disabled because this is not needed in order to track layout changes for saving*/
|
||||
|
@ -57,6 +57,7 @@ public:
|
||||
bool isShownInMenu{false};
|
||||
bool isTemplate{false};
|
||||
bool hasDisabledBorders{false};
|
||||
int popUpMargin{-1};
|
||||
QStringList activities;
|
||||
int errors{0};
|
||||
int warnings{0};
|
||||
|
@ -71,6 +71,7 @@ void AbstractLayout::init()
|
||||
connect(this, &AbstractLayout::lastUsedActivityChanged, this, &AbstractLayout::saveConfig);
|
||||
connect(this, &AbstractLayout::launchersChanged, this, &AbstractLayout::saveConfig);
|
||||
connect(this, &AbstractLayout::preferredForShortcutsTouchedChanged, this, &AbstractLayout::saveConfig);
|
||||
connect(this, &AbstractLayout::popUpMarginChanged, this, &AbstractLayout::saveConfig);
|
||||
connect(this, &AbstractLayout::versionChanged, this, &AbstractLayout::saveConfig);
|
||||
}
|
||||
|
||||
@ -106,6 +107,21 @@ void AbstractLayout::setPreferredForShortcutsTouched(bool touched)
|
||||
emit preferredForShortcutsTouchedChanged();
|
||||
}
|
||||
|
||||
int AbstractLayout::popUpMargin() const
|
||||
{
|
||||
return m_popUpMargin;
|
||||
}
|
||||
|
||||
void AbstractLayout::setPopUpMargin(const int &margin)
|
||||
{
|
||||
if (m_popUpMargin == margin) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_popUpMargin = margin;
|
||||
emit popUpMarginChanged();
|
||||
}
|
||||
|
||||
QString AbstractLayout::background() const
|
||||
{
|
||||
if (m_backgroundStyle == ColorBackgroundStyle) {
|
||||
@ -355,6 +371,7 @@ void AbstractLayout::loadConfig()
|
||||
m_launchers = m_layoutGroup.readEntry("launchers", QStringList());
|
||||
m_lastUsedActivity = m_layoutGroup.readEntry("lastUsedActivity", QString());
|
||||
m_preferredForShortcutsTouched = m_layoutGroup.readEntry("preferredForShortcutsTouched", false);
|
||||
m_popUpMargin = m_layoutGroup.readEntry("popUpMargin", -1);
|
||||
|
||||
m_color = m_layoutGroup.readEntry("color", QString("blue"));
|
||||
m_backgroundStyle = static_cast<BackgroundStyle>(m_layoutGroup.readEntry("backgroundStyle", (int)ColorBackgroundStyle));
|
||||
@ -390,6 +407,7 @@ void AbstractLayout::saveConfig()
|
||||
m_layoutGroup.writeEntry("customTextColor", m_customTextColor);
|
||||
m_layoutGroup.writeEntry("icon", m_icon);
|
||||
m_layoutGroup.writeEntry("lastUsedActivity", m_lastUsedActivity);
|
||||
m_layoutGroup.writeEntry("popUpMargin", m_popUpMargin);
|
||||
m_layoutGroup.writeEntry("preferredForShortcutsTouched", m_preferredForShortcutsTouched);
|
||||
m_layoutGroup.sync();
|
||||
}
|
||||
|
@ -67,6 +67,8 @@ class AbstractLayout : public QObject
|
||||
|
||||
Q_PROPERTY(bool preferredForShortcutsTouched READ preferredForShortcutsTouched WRITE setPreferredForShortcutsTouched NOTIFY preferredForShortcutsTouchedChanged)
|
||||
|
||||
Q_PROPERTY(int popUpMargin READ popUpMargin WRITE setPopUpMargin NOTIFY popUpMarginChanged)
|
||||
|
||||
Q_PROPERTY(QString icon READ icon NOTIFY iconChanged)
|
||||
Q_PROPERTY(QString background READ background NOTIFY backgroundChanged)
|
||||
Q_PROPERTY(QString textColor READ textColor NOTIFY textColorChanged)
|
||||
@ -84,6 +86,9 @@ public:
|
||||
bool preferredForShortcutsTouched() const;
|
||||
void setPreferredForShortcutsTouched(bool touched);
|
||||
|
||||
int popUpMargin() const;
|
||||
void setPopUpMargin(const int &margin);
|
||||
|
||||
QString lastUsedActivity() const;
|
||||
void clearLastUsedActivity(); //!e.g. when we export a layout
|
||||
|
||||
@ -138,6 +143,7 @@ signals:
|
||||
void lastUsedActivityChanged();
|
||||
void launchersChanged();
|
||||
void nameChanged();
|
||||
void popUpMarginChanged();
|
||||
void preferredForShortcutsTouchedChanged();
|
||||
void textColorChanged();
|
||||
void versionChanged();
|
||||
@ -158,6 +164,8 @@ protected:
|
||||
//if version doesn't exist it is and old layout file
|
||||
int m_version{2};
|
||||
|
||||
int m_popUpMargin{-1}; //default
|
||||
|
||||
QString m_customBackground;
|
||||
QString m_customTextColor;
|
||||
QString m_color;
|
||||
|
@ -151,6 +151,7 @@ Data::Layout CentralLayout::data() const
|
||||
cdata.isLocked = !isWritable();
|
||||
cdata.isShownInMenu = showInMenu();
|
||||
cdata.hasDisabledBorders = disableBordersForMaximizedWindows();
|
||||
cdata.popUpMargin = popUpMargin();
|
||||
cdata.activities = activities();
|
||||
cdata.lastUsedActivity = lastUsedActivity();
|
||||
|
||||
|
@ -902,6 +902,7 @@ void Layouts::save()
|
||||
//! Extra Properties
|
||||
central->setShowInMenu(iLayoutCurrentData.isShownInMenu);
|
||||
central->setDisableBordersForMaximizedWindows(iLayoutCurrentData.hasDisabledBorders);
|
||||
central->setPopUpMargin(iLayoutCurrentData.popUpMargin);
|
||||
central->setActivities(iLayoutCurrentData.activities);
|
||||
|
||||
//! If the layout name changed OR the layout path is a temporary one
|
||||
|
Loading…
Reference in New Issue
Block a user