settings:store views dialog window size

work/spdx
Michail Vourlakos 4 years ago
parent 634e68b857
commit 089b24dbe5

@ -33,8 +33,11 @@ ViewsDialog::ViewsDialog(SettingsDialog *parent, Controller::Layouts *controller
: GenericDialog(parent), : GenericDialog(parent),
m_parentDlg(parent), m_parentDlg(parent),
m_ui(new Ui::ViewsDialog), m_ui(new Ui::ViewsDialog),
m_layoutsController(controller) m_layoutsController(controller),
m_storage(KConfigGroup(KSharedConfig::openConfig(),"LatteSettingsDialog").group("ViewsDialog"))
{ {
loadConfig();
//! first we need to setup the ui //! first we need to setup the ui
m_ui->setupUi(this); m_ui->setupUi(this);
//! we must create handlers after creating/adjusting the ui //! we must create handlers after creating/adjusting the ui
@ -52,11 +55,13 @@ ViewsDialog::ViewsDialog(SettingsDialog *parent, Controller::Layouts *controller
connect(m_ui->buttonBox->button(QDialogButtonBox::Reset), &QPushButton::clicked, connect(m_ui->buttonBox->button(QDialogButtonBox::Reset), &QPushButton::clicked,
this, &ViewsDialog::onReset); this, &ViewsDialog::onReset);
resize(m_windowSize);
updateApplyButtonsState(); updateApplyButtonsState();
} }
ViewsDialog::~ViewsDialog() ViewsDialog::~ViewsDialog()
{ {
saveConfig();
} }
Controller::Layouts *ViewsDialog::layoutsController() const Controller::Layouts *ViewsDialog::layoutsController() const
@ -109,6 +114,16 @@ void ViewsDialog::onReset()
// m_handler->reset(); // m_handler->reset();
} }
void ViewsDialog::loadConfig()
{
m_windowSize = m_storage.readEntry("windowSize", QSize(775, 500));
}
void ViewsDialog::saveConfig()
{
m_storage.writeEntry("windowSize", size());
}
} }
} }
} }

@ -65,6 +65,9 @@ protected:
void accept() override; void accept() override;
private slots: private slots:
void loadConfig();
void saveConfig();
void onOk(); void onOk();
void onCancel(); void onCancel();
void onReset(); void onReset();
@ -77,6 +80,12 @@ private:
Controller::Layouts *m_layoutsController{nullptr}; Controller::Layouts *m_layoutsController{nullptr};
Handler::ViewsHandler *m_handler; Handler::ViewsHandler *m_handler;
//! properties
QSize m_windowSize;
//! storage
KConfigGroup m_storage;
}; };
} }

Loading…
Cancel
Save