mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-06-07 08:24:43 -04:00
Add --start option to start all devices and features. For #2359.
This commit is contained in:
@@ -61,6 +61,7 @@
|
||||
#include "feature/featureset.h"
|
||||
#include "feature/feature.h"
|
||||
#include "feature/featuregui.h"
|
||||
#include "feature/featurewebapiutils.h"
|
||||
#include "mainspectrum/mainspectrumgui.h"
|
||||
#include "commands/commandkeyreceiver.h"
|
||||
#include "gui/presetitem.h"
|
||||
@@ -275,6 +276,9 @@ MainWindow::MainWindow(qtwebapp::LoggerWithFile *logger, const MainParser& parse
|
||||
InitFSM *fsm = new InitFSM(this, splash, !parser.getScratch());
|
||||
connect(fsm, &InitFSM::finished, fsm, &InitFSM::deleteLater);
|
||||
connect(fsm, &InitFSM::finished, splash, &SDRangelSplash::deleteLater);
|
||||
if (parser.getStart()) {
|
||||
connect(fsm, &InitFSM::finished, this, &MainWindow::startAllAfterDelay);
|
||||
}
|
||||
fsm->start();
|
||||
|
||||
qDebug() << "MainWindow::MainWindow: end";
|
||||
@@ -3382,6 +3386,30 @@ void MainWindow::showAllChannels(int deviceSetIndex)
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::startAllAfterDelay()
|
||||
{
|
||||
// Wait a little bit before starting all devices and features,
|
||||
// as some devices, such as FileSinks, can fail to start if run before initialised
|
||||
// Is there a better way than this arbitrary time?
|
||||
QTimer::singleShot(1000, this, &MainWindow::startAll);
|
||||
}
|
||||
|
||||
// Start all devices and features in all workspaces
|
||||
void MainWindow::startAll()
|
||||
{
|
||||
// Start all devices
|
||||
for (const auto& workspace : m_workspaces) {
|
||||
startAllDevices(workspace);
|
||||
}
|
||||
// Start all features
|
||||
for (int featureSetIndex = 0; featureSetIndex < m_featureUIs.size(); featureSetIndex++)
|
||||
{
|
||||
for (int featureIndex = 0; featureIndex < m_featureUIs[featureSetIndex]->getNumberOfFeatures(); featureIndex++) {
|
||||
FeatureWebAPIUtils::run(featureSetIndex, featureIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Start all devices in the workspace
|
||||
void MainWindow::startAllDevices(const Workspace *workspace) const
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user