save layout window size to improve usability

pull/1/head
Michail Vourlakos 8 years ago
parent 85bd62acc6
commit 5ff0e7af5b

@ -46,6 +46,7 @@ LayoutConfigDialog::LayoutConfigDialog(QWidget *parent, LayoutManager *manager)
setAttribute(Qt::WA_DeleteOnClose, true);
setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint);
resize(m_manager->corona()->universalSettings()->layoutsWindowSize());
connect(ui->buttonBox->button(QDialogButtonBox::Apply), &QPushButton::clicked
, this, &LayoutConfigDialog::apply);
@ -101,6 +102,10 @@ LayoutConfigDialog::~LayoutConfigDialog()
if (m_model) {
delete m_model;
}
if (m_manager && m_manager->corona() && m_manager->corona()->universalSettings()) {
m_manager->corona()->universalSettings()->setLayoutsWindowSize(size());
}
}
QStringList LayoutConfigDialog::activities()

@ -2,14 +2,6 @@
<ui version="4.0">
<class>LayoutConfigDialog</class>
<widget class="QDialog" name="LayoutConfigDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>682</width>
<height>462</height>
</rect>
</property>
<property name="windowTitle">
<string/>
</property>
@ -53,7 +45,8 @@
<string>Switch</string>
</property>
<property name="icon">
<iconset theme="user-identity"/>
<iconset theme="user-identity">
<normaloff>.</normaloff>.</iconset>
</property>
</widget>
</item>
@ -63,7 +56,8 @@
<string>Copy</string>
</property>
<property name="icon">
<iconset theme="edit-copy"/>
<iconset theme="edit-copy">
<normaloff>.</normaloff>.</iconset>
</property>
<property name="flat">
<bool>false</bool>
@ -76,7 +70,8 @@
<string>Remove</string>
</property>
<property name="icon">
<iconset theme="list-remove"/>
<iconset theme="list-remove">
<normaloff>.</normaloff>.</iconset>
</property>
</widget>
</item>
@ -114,7 +109,8 @@
<string>Import</string>
</property>
<property name="icon">
<iconset theme="document-import"/>
<iconset theme="document-import">
<normaloff>.</normaloff>.</iconset>
</property>
<property name="default">
<bool>false</bool>
@ -127,7 +123,8 @@
<string>Export</string>
</property>
<property name="icon">
<iconset theme="document-export"/>
<iconset theme="document-export">
<normaloff>.</normaloff>.</iconset>
</property>
</widget>
</item>

@ -81,6 +81,21 @@ void UniversalSettings::setCurrentLayoutName(QString layoutName)
emit currentLayoutNameChanged();
}
QSize UniversalSettings::layoutsWindowSize() const
{
return m_layoutsWindowSize;
}
void UniversalSettings::setLayoutsWindowSize(QSize size)
{
if (m_layoutsWindowSize == size) {
return;
}
m_layoutsWindowSize = size;
emit layoutsWindowSizeChanged();
}
bool UniversalSettings::autostart() const
{
QFile autostartFile(QDir::homePath() + "/.config/autostart/org.kde.latte-dock.desktop");
@ -123,12 +138,14 @@ void UniversalSettings::loadConfig()
{
m_version = m_universalGroup.readEntry("version", 1);
m_currentLayoutName = m_universalGroup.readEntry("currentLayout", QString());
m_layoutsWindowSize = m_universalGroup.readEntry("layoutsWindowSize", QSize(700, 450));
}
void UniversalSettings::saveConfig()
{
m_universalGroup.writeEntry("version", m_version);
m_universalGroup.writeEntry("currentLayout", m_currentLayoutName);
m_universalGroup.writeEntry("layoutsWindowSize", m_layoutsWindowSize);
m_universalGroup.sync();
}

@ -53,9 +53,13 @@ public:
QString currentLayoutName() const;
void setCurrentLayoutName(QString layoutName);
QSize layoutsWindowSize() const;
void setLayoutsWindowSize(QSize);
signals:
void autostartChanged();
void currentLayoutNameChanged();
void layoutsWindowSizeChanged();
void versionChanged();
private slots:
@ -70,6 +74,7 @@ private:
int m_version{1};
QString m_currentLayoutName;
QSize m_layoutsWindowSize{700, 450};
KConfigGroup m_universalGroup;
KSharedConfig::Ptr m_config;

Loading…
Cancel
Save