Commit 45c0176d065edd9ba7e2834e4d9768037f81c676

Authored by Denis Dovzhenko
Committed by David Gräff
1 parent 3fd7e443

Save / load layout of docking windows and toolbars into new [window] section of .ini file

openhantek/src/dockwindows.cpp
... ... @@ -35,6 +35,19 @@
35 35 #include "settings.h"
36 36 #include "sispinbox.h"
37 37  
  38 +namespace {
  39 +
  40 +void SetupDockWidget(QDockWidget *dockWindow, QWidget *dockWidget, QLayout *layout) {
  41 + dockWindow->setObjectName(dockWindow->windowTitle());
  42 + dockWindow->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
  43 + dockWidget->setLayout(layout);
  44 + dockWidget->setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed,
  45 + QSizePolicy::DefaultType));
  46 + dockWindow->setWidget(dockWidget);
  47 +}
  48 +
  49 +}
  50 +
38 51 ////////////////////////////////////////////////////////////////////////////////
39 52 // class HorizontalDock
40 53 /// \brief Initializes the horizontal axis docking window.
... ... @@ -90,11 +103,8 @@ HorizontalDock::HorizontalDock(DsoSettings *settings, QWidget *parent,
90 103 this->dockLayout->addWidget(this->formatLabel, 4, 0);
91 104 this->dockLayout->addWidget(this->formatComboBox, 4, 1);
92 105  
93   - this->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
94   -
95 106 this->dockWidget = new QWidget();
96   - this->dockWidget->setLayout(this->dockLayout);
97   - this->setWidget(this->dockWidget);
  107 + SetupDockWidget(this, dockWidget, dockLayout);
98 108  
99 109 // Connect signals and slots
100 110 connect(this->samplerateSiSpinBox, SIGNAL(valueChanged(double)), this,
... ... @@ -337,11 +347,8 @@ TriggerDock::TriggerDock(DsoSettings *settings,
337 347 this->dockLayout->addWidget(this->slopeLabel, 2, 0);
338 348 this->dockLayout->addWidget(this->slopeComboBox, 2, 1);
339 349  
340   - this->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
341   -
342 350 this->dockWidget = new QWidget();
343   - this->dockWidget->setLayout(this->dockLayout);
344   - this->setWidget(this->dockWidget);
  351 + SetupDockWidget(this, dockWidget, dockLayout);
345 352  
346 353 // Connect signals and slots
347 354 connect(this->modeComboBox, SIGNAL(currentIndexChanged(int)), this,
... ... @@ -479,11 +486,8 @@ SpectrumDock::SpectrumDock(DsoSettings *settings, QWidget *parent,
479 486 this->dockLayout->addWidget(this->magnitudeComboBox[channel], channel, 1);
480 487 }
481 488  
482   - this->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
483   -
484 489 this->dockWidget = new QWidget();
485   - this->dockWidget->setLayout(this->dockLayout);
486   - this->setWidget(this->dockWidget);
  490 + SetupDockWidget(this, dockWidget, dockLayout);
487 491  
488 492 // Connect signals and slots
489 493 for (int channel = 0; channel < this->settings->scope.voltage.count();
... ... @@ -630,11 +634,8 @@ VoltageDock::VoltageDock(DsoSettings *settings, QWidget *parent,
630 634 1);
631 635 }
632 636  
633   - this->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
634   -
635 637 this->dockWidget = new QWidget();
636   - this->dockWidget->setLayout(this->dockLayout);
637   - this->setWidget(this->dockWidget);
  638 + SetupDockWidget(this, dockWidget, dockLayout);
638 639  
639 640 // Connect signals and slots
640 641 for (int channel = 0; channel < this->settings->scope.voltage.count();
... ...
openhantek/src/openhantek.cpp
... ... @@ -88,10 +88,6 @@ OpenHantekMainWindow::OpenHantekMainWindow(QWidget *parent,
88 88 // Apply the settings after the gui is initialized
89 89 this->applySettings();
90 90  
91   - // Update stored window size and position
92   - this->settings->options.window.position = this->pos();
93   - this->settings->options.window.size = this->size();
94   -
95 91 // Connect all signals
96 92 this->connectSignals();
97 93  
... ... @@ -233,10 +229,22 @@ void OpenHantekMainWindow::createMenus() {
233 229 this->helpMenu->addAction(this->aboutQtAction);
234 230 }
235 231  
  232 +namespace {
  233 +
  234 +QToolBar* CreateToolBar(const QString& title) {
  235 + QToolBar* newObj = new QToolBar(title);
  236 + newObj->setObjectName(title);
  237 + newObj->setAllowedAreas(Qt::TopToolBarArea | Qt::LeftToolBarArea);
  238 + return newObj;
  239 +}
  240 +
  241 +}
  242 +
236 243 /// \brief Create the toolbars and their buttons.
237 244 void OpenHantekMainWindow::createToolBars() {
238   - this->fileToolBar = new QToolBar(tr("File"));
239   - this->fileToolBar->setAllowedAreas(Qt::TopToolBarArea);
  245 +
  246 + // File
  247 + this->fileToolBar = CreateToolBar(tr("File"));
240 248 this->fileToolBar->addAction(this->openAction);
241 249 this->fileToolBar->addAction(this->saveAction);
242 250 this->fileToolBar->addAction(this->saveAsAction);
... ... @@ -244,10 +252,12 @@ void OpenHantekMainWindow::createToolBars() {
244 252 this->fileToolBar->addAction(this->printAction);
245 253 this->fileToolBar->addAction(this->exportAsAction);
246 254  
247   - this->oscilloscopeToolBar = new QToolBar(tr("Oscilloscope"));
  255 + // Oscilloscope
  256 + this->oscilloscopeToolBar = CreateToolBar(tr("Oscilloscope"));
248 257 this->oscilloscopeToolBar->addAction(this->startStopAction);
249 258  
250   - this->viewToolBar = new QToolBar(tr("View"));
  259 + // View
  260 + this->viewToolBar = CreateToolBar(tr("View"));
251 261 this->viewToolBar->addAction(this->digitalPhosphorAction);
252 262 this->viewToolBar->addAction(this->zoomAction);
253 263 }
... ... @@ -427,22 +437,6 @@ int OpenHantekMainWindow::writeSettings(const QString &amp;fileName) {
427 437 return this->settings->save(fileName);
428 438 }
429 439  
430   -/// \brief Called everytime the window is moved.
431   -/// \param event The move event, it isn't used here though.
432   -void OpenHantekMainWindow::moveEvent(QMoveEvent *event) {
433   - Q_UNUSED(event);
434   -
435   - this->settings->options.window.position = this->pos();
436   -}
437   -
438   -/// \brief Called everytime the window is resized.
439   -/// \param event The resize event, it isn't used here though.
440   -void OpenHantekMainWindow::resizeEvent(QResizeEvent *event) {
441   - Q_UNUSED(event);
442   -
443   - this->settings->options.window.size = this->size();
444   -}
445   -
446 440 /// \brief Open a configuration file.
447 441 /// \return 0 on success, 1 on user abort, negative on error.
448 442 int OpenHantekMainWindow::open() {
... ... @@ -546,143 +540,24 @@ void OpenHantekMainWindow::about() {
546 540  
547 541 /// \brief The settings have changed.
548 542 void OpenHantekMainWindow::applySettings() {
549   - // Main window
550   - if (!this->settings->options.window.position.isNull())
551   - this->move(this->settings->options.window.position);
552   - if (!this->settings->options.window.size.isNull())
553   - this->resize(this->settings->options.window.size);
554   -
555   - // Docking windows
556   - QList<QDockWidget *> docks;
557   - docks.append(this->horizontalDock);
558   - docks.append(this->triggerDock);
559   - docks.append(this->voltageDock);
560   - docks.append(this->spectrumDock);
561   -
562   - QList<DsoSettingsOptionsWindowPanel *> dockSettings;
563   - dockSettings.append(&(this->settings->options.window.dock.horizontal));
564   - dockSettings.append(&(this->settings->options.window.dock.trigger));
565   - dockSettings.append(&(this->settings->options.window.dock.voltage));
566   - dockSettings.append(&(this->settings->options.window.dock.spectrum));
567   -
568   - QList<int> dockedWindows[2]; // Docks docked on the sides of the main window
569   -
570   - for (int dockId = 0; dockId < docks.size(); ++dockId) {
571   - docks[dockId]->setVisible(dockSettings[dockId]->visible);
572   - docks[dockId]->setFloating(dockSettings[dockId]->floating);
573   - if (!dockSettings[dockId]->position.isNull()) {
574   - if (dockSettings[dockId]->floating) {
575   - this->addDockWidget(Qt::RightDockWidgetArea, docks[dockId]);
576   - docks[dockId]->move(dockSettings[dockId]->position);
577   - } else {
578   - // Check in which order the docking windows where placed
579   - int side = (dockSettings[dockId]->position.x() <
580   - this->settings->options.window.size.width() / 2)
581   - ? 0
582   - : 1;
583   - int index = 0;
584   - while (index < dockedWindows[side].size() &&
585   - dockSettings[dockedWindows[side][index]]->position.y() <=
586   - dockSettings[dockId]->position.y())
587   - ++index;
588   - dockedWindows[side].insert(index, dockId);
589   - }
590   - } else {
591   - this->addDockWidget(Qt::RightDockWidgetArea, docks[dockId]);
592   - }
593   - }
  543 + addDockWidget(Qt::RightDockWidgetArea, horizontalDock);
  544 + addDockWidget(Qt::RightDockWidgetArea, triggerDock);
  545 + addDockWidget(Qt::RightDockWidgetArea, voltageDock);
  546 + addDockWidget(Qt::RightDockWidgetArea, spectrumDock);
594 547  
595   - // Put the docked docking windows into the main window
596   - for (int position = 0; position < dockedWindows[0].size(); ++position)
597   - this->addDockWidget(Qt::LeftDockWidgetArea,
598   - docks[dockedWindows[0][position]]);
599   - for (int position = 0; position < dockedWindows[1].size(); ++position)
600   - this->addDockWidget(Qt::RightDockWidgetArea,
601   - docks[dockedWindows[1][position]]);
602   -
603   - // Toolbars
604   - QList<QToolBar *> toolbars;
605   - toolbars.append(this->fileToolBar);
606   - toolbars.append(this->oscilloscopeToolBar);
607   - toolbars.append(this->viewToolBar);
608   -
609   - QList<DsoSettingsOptionsWindowPanel *> toolbarSettings;
610   - toolbarSettings.append(&(this->settings->options.window.toolbar.file));
611   - toolbarSettings.append(
612   - &(this->settings->options.window.toolbar.oscilloscope));
613   - toolbarSettings.append(&(this->settings->options.window.toolbar.view));
614   -
615   - QList<int> dockedToolbars; // Docks docked on the sides of the main window
616   -
617   - for (int toolbarId = 0; toolbarId < toolbars.size(); ++toolbarId) {
618   - toolbars[toolbarId]->setVisible(toolbarSettings[toolbarId]->visible);
619   - toolbars[toolbarId]->setWindowFlags(Qt::Tool);
620   - if (!toolbarSettings[toolbarId]->position.isNull() &&
621   - !toolbarSettings[toolbarId]->floating) {
622   - /*if(toolbarSettings[toolbarId]->floating) {
623   - toolbars[toolbarId]->move(toolbarSettings[toolbarId]->position);
624   - }
625   - else*/ {
626   - // Check in which order the toolbars where placed
627   - int index = 0;
628   - while (index < dockedToolbars.size() &&
629   - toolbarSettings[dockedToolbars[index]]->position.x() <=
630   - toolbarSettings[toolbarId]->position.x())
631   - ++index;
632   - dockedToolbars.insert(index, toolbarId);
633   - }
634   - } else {
635   - this->addToolBar(toolbars[toolbarId]);
636   - }
637   - }
  548 + addToolBar(fileToolBar);
  549 + addToolBar(oscilloscopeToolBar);
  550 + addToolBar(viewToolBar);
638 551  
639   - // Put the docked toolbars into the main window
640   - for (int position = 0; position < dockedToolbars.size(); ++position)
641   - this->addToolBar(toolbars[dockedToolbars[position]]);
  552 + restoreGeometry(settings->mainWindowGeometry);
  553 + restoreState(settings->mainWindowState);
642 554 }
643 555  
644 556 /// \brief Update the window layout in the settings.
645 557 void OpenHantekMainWindow::updateSettings() {
646 558 // Main window
647   - this->settings->options.window.position = this->pos();
648   - this->settings->options.window.size = this->size();
649   -
650   - // Docking windows
651   - QList<QDockWidget *> docks;
652   - docks.append(this->horizontalDock);
653   - docks.append(this->spectrumDock);
654   - docks.append(this->triggerDock);
655   - docks.append(this->voltageDock);
656   -
657   - QList<DsoSettingsOptionsWindowPanel *> dockSettings;
658   - dockSettings.append(&(this->settings->options.window.dock.horizontal));
659   - dockSettings.append(&(this->settings->options.window.dock.spectrum));
660   - dockSettings.append(&(this->settings->options.window.dock.trigger));
661   - dockSettings.append(&(this->settings->options.window.dock.voltage));
662   -
663   - for (int dockId = 0; dockId < docks.size(); ++dockId) {
664   - dockSettings[dockId]->floating = docks[dockId]->isFloating();
665   - dockSettings[dockId]->position = docks[dockId]->pos();
666   - dockSettings[dockId]->visible = docks[dockId]->isVisible();
667   - }
668   -
669   - // Toolbars
670   - QList<QToolBar *> toolbars;
671   - toolbars.append(this->fileToolBar);
672   - toolbars.append(this->oscilloscopeToolBar);
673   - toolbars.append(this->viewToolBar);
674   -
675   - QList<DsoSettingsOptionsWindowPanel *> toolbarSettings;
676   - toolbarSettings.append(&(this->settings->options.window.toolbar.file));
677   - toolbarSettings.append(
678   - &(this->settings->options.window.toolbar.oscilloscope));
679   - toolbarSettings.append(&(this->settings->options.window.toolbar.view));
680   -
681   - for (int toolbarId = 0; toolbarId < toolbars.size(); ++toolbarId) {
682   - toolbarSettings[toolbarId]->floating = toolbars[toolbarId]->isFloating();
683   - toolbarSettings[toolbarId]->position = toolbars[toolbarId]->pos();
684   - toolbarSettings[toolbarId]->visible = toolbars[toolbarId]->isVisible();
685   - }
  559 + settings->mainWindowGeometry = saveGeometry();
  560 + settings->mainWindowState = saveState();
686 561 }
687 562  
688 563 /// \brief The oscilloscope changed the record time.
... ...
openhantek/src/openhantek.h
... ... @@ -70,10 +70,6 @@ private:
70 70 int readSettings(const QString &fileName = QString());
71 71 int writeSettings(const QString &fileName = QString());
72 72  
73   - // Window translation events
74   - void moveEvent(QMoveEvent *event);
75   - void resizeEvent(QResizeEvent *event);
76   -
77 73 // Actions
78 74 QAction *newAction, *openAction, *saveAction, *saveAsAction;
79 75 QAction *printAction, *exportAsAction;
... ...
openhantek/src/settings.cpp
... ... @@ -36,24 +36,6 @@ DsoSettings::DsoSettings(QWidget *parent) : QObject(parent) {
36 36 // Options
37 37 this->options.alwaysSave = true;
38 38 this->options.imageSize = QSize(640, 480);
39   - // Main window
40   - this->options.window.position = QPoint();
41   - this->options.window.size = QSize(800, 600);
42   - // Docking windows and toolbars
43   - QList<DsoSettingsOptionsWindowPanel *> panels;
44   - panels.append(&(this->options.window.dock.horizontal));
45   - panels.append(&(this->options.window.dock.spectrum));
46   - panels.append(&(this->options.window.dock.trigger));
47   - panels.append(&(this->options.window.dock.voltage));
48   - panels.append(&(this->options.window.toolbar.file));
49   - panels.append(&(this->options.window.toolbar.oscilloscope));
50   - panels.append(&(this->options.window.toolbar.view));
51   - for (int panelId = 0; panelId < panels.size(); ++panelId) {
52   - panels[panelId]->floating = false;
53   - panels[panelId]->position = QPoint();
54   - panels[panelId]->visible = true;
55   - }
56   -
57 39 // Oscilloscope settings
58 40 // Horizontal axis
59 41 this->scope.horizontal.format = Dso::GRAPHFORMAT_TY;
... ... @@ -213,68 +195,17 @@ int DsoSettings::load(const QString &amp;fileName) {
213 195 if (settingsLoader->status() != QSettings::NoError)
214 196 return -settingsLoader->status();
215 197  
216   - // Main window layout and other general options
217   - settingsLoader->beginGroup("options");
218   - settingsLoader->beginGroup("window");
219   - // Docking windows and toolbars
220   - settingsLoader->beginGroup("docks");
221   - QList<DsoSettingsOptionsWindowPanel *> docks;
222   - docks.append(&(this->options.window.dock.horizontal));
223   - docks.append(&(this->options.window.dock.spectrum));
224   - docks.append(&(this->options.window.dock.trigger));
225   - docks.append(&(this->options.window.dock.voltage));
226   - QStringList dockNames;
227   - dockNames << "horizontal"
228   - << "spectrum"
229   - << "trigger"
230   - << "voltage";
231   - for (int dockId = 0; dockId < docks.size(); ++dockId) {
232   - settingsLoader->beginGroup(dockNames[dockId]);
233   - if (settingsLoader->contains("floating"))
234   - docks[dockId]->floating = settingsLoader->value("floating").toBool();
235   - if (settingsLoader->contains("position"))
236   - docks[dockId]->position = settingsLoader->value("position").toPoint();
237   - if (settingsLoader->contains("visible"))
238   - docks[dockId]->visible = settingsLoader->value("visible").toBool();
239   - settingsLoader->endGroup();
240   - }
241   - settingsLoader->endGroup();
242   - settingsLoader->beginGroup("toolbars");
243   - QList<DsoSettingsOptionsWindowPanel *> toolbars;
244   - toolbars.append(&(this->options.window.toolbar.file));
245   - toolbars.append(&(this->options.window.toolbar.oscilloscope));
246   - toolbars.append(&(this->options.window.toolbar.view));
247   - QStringList toolbarNames;
248   - toolbarNames << "file"
249   - << "oscilloscope"
250   - << "view";
251   - for (int toolbarId = 0; toolbarId < toolbars.size(); ++toolbarId) {
252   - settingsLoader->beginGroup(toolbarNames[toolbarId]);
253   - if (settingsLoader->contains("floating"))
254   - toolbars[toolbarId]->floating =
255   - settingsLoader->value("floating").toBool();
256   - if (settingsLoader->contains("position"))
257   - toolbars[toolbarId]->position =
258   - settingsLoader->value("position").toPoint();
259   - if (settingsLoader->contains("visible"))
260   - toolbars[toolbarId]->visible = settingsLoader->value("visible").toBool();
261   - settingsLoader->endGroup();
262   - }
263   - settingsLoader->endGroup();
264   - // Main window
265   - if (settingsLoader->contains("pos"))
266   - this->options.window.position = settingsLoader->value("pos").toPoint();
267   - if (settingsLoader->contains("size"))
268   - this->options.window.size = settingsLoader->value("size").toSize();
269   - settingsLoader->endGroup();
270 198 // General options
  199 + settingsLoader->beginGroup("options");
271 200 if (settingsLoader->contains("alwaysSave"))
272 201 this->options.alwaysSave = settingsLoader->value("alwaysSave").toBool();
273 202 if (settingsLoader->contains("imageSize"))
274 203 this->options.imageSize = settingsLoader->value("imageSize").toSize();
  204 + // If the window/* keys were found in this group, remove them from settings
  205 + settingsLoader->remove("window");
275 206 settingsLoader->endGroup();
276 207  
277   - // Oszilloskope settings
  208 + // Oscilloscope settings
278 209 settingsLoader->beginGroup("scope");
279 210 // Horizontal axis
280 211 settingsLoader->beginGroup("horizontal");
... ... @@ -419,6 +350,11 @@ int DsoSettings::load(const QString &amp;fileName) {
419 350 (Dso::InterpolationMode)settingsLoader->value("zoom").toBool();
420 351 settingsLoader->endGroup();
421 352  
  353 + settingsLoader->beginGroup("window");
  354 + mainWindowGeometry = settingsLoader->value("geometry").toByteArray();
  355 + mainWindowState = settingsLoader->value("state").toByteArray();
  356 + settingsLoader->endGroup();
  357 +
422 358 delete settingsLoader;
423 359  
424 360 return 0;
... ... @@ -441,48 +377,6 @@ int DsoSettings::save(const QString &amp;fileName) {
441 377 if (complete) {
442 378 // Main window layout and other general options
443 379 settingsSaver->beginGroup("options");
444   - settingsSaver->beginGroup("window");
445   - // Docking windows and toolbars
446   - settingsSaver->beginGroup("docks");
447   - QList<DsoSettingsOptionsWindowPanel *> docks;
448   - docks.append(&(this->options.window.dock.horizontal));
449   - docks.append(&(this->options.window.dock.spectrum));
450   - docks.append(&(this->options.window.dock.trigger));
451   - docks.append(&(this->options.window.dock.voltage));
452   - QStringList dockNames;
453   - dockNames << "horizontal"
454   - << "spectrum"
455   - << "trigger"
456   - << "voltage";
457   - for (int dockId = 0; dockId < docks.size(); ++dockId) {
458   - settingsSaver->beginGroup(dockNames[dockId]);
459   - settingsSaver->setValue("floating", docks[dockId]->floating);
460   - settingsSaver->setValue("position", docks[dockId]->position);
461   - settingsSaver->setValue("visible", docks[dockId]->visible);
462   - settingsSaver->endGroup();
463   - }
464   - settingsSaver->endGroup();
465   - settingsSaver->beginGroup("toolbars");
466   - QList<DsoSettingsOptionsWindowPanel *> toolbars;
467   - toolbars.append(&(this->options.window.toolbar.file));
468   - toolbars.append(&(this->options.window.toolbar.oscilloscope));
469   - toolbars.append(&(this->options.window.toolbar.view));
470   - QStringList toolbarNames;
471   - toolbarNames << "file"
472   - << "oscilloscope"
473   - << "view";
474   - for (int toolbarId = 0; toolbarId < toolbars.size(); ++toolbarId) {
475   - settingsSaver->beginGroup(toolbarNames[toolbarId]);
476   - settingsSaver->setValue("floating", toolbars[toolbarId]->floating);
477   - settingsSaver->setValue("position", toolbars[toolbarId]->position);
478   - settingsSaver->setValue("visible", toolbars[toolbarId]->visible);
479   - settingsSaver->endGroup();
480   - }
481   - settingsSaver->endGroup();
482   - // Main window
483   - settingsSaver->setValue("pos", this->options.window.position);
484   - settingsSaver->setValue("size", this->options.window.size);
485   - settingsSaver->endGroup();
486 380 settingsSaver->setValue("alwaysSave", this->options.alwaysSave);
487 381 settingsSaver->setValue("imageSize", this->options.imageSize);
488 382 settingsSaver->endGroup();
... ... @@ -576,6 +470,11 @@ int DsoSettings::save(const QString &amp;fileName) {
576 470 settingsSaver->setValue("zoom", this->view.zoom);
577 471 settingsSaver->endGroup();
578 472  
  473 + settingsSaver->beginGroup("window");
  474 + settingsSaver->setValue("geometry", mainWindowGeometry);
  475 + settingsSaver->setValue("state", mainWindowState);
  476 + settingsSaver->endGroup();
  477 +
579 478 delete settingsSaver;
580 479  
581 480 return 0;
... ...
openhantek/src/settings.h
... ... @@ -35,50 +35,11 @@
35 35 #include "dso.h"
36 36  
37 37 ////////////////////////////////////////////////////////////////////////////////
38   -/// \struct DsoSettingsOptionsWindowPanel settings.h
39   -/// \brief Holds the position and state of a docking window or toolbar.
40   -struct DsoSettingsOptionsWindowPanel {
41   - bool floating; ///< true, if the panel is floating
42   - QPoint position; ///< Position of the panel
43   - bool visible; ///< true, if the panel is shown
44   -};
45   -
46   -////////////////////////////////////////////////////////////////////////////////
47   -/// \struct DsoSettingsOptionsWindowDock settings.h
48   -/// \brief Holds the layout of the docking windows.
49   -struct DsoSettingsOptionsWindowDock {
50   - DsoSettingsOptionsWindowPanel horizontal; ///< "Horizontal" docking window
51   - DsoSettingsOptionsWindowPanel spectrum; ///< "Spectrum" docking window
52   - DsoSettingsOptionsWindowPanel trigger; ///< "Trigger" docking window
53   - DsoSettingsOptionsWindowPanel voltage; ///< "Voltage" docking window
54   -};
55   -
56   -////////////////////////////////////////////////////////////////////////////////
57   -/// \struct DsoSettingsOptionsWindowToolbar settings.h
58   -/// \brief Holds the layout of the toolbars.
59   -struct DsoSettingsOptionsWindowToolbar {
60   - DsoSettingsOptionsWindowPanel file; ///< "File" toolbar
61   - DsoSettingsOptionsWindowPanel oscilloscope; ///< "Oscilloscope" toolbar
62   - DsoSettingsOptionsWindowPanel view; ///< The "View" toolbar
63   -};
64   -
65   -////////////////////////////////////////////////////////////////////////////////
66   -/// \struct DsoSettingsOptionsWindow settings.h
67   -/// \brief Holds the layout of the main window.
68   -struct DsoSettingsOptionsWindow {
69   - QPoint position; ///< Position of the main window
70   - QSize size; ///< Size of the main window
71   - DsoSettingsOptionsWindowDock dock; ///< Docking windows
72   - DsoSettingsOptionsWindowToolbar toolbar; ///< Toolbars
73   -};
74   -
75   -////////////////////////////////////////////////////////////////////////////////
76 38 /// \struct DsoSettingsOptions settings.h
77 39 /// \brief Holds the general options of the program.
78 40 struct DsoSettingsOptions {
79 41 bool alwaysSave; ///< Always save the settings on exit
80 42 QSize imageSize; ///< Size of exported images in pixels
81   - DsoSettingsOptionsWindow window; ///< Window layout
82 43 };
83 44  
84 45 ////////////////////////////////////////////////////////////////////////////////
... ... @@ -195,6 +156,9 @@ public:
195 156 DsoSettingsScope scope; ///< All oscilloscope related settings
196 157 DsoSettingsView view; ///< All view related settings
197 158  
  159 + QByteArray mainWindowGeometry; ///< Geometry of the main window
  160 + QByteArray mainWindowState; ///< State of docking windows and toolbars
  161 +
198 162 public slots:
199 163 // Saving to and loading from configuration files
200 164 int load(const QString &fileName = QString());
... ...