mirror of
https://github.com/KDE/latte-dock.git
synced 2025-01-11 13:18:13 +03:00
use universal inAdvancedMode for edit settings
--for all view edit windows are now using the same flag in order to identify basic and advanced level for editing their settings
This commit is contained in:
parent
3ce1eb06bd
commit
e323f31645
@ -54,6 +54,7 @@ UniversalSettings::UniversalSettings(KSharedConfig::Ptr config, QObject *parent)
|
||||
connect(this, &UniversalSettings::badges3DStyleChanged, this, &UniversalSettings::saveConfig);
|
||||
connect(this, &UniversalSettings::canDisableBordersChanged, this, &UniversalSettings::saveConfig);
|
||||
connect(this, &UniversalSettings::currentLayoutNameChanged, this, &UniversalSettings::saveConfig);
|
||||
connect(this, &UniversalSettings::inAdvancedModeForEditSettingsChanged, this, &UniversalSettings::saveConfig);
|
||||
connect(this, &UniversalSettings::lastNonAssignedLayoutNameChanged, this, &UniversalSettings::saveConfig);
|
||||
connect(this, &UniversalSettings::launchersChanged, this, &UniversalSettings::saveConfig);
|
||||
connect(this, &UniversalSettings::layoutsMemoryUsageChanged, this, &UniversalSettings::saveConfig);
|
||||
@ -115,6 +116,21 @@ void UniversalSettings::load()
|
||||
emit metaPressAndHoldEnabledChanged();
|
||||
}
|
||||
|
||||
bool UniversalSettings::inAdvancedModeForEditSettings() const
|
||||
{
|
||||
return m_inAdvancedModeForEditSettings;
|
||||
}
|
||||
|
||||
void UniversalSettings::setInAdvancedModeForEditSettings(const bool &inAdvanced)
|
||||
{
|
||||
if (m_inAdvancedModeForEditSettings == inAdvanced) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_inAdvancedModeForEditSettings = inAdvanced;
|
||||
emit inAdvancedModeForEditSettingsChanged();
|
||||
}
|
||||
|
||||
bool UniversalSettings::showInfoWindow() const
|
||||
{
|
||||
return m_showInfoWindow;
|
||||
@ -482,6 +498,7 @@ void UniversalSettings::loadConfig()
|
||||
m_badges3DStyle = m_universalGroup.readEntry("badges3DStyle", false);
|
||||
m_canDisableBorders = m_universalGroup.readEntry("canDisableBorders", false);
|
||||
m_currentLayoutName = m_universalGroup.readEntry("currentLayout", QString());
|
||||
m_inAdvancedModeForEditSettings = m_universalGroup.readEntry("inAdvancedModeForEditSettings", false);
|
||||
m_lastNonAssignedLayoutName = m_universalGroup.readEntry("lastNonAssignedLayout", QString());
|
||||
m_launchers = m_universalGroup.readEntry("launchers", QStringList());
|
||||
m_metaPressAndHoldEnabled = m_universalGroup.readEntry("metaPressAndHoldEnabled", true);
|
||||
@ -499,6 +516,7 @@ void UniversalSettings::saveConfig()
|
||||
m_universalGroup.writeEntry("badges3DStyle", m_badges3DStyle);
|
||||
m_universalGroup.writeEntry("canDisableBorders", m_canDisableBorders);
|
||||
m_universalGroup.writeEntry("currentLayout", m_currentLayoutName);
|
||||
m_universalGroup.writeEntry("inAdvancedModeForEditSettings", m_inAdvancedModeForEditSettings);
|
||||
m_universalGroup.writeEntry("lastNonAssignedLayout", m_lastNonAssignedLayoutName);
|
||||
m_universalGroup.writeEntry("launchers", m_launchers);
|
||||
m_universalGroup.writeEntry("metaPressAndHoldEnabled", m_metaPressAndHoldEnabled);
|
||||
|
@ -56,6 +56,7 @@ class UniversalSettings : public QObject
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(bool autostart READ autostart WRITE setAutostart NOTIFY autostartChanged)
|
||||
Q_PROPERTY(bool badges3DStyle READ badges3DStyle WRITE setBadges3DStyle NOTIFY badges3DStyleChanged)
|
||||
Q_PROPERTY(bool inAdvancedModeForEditSettings READ inAdvancedModeForEditSettings WRITE setInAdvancedModeForEditSettings NOTIFY inAdvancedModeForEditSettingsChanged)
|
||||
Q_PROPERTY(bool colorsScriptIsPresent READ colorsScriptIsPresent NOTIFY colorsScriptIsPresentChanged)
|
||||
Q_PROPERTY(bool showInfoWindow READ showInfoWindow WRITE setShowInfoWindow NOTIFY showInfoWindowChanged)
|
||||
|
||||
@ -84,6 +85,9 @@ public:
|
||||
|
||||
bool colorsScriptIsPresent() const;
|
||||
|
||||
bool inAdvancedModeForEditSettings() const;
|
||||
void setInAdvancedModeForEditSettings(const bool &inAdvanced);
|
||||
|
||||
bool kwin_metaForwardedToLatte() const;
|
||||
void kwin_forwardMetaToLatte(bool forward);
|
||||
|
||||
@ -134,6 +138,7 @@ signals:
|
||||
void colorsScriptIsPresentChanged();
|
||||
void currentLayoutNameChanged();
|
||||
void downloadWindowSizeChanged();
|
||||
void inAdvancedModeForEditSettingsChanged();
|
||||
void lastNonAssignedLayoutNameChanged();
|
||||
void layoutsColumnWidthsChanged();
|
||||
void layoutsWindowSizeChanged();
|
||||
@ -169,6 +174,7 @@ private:
|
||||
bool m_badges3DStyle{false};
|
||||
bool m_canDisableBorders{false};
|
||||
bool m_colorsScriptIsPresent{false};
|
||||
bool m_inAdvancedModeForEditSettings{false};
|
||||
bool m_metaPressAndHoldEnabled{true};
|
||||
bool m_showInfoWindow{true};
|
||||
|
||||
|
@ -67,9 +67,6 @@ PrimaryConfigView::PrimaryConfigView(Latte::View *view)
|
||||
connect(this, &QQuickView::heightChanged, this, &PrimaryConfigView::updateEffects);
|
||||
|
||||
connect(this, &PrimaryConfigView::availableScreenGeometryChanged, this, &PrimaryConfigView::syncGeometry);
|
||||
connect(this, &PrimaryConfigView::inAdvancedModeChanged, this, &PrimaryConfigView::saveConfig);
|
||||
connect(this, &PrimaryConfigView::inAdvancedModeChanged, this, &PrimaryConfigView::updateShowInlineProperties);
|
||||
connect(this, &PrimaryConfigView::inAdvancedModeChanged, this, &PrimaryConfigView::syncGeometry);
|
||||
|
||||
connect(this, &QQuickView::statusChanged, [&](QQuickView::Status status) {
|
||||
if (status == QQuickView::Ready) {
|
||||
@ -86,6 +83,11 @@ PrimaryConfigView::PrimaryConfigView(Latte::View *view)
|
||||
hideConfigWindow();
|
||||
}
|
||||
});
|
||||
|
||||
connect(m_corona->universalSettings(), &Latte::UniversalSettings::inAdvancedModeForEditSettingsChanged,
|
||||
this, &PrimaryConfigView::updateShowInlineProperties);
|
||||
connect(m_corona->universalSettings(), &Latte::UniversalSettings::inAdvancedModeForEditSettingsChanged,
|
||||
this, &PrimaryConfigView::syncGeometry);
|
||||
}
|
||||
|
||||
m_availableScreemGeometryTimer.setSingleShot(true);
|
||||
@ -274,14 +276,12 @@ void PrimaryConfigView::initParentView(Latte::View *view)
|
||||
updateAvailableScreenGeometry();
|
||||
});
|
||||
|
||||
viewconnections << connect(this, &PrimaryConfigView::inAdvancedModeChanged, m_latteView, &Latte::View::inSettingsAdvancedModeChanged);
|
||||
viewconnections << connect(m_corona->universalSettings(), &Latte::UniversalSettings::inAdvancedModeForEditSettingsChanged, m_latteView, &Latte::View::inSettingsAdvancedModeChanged);
|
||||
viewconnections << connect(m_latteView->containment(), &Plasma::Containment::immutabilityChanged, this, &PrimaryConfigView::immutabilityChanged);
|
||||
|
||||
m_originalByPassWM = m_latteView->byPassWM();
|
||||
m_originalMode = m_latteView->visibility()->mode();
|
||||
|
||||
loadConfig();
|
||||
|
||||
updateEnabledBorders();
|
||||
updateAvailableScreenGeometry();
|
||||
syncGeometry();
|
||||
@ -359,7 +359,7 @@ void PrimaryConfigView::syncGeometry()
|
||||
|
||||
switch (m_latteView->formFactor()) {
|
||||
case Plasma::Types::Horizontal: {
|
||||
if (m_inAdvancedMode) {
|
||||
if (inAdvancedMode()) {
|
||||
if (qApp->isLeftToRight()) {
|
||||
xPos = availGeometry.x() + availGeometry.width() - size.width();
|
||||
} else {
|
||||
@ -565,7 +565,7 @@ void PrimaryConfigView::updateShowInlineProperties()
|
||||
bool showSecWindow{false};
|
||||
bool advancedApprovedSecWindow{false};
|
||||
|
||||
if (m_inAdvancedMode && m_latteView->formFactor() != Plasma::Types::Vertical) {
|
||||
if (inAdvancedMode() && m_latteView->formFactor() != Plasma::Types::Vertical) {
|
||||
showSecWindow = true;
|
||||
advancedApprovedSecWindow = true;
|
||||
}
|
||||
@ -594,17 +594,7 @@ void PrimaryConfigView::updateShowInlineProperties()
|
||||
|
||||
bool PrimaryConfigView::inAdvancedMode() const
|
||||
{
|
||||
return m_inAdvancedMode;
|
||||
}
|
||||
|
||||
void PrimaryConfigView::setInAdvancedMode(bool advanced)
|
||||
{
|
||||
if (m_inAdvancedMode == advanced) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_inAdvancedMode = advanced;
|
||||
emit inAdvancedModeChanged();
|
||||
return m_corona->universalSettings()->inAdvancedModeForEditSettings();
|
||||
}
|
||||
|
||||
//!BEGIN borders
|
||||
@ -683,29 +673,6 @@ void PrimaryConfigView::updateEffects()
|
||||
}
|
||||
}
|
||||
|
||||
//!BEGIN configuration
|
||||
void PrimaryConfigView::loadConfig()
|
||||
{
|
||||
if (!m_latteView || !m_latteView->containment()) {
|
||||
return;
|
||||
}
|
||||
auto config = m_latteView->containment()->config();
|
||||
int complexity = config.readEntry("settingsComplexity", 0);
|
||||
setInAdvancedMode(complexity>0);
|
||||
}
|
||||
|
||||
void PrimaryConfigView::saveConfig()
|
||||
{
|
||||
if (!m_latteView || !m_latteView->containment()) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto config = m_latteView->containment()->config();
|
||||
int complexity = m_inAdvancedMode ? 1 : 0;
|
||||
config.writeEntry("settingsComplexity", complexity);
|
||||
}
|
||||
//!END configuration
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -74,7 +74,6 @@ class PrimaryConfigView : public SubConfigView
|
||||
Q_OBJECT
|
||||
//! used when the secondary config window can not be shown
|
||||
Q_PROPERTY(bool showInlineProperties READ showInlineProperties NOTIFY showInlinePropertiesChanged)
|
||||
Q_PROPERTY(bool inAdvancedMode READ inAdvancedMode WRITE setInAdvancedMode NOTIFY inAdvancedModeChanged)
|
||||
Q_PROPERTY(bool isReady READ isReady NOTIFY isReadyChanged)
|
||||
|
||||
Q_PROPERTY(QRect availableScreenGeometry READ availableScreenGeometry NOTIFY availableScreenGeometryChanged)
|
||||
@ -91,9 +90,6 @@ public:
|
||||
PrimaryConfigView(Latte::View *view);
|
||||
~PrimaryConfigView() override;
|
||||
|
||||
bool inAdvancedMode() const;
|
||||
void setInAdvancedMode(bool advanced);
|
||||
|
||||
bool hasFocus() const;
|
||||
|
||||
bool isReady() const;
|
||||
@ -121,7 +117,6 @@ public slots:
|
||||
|
||||
signals:
|
||||
void availableScreenGeometryChanged();
|
||||
void inAdvancedModeChanged();
|
||||
void indicatorUiManagerChanged();
|
||||
void isReadyChanged();
|
||||
void raiseDocksTemporaryChanged();
|
||||
@ -150,18 +145,17 @@ private slots:
|
||||
|
||||
void setShowInlineProperties(bool show);
|
||||
|
||||
void loadConfig();
|
||||
void saveConfig();
|
||||
|
||||
private:
|
||||
void setIsReady(bool ready);
|
||||
void instantUpdateAvailableScreenGeometry();
|
||||
|
||||
bool inAdvancedMode() const;
|
||||
|
||||
private:
|
||||
bool m_blockFocusLost{false};
|
||||
bool m_blockFocusLostOnStartup{true};
|
||||
bool m_originalByPassWM{false};
|
||||
bool m_inAdvancedMode{false};
|
||||
bool m_inReverse{false}; //! it is used by the borders
|
||||
bool m_isReady{false};
|
||||
bool m_showInlineProperties{false};
|
||||
|
@ -826,7 +826,7 @@ void View::setIsPreferredForShortcuts(bool preferred)
|
||||
|
||||
bool View::inSettingsAdvancedMode() const
|
||||
{
|
||||
return m_primaryConfigView && m_primaryConfigView->inAdvancedMode();
|
||||
return m_primaryConfigView && m_corona->universalSettings()->inAdvancedModeForEditSettings();
|
||||
}
|
||||
|
||||
bool View::isTouchingBottomViewAndIsBusy() const
|
||||
|
@ -44,7 +44,7 @@ FocusScope {
|
||||
height: appliedHeight
|
||||
|
||||
readonly property bool basicLevel: !advancedLevel
|
||||
readonly property bool advancedLevel: viewConfig.inAdvancedMode
|
||||
readonly property bool advancedLevel: universalSettings.inAdvancedModeForEditSettings
|
||||
|
||||
readonly property bool inConfigureAppletsMode: plasmoid.configuration.inConfigureAppletsMode || !LatteCore.WindowSystem.compositingActive
|
||||
|
||||
@ -80,7 +80,7 @@ FocusScope {
|
||||
//! width can be between 200px - maxWidth
|
||||
//! height can be between 400px - maxHeight
|
||||
property int appliedWidth: Math.min(maxWidth, Math.max(200, chosenWidth))
|
||||
property int appliedHeight: viewConfig.inAdvancedMode ? maxHeight : Math.min(maxHeight, Math.max(400, chosenHeight))
|
||||
property int appliedHeight: universalSettings.inAdvancedModeForEditSettings ? maxHeight : Math.min(maxHeight, Math.max(400, chosenHeight))
|
||||
|
||||
Layout.minimumWidth: width
|
||||
Layout.minimumHeight: height
|
||||
@ -361,11 +361,11 @@ FocusScope {
|
||||
|
||||
LatteComponents.Switch {
|
||||
id: advancedSwitch
|
||||
checked: viewConfig.inAdvancedMode && viewConfig.isReady
|
||||
checked: universalSettings.inAdvancedModeForEditSettings && viewConfig.isReady
|
||||
|
||||
onCheckedChanged: {
|
||||
if (viewConfig.isReady) {
|
||||
viewConfig.inAdvancedMode = checked;
|
||||
universalSettings.inAdvancedModeForEditSettings = checked;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user