At exit Ostinato main window geometry and layout is saved and restored next time you open Ostinato
This commit is contained in:
parent
ac3bd72a8d
commit
12aea59867
@ -27,6 +27,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
|
|||||||
#include "portstatswindow.h"
|
#include "portstatswindow.h"
|
||||||
#include "portswindow.h"
|
#include "portswindow.h"
|
||||||
#include "preferences.h"
|
#include "preferences.h"
|
||||||
|
#include "settings.h"
|
||||||
#include "ui_about.h"
|
#include "ui_about.h"
|
||||||
|
|
||||||
#include <QDockWidget>
|
#include <QDockWidget>
|
||||||
@ -62,7 +63,13 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
portsWindow = new PortsWindow(pgl, this);
|
portsWindow = new PortsWindow(pgl, this);
|
||||||
statsWindow = new PortStatsWindow(pgl, this);
|
statsWindow = new PortStatsWindow(pgl, this);
|
||||||
portsDock = new QDockWidget(tr("Ports and Streams"), this);
|
portsDock = new QDockWidget(tr("Ports and Streams"), this);
|
||||||
|
portsDock->setObjectName("portsDock");
|
||||||
|
portsDock->setFeatures(
|
||||||
|
portsDock->features() & ~QDockWidget::DockWidgetClosable);
|
||||||
statsDock = new QDockWidget(tr("Statistics"), this);
|
statsDock = new QDockWidget(tr("Statistics"), this);
|
||||||
|
statsDock->setObjectName("statsDock");
|
||||||
|
statsDock->setFeatures(
|
||||||
|
statsDock->features() & ~QDockWidget::DockWidgetClosable);
|
||||||
|
|
||||||
setupUi(this);
|
setupUi(this);
|
||||||
|
|
||||||
@ -73,6 +80,14 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
portsDock->setWidget(portsWindow);
|
portsDock->setWidget(portsWindow);
|
||||||
addDockWidget(Qt::TopDockWidgetArea, portsDock);
|
addDockWidget(Qt::TopDockWidgetArea, portsDock);
|
||||||
|
|
||||||
|
QRect geom = appSettings->value(kApplicationWindowGeometryKey).toRect();
|
||||||
|
if (!geom.isNull())
|
||||||
|
setGeometry(geom);
|
||||||
|
QByteArray layout = appSettings->value(kApplicationWindowLayout)
|
||||||
|
.toByteArray();
|
||||||
|
if (layout.size())
|
||||||
|
restoreState(layout, 0);
|
||||||
|
|
||||||
connect(actionFileExit, SIGNAL(triggered()), this, SLOT(close()));
|
connect(actionFileExit, SIGNAL(triggered()), this, SLOT(close()));
|
||||||
connect(actionAboutQt, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
|
connect(actionAboutQt, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
|
||||||
#if 0
|
#if 0
|
||||||
@ -89,6 +104,10 @@ MainWindow::~MainWindow()
|
|||||||
localServer_->terminate();
|
localServer_->terminate();
|
||||||
localServer_->waitForFinished();
|
localServer_->waitForFinished();
|
||||||
delete localServer_;
|
delete localServer_;
|
||||||
|
|
||||||
|
QByteArray layout = saveState(0);
|
||||||
|
appSettings->setValue(kApplicationWindowLayout, layout);
|
||||||
|
appSettings->setValue(kApplicationWindowGeometryKey, geometry());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionPreferences_triggered()
|
void MainWindow::on_actionPreferences_triggered()
|
||||||
|
@ -74,6 +74,13 @@ const QString kAwkPathDefaultValue("/usr/bin/awk");
|
|||||||
const QString kAwkPathDefaultValue("/usr/bin/awk");
|
const QString kAwkPathDefaultValue("/usr/bin/awk");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// LastUse Section Keys
|
||||||
|
//
|
||||||
|
const QString kApplicationWindowGeometryKey("LastUse/ApplicationWindowGeometry");
|
||||||
|
const QString kApplicationWindowLayout("LastUse/ApplicationWindowLayout");
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user