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:
branches:
- master
- v7
tags:
- 'v*'
pull_request:

View File

@ -58,6 +58,13 @@ QByteArray Configuration::serialize() const
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();
}
@ -98,6 +105,14 @@ bool Configuration::deserialize(const QByteArray& data)
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;
}
else

View File

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

View File

@ -688,6 +688,16 @@ void Workspace::restoreMdiGeometry(const QByteArray& 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()
{
QList<QMdiSubWindow *> subWindowList = m_mdi->subWindowList();

View File

@ -53,6 +53,8 @@ public:
int getNumberOfSubWindows() const;
QByteArray saveMdiGeometry();
void restoreMdiGeometry(const QByteArray& blob);
bool getAutoStackOption() const;
void setAutoStackOption(bool autoStack);
QList<QMdiSubWindow *> getSubWindowList() const;
void orderByIndex(QList<ChannelGUI *> &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
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);
qDebug() << "MainWindow::MainWindow: load current configuration...";
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);
@ -1232,8 +1238,10 @@ void MainWindow::loadConfiguration(const Configuration *configuration, bool from
// Reconstruct
// Workspaces
for (int i = 0; i < configuration->getNumberOfWorkspaceGeometries(); i++) {
for (int i = 0; i < configuration->getNumberOfWorkspaceGeometries(); i++)
{
addWorkspace();
m_workspaces[i]->setAutoStackOption(configuration->getWorkspaceAutoStackOptions()[i]);
}
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());
for (const auto& workspace : m_workspaces) {
for (const auto& workspace : m_workspaces)
{
configuration->getWorkspaceGeometries().push_back(workspace->saveGeometry());
configuration->getWorkspaceAutoStackOptions().push_back(workspace->getAutoStackOption());
}
}