diff --git a/client/mainwindow.cpp b/client/mainwindow.cpp
index 4554e53..2e2215f 100644
--- a/client/mainwindow.cpp
+++ b/client/mainwindow.cpp
@@ -82,6 +82,11 @@ MainWindow::MainWindow(QWidget *parent)
portsDock->setWidget(portsWindow);
addDockWidget(Qt::TopDockWidgetArea, portsDock);
+ // Save the default window geometry and layout ...
+ defaultGeometry_ = geometry();
+ defaultLayout_ = saveState(0);
+
+ // ... before restoring the last used settings
QRect geom = appSettings->value(kApplicationWindowGeometryKey).toRect();
if (!geom.isNull())
setGeometry(geom);
@@ -135,6 +140,17 @@ void MainWindow::on_actionPreferences_triggered()
delete preferences;
}
+void MainWindow::on_actionViewRestoreDefaults_triggered()
+{
+ // Use the saved default geometry/layout, however keep the
+ // window location same
+ defaultGeometry_.moveTo(geometry().topLeft());
+ setGeometry(defaultGeometry_);
+ restoreState(defaultLayout_, 0);
+
+ actionViewShowMyReservedPortsOnly->setChecked(false);
+}
+
void MainWindow::on_actionHelpAbout_triggered()
{
QDialog *aboutDialog = new QDialog;
diff --git a/client/mainwindow.h b/client/mainwindow.h
index 2b68ca5..e05ab54 100644
--- a/client/mainwindow.h
+++ b/client/mainwindow.h
@@ -40,12 +40,16 @@ private:
QDockWidget *portsDock;
QDockWidget *statsDock;
+ QRect defaultGeometry_;
+ QByteArray defaultLayout_;
+
public:
MainWindow(QWidget *parent = 0);
~MainWindow();
public slots:
void on_actionPreferences_triggered();
+ void on_actionViewRestoreDefaults_triggered();
void on_actionHelpAbout_triggered();
private slots:
diff --git a/client/mainwindow.ui b/client/mainwindow.ui
index 27f520c..82dfc93 100644
--- a/client/mainwindow.ui
+++ b/client/mainwindow.ui
@@ -27,7 +27,7 @@
@@ -80,7 +81,7 @@
:/icons/qt.png
- About Qt
+ About &Qt
@@ -88,7 +89,12 @@
true
- Show My &Reserved Ports Only
+ Show &My Reserved Ports Only
+
+
+
+
+ Restore &Defaults