remember the download window size

--Latte now remembers the last used window size
for the Download dialog
pull/2/head
Michail Vourlakos 7 years ago
parent d1320f692e
commit 9e03f2732a

@ -315,6 +315,7 @@ void SettingsDialog::on_downloadButton_clicked()
qDebug() << Q_FUNC_INFO;
KNS3::DownloadDialog dialog(QStringLiteral("latte-layouts.knsrc"), this);
dialog.resize(m_corona->universalSettings()->downloadWindowSize());
dialog.exec();
bool layoutAdded{false};
@ -333,6 +334,8 @@ void SettingsDialog::on_downloadButton_clicked()
}
}
m_corona->universalSettings()->setDownloadWindowSize(dialog.size());
if (layoutAdded) {
apply();
}

@ -35,6 +35,7 @@ UniversalSettings::UniversalSettings(KSharedConfig::Ptr config, QObject *parent)
m_universalGroup(KConfigGroup(config, QStringLiteral("UniversalSettings")))
{
connect(this, &UniversalSettings::currentLayoutNameChanged, this, &UniversalSettings::saveConfig);
connect(this, &UniversalSettings::downloadWindowSizeChanged, this, &UniversalSettings::saveConfig);
connect(this, &UniversalSettings::lastNonAssignedLayoutNameChanged, this, &UniversalSettings::saveConfig);
connect(this, &UniversalSettings::launchersChanged, this, &UniversalSettings::saveConfig);
connect(this, &UniversalSettings::layoutsColumnWidthsChanged, this, &UniversalSettings::saveConfig);
@ -129,6 +130,22 @@ void UniversalSettings::setLastNonAssignedLayoutName(QString layoutName)
emit lastNonAssignedLayoutNameChanged();
}
QSize UniversalSettings::downloadWindowSize() const
{
return m_downloadWindowSize;
}
void UniversalSettings::setDownloadWindowSize(QSize size)
{
if (m_downloadWindowSize == size) {
return;
}
m_downloadWindowSize = size;
emit downloadWindowSizeChanged();
}
QSize UniversalSettings::layoutsWindowSize() const
{
return m_layoutsWindowSize;
@ -247,6 +264,7 @@ void UniversalSettings::loadConfig()
{
m_version = m_universalGroup.readEntry("version", 1);
m_currentLayoutName = m_universalGroup.readEntry("currentLayout", QString());
m_downloadWindowSize = m_universalGroup.readEntry("downloadWindowSize", QSize(800, 550));
m_lastNonAssignedLayoutName = m_universalGroup.readEntry("lastNonAssignedLayout", QString());
m_layoutsWindowSize = m_universalGroup.readEntry("layoutsWindowSize", QSize(700, 450));
m_layoutsColumnWidths = m_universalGroup.readEntry("layoutsColumnWidths", QStringList());
@ -260,6 +278,7 @@ void UniversalSettings::saveConfig()
{
m_universalGroup.writeEntry("version", m_version);
m_universalGroup.writeEntry("currentLayout", m_currentLayoutName);
m_universalGroup.writeEntry("downloadWindowSize", m_downloadWindowSize);
m_universalGroup.writeEntry("lastNonAssignedLayout", m_lastNonAssignedLayoutName);
m_universalGroup.writeEntry("layoutsWindowSize", m_layoutsWindowSize);
m_universalGroup.writeEntry("layoutsColumnWidths", m_layoutsColumnWidths);

@ -70,8 +70,11 @@ public:
QString lastNonAssignedLayoutName() const;
void setLastNonAssignedLayoutName(QString layoutName);
QSize downloadWindowSize() const;
void setDownloadWindowSize(QSize size);
QSize layoutsWindowSize() const;
void setLayoutsWindowSize(QSize);
void setLayoutsWindowSize(QSize size);
QStringList layoutsColumnWidths() const;
void setLayoutsColumnWidths(QStringList widths);
@ -96,6 +99,7 @@ public slots:
signals:
void autostartChanged();
void currentLayoutNameChanged();
void downloadWindowSizeChanged();
void lastNonAssignedLayoutNameChanged();
void layoutsColumnWidthsChanged();
void layoutsWindowSizeChanged();
@ -124,6 +128,7 @@ private:
QString m_currentLayoutName;
QString m_lastNonAssignedLayoutName;
QSize m_downloadWindowSize{800, 550};
QSize m_layoutsWindowSize{700, 450};
QStringList m_layoutsColumnWidths;

Loading…
Cancel
Save