the user can disable the Latte Info window

--which is mainly used to inform the user for
a dynamic layout switching
pull/1/head
Michail Vourlakos 8 years ago
parent aed9452330
commit 6f7a44c450

@ -202,11 +202,16 @@ void LayoutManager::confirmDynamicSwitch()
if (m_shouldSwitchToLayout == tempShouldSwitch && m_shouldSwitchToLayout != currentLayoutName()) { if (m_shouldSwitchToLayout == tempShouldSwitch && m_shouldSwitchToLayout != currentLayoutName()) {
qDebug() << "dynamic switch to layout :: " << m_shouldSwitchToLayout; 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 { } else {
m_shouldSwitchToLayout = tempShouldSwitch; m_shouldSwitchToLayout = tempShouldSwitch;
m_dynamicSwitchTimer.start(); m_dynamicSwitchTimer.start();

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

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

@ -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 { PlasmaComponents.CheckBox {
Layout.leftMargin: units.smallSpacing * 2 Layout.leftMargin: units.smallSpacing * 2
text: i18n("Raise dock on desktop change") text: i18n("Raise dock on desktop change")

Loading…
Cancel
Save