diff --git a/app/data/layoutdata.cpp b/app/data/layoutdata.cpp index 664ee0227..51d9df728 100644 --- a/app/data/layoutdata.cpp +++ b/app/data/layoutdata.cpp @@ -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*/ diff --git a/app/data/layoutdata.h b/app/data/layoutdata.h index a5eea0bbf..3f97b365c 100644 --- a/app/data/layoutdata.h +++ b/app/data/layoutdata.h @@ -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}; diff --git a/app/layout/abstractlayout.cpp b/app/layout/abstractlayout.cpp index 5564899f4..cf0ece0ca 100644 --- a/app/layout/abstractlayout.cpp +++ b/app/layout/abstractlayout.cpp @@ -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(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(); } diff --git a/app/layout/abstractlayout.h b/app/layout/abstractlayout.h index e0348b777..740055176 100644 --- a/app/layout/abstractlayout.h +++ b/app/layout/abstractlayout.h @@ -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; diff --git a/app/layout/centrallayout.cpp b/app/layout/centrallayout.cpp index 1405adc1c..75a2b9bfe 100644 --- a/app/layout/centrallayout.cpp +++ b/app/layout/centrallayout.cpp @@ -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(); diff --git a/app/settings/settingsdialog/layoutscontroller.cpp b/app/settings/settingsdialog/layoutscontroller.cpp index 363d295dd..7bc23697b 100644 --- a/app/settings/settingsdialog/layoutscontroller.cpp +++ b/app/settings/settingsdialog/layoutscontroller.cpp @@ -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