diff --git a/sdrbase/settings/configuration.cpp b/sdrbase/settings/configuration.cpp index d2ef6ebcd..4d194c07f 100644 --- a/sdrbase/settings/configuration.cpp +++ b/sdrbase/settings/configuration.cpp @@ -107,11 +107,6 @@ bool Configuration::deserialize(const QByteArray& data) } } -int Configuration::getNumberOfWorkspaces() const -{ - return m_workspaceGeometries.size(); -} - void Configuration::clearData() { m_deviceSetPresets.clear(); diff --git a/sdrbase/settings/configuration.h b/sdrbase/settings/configuration.h index f99e6ed44..296db22c3 100644 --- a/sdrbase/settings/configuration.h +++ b/sdrbase/settings/configuration.h @@ -47,7 +47,7 @@ public: void setDescription(const QString& description) { m_description = description; } const QString& getDescription() const { return m_description; } - int getNumberOfWorkspaces() const; + int getNumberOfWorkspaceGeometries() const { return m_workspaceGeometries.size(); } QList& getWorkspaceGeometries() { return m_workspaceGeometries; } const QList& getWorkspaceGeometries() const { return m_workspaceGeometries; } FeatureSetPreset& getFeatureSetPreset() { return m_featureSetPreset; } diff --git a/sdrgui/gui/workspace.cpp b/sdrgui/gui/workspace.cpp index a9345417e..94f7a1474 100644 --- a/sdrgui/gui/workspace.cpp +++ b/sdrgui/gui/workspace.cpp @@ -25,6 +25,10 @@ #include #include "gui/samplingdevicedialog.h" +#include "device/devicegui.h" +#include "channel/channelgui.h" +#include "mainspectrum/mainspectrumgui.h" +#include "feature/featuregui.h" #include "workspace.h" Workspace::Workspace(int index, QWidget *parent, Qt::WindowFlags flags) : @@ -313,3 +317,23 @@ void Workspace::restoreMdiGeometry(const QByteArray& blob) { m_mdi->restoreGeometry(qUncompress(blob)); } + +void Workspace::adjustSubWindowsAfterRestore() +{ + QList subWindowList = m_mdi->subWindowList(); + + for (auto& subWindow : subWindowList) + { + if ((subWindow->y() >= 20) && (subWindow->y() < 40)) { + subWindow->move(subWindow->x(), subWindow->y() - 20); + } + + if (qobject_cast(subWindow)) { + subWindow->resize(subWindow->width(), subWindow->height() - 22); + } + + if (qobject_cast(subWindow)) { + subWindow->resize(subWindow->width(), subWindow->height() - 8); + } + } +} diff --git a/sdrgui/gui/workspace.h b/sdrgui/gui/workspace.h index fff92eaa7..804d1d91e 100644 --- a/sdrgui/gui/workspace.h +++ b/sdrgui/gui/workspace.h @@ -49,6 +49,7 @@ public: QByteArray saveMdiGeometry(); void restoreMdiGeometry(const QByteArray& blob); QList getSubWindowList() const; + void adjustSubWindowsAfterRestore(); private: int m_index; diff --git a/sdrgui/mainwindow.cpp b/sdrgui/mainwindow.cpp index 338c08567..d1a7faac9 100644 --- a/sdrgui/mainwindow.cpp +++ b/sdrgui/mainwindow.cpp @@ -1173,7 +1173,7 @@ void MainWindow::loadConfiguration(const Configuration *configuration, bool from qDebug("MainWindow::loadConfiguration: configuration [%s | %s] %d workspace(s) - %d device set(s) - %d feature(s)", qPrintable(configuration->getGroup()), qPrintable(configuration->getDescription()), - configuration->getNumberOfWorkspaces(), + configuration->getNumberOfWorkspaceGeometries(), configuration->getDeviceSetPresets().size(), configuration->getFeatureSetPreset().getFeatureCount() ); @@ -1210,7 +1210,7 @@ void MainWindow::loadConfiguration(const Configuration *configuration, bool from // Reconstruct // Workspaces - for (int i = 0; i < configuration->getNumberOfWorkspaces(); i++) { + for (int i = 0; i < configuration->getNumberOfWorkspaceGeometries(); i++) { addWorkspace(); } @@ -1321,8 +1321,10 @@ void MainWindow::loadConfiguration(const Configuration *configuration, bool from waitBox->setInformativeText("Finalizing..."); } - for (int i = 0; i < configuration->getNumberOfWorkspaces(); i++) { + for (int i = 0; i < configuration->getNumberOfWorkspaceGeometries(); i++) + { m_workspaces[i]->restoreGeometry(configuration->getWorkspaceGeometries()[i]); + m_workspaces[i]->adjustSubWindowsAfterRestore(); } if (waitBox)