diff --git a/app/main.cpp b/app/main.cpp index 335fc7d27..deb75b6d5 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -135,6 +135,7 @@ int main(int argc, char* argv[]) qtwebapp::LoggerWithFile *logger = new qtwebapp::LoggerWithFile(qApp); logger->installMsgHandler(); int res = runQtApplication(argc, argv, logger); + delete logger; qWarning("SDRangel quit."); return res; } diff --git a/sdrbase/CMakeLists.txt b/sdrbase/CMakeLists.txt index 0bce7e0a7..2947110f1 100644 --- a/sdrbase/CMakeLists.txt +++ b/sdrbase/CMakeLists.txt @@ -139,6 +139,7 @@ set(sdrbase_SOURCES device/deviceutils.cpp feature/feature.cpp + feature/featureset.cpp feature/featureutils.cpp limerfe/limerfeusbcalib.cpp @@ -298,6 +299,7 @@ set(sdrbase_HEADERS device/deviceutils.h feature/feature.h + feature/featureset.h feature/featureutils.h limerfe/limerfeusbcalib.h diff --git a/sdrsrv/feature/featureset.cpp b/sdrbase/feature/featureset.cpp similarity index 100% rename from sdrsrv/feature/featureset.cpp rename to sdrbase/feature/featureset.cpp diff --git a/sdrsrv/feature/featureset.h b/sdrbase/feature/featureset.h similarity index 100% rename from sdrsrv/feature/featureset.h rename to sdrbase/feature/featureset.h diff --git a/sdrbase/maincore.cpp b/sdrbase/maincore.cpp index a178bbcee..cbdc895e2 100644 --- a/sdrbase/maincore.cpp +++ b/sdrbase/maincore.cpp @@ -24,6 +24,8 @@ #include "maincore.h" +MESSAGE_CLASS_DEFINITION(MainCore::MsgDeviceSetFocus, Message) +MESSAGE_CLASS_DEFINITION(MainCore::MsgDVSerial, Message) MESSAGE_CLASS_DEFINITION(MainCore::MsgDeleteInstance, Message) MESSAGE_CLASS_DEFINITION(MainCore::MsgLoadPreset, Message) MESSAGE_CLASS_DEFINITION(MainCore::MsgSavePreset, Message) diff --git a/sdrbase/maincore.h b/sdrbase/maincore.h index 8aef4d6d9..03d4b1744 100644 --- a/sdrbase/maincore.h +++ b/sdrbase/maincore.h @@ -38,6 +38,46 @@ namespace qtwebapp { class SDRBASE_API MainCore { public: + class MsgDeviceSetFocus : public Message { + MESSAGE_CLASS_DECLARATION + + public: + int getDeviceSetIndex() const { return m_deviceSetIndex; } + + static MsgDeviceSetFocus* create(int deviceSetIndex) + { + return new MsgDeviceSetFocus(deviceSetIndex); + } + + private: + int m_deviceSetIndex; + + MsgDeviceSetFocus(int deviceSetIndex) : + Message(), + m_deviceSetIndex(deviceSetIndex) + { } + }; + + class MsgDVSerial : public Message { + MESSAGE_CLASS_DECLARATION + + public: + bool getActive() const { return m_active; } + + static MsgDVSerial* create(bool active) + { + return new MsgDVSerial(active); + } + + private: + bool m_active; + + MsgDVSerial(bool active) : + Message(), + m_active(active) + { } + }; + class MsgLoadPreset : public Message { MESSAGE_CLASS_DECLARATION @@ -374,6 +414,7 @@ public: friend class MainServer; friend class MainWindow; friend class WebAPIAdapterSrv; + friend class WebAPIAdapterGUI; private: MainSettings m_settings; diff --git a/sdrgui/limerfegui/limerfeusbdialog.cpp b/sdrgui/limerfegui/limerfeusbdialog.cpp index f5ca9603c..8466fd24f 100644 --- a/sdrgui/limerfegui/limerfeusbdialog.cpp +++ b/sdrgui/limerfegui/limerfeusbdialog.cpp @@ -665,8 +665,9 @@ void LimeRFEUSBDialog::stopStartRx(bool start) deviceSourceEngine->startAcquisition(); } - MainWindow::MsgDeviceSetFocus *msg = MainWindow::MsgDeviceSetFocus::create(m_rxDeviceSetIndex[rxDeviceSetSequence]); - m_mainWindow->getInputMessageQueue()->push(msg); + MainCore *mainCore = MainCore::instance(); + MainCore::MsgDeviceSetFocus *msg = MainCore::MsgDeviceSetFocus::create(m_rxDeviceSetIndex[rxDeviceSetSequence]); + mainCore->getMainMessageQueue()->push(msg); } else { @@ -690,8 +691,9 @@ void LimeRFEUSBDialog::stopStartTx(bool start) deviceSinkEngine->startGeneration(); } - MainWindow::MsgDeviceSetFocus *msg = MainWindow::MsgDeviceSetFocus::create(m_txDeviceSetIndex[txDeviceSetSequence]); - m_mainWindow->getInputMessageQueue()->push(msg); + MainCore *mainCore = MainCore::instance(); + MainCore::MsgDeviceSetFocus *msg = MainCore::MsgDeviceSetFocus::create(m_txDeviceSetIndex[txDeviceSetSequence]); + mainCore->getMainMessageQueue()->push(msg); } else { @@ -884,4 +886,4 @@ void LimeRFEUSBDialog::on_apply_clicked() void LimeRFEUSBDialog::tick() { refreshPower(); -} \ No newline at end of file +} diff --git a/sdrgui/mainwindow.cpp b/sdrgui/mainwindow.cpp index c9c7dc950..2ca5b64b5 100644 --- a/sdrgui/mainwindow.cpp +++ b/sdrgui/mainwindow.cpp @@ -87,40 +87,27 @@ #include "limerfegui/limerfeusbdialog.h" #endif -MESSAGE_CLASS_DEFINITION(MainWindow::MsgLoadPreset, Message) -MESSAGE_CLASS_DEFINITION(MainWindow::MsgSavePreset, Message) -MESSAGE_CLASS_DEFINITION(MainWindow::MsgDeletePreset, Message) -MESSAGE_CLASS_DEFINITION(MainWindow::MsgLoadFeatureSetPreset, Message) -MESSAGE_CLASS_DEFINITION(MainWindow::MsgSaveFeatureSetPreset, Message) -MESSAGE_CLASS_DEFINITION(MainWindow::MsgDeleteFeatureSetPreset, Message) -MESSAGE_CLASS_DEFINITION(MainWindow::MsgAddDeviceSet, Message) -MESSAGE_CLASS_DEFINITION(MainWindow::MsgRemoveLastDeviceSet, Message) -MESSAGE_CLASS_DEFINITION(MainWindow::MsgSetDevice, Message) -MESSAGE_CLASS_DEFINITION(MainWindow::MsgAddChannel, Message) -MESSAGE_CLASS_DEFINITION(MainWindow::MsgDeleteChannel, Message) -MESSAGE_CLASS_DEFINITION(MainWindow::MsgDeviceSetFocus, Message) -MESSAGE_CLASS_DEFINITION(MainWindow::MsgApplySettings, Message) -MESSAGE_CLASS_DEFINITION(MainWindow::MsgAddFeature, Message) -MESSAGE_CLASS_DEFINITION(MainWindow::MsgDeleteFeature, Message) - MainWindow *MainWindow::m_instance = 0; MainWindow::MainWindow(qtwebapp::LoggerWithFile *logger, const MainParser& parser, QWidget* parent) : QMainWindow(parent), ui(new Ui::MainWindow), - m_settings(), - m_masterTabIndex(0), + m_mainCore(MainCore::instance()), m_dspEngine(DSPEngine::instance()), m_lastEngineState(DeviceAPI::StNotStarted), m_inputGUI(0), m_sampleRate(0), m_centerFrequency(0), - m_sampleFileName(std::string("./test.sdriq")), - m_logger(logger) + m_sampleFileName(std::string("./test.sdriq")) { qDebug() << "MainWindow::MainWindow: start"; m_instance = this; + m_mainCore->m_logger = logger; + m_mainCore->m_masterTabIndex = 0; + m_mainCore->m_mainMessageQueue = &m_inputMessageQueue; + m_mainCore->m_settings.setAudioDeviceManager(m_dspEngine->getAudioDeviceManager()); + m_mainCore->m_settings.setAMBEEngine(m_dspEngine->getAMBEEngine()); QFontDatabase::addApplicationFont(":/LiberationSans-Regular.ttf"); QFontDatabase::addApplicationFont(":/LiberationMono-Regular.ttf"); @@ -136,9 +123,6 @@ MainWindow::MainWindow(qtwebapp::LoggerWithFile *logger, const MainParser& parse splash->showStatusMessage("starting...", Qt::white); splash->showStatusMessage("starting...", Qt::white); - m_settings.setAudioDeviceManager(m_dspEngine->getAudioDeviceManager()); - m_settings.setAMBEEngine(m_dspEngine->getAMBEEngine()); - ui->setupUi(this); createStatusBar(); @@ -187,9 +171,6 @@ MainWindow::MainWindow(qtwebapp::LoggerWithFile *logger, const MainParser& parse connect(&m_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus())); m_statusTimer.start(1000); - m_masterTimer.setTimerType(Qt::PreciseTimer); - m_masterTimer.start(50); - splash->showStatusMessage("allocate FFTs...", Qt::white); splash->showStatusMessage("allocate FFTs...", Qt::white); m_dspEngine->createFFTFactory(parser.getFFTWFWisdomFileName()); @@ -205,7 +186,7 @@ MainWindow::MainWindow(qtwebapp::LoggerWithFile *logger, const MainParser& parse m_pluginManager = new PluginManager(this); m_pluginManager->loadPlugins(QString("plugins")); - m_pluginManager->loadPluginsNonDiscoverable(m_settings.getDeviceUserArgs()); + m_pluginManager->loadPluginsNonDiscoverable(m_mainCore->m_settings.getDeviceUserArgs()); splash->showStatusMessage("load initial feature set...", Qt::white); QStringList featureNames; @@ -213,13 +194,13 @@ MainWindow::MainWindow(qtwebapp::LoggerWithFile *logger, const MainParser& parse ui->featureDock->addAvailableFeatures(featureNames); addFeatureSet(); ui->featureDock->setFeatureUISet(m_featureUIs[0]); - ui->featureDock->setPresets(m_settings.getFeatureSetPresets()); + ui->featureDock->setPresets(m_mainCore->m_settings.getFeatureSetPresets()); ui->featureDock->setPluginAPI(m_pluginManager->getPluginAPI()); splash->showStatusMessage("load file input...", Qt::white); qDebug() << "MainWindow::MainWindow: select SampleSource from settings or default (file input)..."; - int deviceIndex = DeviceEnumerator::instance()->getRxSamplingDeviceIndex(m_settings.getSourceDeviceId(), m_settings.getSourceIndex()); + int deviceIndex = DeviceEnumerator::instance()->getRxSamplingDeviceIndex(m_mainCore->m_settings.getSourceDeviceId(), m_mainCore->m_settings.getSourceIndex()); addSourceDevice(deviceIndex); // add the first device set with file input device as default if device in settings is not enumerated m_deviceUIs.back()->m_deviceAPI->setBuddyLeader(true); // the first device is always the leader tabChannelsIndexChanged(); // force channel selection list update @@ -227,9 +208,9 @@ MainWindow::MainWindow(qtwebapp::LoggerWithFile *logger, const MainParser& parse splash->showStatusMessage("load current preset settings...", Qt::white); qDebug() << "MainWindow::MainWindow: load current preset settings..."; - loadPresetSettings(m_settings.getWorkingPreset(), 0); - m_apiAdapter = new WebAPIAdapterGUI(*this); - loadFeatureSetPresetSettings(m_settings.getWorkingFeatureSetPreset(), 0); + loadPresetSettings(m_mainCore->m_settings.getWorkingPreset(), 0); + m_apiAdapter = new WebAPIAdapterGUI(); + loadFeatureSetPresetSettings(m_mainCore->m_settings.getWorkingFeatureSetPreset(), 0); splash->showStatusMessage("update preset controls...", Qt::white); qDebug() << "MainWindow::MainWindow: update preset controls..."; @@ -299,7 +280,6 @@ MainWindow::~MainWindow() delete ui; qDebug() << "MainWindow::~MainWindow: end"; - delete m_logger; delete m_commandKeyReceiver; } @@ -315,7 +295,7 @@ void MainWindow::addSourceDevice(int deviceIndex) int deviceTabIndex = m_deviceUIs.size(); ui->inputViewDock->addDevice(0, deviceTabIndex); - m_deviceUIs.push_back(new DeviceUISet(deviceTabIndex, 0, m_masterTimer)); + m_deviceUIs.push_back(new DeviceUISet(deviceTabIndex, 0, m_mainCore->m_masterTimer)); m_deviceUIs.back()->m_deviceSourceEngine = dspDeviceSourceEngine; m_deviceUIs.back()->m_deviceSinkEngine = nullptr; m_deviceUIs.back()->m_deviceMIMOEngine = nullptr; @@ -350,7 +330,7 @@ void MainWindow::addSourceDevice(int deviceIndex) m_deviceUIs.back()->m_deviceAPI->setSamplingDeviceDisplayName(samplingDevice->displayedName); m_deviceUIs.back()->m_deviceAPI->setSamplingDevicePluginInterface(DeviceEnumerator::instance()->getRxPluginInterface(deviceIndex)); - QString userArgs = m_settings.getDeviceUserArgs().findUserArgs(samplingDevice->hardwareId, samplingDevice->sequence); + QString userArgs = m_mainCore->m_settings.getDeviceUserArgs().findUserArgs(samplingDevice->hardwareId, samplingDevice->sequence); if (userArgs.size() > 0) { m_deviceUIs.back()->m_deviceAPI->setHardwareUserArguments(userArgs); @@ -389,7 +369,7 @@ void MainWindow::addSinkDevice() int deviceTabIndex = m_deviceUIs.size(); ui->inputViewDock->addDevice(1, deviceTabIndex); - m_deviceUIs.push_back(new DeviceUISet(deviceTabIndex, 1, m_masterTimer)); + m_deviceUIs.push_back(new DeviceUISet(deviceTabIndex, 1, m_mainCore->m_masterTimer)); m_deviceUIs.back()->m_deviceSourceEngine = nullptr; m_deviceUIs.back()->m_deviceSinkEngine = dspDeviceSinkEngine; m_deviceUIs.back()->m_deviceMIMOEngine = nullptr; @@ -422,7 +402,7 @@ void MainWindow::addSinkDevice() m_deviceUIs.back()->m_deviceAPI->setSamplingDeviceDisplayName(samplingDevice->displayedName); m_deviceUIs.back()->m_deviceAPI->setSamplingDevicePluginInterface(DeviceEnumerator::instance()->getTxPluginInterface(fileSinkDeviceIndex)); - QString userArgs = m_settings.getDeviceUserArgs().findUserArgs(samplingDevice->hardwareId, samplingDevice->sequence); + QString userArgs = m_mainCore->m_settings.getDeviceUserArgs().findUserArgs(samplingDevice->hardwareId, samplingDevice->sequence); if (userArgs.size() > 0) { m_deviceUIs.back()->m_deviceAPI->setHardwareUserArguments(userArgs); @@ -647,28 +627,28 @@ void MainWindow::loadSettings() { qDebug() << "MainWindow::loadSettings"; - m_settings.load(); - m_settings.sortPresets(); - int middleIndex = m_settings.getPresetCount() / 2; + m_mainCore->m_settings.load(); + m_mainCore->m_settings.sortPresets(); + int middleIndex = m_mainCore->m_settings.getPresetCount() / 2; QTreeWidgetItem *treeItem; - for (int i = 0; i < m_settings.getPresetCount(); ++i) + for (int i = 0; i < m_mainCore->m_settings.getPresetCount(); ++i) { - treeItem = addPresetToTree(m_settings.getPreset(i)); + treeItem = addPresetToTree(m_mainCore->m_settings.getPreset(i)); if (i == middleIndex) { ui->presetTree->setCurrentItem(treeItem); } } - m_settings.sortCommands(); + m_mainCore->m_settings.sortCommands(); - for (int i = 0; i < m_settings.getCommandCount(); ++i) + for (int i = 0; i < m_mainCore->m_settings.getCommandCount(); ++i) { - treeItem = addCommandToTree(m_settings.getCommand(i)); + treeItem = addCommandToTree(m_mainCore->m_settings.getCommand(i)); } - setLoggingOptions(); + m_mainCore->setLoggingOptions(); } void MainWindow::loadPresetSettings(const Preset* preset, int tabIndex) @@ -791,9 +771,9 @@ void MainWindow::closeEvent(QCloseEvent *closeEvent) { qDebug("MainWindow::closeEvent"); - savePresetSettings(m_settings.getWorkingPreset(), 0); - saveFeatureSetPresetSettings(m_settings.getWorkingFeatureSetPreset(), 0); - m_settings.save(); + savePresetSettings(m_mainCore->m_settings.getWorkingPreset(), 0); + saveFeatureSetPresetSettings(m_mainCore->m_settings.getWorkingFeatureSetPreset(), 0); + m_mainCore->m_settings.save(); while (m_deviceUIs.size() > 0) { @@ -896,67 +876,67 @@ QTreeWidgetItem* MainWindow::addCommandToTree(const Command* command) void MainWindow::applySettings() { - loadPresetSettings(m_settings.getWorkingPreset(), 0); - loadFeatureSetPresetSettings(m_settings.getWorkingFeatureSetPreset(), 0); + loadPresetSettings(m_mainCore->m_settings.getWorkingPreset(), 0); + loadFeatureSetPresetSettings(m_mainCore->m_settings.getWorkingFeatureSetPreset(), 0); - m_settings.sortPresets(); - int middleIndex = m_settings.getPresetCount() / 2; + m_mainCore->m_settings.sortPresets(); + int middleIndex = m_mainCore->m_settings.getPresetCount() / 2; QTreeWidgetItem *treeItem; ui->presetTree->clear(); - for (int i = 0; i < m_settings.getPresetCount(); ++i) + for (int i = 0; i < m_mainCore->m_settings.getPresetCount(); ++i) { - treeItem = addPresetToTree(m_settings.getPreset(i)); + treeItem = addPresetToTree(m_mainCore->m_settings.getPreset(i)); if (i == middleIndex) { ui->presetTree->setCurrentItem(treeItem); } } - m_settings.sortCommands(); + m_mainCore->m_settings.sortCommands(); ui->commandTree->clear(); - for (int i = 0; i < m_settings.getCommandCount(); ++i) { - treeItem = addCommandToTree(m_settings.getCommand(i)); + for (int i = 0; i < m_mainCore->m_settings.getCommandCount(); ++i) { + treeItem = addCommandToTree(m_mainCore->m_settings.getCommand(i)); } - setLoggingOptions(); + m_mainCore->setLoggingOptions(); } bool MainWindow::handleMessage(const Message& cmd) { - if (MsgLoadPreset::match(cmd)) + if (MainCore::MsgLoadPreset::match(cmd)) { - MsgLoadPreset& notif = (MsgLoadPreset&) cmd; + MainCore::MsgLoadPreset& notif = (MainCore::MsgLoadPreset&) cmd; loadPresetSettings(notif.getPreset(), notif.getDeviceSetIndex()); return true; } - else if (MsgSavePreset::match(cmd)) + else if (MainCore::MsgSavePreset::match(cmd)) { - MsgSavePreset& notif = (MsgSavePreset&) cmd; + MainCore::MsgSavePreset& notif = (MainCore::MsgSavePreset&) cmd; savePresetSettings(notif.getPreset(), notif.getDeviceSetIndex()); if (notif.isNewPreset()) { ui->presetTree->setCurrentItem(addPresetToTree(notif.getPreset())); } - m_settings.sortPresets(); - m_settings.save(); + m_mainCore->m_settings.sortPresets(); + m_mainCore->m_settings.save(); return true; } - else if (MsgLoadFeatureSetPreset::match(cmd)) + else if (MainCore::MsgLoadFeatureSetPreset::match(cmd)) { - MsgLoadFeatureSetPreset& notif = (MsgLoadFeatureSetPreset&) cmd; + MainCore::MsgLoadFeatureSetPreset& notif = (MainCore::MsgLoadFeatureSetPreset&) cmd; loadFeatureSetPresetSettings(notif.getPreset(), notif.getFeatureSetIndex()); return true; } - else if (MsgSaveFeatureSetPreset::match(cmd)) + else if (MainCore::MsgSaveFeatureSetPreset::match(cmd)) { - MsgSaveFeatureSetPreset& notif = (MsgSaveFeatureSetPreset&) cmd; + MainCore::MsgSaveFeatureSetPreset& notif = (MainCore::MsgSaveFeatureSetPreset&) cmd; saveFeatureSetPresetSettings(notif.getPreset(), notif.getFeatureSetIndex()); - m_settings.sortFeatureSetPresets(); - m_settings.save(); + m_mainCore->m_settings.sortFeatureSetPresets(); + m_mainCore->m_settings.save(); return true; } - else if (MsgDeletePreset::match(cmd)) + else if (MainCore::MsgDeletePreset::match(cmd)) { - MsgDeletePreset& notif = (MsgDeletePreset&) cmd; + MainCore::MsgDeletePreset& notif = (MainCore::MsgDeletePreset&) cmd; const Preset *presetToDelete = notif.getPreset(); // remove preset from tree @@ -982,12 +962,12 @@ bool MainWindow::handleMessage(const Message& cmd) } // remove preset from settings - m_settings.deletePreset(presetToDelete); + m_mainCore->m_settings.deletePreset(presetToDelete); return true; } - else if (MsgAddDeviceSet::match(cmd)) + else if (MainCore::MsgAddDeviceSet::match(cmd)) { - MsgAddDeviceSet& notif = (MsgAddDeviceSet&) cmd; + MainCore::MsgAddDeviceSet& notif = (MainCore::MsgAddDeviceSet&) cmd; int direction = notif.getDirection(); if (direction == 1) { // Single stream Tx @@ -998,7 +978,7 @@ bool MainWindow::handleMessage(const Message& cmd) return true; } - else if (MsgRemoveLastDeviceSet::match(cmd)) + else if (MainCore::MsgRemoveLastDeviceSet::match(cmd)) { if (m_deviceUIs.size() > 1) { removeLastDevice(); @@ -1006,9 +986,9 @@ bool MainWindow::handleMessage(const Message& cmd) return true; } - else if (MsgSetDevice::match(cmd)) + else if (MainCore::MsgSetDevice::match(cmd)) { - MsgSetDevice& notif = (MsgSetDevice&) cmd; + MainCore::MsgSetDevice& notif = (MainCore::MsgSetDevice&) cmd; ui->tabInputsView->setCurrentIndex(notif.getDeviceSetIndex()); DeviceUISet *deviceUI = m_deviceUIs[notif.getDeviceSetIndex()]; ui->inputViewDock->setSelectedDeviceIndex(notif.getDeviceSetIndex(), notif.getDeviceIndex()); @@ -1016,47 +996,53 @@ bool MainWindow::handleMessage(const Message& cmd) return true; } - else if (MsgAddChannel::match(cmd)) + else if (MainCore::MsgAddChannel::match(cmd)) { - MsgAddChannel& notif = (MsgAddChannel&) cmd; + MainCore::MsgAddChannel& notif = (MainCore::MsgAddChannel&) cmd; ui->tabInputsView->setCurrentIndex(notif.getDeviceSetIndex()); channelAddClicked(notif.getChannelRegistrationIndex()); return true; } - else if (MsgDeleteChannel::match(cmd)) + else if (MainCore::MsgDeleteChannel::match(cmd)) { - MsgDeleteChannel& notif = (MsgDeleteChannel&) cmd; + MainCore::MsgDeleteChannel& notif = (MainCore::MsgDeleteChannel&) cmd; deleteChannel(notif.getDeviceSetIndex(), notif.getChannelIndex()); return true; } - else if (MsgDeviceSetFocus::match(cmd)) + else if (MainCore::MsgDeviceSetFocus::match(cmd)) { - MsgDeviceSetFocus& notif = (MsgDeviceSetFocus&) cmd; + MainCore::MsgDeviceSetFocus& notif = (MainCore::MsgDeviceSetFocus&) cmd; int index = notif.getDeviceSetIndex(); if ((index >= 0) && (index < (int) m_deviceUIs.size())) { ui->tabInputsView->setCurrentIndex(index); } } - else if (MsgAddFeature::match(cmd)) + else if (MainCore::MsgAddFeature::match(cmd)) { - MsgAddFeature& notif = (MsgAddFeature&) cmd; + MainCore::MsgAddFeature& notif = (MainCore::MsgAddFeature&) cmd; ui->tabFeatures->setCurrentIndex(notif.getFeatureSetIndex()); featureAddClicked(notif.getFeatureRegistrationIndex()); return true; } - else if (MsgDeleteFeature::match(cmd)) + else if (MainCore::MsgDeleteFeature::match(cmd)) { - MsgDeleteFeature& notif = (MsgDeleteFeature&) cmd; + MainCore::MsgDeleteFeature& notif = (MainCore::MsgDeleteFeature&) cmd; deleteFeature(notif.getFeatureSetIndex(), notif.getFeatureIndex()); return true; } - else if (MsgApplySettings::match(cmd)) + else if (MainCore::MsgApplySettings::match(cmd)) { applySettings(); return true; } + else if (MainCore::MsgDVSerial::match(cmd)) + { + MainCore::MsgDVSerial& notif = (MainCore::MsgDVSerial&) cmd; + ui->action_DV_Serial->setChecked(notif.getActive()); + return true; + } return false; } @@ -1113,9 +1099,9 @@ void MainWindow::on_commandNew_clicked() if (editCommandDialog.exec() == QDialog::Accepted) { editCommandDialog.toCommand(*command); - m_settings.addCommand(command); + m_mainCore->m_settings.addCommand(command); ui->commandTree->setCurrentItem(addCommandToTree(command)); - m_settings.sortCommands(); + m_mainCore->m_settings.sortCommands(); } } @@ -1124,9 +1110,9 @@ void MainWindow::on_commandDuplicate_clicked() QTreeWidgetItem* item = ui->commandTree->currentItem(); const Command* command = qvariant_cast(item->data(0, Qt::UserRole)); Command *commandCopy = new Command(*command); - m_settings.addCommand(commandCopy); + m_mainCore->m_settings.addCommand(commandCopy); ui->commandTree->setCurrentItem(addCommandToTree(commandCopy)); - m_settings.sortCommands(); + m_mainCore->m_settings.sortCommands(); } void MainWindow::on_commandEdit_clicked() @@ -1171,7 +1157,7 @@ void MainWindow::on_commandEdit_clicked() if (dlg.exec() == QDialog::Accepted) { - m_settings.renameCommandGroup(item->text(0), dlg.group()); + m_mainCore->m_settings.renameCommandGroup(item->text(0), dlg.group()); newGroupName = dlg.group(); change = true; } @@ -1180,12 +1166,12 @@ void MainWindow::on_commandEdit_clicked() if (change) { - m_settings.sortCommands(); + m_mainCore->m_settings.sortCommands(); ui->commandTree->clear(); - for (int i = 0; i < m_settings.getCommandCount(); ++i) + for (int i = 0; i < m_mainCore->m_settings.getCommandCount(); ++i) { - QTreeWidgetItem *item_x = addCommandToTree(m_settings.getCommand(i)); + QTreeWidgetItem *item_x = addCommandToTree(m_mainCore->m_settings.getCommand(i)); const Command* command_x = qvariant_cast(item_x->data(0, Qt::UserRole)); if (changedCommand && (command_x == changedCommand)) { // set cursor on changed command ui->commandTree->setCurrentItem(item_x); @@ -1224,7 +1210,7 @@ void MainWindow::on_commandDelete_clicked() .arg(command->getDescription()), QMessageBox::No | QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) { delete item; - m_settings.deleteCommand(command); + m_mainCore->m_settings.deleteCommand(command); } } } @@ -1235,12 +1221,12 @@ void MainWindow::on_commandDelete_clicked() tr("Do you want to delete command group '%1'?") .arg(item->text(0)), QMessageBox::No | QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) { - m_settings.deleteCommandGroup(item->text(0)); + m_mainCore->m_settings.deleteCommandGroup(item->text(0)); ui->commandTree->clear(); - for (int i = 0; i < m_settings.getCommandCount(); ++i) { - addCommandToTree(m_settings.getCommand(i)); + for (int i = 0; i < m_mainCore->m_settings.getCommandCount(); ++i) { + addCommandToTree(m_mainCore->m_settings.getCommand(i)); } } } @@ -1265,9 +1251,9 @@ void MainWindow::on_commandRun_clicked() { QString group = item->text(0); - for (int i = 0; i < m_settings.getCommandCount(); ++i) + for (int i = 0; i < m_mainCore->m_settings.getCommandCount(); ++i) { - Command *command_mod = const_cast(m_settings.getCommand(i)); + Command *command_mod = const_cast(m_mainCore->m_settings.getCommand(i)); if (command_mod->getGroup() == group) { command_mod->run(m_apiServer->getHost(), m_apiServer->getPort(), currentDeviceSetIndex); @@ -1293,7 +1279,7 @@ void MainWindow::on_commandOutput_clicked() void MainWindow::on_commandsSave_clicked() { saveCommandSettings(); - m_settings.save(); + m_mainCore->m_settings.save(); } void MainWindow::commandKeysConnect(QObject *object, const char *slot) @@ -1352,13 +1338,13 @@ void MainWindow::on_presetSave_clicked() } if(dlg.exec() == QDialog::Accepted) { - Preset* preset = m_settings.newPreset(dlg.group(), dlg.description()); + Preset* preset = m_mainCore->m_settings.newPreset(dlg.group(), dlg.description()); savePresetSettings(preset, ui->tabInputsView->currentIndex()); ui->presetTree->setCurrentItem(addPresetToTree(preset)); } - m_settings.sortPresets(); + m_mainCore->m_settings.sortPresets(); } void MainWindow::on_presetUpdate_clicked() @@ -1381,12 +1367,12 @@ void MainWindow::on_presetUpdate_clicked() } } - m_settings.sortPresets(); + m_mainCore->m_settings.sortPresets(); ui->presetTree->clear(); - for (int i = 0; i < m_settings.getPresetCount(); ++i) + for (int i = 0; i < m_mainCore->m_settings.getPresetCount(); ++i) { - QTreeWidgetItem *item_x = addPresetToTree(m_settings.getPreset(i)); + QTreeWidgetItem *item_x = addPresetToTree(m_mainCore->m_settings.getPreset(i)); const Preset* preset_x = qvariant_cast(item_x->data(0, Qt::UserRole)); if (changedPreset && (preset_x == changedPreset)) { // set cursor on changed preset ui->presetTree->setCurrentItem(item_x); @@ -1431,7 +1417,7 @@ void MainWindow::on_presetEdit_clicked() if (dlg.exec() == QDialog::Accepted) { - m_settings.renamePresetGroup(item->text(0), dlg.group()); + m_mainCore->m_settings.renamePresetGroup(item->text(0), dlg.group()); newGroupName = dlg.group(); change = true; } @@ -1440,12 +1426,12 @@ void MainWindow::on_presetEdit_clicked() if (change) { - m_settings.sortPresets(); + m_mainCore->m_settings.sortPresets(); ui->presetTree->clear(); - for (int i = 0; i < m_settings.getPresetCount(); ++i) + for (int i = 0; i < m_mainCore->m_settings.getPresetCount(); ++i) { - QTreeWidgetItem *item_x = addPresetToTree(m_settings.getPreset(i)); + QTreeWidgetItem *item_x = addPresetToTree(m_mainCore->m_settings.getPreset(i)); const Preset* preset_x = qvariant_cast(item_x->data(0, Qt::UserRole)); if (changedPreset && (preset_x == changedPreset)) { // set cursor on changed preset ui->presetTree->setCurrentItem(item_x); @@ -1533,7 +1519,7 @@ void MainWindow::on_presetImport_clicked() instream >> base64Str; exportFile.close(); - Preset* preset = m_settings.newPreset("", ""); + Preset* preset = m_mainCore->m_settings.newPreset("", ""); preset->deserialize(QByteArray::fromBase64(base64Str)); preset->setGroup(group); // override with current group @@ -1549,9 +1535,9 @@ void MainWindow::on_presetImport_clicked() void MainWindow::on_settingsSave_clicked() { - savePresetSettings(m_settings.getWorkingPreset(), ui->tabInputsView->currentIndex()); - saveFeatureSetPresetSettings(m_settings.getWorkingFeatureSetPreset(), ui->tabFeatures->currentIndex()); - m_settings.save(); + savePresetSettings(m_mainCore->m_settings.getWorkingPreset(), ui->tabInputsView->currentIndex()); + saveFeatureSetPresetSettings(m_mainCore->m_settings.getWorkingFeatureSetPreset(), ui->tabFeatures->currentIndex()); + m_mainCore->m_settings.save(); } void MainWindow::on_presetLoad_clicked() @@ -1597,7 +1583,7 @@ void MainWindow::on_presetDelete_clicked() { if(QMessageBox::question(this, tr("Delete Preset"), tr("Do you want to delete preset '%1'?").arg(preset->getDescription()), QMessageBox::No | QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) { delete item; - m_settings.deletePreset(preset); + m_mainCore->m_settings.deletePreset(preset); } } } @@ -1608,12 +1594,12 @@ void MainWindow::on_presetDelete_clicked() tr("Do you want to delete preset group '%1'?") .arg(item->text(0)), QMessageBox::No | QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes) { - m_settings.deletePresetGroup(item->text(0)); + m_mainCore->m_settings.deletePresetGroup(item->text(0)); ui->presetTree->clear(); - for (int i = 0; i < m_settings.getPresetCount(); ++i) { - addPresetToTree(m_settings.getPreset(i)); + for (int i = 0; i < m_mainCore->m_settings.getPresetCount(); ++i) { + addPresetToTree(m_mainCore->m_settings.getPreset(i)); } } } @@ -1648,21 +1634,21 @@ void MainWindow::on_action_Audio_triggered() void MainWindow::on_action_Logging_triggered() { - LoggingDialog loggingDialog(m_settings, this); + LoggingDialog loggingDialog(m_mainCore->m_settings, this); loggingDialog.exec(); - setLoggingOptions(); + m_mainCore->setLoggingOptions(); } void MainWindow::on_action_My_Position_triggered() { - MyPositionDialog myPositionDialog(m_settings, this); + MyPositionDialog myPositionDialog(m_mainCore->m_settings, this); myPositionDialog.exec(); } void MainWindow::on_action_DeviceUserArguments_triggered() { qDebug("MainWindow::on_action_DeviceUserArguments_triggered"); - DeviceUserArgsDialog deviceUserArgsDialog(DeviceEnumerator::instance(), m_settings.getDeviceUserArgs(), this); + DeviceUserArgsDialog deviceUserArgsDialog(DeviceEnumerator::instance(), m_mainCore->m_settings.getDeviceUserArgs(), this); deviceUserArgsDialog.exec(); } @@ -1680,7 +1666,7 @@ void MainWindow::on_action_LimeRFE_triggered() qDebug("MainWindow::on_action_LimeRFE_triggered"); #if defined(HAS_LIMERFEUSB) qDebug("MainWindow::on_action_LimeRFE_triggered: activated"); - LimeRFEUSBDialog *limeRFEUSBDialog = new LimeRFEUSBDialog(m_settings.getLimeRFEUSBCalib(), this); + LimeRFEUSBDialog *limeRFEUSBDialog = new LimeRFEUSBDialog(m_mainCore->m_settings.getLimeRFEUSBCalib(), this); limeRFEUSBDialog->setModal(false); limeRFEUSBDialog->show(); #endif @@ -1705,7 +1691,7 @@ void MainWindow::sampleSourceChanged(int tabIndex, int newDeviceIndex) { qDebug("MainWindow::sampleSourceChanged: tab at %d", tabIndex); DeviceUISet *deviceUI = m_deviceUIs[tabIndex]; - deviceUI->m_deviceAPI->saveSamplingDeviceSettings(m_settings.getWorkingPreset()); // save old API settings + deviceUI->m_deviceAPI->saveSamplingDeviceSettings(m_mainCore->m_settings.getWorkingPreset()); // save old API settings deviceUI->m_deviceAPI->stopDeviceEngine(); // deletes old UI and input object @@ -1742,7 +1728,7 @@ void MainWindow::sampleSourceChanged(int tabIndex, int newDeviceIndex) deviceUI->m_deviceAPI->setSamplingDevicePluginInterface(DeviceEnumerator::instance()->getRxPluginInterface(fileInputDeviceIndex)); } - QString userArgs = m_settings.getDeviceUserArgs().findUserArgs(samplingDevice->hardwareId, samplingDevice->sequence); + QString userArgs = m_mainCore->m_settings.getDeviceUserArgs().findUserArgs(samplingDevice->hardwareId, samplingDevice->sequence); if (userArgs.size() > 0) { deviceUI->m_deviceAPI->setHardwareUserArguments(userArgs); @@ -1796,12 +1782,12 @@ void MainWindow::sampleSourceChanged(int tabIndex, int newDeviceIndex) setDeviceGUI(tabIndex, gui, deviceUI->m_deviceAPI->getSamplingDeviceDisplayName()); deviceUI->m_deviceAPI->getSampleSource()->init(); - deviceUI->m_deviceAPI->loadSamplingDeviceSettings(m_settings.getWorkingPreset()); // load new API settings + deviceUI->m_deviceAPI->loadSamplingDeviceSettings(m_mainCore->m_settings.getWorkingPreset()); // load new API settings if (tabIndex == 0) // save as default starting device { - m_settings.setSourceIndex(samplingDevice->sequence); - m_settings.setSourceDeviceId(samplingDevice->id); + m_mainCore->m_settings.setSourceIndex(samplingDevice->sequence); + m_mainCore->m_settings.setSourceDeviceId(samplingDevice->id); } } } @@ -1812,7 +1798,7 @@ void MainWindow::sampleSinkChanged(int tabIndex, int newDeviceIndex) { qDebug("MainWindow::sampleSinkChanged: tab at %d", tabIndex); DeviceUISet *deviceUI = m_deviceUIs[tabIndex]; - deviceUI->m_deviceAPI->saveSamplingDeviceSettings(m_settings.getWorkingPreset()); // save old API settings + deviceUI->m_deviceAPI->saveSamplingDeviceSettings(m_mainCore->m_settings.getWorkingPreset()); // save old API settings deviceUI->m_deviceAPI->stopDeviceEngine(); // deletes old UI and output object @@ -1847,7 +1833,7 @@ void MainWindow::sampleSinkChanged(int tabIndex, int newDeviceIndex) deviceUI->m_deviceAPI->setSamplingDevicePluginInterface(DeviceEnumerator::instance()->getTxPluginInterface(fileSinkDeviceIndex)); } - QString userArgs = m_settings.getDeviceUserArgs().findUserArgs(samplingDevice->hardwareId, samplingDevice->sequence); + QString userArgs = m_mainCore->m_settings.getDeviceUserArgs().findUserArgs(samplingDevice->hardwareId, samplingDevice->sequence); if (userArgs.size() > 0) { deviceUI->m_deviceAPI->setHardwareUserArguments(userArgs); @@ -1901,7 +1887,7 @@ void MainWindow::sampleSinkChanged(int tabIndex, int newDeviceIndex) setDeviceGUI(tabIndex, gui, deviceUI->m_deviceAPI->getSamplingDeviceDisplayName(), 1); deviceUI->m_deviceAPI->getSampleSink()->init(); - deviceUI->m_deviceAPI->loadSamplingDeviceSettings(m_settings.getWorkingPreset()); // load new API settings + deviceUI->m_deviceAPI->loadSamplingDeviceSettings(m_mainCore->m_settings.getWorkingPreset()); // load new API settings } } @@ -1994,7 +1980,7 @@ void MainWindow::deleteFeature(int featureSetIndex, int featureIndex) void MainWindow::on_action_About_triggered() { - AboutDialog dlg(m_apiHost, m_apiPort, m_settings, this); + AboutDialog dlg(m_apiHost, m_apiPort, m_mainCore->m_settings, this); dlg.exec(); } @@ -2029,13 +2015,13 @@ void MainWindow::tabInputViewIndexChanged() ui->inputViewDock->setCurrentTabIndex(inputViewIndex); } - if ((inputViewIndex >= 0) && (m_masterTabIndex >= 0) && (inputViewIndex != m_masterTabIndex)) + if ((inputViewIndex >= 0) && (m_mainCore->m_masterTabIndex >= 0) && (inputViewIndex != m_mainCore->m_masterTabIndex)) { DeviceUISet *deviceUI = m_deviceUIs[inputViewIndex]; - DeviceUISet *lastdeviceUI = m_deviceUIs[m_masterTabIndex]; + DeviceUISet *lastdeviceUI = m_deviceUIs[m_mainCore->m_masterTabIndex]; lastdeviceUI->m_mainWindowState = saveState(); restoreState(deviceUI->m_mainWindowState); - m_masterTabIndex = inputViewIndex; + m_mainCore->m_masterTabIndex = inputViewIndex; } ui->tabSpectra->setCurrentIndex(inputViewIndex); @@ -2080,63 +2066,14 @@ void MainWindow::updateStatus() m_dateTimeWidget->setText(QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss t")); } -void MainWindow::setLoggingOptions() -{ - m_logger->setConsoleMinMessageLevel(m_settings.getConsoleMinLogLevel()); - - if (m_settings.getUseLogFile()) - { - qtwebapp::FileLoggerSettings fileLoggerSettings; // default values - - if (m_logger->hasFileLogger()) { - fileLoggerSettings = m_logger->getFileLoggerSettings(); // values from file logger if it exists - } - - fileLoggerSettings.fileName = m_settings.getLogFileName(); // put new values - m_logger->createOrSetFileLogger(fileLoggerSettings, 2000); // create file logger if it does not exist and apply settings in any case - } - - if (m_logger->hasFileLogger()) { - m_logger->setFileMinMessageLevel(m_settings.getFileMinLogLevel()); - } - - m_logger->setUseFileLogger(m_settings.getUseLogFile()); - - if (m_settings.getUseLogFile()) - { -#if QT_VERSION >= 0x050400 - QString appInfoStr(tr("%1 %2 Qt %3 %4b %5 %6 DSP Rx:%7b Tx:%8b PID %9") - .arg(qApp->applicationName()) - .arg(qApp->applicationVersion()) - .arg(QT_VERSION_STR) - .arg(QT_POINTER_SIZE*8) - .arg(QSysInfo::currentCpuArchitecture()) - .arg(QSysInfo::prettyProductName()) - .arg(SDR_RX_SAMP_SZ) - .arg(SDR_TX_SAMP_SZ) - .arg(qApp->applicationPid())); -#else - QString appInfoStr(tr("%1 %2 Qt %3 %4b DSP Rx:%5b Tx:%6b PID %7") - .arg(qApp->applicationName()) - .arg(qApp->applicationVersion()) - .arg(QT_VERSION_STR) - .arg(QT_POINTER_SIZE*8) - .arg(SDR_RX_SAMP_SZ) - .arg(SDR_TX_SAMP_SZ) - .arg(qApp->applicationPid())); - #endif - m_logger->logToFile(QtInfoMsg, appInfoStr); - } -} - void MainWindow::commandKeyPressed(Qt::Key key, Qt::KeyboardModifiers keyModifiers, bool release) { //qDebug("MainWindow::commandKeyPressed: key: %x mod: %x %s", (int) key, (int) keyModifiers, release ? "release" : "press"); int currentDeviceSetIndex = ui->tabInputsView->currentIndex(); - for (int i = 0; i < m_settings.getCommandCount(); ++i) + for (int i = 0; i < m_mainCore->m_settings.getCommandCount(); ++i) { - const Command* command = m_settings.getCommand(i); + const Command* command = m_mainCore->m_settings.getCommand(i); if (command->getAssociateKey() && (command->getRelease() == release) diff --git a/sdrgui/mainwindow.h b/sdrgui/mainwindow.h index a53d7ed21..23ef4fd97 100644 --- a/sdrgui/mainwindow.h +++ b/sdrgui/mainwindow.h @@ -28,6 +28,7 @@ #include "util/messagequeue.h" #include "export.h" #include "mainparser.h" +#include "maincore.h" class QLabel; class QTreeWidgetItem; @@ -55,10 +56,6 @@ class Command; class FeatureSetPreset; class CommandKeyReceiver; -namespace qtwebapp { - class LoggerWithFile; -} - namespace Ui { class MainWindow; } @@ -67,26 +64,6 @@ class SDRGUI_API MainWindow : public QMainWindow { Q_OBJECT public: - class MsgDeviceSetFocus : public Message { - MESSAGE_CLASS_DECLARATION - - public: - int getDeviceSetIndex() const { return m_deviceSetIndex; } - - static MsgDeviceSetFocus* create(int deviceSetIndex) - { - return new MsgDeviceSetFocus(deviceSetIndex); - } - - private: - int m_deviceSetIndex; - - MsgDeviceSetFocus(int deviceSetIndex) : - Message(), - m_deviceSetIndex(deviceSetIndex) - { } - }; - explicit MainWindow(qtwebapp::LoggerWithFile *logger, const MainParser& parser, QWidget* parent = 0); ~MainWindow(); static MainWindow *getInstance() { return m_instance; } // Main Window is de facto a singleton so this just returns its reference @@ -97,8 +74,8 @@ public: void setDeviceGUI(int deviceTabIndex, QWidget* gui, const QString& deviceDisplayName, int deviceType = 0); - const QTimer& getMasterTimer() const { return m_masterTimer; } - const MainSettings& getMainSettings() const { return m_settings; } + const QTimer& getMasterTimer() const { return m_mainCore->m_masterTimer; } + const MainSettings& getMainSettings() const { return m_mainCore->m_settings; } const PluginManager *getPluginManager() const { return m_pluginManager; } std::vector& getDeviceUISets() { return m_deviceUIs; } void commandKeysConnect(QObject *object, const char *slot); @@ -109,299 +86,6 @@ public: friend class WebAPIAdapterGUI; private: - class MsgLoadPreset : public Message { - MESSAGE_CLASS_DECLARATION - - public: - const Preset *getPreset() const { return m_preset; } - int getDeviceSetIndex() const { return m_deviceSetIndex; } - - static MsgLoadPreset* create(const Preset *preset, int deviceSetIndex) - { - return new MsgLoadPreset(preset, deviceSetIndex); - } - - private: - const Preset *m_preset; - int m_deviceSetIndex; - - MsgLoadPreset(const Preset *preset, int deviceSetIndex) : - Message(), - m_preset(preset), - m_deviceSetIndex(deviceSetIndex) - { } - }; - - class MsgSavePreset : public Message { - MESSAGE_CLASS_DECLARATION - - public: - Preset *getPreset() const { return m_preset; } - int getDeviceSetIndex() const { return m_deviceSetIndex; } - bool isNewPreset() const { return m_newPreset; } - - static MsgSavePreset* create(Preset *preset, int deviceSetIndex, bool newPreset) - { - return new MsgSavePreset(preset, deviceSetIndex, newPreset); - } - - private: - Preset *m_preset; - int m_deviceSetIndex; - bool m_newPreset; - - MsgSavePreset(Preset *preset, int deviceSetIndex, bool newPreset) : - Message(), - m_preset(preset), - m_deviceSetIndex(deviceSetIndex), - m_newPreset(newPreset) - { } - }; - - class MsgDeletePreset : public Message { - MESSAGE_CLASS_DECLARATION - - public: - const Preset *getPreset() const { return m_preset; } - - static MsgDeletePreset* create(const Preset *preset) - { - return new MsgDeletePreset(preset); - } - - private: - const Preset *m_preset; - - MsgDeletePreset(const Preset *preset) : - Message(), - m_preset(preset) - { } - }; - - class MsgLoadFeatureSetPreset : public Message { - MESSAGE_CLASS_DECLARATION - - public: - const FeatureSetPreset *getPreset() const { return m_preset; } - int getFeatureSetIndex() const { return m_featureSetIndex; } - - static MsgLoadFeatureSetPreset* create(const FeatureSetPreset *preset, int featureSetIndex) - { - return new MsgLoadFeatureSetPreset(preset, featureSetIndex); - } - - private: - const FeatureSetPreset *m_preset; - int m_featureSetIndex; - - MsgLoadFeatureSetPreset(const FeatureSetPreset *preset, int featureSetIndex) : - Message(), - m_preset(preset), - m_featureSetIndex(featureSetIndex) - { } - }; - - class MsgSaveFeatureSetPreset : public Message { - MESSAGE_CLASS_DECLARATION - - public: - FeatureSetPreset *getPreset() const { return m_preset; } - int getFeatureSetIndex() const { return m_featureSetIndex; } - bool isNewPreset() const { return m_newPreset; } - - static MsgSaveFeatureSetPreset* create(FeatureSetPreset *preset, int featureSetIndex, bool newPreset) - { - return new MsgSaveFeatureSetPreset(preset, featureSetIndex, newPreset); - } - - private: - FeatureSetPreset *m_preset; - int m_featureSetIndex; - bool m_newPreset; - - MsgSaveFeatureSetPreset(FeatureSetPreset *preset, int featureSetIndex, bool newPreset) : - Message(), - m_preset(preset), - m_featureSetIndex(featureSetIndex), - m_newPreset(newPreset) - { } - }; - - class MsgDeleteFeatureSetPreset : public Message { - MESSAGE_CLASS_DECLARATION - - public: - const FeatureSetPreset *getPreset() const { return m_preset; } - - static MsgDeleteFeatureSetPreset* create(const FeatureSetPreset *preset) - { - return new MsgDeleteFeatureSetPreset(preset); - } - - private: - const FeatureSetPreset *m_preset; - - MsgDeleteFeatureSetPreset(const FeatureSetPreset *preset) : - Message(), - m_preset(preset) - { } - }; - - class MsgAddDeviceSet : public Message { - MESSAGE_CLASS_DECLARATION - - public: - int getDirection() const { return m_direction; } - - static MsgAddDeviceSet* create(int direction) - { - return new MsgAddDeviceSet(direction); - } - - private: - int m_direction; - - MsgAddDeviceSet(int direction) : - Message(), - m_direction(direction) - { } - }; - - class MsgRemoveLastDeviceSet : public Message { - MESSAGE_CLASS_DECLARATION - - public: - static MsgRemoveLastDeviceSet* create() - { - return new MsgRemoveLastDeviceSet(); - } - - private: - MsgRemoveLastDeviceSet() : - Message() - { } - }; - - class MsgSetDevice : public Message { - MESSAGE_CLASS_DECLARATION - - public: - int getDeviceSetIndex() const { return m_deviceSetIndex; } - int getDeviceIndex() const { return m_deviceIndex; } - int getDeviceType() const { return m_deviceType; } - - static MsgSetDevice* create(int deviceSetIndex, int deviceIndex, int deviceType) - { - return new MsgSetDevice(deviceSetIndex, deviceIndex, deviceType); - } - - private: - int m_deviceSetIndex; - int m_deviceIndex; - int m_deviceType; - - MsgSetDevice(int deviceSetIndex, int deviceIndex, int deviceType) : - Message(), - m_deviceSetIndex(deviceSetIndex), - m_deviceIndex(deviceIndex), - m_deviceType(deviceType) - { } - }; - - class MsgAddChannel : public Message { - MESSAGE_CLASS_DECLARATION - - public: - int getDeviceSetIndex() const { return m_deviceSetIndex; } - int getChannelRegistrationIndex() const { return m_channelRegistrationIndex; } - bool isTx() const { return m_tx; } - - static MsgAddChannel* create(int deviceSetIndex, int channelRegistrationIndex, bool tx) - { - return new MsgAddChannel(deviceSetIndex, channelRegistrationIndex, tx); - } - - private: - int m_deviceSetIndex; - int m_channelRegistrationIndex; - bool m_tx; - - MsgAddChannel(int deviceSetIndex, int channelRegistrationIndex, bool tx) : - Message(), - m_deviceSetIndex(deviceSetIndex), - m_channelRegistrationIndex(channelRegistrationIndex), - m_tx(tx) - { } - }; - - class MsgDeleteChannel : public Message { - MESSAGE_CLASS_DECLARATION - - public: - int getDeviceSetIndex() const { return m_deviceSetIndex; } - int getChannelIndex() const { return m_channelIndex; } - - static MsgDeleteChannel* create(int deviceSetIndex, int channelIndex) - { - return new MsgDeleteChannel(deviceSetIndex, channelIndex); - } - - private: - int m_deviceSetIndex; - int m_channelIndex; - - MsgDeleteChannel(int deviceSetIndex, int channelIndex) : - Message(), - m_deviceSetIndex(deviceSetIndex), - m_channelIndex(channelIndex) - { } - }; - - class MsgAddFeature : public Message { - MESSAGE_CLASS_DECLARATION - - public: - int getFeatureSetIndex() const { return m_featureSetIndex; } - int getFeatureRegistrationIndex() const { return m_featureRegistrationIndex; } - - static MsgAddFeature* create(int featureSetIndex, int featureRegistrationIndex) - { - return new MsgAddFeature(featureSetIndex, featureRegistrationIndex); - } - - private: - int m_featureSetIndex; - int m_featureRegistrationIndex; - - MsgAddFeature(int featureSetIndex, int featureRegistrationIndex) : - Message(), - m_featureSetIndex(featureSetIndex), - m_featureRegistrationIndex(featureRegistrationIndex) - { } - }; - - class MsgDeleteFeature : public Message { - MESSAGE_CLASS_DECLARATION - - public: - int getFeatureSetIndex() const { return m_featureSetIndex; } - int getFeatureIndex() const { return m_featureIndex; } - - static MsgDeleteFeature* create(int m_featureSetIndex, int m_featureIndex) { - return new MsgDeleteFeature(m_featureSetIndex, m_featureIndex); - } - - private: - int m_featureSetIndex; - int m_featureIndex; - - MsgDeleteFeature(int m_featureSetIndex, int m_featureIndex) : - Message(), - m_featureSetIndex(m_featureSetIndex), - m_featureIndex(m_featureIndex) - { } - }; - enum { PGroup, PItem @@ -414,33 +98,17 @@ private: QString tabName; }; - class MsgApplySettings : public Message { - MESSAGE_CLASS_DECLARATION - - public: - static MsgApplySettings* create() { - return new MsgApplySettings(); - } - - private: - MsgApplySettings() : - Message() - { } - }; - static MainWindow *m_instance; Ui::MainWindow* ui; MessageQueue m_inputMessageQueue; - MainSettings m_settings; + MainCore *m_mainCore; std::vector m_deviceUIs; std::vector m_featureUIs; QList m_deviceWidgetTabs; - int m_masterTabIndex; DSPEngine* m_dspEngine; PluginManager* m_pluginManager; - QTimer m_masterTimer; QTimer m_statusTimer; int m_lastEngineState; @@ -453,8 +121,6 @@ private: quint64 m_centerFrequency; std::string m_sampleFileName; - qtwebapp::LoggerWithFile *m_logger; - WebAPIRequestMapper *m_requestMapper; WebAPIServer *m_apiServer; WebAPIAdapterGUI *m_apiAdapter; @@ -488,8 +154,6 @@ private: void sampleSinkChanged(int tabIndex, int newDeviceIndex); void deleteFeature(int featureSetIndex, int featureIndex); - void setLoggingOptions(); - bool handleMessage(const Message& cmd); private slots: diff --git a/sdrgui/webapi/webapiadaptergui.cpp b/sdrgui/webapi/webapiadaptergui.cpp index 06bf495bd..122637fd1 100644 --- a/sdrgui/webapi/webapiadaptergui.cpp +++ b/sdrgui/webapi/webapiadaptergui.cpp @@ -21,13 +21,13 @@ #include #include -#include "mainwindow.h" +#include "maincore.h" #include "ui_mainwindow.h" #include "loggerwithfile.h" #include "device/deviceapi.h" -#include "device/deviceuiset.h" +#include "device/deviceset.h" #include "device/deviceenumerator.h" -#include "feature/featureuiset.h" +#include "feature/featureset.h" #include "feature/feature.h" #include "dsp/devicesamplesource.h" #include "dsp/devicesamplesink.h" @@ -82,9 +82,9 @@ #include "webapiadaptergui.h" -WebAPIAdapterGUI::WebAPIAdapterGUI(MainWindow& mainWindow) : - m_mainWindow(mainWindow) +WebAPIAdapterGUI::WebAPIAdapterGUI() { + m_mainCore = MainCore::instance(); } WebAPIAdapterGUI::~WebAPIAdapterGUI() @@ -110,14 +110,14 @@ int WebAPIAdapterGUI::instanceSummary( SWGSDRangel::SWGLoggingInfo *logging = response.getLogging(); logging->init(); - logging->setDumpToFile(m_mainWindow.m_logger->getUseFileLogger() ? 1 : 0); + logging->setDumpToFile(m_mainCore->m_logger->getUseFileLogger() ? 1 : 0); if (logging->getDumpToFile()) { - m_mainWindow.m_logger->getLogFileName(*logging->getFileName()); - m_mainWindow.m_logger->getFileMinMessageLevelStr(*logging->getFileLevel()); + m_mainCore->m_logger->getLogFileName(*logging->getFileName()); + m_mainCore->m_logger->getFileMinMessageLevelStr(*logging->getFileLevel()); } - m_mainWindow.m_logger->getConsoleMinMessageLevelStr(*logging->getConsoleLevel()); + m_mainCore->m_logger->getConsoleMinMessageLevelStr(*logging->getConsoleLevel()); SWGSDRangel::SWGDeviceSetList *deviceSetList = response.getDevicesetlist(); getDeviceSetList(deviceSetList); @@ -140,40 +140,40 @@ int WebAPIAdapterGUI::instanceConfigGet( { response.init(); WebAPIAdapterBase webAPIAdapterBase; - webAPIAdapterBase.setPluginManager(m_mainWindow.getPluginManager()); + webAPIAdapterBase.setPluginManager(m_mainCore->getPluginManager()); SWGSDRangel::SWGPreferences *preferences = response.getPreferences(); - WebAPIAdapterBase::webapiFormatPreferences(preferences, m_mainWindow.getMainSettings().getPreferences()); + WebAPIAdapterBase::webapiFormatPreferences(preferences, m_mainCore->m_settings.getPreferences()); SWGSDRangel::SWGPreset *workingPreset = response.getWorkingPreset(); - webAPIAdapterBase.webapiFormatPreset(workingPreset, m_mainWindow.getMainSettings().getWorkingPresetConst()); + webAPIAdapterBase.webapiFormatPreset(workingPreset, m_mainCore->m_settings.getWorkingPresetConst()); SWGSDRangel::SWGFeatureSetPreset *workingFeatureSetPreset = response.getWorkingFeatureSetPreset(); - webAPIAdapterBase.webapiFormatFeatureSetPreset(workingFeatureSetPreset, m_mainWindow.getMainSettings().getWorkingFeatureSetPresetConst()); + webAPIAdapterBase.webapiFormatFeatureSetPreset(workingFeatureSetPreset, m_mainCore->m_settings.getWorkingFeatureSetPresetConst()); - int nbPresets = m_mainWindow.m_settings.getPresetCount(); + int nbPresets = m_mainCore->m_settings.getPresetCount(); QList *swgPresets = response.getPresets(); for (int i = 0; i < nbPresets; i++) { - const Preset *preset = m_mainWindow.m_settings.getPreset(i); + const Preset *preset = m_mainCore->m_settings.getPreset(i); swgPresets->append(new SWGSDRangel::SWGPreset); webAPIAdapterBase.webapiFormatPreset(swgPresets->back(), *preset); } - int nbCommands = m_mainWindow.m_settings.getCommandCount(); + int nbCommands = m_mainCore->m_settings.getCommandCount(); QList *swgCommands = response.getCommands(); for (int i = 0; i < nbCommands; i++) { - const Command *command = m_mainWindow.m_settings.getCommand(i); + const Command *command = m_mainCore->m_settings.getCommand(i); swgCommands->append(new SWGSDRangel::SWGCommand); WebAPIAdapterBase::webapiFormatCommand(swgCommands->back(), *command); } - int nbFeatureSetPresets = m_mainWindow.m_settings.getFeatureSetPresetCount(); + int nbFeatureSetPresets = m_mainCore->m_settings.getFeatureSetPresetCount(); QList *swgFeatureSetPresets = response.getFeaturesetpresets(); for (int i = 0; i < nbFeatureSetPresets; i++) { - const FeatureSetPreset *preset = m_mainWindow.m_settings.getFeatureSetPreset(i); + const FeatureSetPreset *preset = m_mainCore->m_settings.getFeatureSetPreset(i); swgFeatureSetPresets->append(new SWGSDRangel::SWGFeatureSetPreset); webAPIAdapterBase.webapiFormatFeatureSetPreset(swgFeatureSetPresets->back(), *preset); } @@ -189,20 +189,20 @@ int WebAPIAdapterGUI::instanceConfigPutPatch( SWGSDRangel::SWGErrorResponse& error) { WebAPIAdapterBase webAPIAdapterBase; - webAPIAdapterBase.setPluginManager(m_mainWindow.getPluginManager()); + webAPIAdapterBase.setPluginManager(m_mainCore->getPluginManager()); if (force) { - webAPIAdapterBase.webapiInitConfig(m_mainWindow.m_settings); + webAPIAdapterBase.webapiInitConfig(m_mainCore->m_settings); } - Preferences newPreferences = m_mainWindow.m_settings.getPreferences(); + Preferences newPreferences = m_mainCore->m_settings.getPreferences(); webAPIAdapterBase.webapiUpdatePreferences(query.getPreferences(), configKeys.m_preferencesKeys, newPreferences); - m_mainWindow.m_settings.setPreferences(newPreferences); + m_mainCore->m_settings.setPreferences(newPreferences); - Preset *workingPreset = m_mainWindow.m_settings.getWorkingPreset(); + Preset *workingPreset = m_mainCore->m_settings.getWorkingPreset(); webAPIAdapterBase.webapiUpdatePreset(force, query.getWorkingPreset(), configKeys.m_workingPresetKeys, workingPreset); - FeatureSetPreset *workingFeatureSetPreset = m_mainWindow.m_settings.getWorkingFeatureSetPreset(); + FeatureSetPreset *workingFeatureSetPreset = m_mainCore->m_settings.getWorkingFeatureSetPreset(); webAPIAdapterBase.webapiUpdateFeatureSetPreset(force, query.getWorkingFeatureSetPreset(), configKeys.m_workingFeatureSetPresetKeys, workingFeatureSetPreset); QList::const_iterator presetKeysIt = configKeys.m_presetKeys.begin(); @@ -212,7 +212,7 @@ int WebAPIAdapterGUI::instanceConfigPutPatch( Preset *newPreset = new Preset(); // created with default values SWGSDRangel::SWGPreset *swgPreset = query.getPresets()->at(i); webAPIAdapterBase.webapiUpdatePreset(force, swgPreset, *presetKeysIt, newPreset); - m_mainWindow.m_settings.addPreset(newPreset); + m_mainCore->m_settings.addPreset(newPreset); } QList::const_iterator commandKeysIt = configKeys.m_commandKeys.begin(); @@ -222,7 +222,7 @@ int WebAPIAdapterGUI::instanceConfigPutPatch( Command *newCommand = new Command(); // created with default values SWGSDRangel::SWGCommand *swgCommand = query.getCommands()->at(i); webAPIAdapterBase.webapiUpdateCommand(swgCommand, *commandKeysIt, *newCommand); - m_mainWindow.m_settings.addCommand(newCommand); + m_mainCore->m_settings.addCommand(newCommand); } QList::const_iterator featureSetPresetKeysIt = configKeys.m_featureSetPresetKeys.begin(); @@ -232,11 +232,11 @@ int WebAPIAdapterGUI::instanceConfigPutPatch( FeatureSetPreset *newPreset = new FeatureSetPreset(); // created with default values SWGSDRangel::SWGFeatureSetPreset *swgPreset = query.getFeaturesetpresets()->at(i); webAPIAdapterBase.webapiUpdateFeatureSetPreset(force, swgPreset, *featureSetPresetKeysIt, newPreset); - m_mainWindow.m_settings.addFeatureSetPreset(newPreset); + m_mainCore->m_settings.addFeatureSetPreset(newPreset); } - MainWindow::MsgApplySettings *msg = MainWindow::MsgApplySettings::create(); - m_mainWindow.m_inputMessageQueue.push(msg); + MainCore::MsgApplySettings *msg = MainCore::MsgApplySettings::create(); + m_mainCore->m_mainMessageQueue->push(msg); return 200; } @@ -305,17 +305,17 @@ int WebAPIAdapterGUI::instanceChannels( if (direction == 0) // Single sink (Rx) channel { - channelRegistrations = m_mainWindow.m_pluginManager->getRxChannelRegistrations(); + channelRegistrations = m_mainCore->m_pluginManager->getRxChannelRegistrations(); nbChannelDevices = channelRegistrations->size(); } else if (direction == 1) // Single source (Tx) channel { - channelRegistrations = m_mainWindow.m_pluginManager->getTxChannelRegistrations(); + channelRegistrations = m_mainCore->m_pluginManager->getTxChannelRegistrations(); nbChannelDevices = channelRegistrations->size(); } else if (direction == 2) // MIMO channel { - channelRegistrations = m_mainWindow.m_pluginManager->getMIMOChannelRegistrations(); + channelRegistrations = m_mainCore->m_pluginManager->getMIMOChannelRegistrations(); nbChannelDevices = channelRegistrations->size(); } else // not supported @@ -350,14 +350,14 @@ int WebAPIAdapterGUI::instanceLoggingGet( { (void) error; response.init(); - response.setDumpToFile(m_mainWindow.m_logger->getUseFileLogger() ? 1 : 0); + response.setDumpToFile(m_mainCore->m_logger->getUseFileLogger() ? 1 : 0); if (response.getDumpToFile()) { - m_mainWindow.m_logger->getLogFileName(*response.getFileName()); - m_mainWindow.m_logger->getFileMinMessageLevelStr(*response.getFileLevel()); + m_mainCore->m_logger->getLogFileName(*response.getFileName()); + m_mainCore->m_logger->getFileMinMessageLevelStr(*response.getFileLevel()); } - m_mainWindow.m_logger->getConsoleMinMessageLevelStr(*response.getConsoleLevel()); + m_mainCore->m_logger->getConsoleMinMessageLevelStr(*response.getConsoleLevel()); return 200; } @@ -376,27 +376,27 @@ int WebAPIAdapterGUI::instanceLoggingPut( // perform actions if (consoleLevel) { - m_mainWindow.m_settings.setConsoleMinLogLevel(getMsgTypeFromString(*consoleLevel)); + m_mainCore->m_settings.setConsoleMinLogLevel(getMsgTypeFromString(*consoleLevel)); } if (fileLevel) { - m_mainWindow.m_settings.setFileMinLogLevel(getMsgTypeFromString(*fileLevel)); + m_mainCore->m_settings.setFileMinLogLevel(getMsgTypeFromString(*fileLevel)); } - m_mainWindow.m_settings.setUseLogFile(dumpToFile); + m_mainCore->m_settings.setUseLogFile(dumpToFile); if (fileName) { - m_mainWindow.m_settings.setLogFileName(*fileName); + m_mainCore->m_settings.setLogFileName(*fileName); } - m_mainWindow.setLoggingOptions(); + m_mainCore->setLoggingOptions(); // build response response.init(); - getMsgTypeString(m_mainWindow.m_settings.getConsoleMinLogLevel(), *response.getConsoleLevel()); - response.setDumpToFile(m_mainWindow.m_settings.getUseLogFile() ? 1 : 0); - getMsgTypeString(m_mainWindow.m_settings.getFileMinLogLevel(), *response.getFileLevel()); - *response.getFileName() = m_mainWindow.m_settings.getLogFileName(); + getMsgTypeString(m_mainCore->m_settings.getConsoleMinLogLevel(), *response.getConsoleLevel()); + response.setDumpToFile(m_mainCore->m_settings.getUseLogFile() ? 1 : 0); + getMsgTypeString(m_mainCore->m_settings.getFileMinLogLevel(), *response.getFileLevel()); + *response.getFileName() = m_mainCore->m_settings.getLogFileName(); return 200; } @@ -406,8 +406,9 @@ int WebAPIAdapterGUI::instanceAudioGet( SWGSDRangel::SWGErrorResponse& error) { (void) error; - const QList& audioInputDevices = m_mainWindow.m_dspEngine->getAudioDeviceManager()->getInputDevices(); - const QList& audioOutputDevices = m_mainWindow.m_dspEngine->getAudioDeviceManager()->getOutputDevices(); + DSPEngine *dspEngine = DSPEngine::instance(); + const QList& audioInputDevices = dspEngine->getAudioDeviceManager()->getInputDevices(); + const QList& audioOutputDevices = dspEngine->getAudioDeviceManager()->getOutputDevices(); int nbInputDevices = audioInputDevices.size(); int nbOutputDevices = audioOutputDevices.size(); @@ -422,7 +423,7 @@ int WebAPIAdapterGUI::instanceAudioGet( // system default input device inputDevices->append(new SWGSDRangel::SWGAudioInputDevice); inputDevices->back()->init(); - bool found = m_mainWindow.m_dspEngine->getAudioDeviceManager()->getInputDeviceInfo(AudioDeviceManager::m_defaultDeviceName, inputDeviceInfo); + bool found = dspEngine->getAudioDeviceManager()->getInputDeviceInfo(AudioDeviceManager::m_defaultDeviceName, inputDeviceInfo); *inputDevices->back()->getName() = AudioDeviceManager::m_defaultDeviceName; inputDevices->back()->setIndex(-1); inputDevices->back()->setSampleRate(inputDeviceInfo.sampleRate); @@ -436,7 +437,7 @@ int WebAPIAdapterGUI::instanceAudioGet( inputDevices->append(new SWGSDRangel::SWGAudioInputDevice); inputDevices->back()->init(); inputDeviceInfo.resetToDefaults(); - found = m_mainWindow.m_dspEngine->getAudioDeviceManager()->getInputDeviceInfo(audioInputDevices.at(i).deviceName(), inputDeviceInfo); + found = dspEngine->getAudioDeviceManager()->getInputDeviceInfo(audioInputDevices.at(i).deviceName(), inputDeviceInfo); *inputDevices->back()->getName() = audioInputDevices.at(i).deviceName(); inputDevices->back()->setIndex(i); inputDevices->back()->setSampleRate(inputDeviceInfo.sampleRate); @@ -448,7 +449,7 @@ int WebAPIAdapterGUI::instanceAudioGet( // system default output device outputDevices->append(new SWGSDRangel::SWGAudioOutputDevice); outputDevices->back()->init(); - found = m_mainWindow.m_dspEngine->getAudioDeviceManager()->getOutputDeviceInfo(AudioDeviceManager::m_defaultDeviceName, outputDeviceInfo); + found = dspEngine->getAudioDeviceManager()->getOutputDeviceInfo(AudioDeviceManager::m_defaultDeviceName, outputDeviceInfo); *outputDevices->back()->getName() = AudioDeviceManager::m_defaultDeviceName; outputDevices->back()->setIndex(-1); outputDevices->back()->setSampleRate(outputDeviceInfo.sampleRate); @@ -468,7 +469,7 @@ int WebAPIAdapterGUI::instanceAudioGet( outputDevices->append(new SWGSDRangel::SWGAudioOutputDevice); outputDevices->back()->init(); outputDeviceInfo.resetToDefaults(); - found = m_mainWindow.m_dspEngine->getAudioDeviceManager()->getOutputDeviceInfo(audioOutputDevices.at(i).deviceName(), outputDeviceInfo); + found = dspEngine->getAudioDeviceManager()->getOutputDeviceInfo(audioOutputDevices.at(i).deviceName(), outputDeviceInfo); *outputDevices->back()->getName() = audioOutputDevices.at(i).deviceName(); outputDevices->back()->setIndex(i); outputDevices->back()->setSampleRate(outputDeviceInfo.sampleRate); @@ -491,19 +492,19 @@ int WebAPIAdapterGUI::instanceAudioInputPatch( const QStringList& audioInputKeys, SWGSDRangel::SWGErrorResponse& error) { - // TODO + DSPEngine *dspEngine = DSPEngine::instance(); AudioDeviceManager::InputDeviceInfo inputDeviceInfo; QString deviceName; int deviceIndex = response.getIndex(); - if (!m_mainWindow.m_dspEngine->getAudioDeviceManager()->getInputDeviceName(deviceIndex, deviceName)) + if (!dspEngine->getAudioDeviceManager()->getInputDeviceName(deviceIndex, deviceName)) { error.init(); *error.getMessage() = QString("There is no audio input device at index %1").arg(deviceIndex); return 404; } - m_mainWindow.m_dspEngine->getAudioDeviceManager()->getInputDeviceInfo(deviceName, inputDeviceInfo); + dspEngine->getAudioDeviceManager()->getInputDeviceInfo(deviceName, inputDeviceInfo); if (audioInputKeys.contains("sampleRate")) { inputDeviceInfo.sampleRate = response.getSampleRate(); @@ -512,8 +513,8 @@ int WebAPIAdapterGUI::instanceAudioInputPatch( inputDeviceInfo.volume = response.getVolume(); } - m_mainWindow.m_dspEngine->getAudioDeviceManager()->setInputDeviceInfo(deviceIndex, inputDeviceInfo); - m_mainWindow.m_dspEngine->getAudioDeviceManager()->getInputDeviceInfo(deviceName, inputDeviceInfo); + dspEngine->getAudioDeviceManager()->setInputDeviceInfo(deviceIndex, inputDeviceInfo); + dspEngine->getAudioDeviceManager()->getInputDeviceInfo(deviceName, inputDeviceInfo); response.setSampleRate(inputDeviceInfo.sampleRate); response.setVolume(inputDeviceInfo.volume); @@ -526,18 +527,19 @@ int WebAPIAdapterGUI::instanceAudioOutputPatch( const QStringList& audioOutputKeys, SWGSDRangel::SWGErrorResponse& error) { + DSPEngine *dspEngine = DSPEngine::instance(); AudioDeviceManager::OutputDeviceInfo outputDeviceInfo; QString deviceName; int deviceIndex = response.getIndex(); - if (!m_mainWindow.m_dspEngine->getAudioDeviceManager()->getOutputDeviceName(deviceIndex, deviceName)) + if (!dspEngine->getAudioDeviceManager()->getOutputDeviceName(deviceIndex, deviceName)) { error.init(); *error.getMessage() = QString("There is no audio output device at index %1").arg(deviceIndex); return 404; } - m_mainWindow.m_dspEngine->getAudioDeviceManager()->getOutputDeviceInfo(deviceName, outputDeviceInfo); + dspEngine->getAudioDeviceManager()->getOutputDeviceInfo(deviceName, outputDeviceInfo); if (audioOutputKeys.contains("sampleRate")) { outputDeviceInfo.sampleRate = response.getSampleRate(); @@ -564,8 +566,8 @@ int WebAPIAdapterGUI::instanceAudioOutputPatch( outputDeviceInfo.udpPort = response.getUdpPort() % (1<<16); } - m_mainWindow.m_dspEngine->getAudioDeviceManager()->setOutputDeviceInfo(deviceIndex, outputDeviceInfo); - m_mainWindow.m_dspEngine->getAudioDeviceManager()->getOutputDeviceInfo(deviceName, outputDeviceInfo); + dspEngine->getAudioDeviceManager()->setOutputDeviceInfo(deviceIndex, outputDeviceInfo); + dspEngine->getAudioDeviceManager()->getOutputDeviceInfo(deviceName, outputDeviceInfo); response.setSampleRate(outputDeviceInfo.sampleRate); response.setCopyToUdp(outputDeviceInfo.copyToUDP == 0 ? 0 : 1); @@ -589,19 +591,20 @@ int WebAPIAdapterGUI::instanceAudioInputDelete( SWGSDRangel::SWGAudioInputDevice& response, SWGSDRangel::SWGErrorResponse& error) { + DSPEngine *dspEngine = DSPEngine::instance(); AudioDeviceManager::InputDeviceInfo inputDeviceInfo; QString deviceName; int deviceIndex = response.getIndex(); - if (!m_mainWindow.m_dspEngine->getAudioDeviceManager()->getInputDeviceName(deviceIndex, deviceName)) + if (!dspEngine->getAudioDeviceManager()->getInputDeviceName(deviceIndex, deviceName)) { error.init(); *error.getMessage() = QString("There is no audio input device at index %1").arg(deviceIndex); return 404; } - m_mainWindow.m_dspEngine->getAudioDeviceManager()->unsetInputDeviceInfo(deviceIndex); - m_mainWindow.m_dspEngine->getAudioDeviceManager()->getInputDeviceInfo(deviceName, inputDeviceInfo); + dspEngine->getAudioDeviceManager()->unsetInputDeviceInfo(deviceIndex); + dspEngine->getAudioDeviceManager()->getInputDeviceInfo(deviceName, inputDeviceInfo); response.setSampleRate(inputDeviceInfo.sampleRate); response.setVolume(inputDeviceInfo.volume); @@ -613,19 +616,20 @@ int WebAPIAdapterGUI::instanceAudioOutputDelete( SWGSDRangel::SWGAudioOutputDevice& response, SWGSDRangel::SWGErrorResponse& error) { + DSPEngine *dspEngine = DSPEngine::instance(); AudioDeviceManager::OutputDeviceInfo outputDeviceInfo; QString deviceName; int deviceIndex = response.getIndex(); - if (!m_mainWindow.m_dspEngine->getAudioDeviceManager()->getOutputDeviceName(deviceIndex, deviceName)) + if (!dspEngine->getAudioDeviceManager()->getOutputDeviceName(deviceIndex, deviceName)) { error.init(); *error.getMessage() = QString("There is no audio output device at index %1").arg(deviceIndex); return 404; } - m_mainWindow.m_dspEngine->getAudioDeviceManager()->unsetInputDeviceInfo(deviceIndex); - m_mainWindow.m_dspEngine->getAudioDeviceManager()->getOutputDeviceInfo(deviceName, outputDeviceInfo); + dspEngine->getAudioDeviceManager()->unsetInputDeviceInfo(deviceIndex); + dspEngine->getAudioDeviceManager()->getOutputDeviceInfo(deviceName, outputDeviceInfo); response.setSampleRate(outputDeviceInfo.sampleRate); response.setCopyToUdp(outputDeviceInfo.copyToUDP == 0 ? 0 : 1); @@ -650,7 +654,8 @@ int WebAPIAdapterGUI::instanceAudioInputCleanupPatch( SWGSDRangel::SWGErrorResponse& error) { (void) error; - m_mainWindow.m_dspEngine->getAudioDeviceManager()->inputInfosCleanup(); + DSPEngine *dspEngine = DSPEngine::instance(); + dspEngine->getAudioDeviceManager()->inputInfosCleanup(); response.init(); *response.getMessage() = QString("Unregistered parameters for devices not in list of available input devices for this instance"); @@ -663,7 +668,8 @@ int WebAPIAdapterGUI::instanceAudioOutputCleanupPatch( SWGSDRangel::SWGErrorResponse& error) { (void) error; - m_mainWindow.m_dspEngine->getAudioDeviceManager()->outputInfosCleanup(); + DSPEngine *dspEngine = DSPEngine::instance(); + dspEngine->getAudioDeviceManager()->outputInfosCleanup(); response.init(); *response.getMessage() = QString("Unregistered parameters for devices not in list of available output devices for this instance"); @@ -677,8 +683,8 @@ int WebAPIAdapterGUI::instanceLocationGet( { (void) error; response.init(); - response.setLatitude(m_mainWindow.m_settings.getLatitude()); - response.setLongitude(m_mainWindow.m_settings.getLongitude()); + response.setLatitude(m_mainCore->m_settings.getLatitude()); + response.setLongitude(m_mainCore->m_settings.getLongitude()); return 200; } @@ -694,11 +700,11 @@ int WebAPIAdapterGUI::instanceLocationPut( latitude = latitude < -90.0 ? -90.0 : latitude > 90.0 ? 90.0 : latitude; longitude = longitude < -180.0 ? -180.0 : longitude > 180.0 ? 180.0 : longitude; - m_mainWindow.m_settings.setLatitude(latitude); - m_mainWindow.m_settings.setLongitude(longitude); + m_mainCore->m_settings.setLatitude(latitude); + m_mainCore->m_settings.setLongitude(longitude); - response.setLatitude(m_mainWindow.m_settings.getLatitude()); - response.setLongitude(m_mainWindow.m_settings.getLongitude()); + response.setLatitude(m_mainCore->m_settings.getLatitude()); + response.setLongitude(m_mainCore->m_settings.getLongitude()); return 200; } @@ -708,10 +714,11 @@ int WebAPIAdapterGUI::instanceDVSerialGet( SWGSDRangel::SWGErrorResponse& error) { (void) error; + DSPEngine *dspEngine = DSPEngine::instance(); response.init(); std::vector deviceNames; - m_mainWindow.m_dspEngine->getDVSerialNames(deviceNames); + dspEngine->getDVSerialNames(deviceNames); response.setNbDevices((int) deviceNames.size()); QList *deviceNamesList = response.getDvSerialDevices(); @@ -734,14 +741,17 @@ int WebAPIAdapterGUI::instanceDVSerialPatch( SWGSDRangel::SWGErrorResponse& error) { (void) error; - m_mainWindow.m_dspEngine->setDVSerialSupport(dvserial); - m_mainWindow.ui->action_DV_Serial->setChecked(dvserial); + DSPEngine *dspEngine = DSPEngine::instance(); + dspEngine->setDVSerialSupport(dvserial); + + MainCore::MsgDVSerial *msg = MainCore::MsgDVSerial::create(dvserial); + m_mainCore->m_mainMessageQueue->push(msg); response.init(); if (dvserial) { std::vector deviceNames; - m_mainWindow.m_dspEngine->getDVSerialNames(deviceNames); + dspEngine->getDVSerialNames(deviceNames); response.setNbDevices((int) deviceNames.size()); QList *deviceNamesList = response.getDvSerialDevices(); @@ -768,11 +778,12 @@ int WebAPIAdapterGUI::instanceAMBESerialGet( SWGSDRangel::SWGErrorResponse& error) { (void) error; + DSPEngine *dspEngine = DSPEngine::instance(); response.init(); std::vector deviceNames; std::vector qDeviceNames; - m_mainWindow.m_dspEngine->getAMBEEngine()->scan(qDeviceNames); + dspEngine->getAMBEEngine()->scan(qDeviceNames); for (std::vector::const_iterator it = qDeviceNames.begin(); it != qDeviceNames.end(); ++it) { deviceNames.push_back(it->toStdString()); @@ -799,10 +810,11 @@ int WebAPIAdapterGUI::instanceAMBEDevicesGet( SWGSDRangel::SWGErrorResponse& error) { (void) error; + DSPEngine *dspEngine = DSPEngine::instance(); response.init(); std::vector deviceNames; - m_mainWindow.m_dspEngine->getDVSerialNames(deviceNames); + dspEngine->getDVSerialNames(deviceNames); response.setNbDevices((int) deviceNames.size()); QList *deviceNamesList = response.getAmbeDevices(); @@ -825,7 +837,8 @@ int WebAPIAdapterGUI::instanceAMBEDevicesDelete( SWGSDRangel::SWGErrorResponse& error) { (void) error; - m_mainWindow.m_dspEngine->getAMBEEngine()->releaseAll(); + DSPEngine *dspEngine = DSPEngine::instance(); + dspEngine->getAMBEEngine()->releaseAll(); response.init(); *response.getMessage() = QString("All AMBE devices released"); @@ -838,12 +851,13 @@ int WebAPIAdapterGUI::instanceAMBEDevicesPut( SWGSDRangel::SWGAMBEDevices& response, SWGSDRangel::SWGErrorResponse& error) { - m_mainWindow.m_dspEngine->getAMBEEngine()->releaseAll(); + DSPEngine *dspEngine = DSPEngine::instance(); + dspEngine->getAMBEEngine()->releaseAll(); QList *ambeList = query.getAmbeDevices(); for (QList::const_iterator it = ambeList->begin(); it != ambeList->end(); ++it) { - m_mainWindow.m_dspEngine->getAMBEEngine()->registerController((*it)->getDeviceRef()->toStdString()); + dspEngine->getAMBEEngine()->registerController((*it)->getDeviceRef()->toStdString()); } instanceAMBEDevicesGet(response, error); @@ -855,14 +869,15 @@ int WebAPIAdapterGUI::instanceAMBEDevicesPatch( SWGSDRangel::SWGAMBEDevices& response, SWGSDRangel::SWGErrorResponse& error) { + DSPEngine *dspEngine = DSPEngine::instance(); QList *ambeList = query.getAmbeDevices(); for (QList::const_iterator it = ambeList->begin(); it != ambeList->end(); ++it) { if ((*it)->getDelete()) { - m_mainWindow.m_dspEngine->getAMBEEngine()->releaseController((*it)->getDeviceRef()->toStdString()); + dspEngine->getAMBEEngine()->releaseController((*it)->getDeviceRef()->toStdString()); } else { - m_mainWindow.m_dspEngine->getAMBEEngine()->registerController((*it)->getDeviceRef()->toStdString()); + dspEngine->getAMBEEngine()->registerController((*it)->getDeviceRef()->toStdString()); } } @@ -1084,7 +1099,7 @@ int WebAPIAdapterGUI::instancePresetsGet( SWGSDRangel::SWGErrorResponse& error) { (void) error; - int nbPresets = m_mainWindow.m_settings.getPresetCount(); + int nbPresets = m_mainCore->m_settings.getPresetCount(); int nbGroups = 0; int nbPresetsThisGroup = 0; QString groupName; @@ -1097,7 +1112,7 @@ int WebAPIAdapterGUI::instancePresetsGet( for (; i < nbPresets; i++) { - const Preset *preset = m_mainWindow.m_settings.getPreset(i); + const Preset *preset = m_mainCore->m_settings.getPreset(i); if ((i == 0) || (groupName != preset->getGroup())) // new group { @@ -1132,7 +1147,7 @@ int WebAPIAdapterGUI::instancePresetPatch( { int deviceSetIndex = query.getDeviceSetIndex(); SWGSDRangel::SWGPresetIdentifier *presetIdentifier = query.getPreset(); - int nbDeviceSets = m_mainWindow.m_deviceUIs.size(); + int nbDeviceSets = m_mainCore->m_deviceSets.size(); if (deviceSetIndex >= nbDeviceSets) { @@ -1141,7 +1156,7 @@ int WebAPIAdapterGUI::instancePresetPatch( return 404; } - const Preset *selectedPreset = m_mainWindow.m_settings.getPreset(*presetIdentifier->getGroupName(), + const Preset *selectedPreset = m_mainCore->m_settings.getPreset(*presetIdentifier->getGroupName(), presetIdentifier->getCenterFrequency(), *presetIdentifier->getName(), *presetIdentifier->getType()); @@ -1157,7 +1172,7 @@ int WebAPIAdapterGUI::instancePresetPatch( return 404; } - DeviceUISet *deviceUI = m_mainWindow.m_deviceUIs[deviceSetIndex]; + DeviceSet *deviceUI = m_mainCore->m_deviceSets[deviceSetIndex]; if (deviceUI->m_deviceSourceEngine && !selectedPreset->isSourcePreset()) { @@ -1180,8 +1195,8 @@ int WebAPIAdapterGUI::instancePresetPatch( return 404; } - MainWindow::MsgLoadPreset *msg = MainWindow::MsgLoadPreset::create(selectedPreset, deviceSetIndex); - m_mainWindow.m_inputMessageQueue.push(msg); + MainCore::MsgLoadPreset *msg = MainCore::MsgLoadPreset::create(selectedPreset, deviceSetIndex); + m_mainCore->m_mainMessageQueue->push(msg); response.init(); response.setCenterFrequency(selectedPreset->getCenterFrequency()); @@ -1199,7 +1214,7 @@ int WebAPIAdapterGUI::instancePresetPut( { int deviceSetIndex = query.getDeviceSetIndex(); SWGSDRangel::SWGPresetIdentifier *presetIdentifier = query.getPreset(); - int nbDeviceSets = m_mainWindow.m_deviceUIs.size(); + int nbDeviceSets = m_mainCore->m_deviceSets.size(); if (deviceSetIndex >= nbDeviceSets) { @@ -1208,7 +1223,7 @@ int WebAPIAdapterGUI::instancePresetPut( return 404; } - const Preset *selectedPreset = m_mainWindow.m_settings.getPreset(*presetIdentifier->getGroupName(), + const Preset *selectedPreset = m_mainCore->m_settings.getPreset(*presetIdentifier->getGroupName(), presetIdentifier->getCenterFrequency(), *presetIdentifier->getName(), *presetIdentifier->getType()); @@ -1225,7 +1240,7 @@ int WebAPIAdapterGUI::instancePresetPut( } else // update existing preset { - DeviceUISet *deviceUI = m_mainWindow.m_deviceUIs[deviceSetIndex]; + DeviceSet *deviceUI = m_mainCore->m_deviceSets[deviceSetIndex]; if (deviceUI->m_deviceSourceEngine && !selectedPreset->isSourcePreset()) { @@ -1249,8 +1264,8 @@ int WebAPIAdapterGUI::instancePresetPut( } } - MainWindow::MsgSavePreset *msg = MainWindow::MsgSavePreset::create(const_cast(selectedPreset), deviceSetIndex, false); - m_mainWindow.m_inputMessageQueue.push(msg); + MainCore::MsgSavePreset *msg = MainCore::MsgSavePreset::create(const_cast(selectedPreset), deviceSetIndex, false); + m_mainCore->m_mainMessageQueue->push(msg); response.init(); response.setCenterFrequency(selectedPreset->getCenterFrequency()); @@ -1268,7 +1283,7 @@ int WebAPIAdapterGUI::instancePresetPost( { int deviceSetIndex = query.getDeviceSetIndex(); SWGSDRangel::SWGPresetIdentifier *presetIdentifier = query.getPreset(); - int nbDeviceSets = m_mainWindow.m_deviceUIs.size(); + int nbDeviceSets = m_mainCore->m_deviceSets.size(); if (deviceSetIndex >= nbDeviceSets) { @@ -1277,7 +1292,7 @@ int WebAPIAdapterGUI::instancePresetPost( return 404; } - DeviceUISet *deviceSet = m_mainWindow.m_deviceUIs[deviceSetIndex]; + DeviceSet *deviceSet = m_mainCore->m_deviceSets[deviceSetIndex]; int deviceCenterFrequency = 0; if (deviceSet->m_deviceSourceEngine) { // Rx @@ -1292,14 +1307,14 @@ int WebAPIAdapterGUI::instancePresetPost( return 500; } - const Preset *selectedPreset = m_mainWindow.m_settings.getPreset(*presetIdentifier->getGroupName(), + const Preset *selectedPreset = m_mainCore->m_settings.getPreset(*presetIdentifier->getGroupName(), deviceCenterFrequency, *presetIdentifier->getName(), *presetIdentifier->getType()); if (selectedPreset == 0) // save on a new preset { - selectedPreset = m_mainWindow.m_settings.newPreset(*presetIdentifier->getGroupName(), *presetIdentifier->getName()); + selectedPreset = m_mainCore->m_settings.newPreset(*presetIdentifier->getGroupName(), *presetIdentifier->getName()); } else { @@ -1312,8 +1327,8 @@ int WebAPIAdapterGUI::instancePresetPost( return 409; } - MainWindow::MsgSavePreset *msg = MainWindow::MsgSavePreset::create(const_cast(selectedPreset), deviceSetIndex, true); - m_mainWindow.m_inputMessageQueue.push(msg); + MainCore::MsgSavePreset *msg = MainCore::MsgSavePreset::create(const_cast(selectedPreset), deviceSetIndex, true); + m_mainCore->m_mainMessageQueue->push(msg); response.init(); response.setCenterFrequency(selectedPreset->getCenterFrequency()); @@ -1328,7 +1343,7 @@ int WebAPIAdapterGUI::instancePresetDelete( SWGSDRangel::SWGPresetIdentifier& response, SWGSDRangel::SWGErrorResponse& error) { - const Preset *selectedPreset = m_mainWindow.m_settings.getPreset(*response.getGroupName(), + const Preset *selectedPreset = m_mainCore->m_settings.getPreset(*response.getGroupName(), response.getCenterFrequency(), *response.getName(), *response.getType()); @@ -1348,8 +1363,8 @@ int WebAPIAdapterGUI::instancePresetDelete( *response.getType() = selectedPreset->isSourcePreset() ? "R" : selectedPreset->isSinkPreset() ? "T" : selectedPreset->isMIMOPreset() ? "M" : "X"; *response.getName() = selectedPreset->getDescription(); - MainWindow::MsgDeletePreset *msg = MainWindow::MsgDeletePreset::create(const_cast(selectedPreset)); - m_mainWindow.m_inputMessageQueue.push(msg); + MainCore::MsgDeletePreset *msg = MainCore::MsgDeletePreset::create(const_cast(selectedPreset)); + m_mainCore->m_mainMessageQueue->push(msg); return 202; } @@ -1378,8 +1393,8 @@ int WebAPIAdapterGUI::instanceDeviceSetPost( SWGSDRangel::SWGErrorResponse& error) { (void) error; - MainWindow::MsgAddDeviceSet *msg = MainWindow::MsgAddDeviceSet::create(direction); - m_mainWindow.m_inputMessageQueue.push(msg); + MainCore::MsgAddDeviceSet *msg = MainCore::MsgAddDeviceSet::create(direction); + m_mainCore->m_mainMessageQueue->push(msg); response.init(); *response.getMessage() = QString("Message to add a new device set (MsgAddDeviceSet) was submitted successfully"); @@ -1391,10 +1406,10 @@ int WebAPIAdapterGUI::instanceDeviceSetDelete( SWGSDRangel::SWGSuccessResponse& response, SWGSDRangel::SWGErrorResponse& error) { - if (m_mainWindow.m_deviceUIs.size() > 1) + if (m_mainCore->m_deviceSets.size() > 1) { - MainWindow::MsgRemoveLastDeviceSet *msg = MainWindow::MsgRemoveLastDeviceSet::create(); - m_mainWindow.m_inputMessageQueue.push(msg); + MainCore::MsgRemoveLastDeviceSet *msg = MainCore::MsgRemoveLastDeviceSet::create(); + m_mainCore->m_mainMessageQueue->push(msg); response.init(); *response.getMessage() = QString("Message to remove last device set (MsgRemoveLastDeviceSet) was submitted successfully"); @@ -1415,9 +1430,9 @@ int WebAPIAdapterGUI::devicesetGet( SWGSDRangel::SWGDeviceSet& response, SWGSDRangel::SWGErrorResponse& error) { - if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainWindow.m_deviceUIs.size())) + if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainCore->m_deviceSets.size())) { - const DeviceUISet *deviceSet = m_mainWindow.m_deviceUIs[deviceSetIndex]; + const DeviceSet *deviceSet = m_mainCore->m_deviceSets[deviceSetIndex]; getDeviceSet(&response, deviceSet, deviceSetIndex); return 200; @@ -1436,10 +1451,10 @@ int WebAPIAdapterGUI::devicesetFocusPatch( SWGSDRangel::SWGSuccessResponse& response, SWGSDRangel::SWGErrorResponse& error) { - if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainWindow.m_deviceUIs.size())) + if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainCore->m_deviceSets.size())) { - MainWindow::MsgDeviceSetFocus *msg = MainWindow::MsgDeviceSetFocus::create(deviceSetIndex); - m_mainWindow.m_inputMessageQueue.push(msg); + MainCore::MsgDeviceSetFocus *msg = MainCore::MsgDeviceSetFocus::create(deviceSetIndex); + m_mainCore->m_mainMessageQueue->push(msg); response.init(); *response.getMessage() = QString("Message to focus on device set (MsgDeviceSetFocus) was submitted successfully"); @@ -1461,9 +1476,9 @@ int WebAPIAdapterGUI::devicesetDevicePut( SWGSDRangel::SWGDeviceListItem& response, SWGSDRangel::SWGErrorResponse& error) { - if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainWindow.m_deviceUIs.size())) + if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainCore->m_deviceSets.size())) { - DeviceUISet *deviceSet = m_mainWindow.m_deviceUIs[deviceSetIndex]; + DeviceSet *deviceSet = m_mainCore->m_deviceSets[deviceSetIndex]; if ((query.getDirection() != 1) && (deviceSet->m_deviceSinkEngine)) { @@ -1533,8 +1548,8 @@ int WebAPIAdapterGUI::devicesetDevicePut( continue; } - MainWindow::MsgSetDevice *msg = MainWindow::MsgSetDevice::create(deviceSetIndex, i, query.getDirection()); - m_mainWindow.m_inputMessageQueue.push(msg); + MainCore::MsgSetDevice *msg = MainCore::MsgSetDevice::create(deviceSetIndex, i, query.getDirection()); + m_mainCore->m_mainMessageQueue->push(msg); response.init(); *response.getDisplayedName() = samplingDevice->displayedName; @@ -1569,9 +1584,9 @@ int WebAPIAdapterGUI::devicesetDeviceSettingsGet( { error.init(); - if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainWindow.m_deviceUIs.size())) + if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainCore->m_deviceSets.size())) { - DeviceUISet *deviceSet = m_mainWindow.m_deviceUIs[deviceSetIndex]; + DeviceSet *deviceSet = m_mainCore->m_deviceSets[deviceSetIndex]; if (deviceSet->m_deviceSourceEngine) // Single Rx { @@ -1616,9 +1631,9 @@ int WebAPIAdapterGUI::devicesetDeviceActionsPost( { error.init(); - if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainWindow.m_deviceUIs.size())) + if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainCore->m_deviceSets.size())) { - DeviceUISet *deviceSet = m_mainWindow.m_deviceUIs[deviceSetIndex]; + DeviceSet *deviceSet = m_mainCore->m_deviceSets[deviceSetIndex]; if (deviceSet->m_deviceSourceEngine) // Single Rx { @@ -1720,9 +1735,9 @@ int WebAPIAdapterGUI::devicesetDeviceSettingsPutPatch( { error.init(); - if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainWindow.m_deviceUIs.size())) + if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainCore->m_deviceSets.size())) { - DeviceUISet *deviceSet = m_mainWindow.m_deviceUIs[deviceSetIndex]; + DeviceSet *deviceSet = m_mainCore->m_deviceSets[deviceSetIndex]; if (deviceSet->m_deviceSourceEngine) // Single Rx { @@ -1798,9 +1813,9 @@ int WebAPIAdapterGUI::devicesetDeviceRunGet( { error.init(); - if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainWindow.m_deviceUIs.size())) + if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainCore->m_deviceSets.size())) { - DeviceUISet *deviceSet = m_mainWindow.m_deviceUIs[deviceSetIndex]; + DeviceSet *deviceSet = m_mainCore->m_deviceSets[deviceSetIndex]; if (deviceSet->m_deviceSourceEngine) // Rx { @@ -1835,9 +1850,9 @@ int WebAPIAdapterGUI::devicesetDeviceSubsystemRunGet( { error.init(); - if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainWindow.m_deviceUIs.size())) + if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainCore->m_deviceSets.size())) { - DeviceUISet *deviceSet = m_mainWindow.m_deviceUIs[deviceSetIndex]; + DeviceSet *deviceSet = m_mainCore->m_deviceSets[deviceSetIndex]; if (deviceSet->m_deviceMIMOEngine) // MIMO { @@ -1865,9 +1880,9 @@ int WebAPIAdapterGUI::devicesetDeviceRunPost( { error.init(); - if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainWindow.m_deviceUIs.size())) + if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainCore->m_deviceSets.size())) { - DeviceUISet *deviceSet = m_mainWindow.m_deviceUIs[deviceSetIndex]; + DeviceSet *deviceSet = m_mainCore->m_deviceSets[deviceSetIndex]; if (deviceSet->m_deviceSourceEngine) // Rx { @@ -1902,9 +1917,9 @@ int WebAPIAdapterGUI::devicesetDeviceSubsystemRunPost( { error.init(); - if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainWindow.m_deviceUIs.size())) + if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainCore->m_deviceSets.size())) { - DeviceUISet *deviceSet = m_mainWindow.m_deviceUIs[deviceSetIndex]; + DeviceSet *deviceSet = m_mainCore->m_deviceSets[deviceSetIndex]; if (deviceSet->m_deviceMIMOEngine) // MIMO { @@ -1932,9 +1947,9 @@ int WebAPIAdapterGUI::devicesetDeviceRunDelete( { error.init(); - if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainWindow.m_deviceUIs.size())) + if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainCore->m_deviceSets.size())) { - DeviceUISet *deviceSet = m_mainWindow.m_deviceUIs[deviceSetIndex]; + DeviceSet *deviceSet = m_mainCore->m_deviceSets[deviceSetIndex]; if (deviceSet->m_deviceSourceEngine) // Rx { @@ -1969,9 +1984,9 @@ int WebAPIAdapterGUI::devicesetDeviceSubsystemRunDelete( { error.init(); - if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainWindow.m_deviceUIs.size())) + if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainCore->m_deviceSets.size())) { - DeviceUISet *deviceSet = m_mainWindow.m_deviceUIs[deviceSetIndex]; + DeviceSet *deviceSet = m_mainCore->m_deviceSets[deviceSetIndex]; if (deviceSet->m_deviceMIMOEngine) // MIMO { @@ -1999,9 +2014,9 @@ int WebAPIAdapterGUI::devicesetDeviceReportGet( { error.init(); - if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainWindow.m_deviceUIs.size())) + if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainCore->m_deviceSets.size())) { - DeviceUISet *deviceSet = m_mainWindow.m_deviceUIs[deviceSetIndex]; + DeviceSet *deviceSet = m_mainCore->m_deviceSets[deviceSetIndex]; if (deviceSet->m_deviceSourceEngine) // Single Rx { @@ -2042,9 +2057,9 @@ int WebAPIAdapterGUI::devicesetChannelsReportGet( SWGSDRangel::SWGChannelsDetail& response, SWGSDRangel::SWGErrorResponse& error) { - if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainWindow.m_deviceUIs.size())) + if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainCore->m_deviceSets.size())) { - const DeviceUISet *deviceSet = m_mainWindow.m_deviceUIs[deviceSetIndex]; + const DeviceSet *deviceSet = m_mainCore->m_deviceSets[deviceSetIndex]; getChannelsDetail(&response, deviceSet); return 200; @@ -2064,9 +2079,9 @@ int WebAPIAdapterGUI::devicesetChannelPost( SWGSDRangel::SWGSuccessResponse& response, SWGSDRangel::SWGErrorResponse& error) { - if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainWindow.m_deviceUIs.size())) + if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainCore->m_deviceSets.size())) { - DeviceUISet *deviceSet = m_mainWindow.m_deviceUIs[deviceSetIndex]; + DeviceSet *deviceSet = m_mainCore->m_deviceSets[deviceSetIndex]; if (query.getDirection() == 0) // Single Rx { @@ -2077,7 +2092,7 @@ int WebAPIAdapterGUI::devicesetChannelPost( return 400; } - PluginAPI::ChannelRegistrations *channelRegistrations = m_mainWindow.m_pluginManager->getRxChannelRegistrations(); + PluginAPI::ChannelRegistrations *channelRegistrations = m_mainCore->m_pluginManager->getRxChannelRegistrations(); int nbRegistrations = channelRegistrations->size(); int index = 0; for (; index < nbRegistrations; index++) @@ -2089,8 +2104,8 @@ int WebAPIAdapterGUI::devicesetChannelPost( if (index < nbRegistrations) { - MainWindow::MsgAddChannel *msg = MainWindow::MsgAddChannel::create(deviceSetIndex, index, false); - m_mainWindow.m_inputMessageQueue.push(msg); + MainCore::MsgAddChannel *msg = MainCore::MsgAddChannel::create(deviceSetIndex, index, false); + m_mainCore->m_mainMessageQueue->push(msg); response.init(); *response.getMessage() = QString("Message to add a channel (MsgAddChannel) was submitted successfully"); @@ -2113,7 +2128,7 @@ int WebAPIAdapterGUI::devicesetChannelPost( return 400; } - PluginAPI::ChannelRegistrations *channelRegistrations = m_mainWindow.m_pluginManager->getTxChannelRegistrations(); + PluginAPI::ChannelRegistrations *channelRegistrations = m_mainCore->m_pluginManager->getTxChannelRegistrations(); int nbRegistrations = channelRegistrations->size(); int index = 0; for (; index < nbRegistrations; index++) @@ -2125,8 +2140,8 @@ int WebAPIAdapterGUI::devicesetChannelPost( if (index < nbRegistrations) { - MainWindow::MsgAddChannel *msg = MainWindow::MsgAddChannel::create(deviceSetIndex, index, true); - m_mainWindow.m_inputMessageQueue.push(msg); + MainCore::MsgAddChannel *msg = MainCore::MsgAddChannel::create(deviceSetIndex, index, true); + m_mainCore->m_mainMessageQueue->push(msg); response.init(); *response.getMessage() = QString("Message to add a channel (MsgAddChannel) was submitted successfully"); @@ -2149,7 +2164,7 @@ int WebAPIAdapterGUI::devicesetChannelPost( return 400; } - PluginAPI::ChannelRegistrations *channelRegistrations = m_mainWindow.m_pluginManager->getMIMOChannelRegistrations(); + PluginAPI::ChannelRegistrations *channelRegistrations = m_mainCore->m_pluginManager->getMIMOChannelRegistrations(); int nbRegistrations = channelRegistrations->size(); int index = 0; for (; index < nbRegistrations; index++) @@ -2161,8 +2176,8 @@ int WebAPIAdapterGUI::devicesetChannelPost( if (index < nbRegistrations) { - MainWindow::MsgAddChannel *msg = MainWindow::MsgAddChannel::create(deviceSetIndex, index, true); - m_mainWindow.m_inputMessageQueue.push(msg); + MainCore::MsgAddChannel *msg = MainCore::MsgAddChannel::create(deviceSetIndex, index, true); + m_mainCore->m_mainMessageQueue->push(msg); response.init(); *response.getMessage() = QString("Message to add a channel (MsgAddChannel) was submitted successfully"); @@ -2197,14 +2212,14 @@ int WebAPIAdapterGUI::devicesetChannelDelete( SWGSDRangel::SWGSuccessResponse& response, SWGSDRangel::SWGErrorResponse& error) { - if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainWindow.m_deviceUIs.size())) + if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainCore->m_deviceSets.size())) { - DeviceUISet *deviceSet = m_mainWindow.m_deviceUIs[deviceSetIndex]; + DeviceSet *deviceSet = m_mainCore->m_deviceSets[deviceSetIndex]; if (channelIndex < deviceSet->getNumberOfChannels()) { - MainWindow::MsgDeleteChannel *msg = MainWindow::MsgDeleteChannel::create(deviceSetIndex, channelIndex); - m_mainWindow.m_inputMessageQueue.push(msg); + MainCore::MsgDeleteChannel *msg = MainCore::MsgDeleteChannel::create(deviceSetIndex, channelIndex); + m_mainCore->m_mainMessageQueue->push(msg); response.init(); *response.getMessage() = QString("Message to delete a channel (MsgDeleteChannel) was submitted successfully"); @@ -2236,9 +2251,9 @@ int WebAPIAdapterGUI::devicesetChannelSettingsGet( { error.init(); - if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainWindow.m_deviceUIs.size())) + if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainCore->m_deviceSets.size())) { - DeviceUISet *deviceSet = m_mainWindow.m_deviceUIs[deviceSetIndex]; + DeviceSet *deviceSet = m_mainCore->m_deviceSets[deviceSetIndex]; if (deviceSet->m_deviceSourceEngine) // Single Rx { @@ -2335,9 +2350,9 @@ int WebAPIAdapterGUI::devicesetChannelReportGet( { error.init(); - if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainWindow.m_deviceUIs.size())) + if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainCore->m_deviceSets.size())) { - DeviceUISet *deviceSet = m_mainWindow.m_deviceUIs[deviceSetIndex]; + DeviceSet *deviceSet = m_mainCore->m_deviceSets[deviceSetIndex]; if (deviceSet->m_deviceSourceEngine) // Single Rx { @@ -2436,9 +2451,9 @@ int WebAPIAdapterGUI::devicesetChannelActionsPost( { error.init(); - if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainWindow.m_deviceUIs.size())) + if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainCore->m_deviceSets.size())) { - DeviceUISet *deviceSet = m_mainWindow.m_deviceUIs[deviceSetIndex]; + DeviceSet *deviceSet = m_mainCore->m_deviceSets[deviceSetIndex]; if (deviceSet->m_deviceSourceEngine) // Single Rx { @@ -2591,9 +2606,9 @@ int WebAPIAdapterGUI::devicesetChannelSettingsPutPatch( { error.init(); - if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainWindow.m_deviceUIs.size())) + if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainCore->m_deviceSets.size())) { - DeviceUISet *deviceSet = m_mainWindow.m_deviceUIs[deviceSetIndex]; + DeviceSet *deviceSet = m_mainCore->m_deviceSets[deviceSetIndex]; if (deviceSet->m_deviceSourceEngine) // Single Rx { @@ -2722,11 +2737,11 @@ int WebAPIAdapterGUI::featuresetFeaturePost( SWGSDRangel::SWGSuccessResponse& response, SWGSDRangel::SWGErrorResponse& error) { - if ((featureSetIndex >= 0) && (featureSetIndex < (int) m_mainWindow.m_featureUIs.size())) + if ((featureSetIndex >= 0) && (featureSetIndex < (int) m_mainCore->m_featureSets.size())) { - FeatureUISet *featureSet = m_mainWindow.m_featureUIs[featureSetIndex]; + FeatureSet *featureSet = m_mainCore->m_featureSets[featureSetIndex]; - PluginAPI::FeatureRegistrations *featureRegistrations = m_mainWindow.m_pluginManager->getFeatureRegistrations(); + PluginAPI::FeatureRegistrations *featureRegistrations = m_mainCore->m_pluginManager->getFeatureRegistrations(); int nbRegistrations = featureRegistrations->size(); int index = 0; @@ -2739,8 +2754,8 @@ int WebAPIAdapterGUI::featuresetFeaturePost( if (index < nbRegistrations) { - MainWindow::MsgAddFeature *msg = MainWindow::MsgAddFeature::create(featureSetIndex, index); - m_mainWindow.m_inputMessageQueue.push(msg); + MainCore::MsgAddFeature *msg = MainCore::MsgAddFeature::create(featureSetIndex, index); + m_mainCore->m_mainMessageQueue->push(msg); response.init(); *response.getMessage() = QString("Message to add a feature (MsgAddFeature) was submitted successfully"); @@ -2768,14 +2783,14 @@ int WebAPIAdapterGUI::featuresetFeatureDelete( SWGSDRangel::SWGSuccessResponse& response, SWGSDRangel::SWGErrorResponse& error) { - if ((featureSetIndex >= 0) && (featureSetIndex < (int) m_mainWindow.m_featureUIs.size())) + if ((featureSetIndex >= 0) && (featureSetIndex < (int) m_mainCore->m_featureSets.size())) { - FeatureUISet *featureSet = m_mainWindow.m_featureUIs[featureSetIndex]; + FeatureSet *featureSet = m_mainCore->m_featureSets[featureSetIndex]; if (featureIndex < featureSet->getNumberOfFeatures()) { - MainWindow::MsgDeleteFeature *msg = MainWindow::MsgDeleteFeature::create(featureSetIndex, featureIndex); - m_mainWindow.m_inputMessageQueue.push(msg); + MainCore::MsgDeleteFeature *msg = MainCore::MsgDeleteFeature::create(featureSetIndex, featureIndex); + m_mainCore->m_mainMessageQueue->push(msg); response.init(); *response.getMessage() = QString("Message to delete a feature (MsgDeleteFeature) was submitted successfully"); @@ -2805,9 +2820,9 @@ int WebAPIAdapterGUI::featuresetFeatureRunGet( SWGSDRangel::SWGDeviceState& response, SWGSDRangel::SWGErrorResponse& error) { - if ((featureSetIndex >= 0) && (featureSetIndex < (int) m_mainWindow.m_featureUIs.size())) + if ((featureSetIndex >= 0) && (featureSetIndex < (int) m_mainCore->m_featureSets.size())) { - FeatureUISet *featureSet = m_mainWindow.m_featureUIs[featureSetIndex]; + FeatureSet *featureSet = m_mainCore->m_featureSets[featureSetIndex]; if (featureIndex < featureSet->getNumberOfFeatures()) { @@ -2838,9 +2853,9 @@ int WebAPIAdapterGUI::featuresetFeatureRunPost( SWGSDRangel::SWGDeviceState& response, SWGSDRangel::SWGErrorResponse& error) { - if ((featureSetIndex >= 0) && (featureSetIndex < (int) m_mainWindow.m_featureUIs.size())) + if ((featureSetIndex >= 0) && (featureSetIndex < (int) m_mainCore->m_featureSets.size())) { - FeatureUISet *featureSet = m_mainWindow.m_featureUIs[featureSetIndex]; + FeatureSet *featureSet = m_mainCore->m_featureSets[featureSetIndex]; if (featureIndex < featureSet->getNumberOfFeatures()) { @@ -2871,9 +2886,9 @@ int WebAPIAdapterGUI::featuresetFeatureRunDelete( SWGSDRangel::SWGDeviceState& response, SWGSDRangel::SWGErrorResponse& error) { - if ((featureSetIndex >= 0) && (featureSetIndex < (int) m_mainWindow.m_featureUIs.size())) + if ((featureSetIndex >= 0) && (featureSetIndex < (int) m_mainCore->m_featureSets.size())) { - FeatureUISet *featureSet = m_mainWindow.m_featureUIs[featureSetIndex]; + FeatureSet *featureSet = m_mainCore->m_featureSets[featureSetIndex]; if (featureIndex < featureSet->getNumberOfFeatures()) { @@ -2906,9 +2921,9 @@ int WebAPIAdapterGUI::featuresetFeatureSettingsGet( { error.init(); - if ((featureSetIndex >= 0) && (featureSetIndex < (int) m_mainWindow.m_deviceUIs.size())) + if ((featureSetIndex >= 0) && (featureSetIndex < (int) m_mainCore->m_deviceSets.size())) { - FeatureUISet *featureSet = m_mainWindow.m_featureUIs[featureSetIndex]; + FeatureSet *featureSet = m_mainCore->m_featureSets[featureSetIndex]; Feature *feature = featureSet->getFeatureAt(featureIndex); if (feature) @@ -2940,9 +2955,9 @@ int WebAPIAdapterGUI::featuresetFeatureSettingsPutPatch( { error.init(); - if ((featureSetIndex >= 0) && (featureSetIndex < (int) m_mainWindow.m_featureUIs.size())) + if ((featureSetIndex >= 0) && (featureSetIndex < (int) m_mainCore->m_featureSets.size())) { - FeatureUISet *featureSet = m_mainWindow.m_featureUIs[featureSetIndex]; + FeatureSet *featureSet = m_mainCore->m_featureSets[featureSetIndex]; Feature *feature = featureSet->getFeatureAt(featureIndex); if (feature) @@ -2984,9 +2999,9 @@ int WebAPIAdapterGUI::featuresetFeatureReportGet( { error.init(); - if ((featureSetIndex >= 0) && (featureSetIndex < (int) m_mainWindow.m_featureUIs.size())) + if ((featureSetIndex >= 0) && (featureSetIndex < (int) m_mainCore->m_featureSets.size())) { - FeatureUISet *featureSet = m_mainWindow.m_featureUIs[featureSetIndex]; + FeatureSet *featureSet = m_mainCore->m_featureSets[featureSetIndex]; Feature *feature = featureSet->getFeatureAt(featureIndex); if (feature) @@ -3018,9 +3033,9 @@ int WebAPIAdapterGUI::featuresetFeatureActionsPost( { error.init(); - if ((featureSetIndex >= 0) && (featureSetIndex < (int) m_mainWindow.m_featureUIs.size())) + if ((featureSetIndex >= 0) && (featureSetIndex < (int) m_mainCore->m_featureSets.size())) { - FeatureUISet *featureSet = m_mainWindow.m_featureUIs[featureSetIndex]; + FeatureSet *featureSet = m_mainCore->m_featureSets[featureSetIndex]; Feature *feature = featureSet->getFeatureAt(featureIndex); if (feature) @@ -3065,15 +3080,15 @@ int WebAPIAdapterGUI::featuresetFeatureActionsPost( void WebAPIAdapterGUI::getDeviceSetList(SWGSDRangel::SWGDeviceSetList* deviceSetList) { deviceSetList->init(); - deviceSetList->setDevicesetcount((int) m_mainWindow.m_deviceUIs.size()); + deviceSetList->setDevicesetcount((int) m_mainCore->m_deviceSets.size()); - if (m_mainWindow.m_deviceUIs.size() > 0) { - deviceSetList->setDevicesetfocus(m_mainWindow.ui->tabInputsView->currentIndex()); + if (m_mainCore->m_deviceSets.size() > 0) { + deviceSetList->setDevicesetfocus(m_mainCore->m_masterTabIndex); } - std::vector::const_iterator it = m_mainWindow.m_deviceUIs.begin(); + std::vector::const_iterator it = m_mainCore->m_deviceSets.begin(); - for (int i = 0; it != m_mainWindow.m_deviceUIs.end(); ++it, i++) + for (int i = 0; it != m_mainCore->m_deviceSets.end(); ++it, i++) { QList *deviceSets = deviceSetList->getDeviceSets(); deviceSets->append(new SWGSDRangel::SWGDeviceSet()); @@ -3082,7 +3097,7 @@ void WebAPIAdapterGUI::getDeviceSetList(SWGSDRangel::SWGDeviceSetList* deviceSet } } -void WebAPIAdapterGUI::getDeviceSet(SWGSDRangel::SWGDeviceSet *deviceSet, const DeviceUISet* deviceUISet, int deviceUISetIndex) +void WebAPIAdapterGUI::getDeviceSet(SWGSDRangel::SWGDeviceSet *deviceSet, const DeviceSet* deviceUISet, int deviceUISetIndex) { deviceSet->init(); SWGSDRangel::SWGSamplingDevice *samplingDevice = deviceSet->getSamplingDevice(); @@ -3221,7 +3236,7 @@ void WebAPIAdapterGUI::getDeviceSet(SWGSDRangel::SWGDeviceSet *deviceSet, const } } -void WebAPIAdapterGUI::getChannelsDetail(SWGSDRangel::SWGChannelsDetail *channelsDetail, const DeviceUISet* deviceUISet) +void WebAPIAdapterGUI::getChannelsDetail(SWGSDRangel::SWGChannelsDetail *channelsDetail, const DeviceSet* deviceUISet) { channelsDetail->init(); SWGSDRangel::SWGChannelReport *channelReport; @@ -3359,9 +3374,9 @@ int WebAPIAdapterGUI::featuresetGet( SWGSDRangel::SWGFeatureSet& response, SWGSDRangel::SWGErrorResponse& error) { - if ((featureSetIndex >= 0) && (featureSetIndex < (int) m_mainWindow.m_featureUIs.size())) + if ((featureSetIndex >= 0) && (featureSetIndex < (int) m_mainCore->m_featureSets.size())) { - const FeatureUISet *featureSet = m_mainWindow.m_featureUIs[featureSetIndex]; + const FeatureSet *featureSet = m_mainCore->m_featureSets[featureSetIndex]; getFeatureSet(&response, featureSet, featureSetIndex); return 200; @@ -3378,11 +3393,11 @@ int WebAPIAdapterGUI::featuresetGet( void WebAPIAdapterGUI::getFeatureSetList(SWGSDRangel::SWGFeatureSetList* featureSetList) { featureSetList->init(); - featureSetList->setFeaturesetcount((int) m_mainWindow.m_featureUIs.size()); + featureSetList->setFeaturesetcount((int) m_mainCore->m_featureSets.size()); - std::vector::const_iterator it = m_mainWindow.m_featureUIs.begin(); + std::vector::const_iterator it = m_mainCore->m_featureSets.begin(); - for (int i = 0; it != m_mainWindow.m_featureUIs.end(); ++it, i++) + for (int i = 0; it != m_mainCore->m_featureSets.end(); ++it, i++) { QList *featureSets = featureSetList->getFeatureSets(); featureSets->append(new SWGSDRangel::SWGFeatureSet()); @@ -3391,7 +3406,7 @@ void WebAPIAdapterGUI::getFeatureSetList(SWGSDRangel::SWGFeatureSetList* feature } } -void WebAPIAdapterGUI::getFeatureSet(SWGSDRangel::SWGFeatureSet *featureSet, const FeatureUISet* featureUISet, int featureUISetIndex) +void WebAPIAdapterGUI::getFeatureSet(SWGSDRangel::SWGFeatureSet *featureSet, const FeatureSet* featureUISet, int featureUISetIndex) { featureSet->init(); featureSet->setFeaturecount(featureUISet->getNumberOfFeatures()); diff --git a/sdrgui/webapi/webapiadaptergui.h b/sdrgui/webapi/webapiadaptergui.h index 5fc414a77..3b41c006f 100644 --- a/sdrgui/webapi/webapiadaptergui.h +++ b/sdrgui/webapi/webapiadaptergui.h @@ -25,12 +25,13 @@ #include "webapi/webapiadapterinterface.h" #include "export.h" -class MainWindow; +class MainCore; +class FeatureSet; class SDRGUI_API WebAPIAdapterGUI: public WebAPIAdapterInterface { public: - WebAPIAdapterGUI(MainWindow& mainWindow); + WebAPIAdapterGUI(); virtual ~WebAPIAdapterGUI(); virtual int instanceSummary( @@ -388,13 +389,13 @@ public: SWGSDRangel::SWGErrorResponse& error); private: - MainWindow& m_mainWindow; + MainCore *m_mainCore; void getDeviceSetList(SWGSDRangel::SWGDeviceSetList* deviceSetList); - void getDeviceSet(SWGSDRangel::SWGDeviceSet *deviceSet, const DeviceUISet* deviceUISet, int deviceUISetIndex); - void getChannelsDetail(SWGSDRangel::SWGChannelsDetail *channelsDetail, const DeviceUISet* deviceUISet); + void getDeviceSet(SWGSDRangel::SWGDeviceSet *deviceSet, const DeviceSet* deviceUISet, int deviceUISetIndex); + void getChannelsDetail(SWGSDRangel::SWGChannelsDetail *channelsDetail, const DeviceSet* deviceUISet); void getFeatureSetList(SWGSDRangel::SWGFeatureSetList* featureSetList); - void getFeatureSet(SWGSDRangel::SWGFeatureSet *featureSet, const FeatureUISet* featureUISet, int featureUISetIndex); + void getFeatureSet(SWGSDRangel::SWGFeatureSet *featureSet, const FeatureSet* featureUISet, int featureUISetIndex); static QtMsgType getMsgTypeFromString(const QString& msgTypeString); static void getMsgTypeString(const QtMsgType& msgType, QString& level); }; diff --git a/sdrsrv/CMakeLists.txt b/sdrsrv/CMakeLists.txt index ad5775e3e..cb202c480 100644 --- a/sdrsrv/CMakeLists.txt +++ b/sdrsrv/CMakeLists.txt @@ -2,13 +2,11 @@ project (sdrsrv) set(sdrsrv_SOURCES mainserver.cpp - feature/featureset.cpp webapi/webapiadaptersrv.cpp ) set(sdrsrv_HEADERS mainserver.h - feature/featureset.h webapi/webapiadaptersrv.h )