1
0
mirror of https://github.com/KDE/latte-dock.git synced 2024-12-25 19:21:41 +03:00

the user can disable the Latte Info window

--which is mainly used to inform the user for
a dynamic layout switching
This commit is contained in:
Michail Vourlakos 2017-07-25 14:19:01 +03:00
parent aed9452330
commit 6f7a44c450
4 changed files with 45 additions and 4 deletions

View File

@ -202,11 +202,16 @@ void LayoutManager::confirmDynamicSwitch()
if (m_shouldSwitchToLayout == tempShouldSwitch && m_shouldSwitchToLayout != currentLayoutName()) {
qDebug() << "dynamic switch to layout :: " << m_shouldSwitchToLayout;
showInfoWindow(i18n("Switching to layout <b>%0</b> ...").arg(m_shouldSwitchToLayout), 4500);
if (m_corona->universalSettings()->showInfoWindow()) {
showInfoWindow(i18n("Switching to layout <b>%0</b> ...").arg(m_shouldSwitchToLayout), 4000);
QTimer::singleShot(500, [this, tempShouldSwitch]() {
switchToLayout(tempShouldSwitch);
});
} else {
switchToLayout(m_shouldSwitchToLayout);
}
QTimer::singleShot(500, [this, tempShouldSwitch]() {
switchToLayout(tempShouldSwitch);
});
} else {
m_shouldSwitchToLayout = tempShouldSwitch;
m_dynamicSwitchTimer.start();

View File

@ -32,6 +32,7 @@ UniversalSettings::UniversalSettings(KSharedConfig::Ptr config, QObject *parent)
connect(this, &UniversalSettings::currentLayoutNameChanged, this, &UniversalSettings::saveConfig);
connect(this, &UniversalSettings::lastNonAssignedLayoutNameChanged, this, &UniversalSettings::saveConfig);
connect(this, &UniversalSettings::launchersChanged, this, &UniversalSettings::saveConfig);
connect(this, &UniversalSettings::showInfoWindowChanged, this, &UniversalSettings::saveConfig);
connect(this, &UniversalSettings::versionChanged, this, &UniversalSettings::saveConfig);
}
@ -54,6 +55,21 @@ void UniversalSettings::load()
loadConfig();
}
bool UniversalSettings::showInfoWindow() const
{
return m_showInfoWindow;
}
void UniversalSettings::setShowInfoWindow(bool show)
{
if (m_showInfoWindow == show) {
return;
}
m_showInfoWindow = show;
emit showInfoWindowChanged();
}
int UniversalSettings::version() const
{
return m_version;
@ -176,6 +192,7 @@ void UniversalSettings::loadConfig()
m_lastNonAssignedLayoutName = m_universalGroup.readEntry("lastNonAssignedLayout", QString());
m_layoutsWindowSize = m_universalGroup.readEntry("layoutsWindowSize", QSize(700, 450));
m_launchers = m_universalGroup.readEntry("launchers", QStringList());
m_showInfoWindow = m_universalGroup.readEntry("showInfoWindow", true);
}
void UniversalSettings::saveConfig()
@ -185,6 +202,7 @@ void UniversalSettings::saveConfig()
m_universalGroup.writeEntry("lastNonAssignedLayout", m_lastNonAssignedLayoutName);
m_universalGroup.writeEntry("layoutsWindowSize", m_layoutsWindowSize);
m_universalGroup.writeEntry("launchers", m_launchers);
m_universalGroup.writeEntry("showInfoWindow", m_showInfoWindow);
m_universalGroup.sync();
}

View File

@ -35,6 +35,7 @@ namespace Latte {
class UniversalSettings : public QObject {
Q_OBJECT
Q_PROPERTY(bool autostart READ autostart WRITE setAutostart NOTIFY autostartChanged)
Q_PROPERTY(bool showInfoWindow READ showInfoWindow WRITE setShowInfoWindow NOTIFY showInfoWindowChanged)
Q_PROPERTY(QString currentLayoutName READ currentLayoutName WRITE setCurrentLayoutName NOTIFY currentLayoutNameChanged)
@ -48,6 +49,9 @@ public:
bool autostart() const;
void setAutostart(bool state);
bool showInfoWindow() const;
void setShowInfoWindow(bool show);
int version() const;
void setVersion(int ver);
@ -69,6 +73,7 @@ signals:
void lastNonAssignedLayoutNameChanged();
void layoutsWindowSizeChanged();
void launchersChanged();
void showInfoWindowChanged();
void versionChanged();
private slots:
@ -79,6 +84,8 @@ private:
void cleanupSettings();
private:
bool m_showInfoWindow{true};
//when there isnt a version it is an old universal file
int m_version{1};

View File

@ -156,6 +156,17 @@ PlasmaComponents.Page {
}
}
PlasmaComponents.CheckBox {
Layout.leftMargin: units.smallSpacing * 2
text: i18n("Show info for layouts automatic switching")
checked: universalSettings.showInfoWindow
tooltip: i18n("It shows a Latte specific info window")
onClicked: {
universalSettings.showInfoWindow = checked;
}
}
PlasmaComponents.CheckBox {
Layout.leftMargin: units.smallSpacing * 2
text: i18n("Raise dock on desktop change")