From 7a066ec4b2bf3507108be9196d0bf41fd7f3bec9 Mon Sep 17 00:00:00 2001 From: Dave Page Date: Fri, 4 Oct 2013 10:08:18 -0400 Subject: [PATCH] Save/restore the window position. --- runtime/BrowserWindow.cpp | 15 +++++++++++++++ runtime/BrowserWindow.h | 3 +++ runtime/pgAdmin4.cpp | 5 +++++ 3 files changed, 23 insertions(+) diff --git a/runtime/BrowserWindow.cpp b/runtime/BrowserWindow.cpp index 45e442e5a..b5a840c46 100644 --- a/runtime/BrowserWindow.cpp +++ b/runtime/BrowserWindow.cpp @@ -42,6 +42,11 @@ BrowserWindow::BrowserWindow() setCentralWidget(webView); connect(webView, SIGNAL(loadFinished(bool)), SLOT(finishLoading(bool))); + // Restore the geometry + QSettings settings; + restoreGeometry(settings.value("geometry").toByteArray()); + restoreState(settings.value("windowState").toByteArray()); + // Display the app m_initialload = true; m_loadattempt = 1; @@ -49,6 +54,16 @@ BrowserWindow::BrowserWindow() } +// Save the window geometry on close +void BrowserWindow::closeEvent(QCloseEvent *event) +{ + QSettings settings; + settings.setValue("geometry", saveGeometry()); + settings.setValue("windowState", saveState()); + QMainWindow::closeEvent(event); +} + + // Create the actions for the window void BrowserWindow::createActions() { diff --git a/runtime/BrowserWindow.h b/runtime/BrowserWindow.h index 4fb616ce0..33d9ac11a 100644 --- a/runtime/BrowserWindow.h +++ b/runtime/BrowserWindow.h @@ -36,6 +36,9 @@ class BrowserWindow : public QMainWindow public: BrowserWindow(); +protected: + void closeEvent(QCloseEvent *event); + protected slots: void finishLoading(bool); diff --git a/runtime/pgAdmin4.cpp b/runtime/pgAdmin4.cpp index 32b762164..14c720893 100644 --- a/runtime/pgAdmin4.cpp +++ b/runtime/pgAdmin4.cpp @@ -33,6 +33,11 @@ int main(int argc, char * argv[]) // Create the QT application QApplication app(argc, argv); + // Setup the settings management + QCoreApplication::setOrganizationName("pgAdmin Development Team"); + QCoreApplication::setOrganizationDomain("pgadmin.org"); + QCoreApplication::setApplicationName(PGA_APP_NAME); + // Fire up the webserver // TODO: Find an unused port number to use Server *server = new Server();