1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 01:55:48 -05:00

Save auto stack workspaces status in configuration

This commit is contained in:
f4exb 2022-05-19 15:48:14 +02:00
parent cce023bf56
commit 9e4b5bda56
6 changed files with 47 additions and 8 deletions

View File

@ -6,7 +6,6 @@ on:
push: push:
branches: branches:
- master - master
- v7
tags: tags:
- 'v*' - 'v*'
pull_request: pull_request:

View File

@ -58,6 +58,13 @@ QByteArray Configuration::serialize() const
s.writeBlob(201 + i, m_deviceSetPresets[i].serialize()); s.writeBlob(201 + i, m_deviceSetPresets[i].serialize());
} }
nitems = m_workspaceAutoStackOptions.size() < 99 ? m_workspaceAutoStackOptions.size() : 99;
s.writeS32(300, nitems);
for (int i = 0; i < nitems; i++) {
s.writeBool(301 + i, m_workspaceAutoStackOptions[i]);
}
return s.final(); return s.final();
} }
@ -98,6 +105,14 @@ bool Configuration::deserialize(const QByteArray& data)
m_deviceSetPresets.back().deserialize(b); m_deviceSetPresets.back().deserialize(b);
} }
d.readS32(300, &nitems, 0);
for (int i = 0; i < nitems; i++)
{
m_workspaceAutoStackOptions.push_back(true);
d.readBool(301 + i, &m_workspaceAutoStackOptions.back());
}
return true; return true;
} }
else else

View File

@ -50,6 +50,8 @@ public:
int getNumberOfWorkspaceGeometries() const { return m_workspaceGeometries.size(); } int getNumberOfWorkspaceGeometries() const { return m_workspaceGeometries.size(); }
QList<QByteArray>& getWorkspaceGeometries() { return m_workspaceGeometries; } QList<QByteArray>& getWorkspaceGeometries() { return m_workspaceGeometries; }
const QList<QByteArray>& getWorkspaceGeometries() const { return m_workspaceGeometries; } const QList<QByteArray>& getWorkspaceGeometries() const { return m_workspaceGeometries; }
QList<bool>& getWorkspaceAutoStackOptions() { return m_workspaceAutoStackOptions; }
const QList<bool>& getWorkspaceAutoStackOptions() const { return m_workspaceAutoStackOptions; }
FeatureSetPreset& getFeatureSetPreset() { return m_featureSetPreset; } FeatureSetPreset& getFeatureSetPreset() { return m_featureSetPreset; }
const FeatureSetPreset& getFeatureSetPreset() const { return m_featureSetPreset; } const FeatureSetPreset& getFeatureSetPreset() const { return m_featureSetPreset; }
QList<Preset>& getDeviceSetPresets() { return m_deviceSetPresets; } QList<Preset>& getDeviceSetPresets() { return m_deviceSetPresets; }
@ -73,6 +75,7 @@ private:
QString m_group; QString m_group;
QString m_description; QString m_description;
QList<QByteArray> m_workspaceGeometries; QList<QByteArray> m_workspaceGeometries;
QList<bool> m_workspaceAutoStackOptions;
FeatureSetPreset m_featureSetPreset; FeatureSetPreset m_featureSetPreset;
QList<Preset> m_deviceSetPresets; QList<Preset> m_deviceSetPresets;
}; };

View File

@ -688,6 +688,16 @@ void Workspace::restoreMdiGeometry(const QByteArray& blob)
m_mdi->restoreGeometry(qUncompress(blob)); m_mdi->restoreGeometry(qUncompress(blob));
} }
bool Workspace::getAutoStackOption() const
{
return m_autoStackSubWindows->isChecked();
}
void Workspace::setAutoStackOption(bool autoStack)
{
m_autoStackSubWindows->doToggle(autoStack);
}
void Workspace::adjustSubWindowsAfterRestore() void Workspace::adjustSubWindowsAfterRestore()
{ {
QList<QMdiSubWindow *> subWindowList = m_mdi->subWindowList(); QList<QMdiSubWindow *> subWindowList = m_mdi->subWindowList();

View File

@ -53,6 +53,8 @@ public:
int getNumberOfSubWindows() const; int getNumberOfSubWindows() const;
QByteArray saveMdiGeometry(); QByteArray saveMdiGeometry();
void restoreMdiGeometry(const QByteArray& blob); void restoreMdiGeometry(const QByteArray& blob);
bool getAutoStackOption() const;
void setAutoStackOption(bool autoStack);
QList<QMdiSubWindow *> getSubWindowList() const; QList<QMdiSubWindow *> getSubWindowList() const;
void orderByIndex(QList<ChannelGUI *> &list); void orderByIndex(QList<ChannelGUI *> &list);
void orderByIndex(QList<FeatureGUI *> &list); void orderByIndex(QList<FeatureGUI *> &list);

View File

@ -193,15 +193,21 @@ MainWindow::MainWindow(qtwebapp::LoggerWithFile *logger, const MainParser& parse
addFeatureSet(); // Create the uniuefeature set addFeatureSet(); // Create the uniuefeature set
m_apiAdapter = new WebAPIAdapter(); m_apiAdapter = new WebAPIAdapter();
if (!parser.getScratch()) if (parser.getScratch())
{
qDebug() << "MainWindow::MainWindow: scratch mode: do not load current configuration";
}
else
{ {
splash->showStatusMessage("load current configuration...", Qt::white); splash->showStatusMessage("load current configuration...", Qt::white);
qDebug() << "MainWindow::MainWindow: load current configuration..."; qDebug() << "MainWindow::MainWindow: load current configuration...";
loadConfiguration(m_mainCore->m_settings.getWorkingConfiguration()); loadConfiguration(m_mainCore->m_settings.getWorkingConfiguration());
}
else if (m_workspaces.size() == 0)
{ {
qDebug() << "MainWindow::MainWindow: scratch mode: do not load current configuration"; qDebug() << "MainWindow::MainWindow: no or empty current configuration, creating empty workspace...";
addWorkspace();
}
} }
splash->showStatusMessage("finishing...", Qt::white); splash->showStatusMessage("finishing...", Qt::white);
@ -1232,8 +1238,10 @@ void MainWindow::loadConfiguration(const Configuration *configuration, bool from
// Reconstruct // Reconstruct
// Workspaces // Workspaces
for (int i = 0; i < configuration->getNumberOfWorkspaceGeometries(); i++) { for (int i = 0; i < configuration->getNumberOfWorkspaceGeometries(); i++)
{
addWorkspace(); addWorkspace();
m_workspaces[i]->setAutoStackOption(configuration->getWorkspaceAutoStackOptions()[i]);
} }
if (m_workspaces.size() <= 0) { // cannot go further if there are no workspaces if (m_workspaces.size() <= 0) { // cannot go further if there are no workspaces
@ -1383,8 +1391,10 @@ void MainWindow::saveConfiguration(Configuration *configuration)
m_featureUIs[0]->saveFeatureSetSettings(&configuration->getFeatureSetPreset()); m_featureUIs[0]->saveFeatureSetSettings(&configuration->getFeatureSetPreset());
for (const auto& workspace : m_workspaces) { for (const auto& workspace : m_workspaces)
{
configuration->getWorkspaceGeometries().push_back(workspace->saveGeometry()); configuration->getWorkspaceGeometries().push_back(workspace->saveGeometry());
configuration->getWorkspaceAutoStackOptions().push_back(workspace->getAutoStackOption());
} }
} }