Remember window size.

Refs #154
This commit is contained in:
Florian Geyer 2014-03-22 12:21:49 +01:00
parent b9370c6e79
commit f300ca5b7b
2 changed files with 16 additions and 0 deletions

View File

@ -40,6 +40,8 @@ MainWindow::MainWindow()
{
m_ui->setupUi(this);
restoreGeometry(config()->get("Window/Geometry").toByteArray());
setWindowIcon(filePath()->applicationIcon());
QAction* toggleViewAction = m_ui->toolBar->toggleViewAction();
toggleViewAction->setText(tr("Show toolbar"));
@ -413,6 +415,12 @@ void MainWindow::databaseTabChanged(int tabIndex)
}
void MainWindow::closeEvent(QCloseEvent* event)
{
saveWindowInformation();
saveLastDatabases(event);
}
void MainWindow::saveLastDatabases(QCloseEvent* event)
{
m_openDatabases.clear();
bool openPreviousDatabasesOnStartup = config()->get("OpenPreviousDatabasesOnStartup").toBool();
@ -436,6 +444,11 @@ void MainWindow::closeEvent(QCloseEvent* event)
}
}
void MainWindow::saveWindowInformation()
{
config()->set("Window/Geometry", saveGeometry());
}
void MainWindow::showEntryContextMenu(const QPoint& globalPos)
{
m_ui->menuEntries->popup(globalPos);

View File

@ -67,6 +67,9 @@ private:
static const QString BaseWindowTitle;
void saveWindowInformation();
void saveLastDatabases(QCloseEvent* event);
const QScopedPointer<Ui::MainWindow> m_ui;
SignalMultiplexer m_actionMultiplexer;
QAction* m_clearHistoryAction;