remember geometry

This commit is contained in:
Malte Jürgens 2023-02-27 20:38:14 +01:00
parent 77f31b63aa
commit e447206082
No known key found for this signature in database
GPG key ID: D29FBD5F93C0CFC3

View file

@ -30,8 +30,12 @@ MainWindow::MainWindow(bool useNotifySend, QWidget *parent)
m_centralWidget = new CentralWidget(this); m_centralWidget = new CentralWidget(this);
setCentralWidget(m_centralWidget); setCentralWidget(m_centralWidget);
setupTrayIcon(); setupTrayIcon();
resize(1000, 700); if (m_settings->contains("geometry")) {
showMaximized(); restoreGeometry(m_settings->value("geometry").toByteArray());
} else {
resize(1000, 700);
showMaximized();
}
if (m_settings->value("trayIcon", false).toBool() && if (m_settings->value("trayIcon", false).toBool() &&
m_settings->value("startHidden", false).toBool()) { m_settings->value("startHidden", false).toBool()) {
hide(); hide();
@ -114,8 +118,10 @@ void MainWindow::setTrayIcon(bool enabled) {
void MainWindow::closeEvent(QCloseEvent *event) { void MainWindow::closeEvent(QCloseEvent *event) {
if (m_settings->value("trayIcon", false).toBool()) { if (m_settings->value("trayIcon", false).toBool()) {
hide(); hide();
} else } else {
m_settings->setValue("geometry", saveGeometry());
QApplication::quit(); QApplication::quit();
}
} }
MainWindow *MainWindow::instance() { return m_instance; } MainWindow *MainWindow::instance() { return m_instance; }