diff --git a/AfcControl.cpp b/AfcControl.cpp deleted file mode 100644 index c7667436..00000000 --- a/AfcControl.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include "AfcControl.h" -#include "ui_AfcControl.h" - -AfcControl::AfcControl(QWidget *parent) : - QWidget(parent), - ui(new Ui::AfcControl) -{ - ui->setupUi(this); -} - -AfcControl::~AfcControl() -{ - delete ui; -} diff --git a/AfcControl.h b/AfcControl.h deleted file mode 100644 index e7169d36..00000000 --- a/AfcControl.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef AFCCONTROL_H -#define AFCCONTROL_H - -#include - -namespace Ui { - class AfcControl; -} - -class AfcControl : public QWidget -{ - Q_OBJECT - - public: - explicit AfcControl(QWidget *parent = nullptr); - ~AfcControl(); - - private: - Ui::AfcControl *ui; -}; - -#endif // AFCCONTROL_H diff --git a/AfcControl.ui b/AfcControl.ui deleted file mode 100644 index d301e717..00000000 --- a/AfcControl.ui +++ /dev/null @@ -1,21 +0,0 @@ - - - - - AfcControl - - - - 0 - 0 - 400 - 300 - - - - Form - - - - - diff --git a/App/AppUI.cpp b/App/AppUI.cpp index 1207c907..b85cbed0 100644 --- a/App/AppUI.cpp +++ b/App/AppUI.cpp @@ -1,6 +1,6 @@ // -// filename: description -// Copyright (C) 2018 Gonzalo José Carracedo Carballal +// AppUI.cpp: Initialize UI controls +// Copyright (C) 2019 Gonzalo José Carracedo Carballal // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as @@ -32,6 +32,7 @@ AppUI::AppUI(QMainWindow *owner) this->inspectorPanel = new InspectorPanel(owner); this->fftPanel = new FftPanel(owner); this->audioPanel = new AudioPanel(owner); + this->aboutDialog = new AboutDialog(owner); } void diff --git a/App/Application.cpp b/App/Application.cpp index ca0d27ba..68ff717e 100644 --- a/App/Application.cpp +++ b/App/Application.cpp @@ -141,6 +141,7 @@ Application::setAudioInspectorParams( cfg.set("audio.sample-rate", static_cast(rate)); cfg.set("audio.demodulator", static_cast(demod)); this->analyzer->setInspectorConfig(this->audioInspHandle, cfg, 0); + this->assertAudioInspectorLo(); } else { this->delayedRate = rate; this->delayedCutOff = cutOff; @@ -165,13 +166,14 @@ Application::openAudio(unsigned int rate) this->playBack = std::make_unique("default", rate); this->audioSampleRate = this->playBack->getSampleRate(); + this->lastAudioLo = this->getAudioInspectorLo(); if (bw > this->analyzer->getSampleRate() / 2) bw = this->analyzer->getSampleRate() / 2; ch.bw = bw; ch.ft = 0; - ch.fc = this->ui.spectrum->getLoFreq(); + ch.fc = this->getAudioInspectorLo(); ch.fLow = -.5 * bw; ch.fHigh = .5 * bw; @@ -236,6 +238,21 @@ Application::getAudioInspectorBandwidth(void) const return bw; } +SUFREQ +Application::getAudioInspectorLo(void) const +{ + SUFREQ lo = this->ui.spectrum->getLoFreq(); + SUFREQ bw = this->getAudioInspectorBandwidth(); + + if (this->ui.audioPanel->getDemod() == AudioDemod::USB) + lo += .5 * bw; + else if (this->ui.audioPanel->getDemod() == AudioDemod::LSB) + lo -= .5 * bw; + + return lo; +} + + void Application::connectUI(void) { @@ -437,23 +454,6 @@ Application::startCapture(void) } } - //maxIfFreq = this->mediator->getProfile()->getSampleRate() / 2; - - /* - this->ui->sbIFFreq->setMaximum(+maxIfFreq); - this->ui->sbIFFreq->setMinimum(-maxIfFreq); - this->setIfFrequency(oldIfFreq); - - if (SU_ABS(oldIfFreq) > maxIfFreq) { - this->setIfFrequency(0); - - QMessageBox::information( - this, - "IF out of bounds", - "Detector IF was set to 0 Hz to fit sample rate constraints.", - QMessageBox::Ok); - }*/ - // Flush log messages from here Suscan::Logger::getInstance()->flush(); @@ -686,6 +686,9 @@ Application::onAnalyzerReadError(void) Application::~Application() { + if (this->audioCfgTemplate != nullptr) + suscan_config_destroy(this->audioCfgTemplate); + this->playBack = nullptr; this->analyzer = nullptr; this->uninstallDataSaver(); @@ -869,13 +872,20 @@ Application::onCommit(void) } void -Application::onLoChanged(qint64 lo) +Application::onLoChanged(qint64) { - if (this->audioConfigured) { - this->analyzer->setInspectorFreq( - this->audioInspHandle, - static_cast(lo), - 0); + if (this->audioConfigured) + this->assertAudioInspectorLo(); +} + +void +Application::assertAudioInspectorLo(void) +{ + SUFREQ lo = this->getAudioInspectorLo(); + + if (fabs(lo - this->lastAudioLo) > 1e-8) { + this->analyzer->setInspectorFreq(this->audioInspHandle, lo, 0); + this->lastAudioLo = lo; } } @@ -883,10 +893,11 @@ void Application::onBandwidthChanged(qreal) { if (this->audioConfigured) { - this->analyzer->setInspectorBandwidth( - this->audioInspHandle, - this->getAudioInspectorBandwidth(), - 0); + SUFREQ bw; + bw = this->getAudioInspectorBandwidth(); + + this->analyzer->setInspectorBandwidth(this->audioInspHandle, bw, 0); + this->assertAudioInspectorLo(); } } diff --git a/AppConfig.cpp b/AppConfig.cpp deleted file mode 100644 index e69de29b..00000000 diff --git a/AppUI.cpp b/AppUI.cpp deleted file mode 100644 index be1c8c09..00000000 --- a/AppUI.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// -// filename: description -// Copyright (C) 2018 Gonzalo José Carracedo Carballal -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this program. If not, see -// -// diff --git a/Application.cpp b/Application.cpp deleted file mode 100644 index be1c8c09..00000000 --- a/Application.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// -// filename: description -// Copyright (C) 2018 Gonzalo José Carracedo Carballal -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this program. If not, see -// -// diff --git a/ApplicationUI.h b/ApplicationUI.h deleted file mode 100644 index 41d2db56..00000000 --- a/ApplicationUI.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// filename: description -// Copyright (C) 2018 Gonzalo José Carracedo Carballal -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this program. If not, see -// -// -#ifndef APPLICATIONUI_H -#define APPLICATIONUI_H - -#endif // APPLICATIONUI_H diff --git a/AskControl.cpp b/AskControl.cpp deleted file mode 100644 index 3f458cee..00000000 --- a/AskControl.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include "AskControl.h" -#include "ui_AskControl.h" - -AskControl::AskControl(QWidget *parent) : - QWidget(parent), - ui(new Ui::AskControl) -{ - ui->setupUi(this); -} - -AskControl::~AskControl() -{ - delete ui; -} diff --git a/AskControl.h b/AskControl.h deleted file mode 100644 index b0438685..00000000 --- a/AskControl.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef ASKCONTROL_H -#define ASKCONTROL_H - -#include - -namespace Ui { - class AskControl; -} - -class AskControl : public QWidget -{ - Q_OBJECT - - public: - explicit AskControl(QWidget *parent = nullptr); - ~AskControl(); - - private: - Ui::AskControl *ui; -}; - -#endif // ASKCONTROL_H diff --git a/AskControl.ui b/AskControl.ui deleted file mode 100644 index 89cfebb0..00000000 --- a/AskControl.ui +++ /dev/null @@ -1,21 +0,0 @@ - - - - - AskControl - - - - 0 - 0 - 400 - 300 - - - - Form - - - - - diff --git a/AsyncDataSaver.cpp b/AsyncDataSaver.cpp deleted file mode 100644 index ab5455a7..00000000 --- a/AsyncDataSaver.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include "AsyncDataSaver.h" - -AsyncDataSaver::AsyncDataSaver(QObject *parent) : QObject(parent) -{ - -} diff --git a/AsyncDataSaver.h b/AsyncDataSaver.h deleted file mode 100644 index fa7fcc12..00000000 --- a/AsyncDataSaver.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef ASYNCDATASAVER_H -#define ASYNCDATASAVER_H - -#include - -class AsyncDataSaver : public QObject -{ - Q_OBJECT - public: - explicit AsyncDataSaver(QObject *parent = nullptr); - - signals: - - public slots: -}; - -#endif // ASYNCDATASAVER_H \ No newline at end of file diff --git a/AudioPanel.cpp b/AudioPanel.cpp deleted file mode 100644 index c2d82b45..00000000 --- a/AudioPanel.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// -// filename: description -// Copyright (C) 2018 Gonzalo José Carracedo Carballal -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this program. If not, see -// -// -#include "AudioPanel.h" -#include "ui_AudioPanel.h" - -AudioPanel::AudioPanel(QWidget *parent) : - QWidget(parent), - ui(new Ui::AudioPanel) -{ - ui->setupUi(this); -} - -AudioPanel::~AudioPanel() -{ - delete ui; -} diff --git a/AudioPanel.h b/AudioPanel.h deleted file mode 100644 index a2fafdd5..00000000 --- a/AudioPanel.h +++ /dev/null @@ -1,40 +0,0 @@ -// -// filename: description -// Copyright (C) 2018 Gonzalo José Carracedo Carballal -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this program. If not, see -// -// -#ifndef AUDIOPANEL_H -#define AUDIOPANEL_H - -#include - -namespace Ui { - class AudioPanel; -} - -class AudioPanel : public QWidget -{ - Q_OBJECT - -public: - explicit AudioPanel(QWidget *parent = nullptr); - ~AudioPanel(); - -private: - Ui::AudioPanel *ui; -}; - -#endif // AUDIOPANEL_H diff --git a/AudioPanel.ui b/AudioPanel.ui deleted file mode 100644 index 13a131e2..00000000 --- a/AudioPanel.ui +++ /dev/null @@ -1,21 +0,0 @@ - - - - - AudioPanel - - - - 0 - 0 - 400 - 300 - - - - Form - - - - - diff --git a/AudioPlayback.cpp b/AudioPlayback.cpp deleted file mode 100644 index 6925bbec..00000000 --- a/AudioPlayback.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include "AudioPlayback.h" - -AudioPlayback::AudioPlayback() -{ - -} diff --git a/AudioPlayback.h b/AudioPlayback.h deleted file mode 100644 index 9240d9ea..00000000 --- a/AudioPlayback.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef AUDIOPLAYBACK_H -#define AUDIOPLAYBACK_H - - -class AudioPlayback -{ - public: - AudioPlayback(); -}; - -#endif // AUDIOPLAYBACK_H \ No newline at end of file diff --git a/AutoGain.cpp b/AutoGain.cpp deleted file mode 100644 index e69de29b..00000000 diff --git a/Averager.cpp b/Averager.cpp deleted file mode 100644 index be1c8c09..00000000 --- a/Averager.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// -// filename: description -// Copyright (C) 2018 Gonzalo José Carracedo Carballal -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this program. If not, see -// -// diff --git a/ClockRecovery.cpp b/ClockRecovery.cpp deleted file mode 100644 index 538e68a7..00000000 --- a/ClockRecovery.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include "ClockRecovery.h" -#include "ui_ClockRecovery.h" - -ClockRecovery::ClockRecovery(QWidget *parent) : - QWidget(parent), - ui(new Ui::ClockRecovery) -{ - ui->setupUi(this); -} - -ClockRecovery::~ClockRecovery() -{ - delete ui; -} diff --git a/ClockRecovery.h b/ClockRecovery.h deleted file mode 100644 index 578e59e6..00000000 --- a/ClockRecovery.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef CLOCKRECOVERY_H -#define CLOCKRECOVERY_H - -#include - -namespace Ui { - class ClockRecovery; -} - -class ClockRecovery : public QWidget -{ - Q_OBJECT - - public: - explicit ClockRecovery(QWidget *parent = nullptr); - ~ClockRecovery(); - - private: - Ui::ClockRecovery *ui; -}; - -#endif // CLOCKRECOVERY_H diff --git a/ClockRecovery.ui b/ClockRecovery.ui deleted file mode 100644 index a2444364..00000000 --- a/ClockRecovery.ui +++ /dev/null @@ -1,21 +0,0 @@ - - - - - ClockRecovery - - - - 0 - 0 - 400 - 300 - - - - Form - - - - - diff --git a/ColorConfig.cpp b/ColorConfig.cpp deleted file mode 100644 index a7b67ad3..00000000 --- a/ColorConfig.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include "ColorConfig.h" - -ColorConfig::ColorConfig(QObject *parent) : QObject(parent) -{ - -} diff --git a/ColorConfig.h b/ColorConfig.h deleted file mode 100644 index 70bf35f3..00000000 --- a/ColorConfig.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef COLORCONFIG_H -#define COLORCONFIG_H - -#include - -class ColorConfig : public QObject -{ - Q_OBJECT - public: - explicit ColorConfig(QObject *parent = nullptr); - - signals: - - public slots: -}; - -#endif // COLORCONFIG_H \ No newline at end of file diff --git a/Components/ConfigDialog.cpp b/Components/ConfigDialog.cpp index 7f3e2035..6c4c1886 100644 --- a/Components/ConfigDialog.cpp +++ b/Components/ConfigDialog.cpp @@ -33,11 +33,13 @@ void ConfigDialog::populateCombos(void) { Suscan::Singleton *sus = Suscan::Singleton::get_instance(); + this->ui->profileCombo->clear(); + this->ui->deviceCombo->clear(); for (auto i = sus->getFirstProfile(); i != sus->getLastProfile(); ++i) this->ui->profileCombo->addItem( - QString::fromStdString(i->label()), - QVariant::fromValue(*i)); + QString::fromStdString(i->first), + QVariant::fromValue(i->second)); for (auto i = sus->getFirstDevice(); i != sus->getLastDevice(); ++i) this->ui->deviceCombo->addItem( @@ -188,6 +190,13 @@ ConfigDialog::refreshProfileUi(void) { Suscan::Singleton *sus = Suscan::Singleton::get_instance(); + for (auto i = 0; i < this->ui->profileCombo->count(); ++i) + if (this->ui->profileCombo->itemText(i).toStdString() == + this->profile.label()) { + this->ui->profileCombo->setCurrentIndex(i); + break; + } + this->ui->frequencyLine->setText( QString::number( static_cast(this->profile.getFreq()))); @@ -328,15 +337,21 @@ ConfigDialog::connectAll(void) connect( this, - SIGNAL(accepted()), + SIGNAL(accepted(void)), this, - SLOT(onAccepted())); + SLOT(onAccepted(void))); connect( this->ui->browseButton, - SIGNAL(clicked()), + SIGNAL(clicked(void)), this, - SLOT(onBrowseCaptureFile())); + SLOT(onBrowseCaptureFile(void))); + + connect( + this->ui->saveProfileButton, + SIGNAL(clicked(void)), + this, + SLOT(onSaveProfile(void))); } void @@ -598,3 +613,36 @@ ConfigDialog::onBrowseCaptureFile(void) this->profile.setPath(path.toStdString()); } } + +void +ConfigDialog::onSaveProfile(void) +{ + Suscan::Singleton *sus = Suscan::Singleton::get_instance(); + std::string name = "My " + this->profile.label(); + std::string candidate = name; + unsigned int i = 1; + + while (sus->getProfile(candidate) != nullptr) + candidate = name + " (" + std::to_string(i++) + ")"; + + this->saveProfileDialog.setProfileName(QString::fromStdString(candidate)); + + if (this->saveProfileDialog.run()) { + candidate = this->saveProfileDialog.getProfileName().toStdString(); + + if (sus->getProfile(candidate) != nullptr) { + QMessageBox::warning( + this, + "Profile already exists", + "There is already a profile named " + + this->saveProfileDialog.getProfileName() + + " please choose a different one.", + QMessageBox::Ok); + return; + } + + this->profile.setLabel(candidate); + sus->saveProfile(this->profile); + this->populateCombos(); + } +} diff --git a/Components/FftPanel.cpp b/Components/FftPanel.cpp index eb464265..9089eff9 100644 --- a/Components/FftPanel.cpp +++ b/Components/FftPanel.cpp @@ -366,6 +366,8 @@ void FftPanel::setFreqZoom(int zoom) { this->ui->freqZoomSlider->setValue(zoom); + this->ui->freqZoomLabel->setText( + zoom < 1 ? "<1x" : QString::number(zoom) + "x"); this->panelConfig->zoom = zoom; } diff --git a/Components/MainSpectrum.cpp b/Components/MainSpectrum.cpp index 854c422b..29f2a0b7 100644 --- a/Components/MainSpectrum.cpp +++ b/Components/MainSpectrum.cpp @@ -1,6 +1,6 @@ // -// filename: description -// Copyright (C) 2018 Gonzalo José Carracedo Carballal +// MainSpectrum.cpp: Main spectrum component +// Copyright (C) 2019 Gonzalo José Carracedo Carballal // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as @@ -16,6 +16,7 @@ // License along with this program. If not, see // // + #include "MainSpectrum.h" #include "ui_MainSpectrum.h" diff --git a/Config.ui b/Config.ui deleted file mode 100644 index 18d31ab9..00000000 --- a/Config.ui +++ /dev/null @@ -1,71 +0,0 @@ - - - - - Dialog - - - - 0 - 0 - 400 - 300 - - - - Dialog - - - - - 30 - 240 - 341 - 32 - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - - - - - buttonBox - accepted() - Dialog - accept() - - - 248 - 254 - - - 157 - 274 - - - - - buttonBox - rejected() - Dialog - reject() - - - 316 - 260 - - - 286 - 274 - - - - - diff --git a/ConfigDialog.cpp b/ConfigDialog.cpp deleted file mode 100644 index be1c8c09..00000000 --- a/ConfigDialog.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// -// filename: description -// Copyright (C) 2018 Gonzalo José Carracedo Carballal -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this program. If not, see -// -// diff --git a/DataSaverUI.cpp b/DataSaverUI.cpp deleted file mode 100644 index 9aed81bd..00000000 --- a/DataSaverUI.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include "DataSaverUI.h" -#include "ui_DataSaverUI.h" - -DataSaverUI::DataSaverUI(QWidget *parent) : - QWidget(parent), - ui(new Ui::DataSaverUI) -{ - ui->setupUi(this); -} - -DataSaverUI::~DataSaverUI() -{ - delete ui; -} diff --git a/DataSaverUI.h b/DataSaverUI.h deleted file mode 100644 index cd108326..00000000 --- a/DataSaverUI.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef DATASAVERUI_H -#define DATASAVERUI_H - -#include - -namespace Ui { - class DataSaverUI; -} - -class DataSaverUI : public QWidget -{ - Q_OBJECT - - public: - explicit DataSaverUI(QWidget *parent = nullptr); - ~DataSaverUI(); - - private: - Ui::DataSaverUI *ui; -}; - -#endif // DATASAVERUI_H diff --git a/DataSaverUI.ui b/DataSaverUI.ui deleted file mode 100644 index fff13b42..00000000 --- a/DataSaverUI.ui +++ /dev/null @@ -1,21 +0,0 @@ - - - - - DataSaverUI - - - - 0 - 0 - 400 - 300 - - - - Form - - - - - diff --git a/DeviceGain.cpp b/DeviceGain.cpp deleted file mode 100644 index 1c2f3a4a..00000000 --- a/DeviceGain.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// -// filename: description -// Copyright (C) 2018 Gonzalo José Carracedo Carballal -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this program. If not, see -// -// -#include "DeviceGain.h" -#include "ui_DeviceGain.h" - -DeviceGain::DeviceGain(QWidget *parent) : - QWidget(parent), - ui(new Ui::DeviceGain) -{ - ui->setupUi(this); -} - -DeviceGain::~DeviceGain() -{ - delete ui; -} diff --git a/DeviceGain.h b/DeviceGain.h deleted file mode 100644 index 52b12c25..00000000 --- a/DeviceGain.h +++ /dev/null @@ -1,40 +0,0 @@ -// -// filename: description -// Copyright (C) 2018 Gonzalo José Carracedo Carballal -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this program. If not, see -// -// -#ifndef DEVICEGAIN_H -#define DEVICEGAIN_H - -#include - -namespace Ui { - class DeviceGain; -} - -class DeviceGain : public QWidget -{ - Q_OBJECT - -public: - explicit DeviceGain(QWidget *parent = nullptr); - ~DeviceGain(); - -private: - Ui::DeviceGain *ui; -}; - -#endif // DEVICEGAIN_H diff --git a/DeviceGain.ui b/DeviceGain.ui deleted file mode 100644 index fab02e01..00000000 --- a/DeviceGain.ui +++ /dev/null @@ -1,21 +0,0 @@ - - - - - DeviceGain - - - - 0 - 0 - 400 - 300 - - - - Form - - - - - diff --git a/EqualizerControl.cpp b/EqualizerControl.cpp deleted file mode 100644 index 350ba64d..00000000 --- a/EqualizerControl.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include "EqualizerControl.h" -#include "ui_EqualizerControl.h" - -EqualizerControl::EqualizerControl(QWidget *parent) : - QWidget(parent), - ui(new Ui::EqualizerControl) -{ - ui->setupUi(this); -} - -EqualizerControl::~EqualizerControl() -{ - delete ui; -} diff --git a/EqualizerControl.h b/EqualizerControl.h deleted file mode 100644 index eee2864f..00000000 --- a/EqualizerControl.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef EQUALIZERCONTROL_H -#define EQUALIZERCONTROL_H - -#include - -namespace Ui { - class EqualizerControl; -} - -class EqualizerControl : public QWidget -{ - Q_OBJECT - - public: - explicit EqualizerControl(QWidget *parent = nullptr); - ~EqualizerControl(); - - private: - Ui::EqualizerControl *ui; -}; - -#endif // EQUALIZERCONTROL_H diff --git a/EqualizerControl.ui b/EqualizerControl.ui deleted file mode 100644 index 4be07498..00000000 --- a/EqualizerControl.ui +++ /dev/null @@ -1,21 +0,0 @@ - - - - - EqualizerControl - - - - 0 - 0 - 400 - 300 - - - - Form - - - - - diff --git a/FftPanel.cpp b/FftPanel.cpp deleted file mode 100644 index 92bb8095..00000000 --- a/FftPanel.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// -// filename: description -// Copyright (C) 2018 Gonzalo José Carracedo Carballal -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this program. If not, see -// -// -#include "FftPanel.h" -#include "ui_FftPanel.h" - -FftPanel::FftPanel(QWidget *parent) : - QWidget(parent), - ui(new Ui::FftPanel) -{ - ui->setupUi(this); -} - -FftPanel::~FftPanel() -{ - delete ui; -} diff --git a/FftPanel.h b/FftPanel.h deleted file mode 100644 index 74cc7b72..00000000 --- a/FftPanel.h +++ /dev/null @@ -1,40 +0,0 @@ -// -// filename: description -// Copyright (C) 2018 Gonzalo José Carracedo Carballal -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this program. If not, see -// -// -#ifndef FFTPANEL_H -#define FFTPANEL_H - -#include - -namespace Ui { - class FftPanel; -} - -class FftPanel : public QWidget -{ - Q_OBJECT - -public: - explicit FftPanel(QWidget *parent = nullptr); - ~FftPanel(); - -private: - Ui::FftPanel *ui; -}; - -#endif // FFTPANEL_H diff --git a/FftPanel.ui b/FftPanel.ui deleted file mode 100644 index 98615c6e..00000000 --- a/FftPanel.ui +++ /dev/null @@ -1,21 +0,0 @@ - - - - - FftPanel - - - - 0 - 0 - 400 - 300 - - - - Form - - - - - diff --git a/GainControl.cpp b/GainControl.cpp deleted file mode 100644 index 7f2dfc4f..00000000 --- a/GainControl.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include "GainControl.h" -#include "ui_GainControl.h" - -GainControl::GainControl(QWidget *parent) : - QWidget(parent), - ui(new Ui::GainControl) -{ - ui->setupUi(this); -} - -GainControl::~GainControl() -{ - delete ui; -} diff --git a/GainControl.h b/GainControl.h deleted file mode 100644 index 60a63a00..00000000 --- a/GainControl.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef GAINCONTROL_H -#define GAINCONTROL_H - -#include - -namespace Ui { - class GainControl; -} - -class GainControl : public QWidget -{ - Q_OBJECT - - public: - explicit GainControl(QWidget *parent = nullptr); - ~GainControl(); - - private: - Ui::GainControl *ui; -}; - -#endif // GAINCONTROL_H diff --git a/GainControl.ui b/GainControl.ui deleted file mode 100644 index f2d5ca75..00000000 --- a/GainControl.ui +++ /dev/null @@ -1,21 +0,0 @@ - - - - - GainControl - - - - 0 - 0 - 400 - 300 - - - - Form - - - - - diff --git a/GainSlider.cpp b/GainSlider.cpp deleted file mode 100644 index 0f420814..00000000 --- a/GainSlider.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include "GainSlider.h" -#include "ui_GainSlider.h" - -GainSlider::GainSlider(QWidget *parent) : - QWidget(parent), - ui(new Ui::GainSlider) -{ - ui->setupUi(this); -} - -GainSlider::~GainSlider() -{ - delete ui; -} diff --git a/GainSlider.h b/GainSlider.h deleted file mode 100644 index 6fbac85c..00000000 --- a/GainSlider.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef GAINSLIDER_H -#define GAINSLIDER_H - -#include - -namespace Ui { - class GainSlider; -} - -class GainSlider : public QWidget -{ - Q_OBJECT - - public: - explicit GainSlider(QWidget *parent = nullptr); - ~GainSlider(); - - private: - Ui::GainSlider *ui; -}; - -#endif // GAINSLIDER_H diff --git a/GainSlider.ui b/GainSlider.ui deleted file mode 100644 index a2436fb0..00000000 --- a/GainSlider.ui +++ /dev/null @@ -1,21 +0,0 @@ - - - - - GainSlider - - - - 0 - 0 - 400 - 300 - - - - Form - - - - - diff --git a/Icons.qrc b/Icons.qrc deleted file mode 100644 index 90f4a837..00000000 --- a/Icons.qrc +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/Inspector.cpp b/Inspector.cpp deleted file mode 100644 index dc8af989..00000000 --- a/Inspector.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include "Inspector.h" -#include "ui_Inspector.h" - -Inspector::Inspector(QWidget *parent) : - QWidget(parent), - ui(new Ui::Inspector) -{ - ui->setupUi(this); -} - -Inspector::~Inspector() -{ - delete ui; -} diff --git a/Inspector.h b/Inspector.h deleted file mode 100644 index c7891c45..00000000 --- a/Inspector.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef INSPECTOR_H -#define INSPECTOR_H - -#include - -namespace Ui { - class Inspector; -} - -class Inspector : public QWidget -{ - Q_OBJECT - - public: - explicit Inspector(QWidget *parent = nullptr); - ~Inspector(); - - private: - Ui::Inspector *ui; -}; - -#endif // INSPECTOR_H diff --git a/Inspector.ui b/Inspector.ui deleted file mode 100644 index 3666032a..00000000 --- a/Inspector.ui +++ /dev/null @@ -1,21 +0,0 @@ - - - - - Inspector - - - - 0 - 0 - 400 - 300 - - - - Form - - - - - diff --git a/InspectorCtl.cpp b/InspectorCtl.cpp deleted file mode 100644 index e69de29b..00000000 diff --git a/InspectorPanel.cpp b/InspectorPanel.cpp deleted file mode 100644 index d9932ae8..00000000 --- a/InspectorPanel.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// -// filename: description -// Copyright (C) 2018 Gonzalo José Carracedo Carballal -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this program. If not, see -// -// -#include "InspectorPanel.h" -#include "ui_InspectorPanel.h" - -InspectorPanel::InspectorPanel(QWidget *parent) : - QWidget(parent), - ui(new Ui::InspectorPanel) -{ - ui->setupUi(this); -} - -InspectorPanel::~InspectorPanel() -{ - delete ui; -} diff --git a/InspectorPanel.h b/InspectorPanel.h deleted file mode 100644 index 58aa0033..00000000 --- a/InspectorPanel.h +++ /dev/null @@ -1,40 +0,0 @@ -// -// filename: description -// Copyright (C) 2018 Gonzalo José Carracedo Carballal -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this program. If not, see -// -// -#ifndef INSPECTORPANEL_H -#define INSPECTORPANEL_H - -#include - -namespace Ui { - class InspectorPanel; -} - -class InspectorPanel : public QWidget -{ - Q_OBJECT - -public: - explicit InspectorPanel(QWidget *parent = nullptr); - ~InspectorPanel(); - -private: - Ui::InspectorPanel *ui; -}; - -#endif // INSPECTORPANEL_H diff --git a/InspectorPanel.ui b/InspectorPanel.ui deleted file mode 100644 index bae9f11c..00000000 --- a/InspectorPanel.ui +++ /dev/null @@ -1,21 +0,0 @@ - - - - - InspectorPanel - - - - 0 - 0 - 400 - 300 - - - - Form - - - - - diff --git a/InspectorUI.cpp b/InspectorUI.cpp deleted file mode 100644 index e69de29b..00000000 diff --git a/Loader.cpp b/Loader.cpp deleted file mode 100644 index a84e1c8f..00000000 --- a/Loader.cpp +++ /dev/null @@ -1,134 +0,0 @@ -// -// Loader.cpp: GUI-Level Suscan initialization -// Copyright (C) 2018 Gonzalo José Carracedo Carballal -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this program. If not, see -// -// - -#include - -#include -#include - -#include - -using namespace QStones; - -//////////////////////////////// Loader thread /////////////////////////////// -InitThread::InitThread(QObject *parent) : QThread(parent) { } - -void -InitThread::run() -{ - Suscan::Singleton *sing = Suscan::Singleton::get_instance(); - - try { - emit change("Loading spectrum sources"); - sing->init_sources(); - } catch (Suscan::Exception &e) { - emit failure(QString(e.what())); - } - - emit done(); -} - -///////////////////////////////// Loader UI ////////////////////////////////// -Loader::Loader(Application *app) -{ - QFont font; - static QPixmap background(QString(":/splash.png")); - - this->suscan = Suscan::Singleton::get_instance(); - this->app = app; - - // Allocate resources - this->initThread = std::make_unique(this); - - font.setBold(true); - font.setPixelSize(12); - font.setStretch(125); - - this->setPixmap(background); - this->setFont(font); - this->setWindowFlags(Qt::WindowStaysOnTopHint | Qt::SplashScreen); - this->finish(this->app); - - // Connect thread to this object - connect( - this->initThread.get(), - SIGNAL(done(void)), - this, - SLOT(handleDone(void)), - Qt::QueuedConnection); - - connect( - this->initThread.get(), - SIGNAL(change(const QString &)), - this, - SLOT(handleChange(const QString &)), - Qt::QueuedConnection); - - connect( - this->initThread.get(), - SIGNAL(failure(const QString &)), - this, - SLOT(handleFailure(const QString &)), - Qt::QueuedConnection); -} - -Loader::~Loader() -{ -} - -// Signal handlers -void -Loader::handleChange(const QString &state) -{ - this->showMessage(state + "..."); -} - -void -Loader::handleFailure(const QString &state) -{ - (void) QMessageBox::critical( - this, - "Suscan initialization", - "Failed to initialize Suscan's utility library: " + state, - QMessageBox::Close); - - QApplication::quit(); -} - -void -Loader::handleDone(void) -{ - this->app->run(); - this->close(); -} - -// Public methods -void -Loader::showMessage(const QString &message) -{ - QSplashScreen::showMessage(message, Qt::AlignLeft, Qt::white); -} - - -void -Loader::load(void) -{ - this->show(); - this->initThread->start(); -} diff --git a/MainSpectrum.cpp b/MainSpectrum.cpp deleted file mode 100644 index c84d4ee1..00000000 --- a/MainSpectrum.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// -// filename: description -// Copyright (C) 2018 Gonzalo José Carracedo Carballal -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this program. If not, see -// -// -#include "MainSpectrum.h" -#include "ui_MainSpectrum.h" - -MainSpectrum::MainSpectrum(QWidget *parent) : - QWidget(parent), - ui(new Ui::MainSpectrum) -{ - ui->setupUi(this); -} - -MainSpectrum::~MainSpectrum() -{ - delete ui; -} diff --git a/MainSpectrum.h b/MainSpectrum.h deleted file mode 100644 index 39ab7169..00000000 --- a/MainSpectrum.h +++ /dev/null @@ -1,40 +0,0 @@ -// -// filename: description -// Copyright (C) 2018 Gonzalo José Carracedo Carballal -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this program. If not, see -// -// -#ifndef MAINSPECTRUM_H -#define MAINSPECTRUM_H - -#include - -namespace Ui { - class MainSpectrum; -} - -class MainSpectrum : public QWidget -{ - Q_OBJECT - -public: - explicit MainSpectrum(QWidget *parent = nullptr); - ~MainSpectrum(); - -private: - Ui::MainSpectrum *ui; -}; - -#endif // MAINSPECTRUM_H diff --git a/MainSpectrum.ui b/MainSpectrum.ui deleted file mode 100644 index 0acd2254..00000000 --- a/MainSpectrum.ui +++ /dev/null @@ -1,21 +0,0 @@ - - - - - MainSpectrum - - - - 0 - 0 - 400 - 300 - - - - Form - - - - - diff --git a/MainWindow.cpp b/MainWindow.cpp deleted file mode 100644 index c7d44d6c..00000000 --- a/MainWindow.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// -// filename: description -// Copyright (C) 2018 Gonzalo José Carracedo Carballal -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this program. If not, see -// -// -#include "MainWindow.h" -#include "ui_MainWindow.h" - -MainWindow::MainWindow(QWidget *parent) : - QMainWindow(parent), - ui(new Ui::MainWindow) -{ - ui->setupUi(this); -} - -MainWindow::~MainWindow() -{ - delete ui; -} diff --git a/MainWindow.h b/MainWindow.h deleted file mode 100644 index ab96d96a..00000000 --- a/MainWindow.h +++ /dev/null @@ -1,40 +0,0 @@ -// -// filename: description -// Copyright (C) 2018 Gonzalo José Carracedo Carballal -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this program. If not, see -// -// -#ifndef MAINWINDOW_H -#define MAINWINDOW_H - -#include - -namespace Ui { - class MainWindow; -} - -class MainWindow : public QMainWindow -{ - Q_OBJECT - -public: - explicit MainWindow(QWidget *parent = nullptr); - ~MainWindow(); - -private: - Ui::MainWindow *ui; -}; - -#endif // MAINWINDOW_H diff --git a/MainWindow.ui b/MainWindow.ui deleted file mode 100644 index 6050363f..00000000 --- a/MainWindow.ui +++ /dev/null @@ -1,24 +0,0 @@ - - MainWindow - - - - 0 - 0 - 400 - 300 - - - - MainWindow - - - - - - - - - - - diff --git a/MfControl.cpp b/MfControl.cpp deleted file mode 100644 index 7f58256e..00000000 --- a/MfControl.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include "MfControl.h" -#include "ui_MfControl.h" - -MfControl::MfControl(QWidget *parent) : - QWidget(parent), - ui(new Ui::MfControl) -{ - ui->setupUi(this); -} - -MfControl::~MfControl() -{ - delete ui; -} diff --git a/MfControl.h b/MfControl.h deleted file mode 100644 index 5f2eaa55..00000000 --- a/MfControl.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef MFCONTROL_H -#define MFCONTROL_H - -#include - -namespace Ui { - class MfControl; -} - -class MfControl : public QWidget -{ - Q_OBJECT - - public: - explicit MfControl(QWidget *parent = nullptr); - ~MfControl(); - - private: - Ui::MfControl *ui; -}; - -#endif // MFCONTROL_H diff --git a/MfControl.ui b/MfControl.ui deleted file mode 100644 index 93c242a9..00000000 --- a/MfControl.ui +++ /dev/null @@ -1,21 +0,0 @@ - - - - - MfControl - - - - 0 - 0 - 400 - 300 - - - - Form - - - - - diff --git a/Palette.cpp b/Palette.cpp deleted file mode 100644 index e69de29b..00000000 diff --git a/PersistentWidget.cpp b/PersistentWidget.cpp deleted file mode 100644 index 8637f5aa..00000000 --- a/PersistentWidget.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include "PersistentWidget.h" - -PersistentWidget::PersistentWidget(QWidget *parent) : QWidget(parent) -{ - -} diff --git a/PersistentWidget.h b/PersistentWidget.h deleted file mode 100644 index 51ff8a05..00000000 --- a/PersistentWidget.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef PERSISTENTWIDGET_H -#define PERSISTENTWIDGET_H - -#include - -class PersistentWidget : public QWidget -{ - Q_OBJECT - public: - explicit PersistentWidget(QWidget *parent = nullptr); - - signals: - - public slots: -}; - -#endif // PERSISTENTWIDGET_H \ No newline at end of file diff --git a/SNREstimator.cpp b/SNREstimator.cpp deleted file mode 100644 index 52ff6692..00000000 --- a/SNREstimator.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include "SNREstimator.h" - -SNREstimator::SNREstimator() -{ - -} diff --git a/SNREstimator.h b/SNREstimator.h deleted file mode 100644 index 950bc501..00000000 --- a/SNREstimator.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef SNRESTIMATOR_H -#define SNRESTIMATOR_H - - -class SNREstimator -{ - public: - SNREstimator(); -}; - -#endif // SNRESTIMATOR_H \ No newline at end of file diff --git a/SigDigger.pro b/SigDigger.pro index 64f6eed6..f1649489 100644 --- a/SigDigger.pro +++ b/SigDigger.pro @@ -22,19 +22,172 @@ DEFINES += QT_DEPRECATED_WARNINGS # You can also select to disable deprecated APIs only up to a certain version of Qt. #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 -CONFIG += c++11 - +CONFIG += c++14 +INCLUDEPATH += $$PWD/include /usr/include/SuWidgets SOURCES += \ - main.cpp \ - MainWindow.cpp + App/AppConfig.cpp \ + App/Application.cpp \ + App/AppUI.cpp \ + App/ColorConfig.cpp \ + App/Loader.cpp \ + Audio/AudioPlayback.cpp \ + Components/AboutDialog.cpp \ + Components/AudioPanel.cpp \ + Components/ConfigDialog.cpp \ + Components/DataSaverUI.cpp \ + Components/DeviceGain.cpp \ + Components/FftPanel.cpp \ + Components/GainSlider.cpp \ + Components/InspectorPanel.cpp \ + Components/MainSpectrum.cpp \ + Components/MainWindow.cpp \ + Components/PersistentWidget.cpp \ + Components/SaveProfileDialog.cpp \ + Components/SourcePanel.cpp \ + Inspector/Inspector.cpp \ + Inspector/InspectorUI.cpp \ + InspectorCtl/AfcControl.cpp \ + InspectorCtl/AskControl.cpp \ + InspectorCtl/ClockRecovery.cpp \ + InspectorCtl/EqualizerControl.cpp \ + InspectorCtl/GainControl.cpp \ + InspectorCtl/InspectorCtl.cpp \ + InspectorCtl/MfControl.cpp \ + InspectorCtl/ToneControl.cpp \ + Misc/AsyncDataSaver.cpp \ + Misc/AutoGain.cpp \ + Misc/Averager.cpp \ + Misc/Palette.cpp \ + Misc/SNREstimator.cpp \ + Suscan/Messages/ChannelMessage.cpp \ + Suscan/Messages/GenericMessage.cpp \ + Suscan/Messages/InspectorMessage.cpp \ + Suscan/Messages/PSDMessage.cpp \ + Suscan/Messages/SamplesMessage.cpp \ + Suscan/Analyzer.cpp \ + Suscan/AnalyzerParams.cpp \ + Suscan/Config.cpp \ + Suscan/Exception.cpp \ + Suscan/Library.cpp \ + Suscan/Logger.cpp \ + Suscan/Message.cpp \ + Suscan/MQ.cpp \ + Suscan/Object.cpp \ + Suscan/Serializable.cpp \ + Suscan/Source.cpp \ + UIMediator/AudioMediator.cpp \ + UIMediator/FftMediator.cpp \ + UIMediator/InspectorMediator.cpp \ + UIMediator/SourceMediator.cpp \ + UIMediator/SpectrumMediator.cpp \ + UIMediator/UIMediator.cpp \ + main.cpp + HEADERS += \ - MainWindow.h + include/Suscan/Messages/ChannelMessage.h \ + include/Suscan/Messages/GenericMessage.h \ + include/Suscan/Messages/InspectorMessage.h \ + include/Suscan/Messages/PSDMessage.h \ + include/Suscan/Messages/SamplesMessage.h \ + include/Suscan/Analyzer.h \ + include/Suscan/AnalyzerParams.h \ + include/Suscan/AutoGain_copy.h \ + include/Suscan/Channel.h \ + include/Suscan/Compat.h \ + include/Suscan/Config.h \ + include/Suscan/Estimator.h \ + include/Suscan/Library.h \ + include/Suscan/Logger.h \ + include/Suscan/Message.h \ + include/Suscan/MQ.h \ + include/Suscan/Object.h \ + include/Suscan/Serializable.h \ + include/Suscan/Source.h \ + include/Suscan/SpectrumSource.h \ + include/AboutDialog.h \ + include/AfcControl.h \ + include/AppConfig.h \ + include/Application.h \ + include/AppUI.h \ + include/AskControl.h \ + include/AsyncDataSaver.h \ + include/AudioPanel.h \ + include/AudioPlayback.h \ + include/AutoGain.h \ + include/Averager.h \ + include/ClockRecovery.h \ + include/ColorConfig.h \ + include/ConfigDialog.h \ + include/DataSaverUI.h \ + include/DefaultGradient.h \ + include/DeviceGain.h \ + include/EqualizerControl.h \ + include/FftPanel.h \ + include/GainControl.h \ + include/GainSlider.h \ + include/Inspector.h \ + include/InspectorCtl.h \ + include/InspectorPanel.h \ + include/InspectorUI.h \ + include/Loader.h \ + include/MainSpectrum.h \ + include/MainWindow.h \ + include/MfControl.h \ + include/Palette.h \ + include/PersistentWidget.h \ + include/SaveProfileDialog.h \ + include/SNREstimator.h \ + include/SourcePanel.h \ + include/ToneControl.h \ + include/UIMediator.h + FORMS += \ - MainWindow.ui + ui/AboutDialog.ui \ + ui/AfcControl.ui \ + ui/AskControl.ui \ + ui/AudioPanel.ui \ + ui/ClockRecovery.ui \ + ui/Config.ui \ + ui/DataSaverUI.ui \ + ui/DeviceGain.ui \ + ui/EqualizerControl.ui \ + ui/FftPanel.ui \ + ui/GainControl.ui \ + ui/GainSlider.ui \ + ui/Inspector.ui \ + ui/InspectorPanel.ui \ + ui/MainSpectrum.ui \ + ui/MainWindow.ui \ + ui/MfControl.ui \ + ui/SourcePanel.ui \ + ui/ToneControl.ui \ + ui/SaveProfileDialog.ui + # Default rules for deployment. qnx: target.path = /tmp/$${TARGET}/bin else: unix:!android: target.path = /opt/$${TARGET}/bin !isEmpty(target.path): INSTALLS += target + +RESOURCES += \ + icons/Icons.qrc + +unix: CONFIG += link_pkgconfig +unix: PKGCONFIG += suscan alsa + +unix: LIBS += -lsuwidgets + +DISTFILES += \ + icons/icon-alpha.png \ + icons/icon-color-about.png \ + icons/icon-color.png \ + icons/icon-pro.png \ + icons/icon.png \ + icons/overlay-channels.png \ + icons/preferences.png \ + icons/select-source.png \ + icons/splash.png \ + icons/start-capture.png \ + icons/splash.xcf diff --git a/SourcePanel.cpp b/SourcePanel.cpp deleted file mode 100644 index 4dc021ed..00000000 --- a/SourcePanel.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include "SourcePanel.h" -#include "ui_SourcePanel.h" - -SourcePanel::SourcePanel(QWidget *parent) : - QWidget(parent), - ui(new Ui::SourcePanel) -{ - ui->setupUi(this); -} - -SourcePanel::~SourcePanel() -{ - delete ui; -} diff --git a/SourcePanel.h b/SourcePanel.h deleted file mode 100644 index c1820f71..00000000 --- a/SourcePanel.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef SOURCEPANEL_H -#define SOURCEPANEL_H - -#include - -namespace Ui { - class SourcePanel; -} - -class SourcePanel : public QWidget -{ - Q_OBJECT - - public: - explicit SourcePanel(QWidget *parent = nullptr); - ~SourcePanel(); - - private: - Ui::SourcePanel *ui; -}; - -#endif // SOURCEPANEL_H diff --git a/SourcePanel.ui b/SourcePanel.ui deleted file mode 100644 index e22f1ff0..00000000 --- a/SourcePanel.ui +++ /dev/null @@ -1,21 +0,0 @@ - - - - - SourcePanel - - - - 0 - 0 - 400 - 300 - - - - Form - - - - - diff --git a/Suscan/Analyzer.cpp b/Suscan/Analyzer.cpp index 57e54792..197410e0 100644 --- a/Suscan/Analyzer.cpp +++ b/Suscan/Analyzer.cpp @@ -44,21 +44,10 @@ Analyzer::AsyncThread::run() data = this->owner->read(type); switch (type) { - // Data messages - case SUSCAN_ANALYZER_MESSAGE_TYPE_CHANNEL: - emit message(ChannelMessage(static_cast(data))); - break; - case SUSCAN_ANALYZER_MESSAGE_TYPE_INSPECTOR: - emit message(InspectorMessage(static_cast(data))); - break; - case SUSCAN_ANALYZER_MESSAGE_TYPE_PSD: - emit message(PSDMessage(static_cast(data))); - break; - case SUSCAN_ANALYZER_MESSAGE_TYPE_SAMPLES: - emit message(SamplesMessage(static_cast(data))); + emit message(type, data); break; // Exit conditions @@ -66,6 +55,7 @@ Analyzer::AsyncThread::run() case SUSCAN_ANALYZER_MESSAGE_TYPE_EOS: case SUSCAN_ANALYZER_MESSAGE_TYPE_READ_ERROR: running = false; + suscan_analyzer_dispose_message(type, data); break; default: @@ -76,7 +66,7 @@ Analyzer::AsyncThread::run() } while (running); // Emit exit reason - emit message(GenericMessage(type, data)); + emit message(type, data); } Analyzer::AsyncThread::AsyncThread(Analyzer *owner) @@ -106,12 +96,60 @@ Analyzer::registerBaseBandFilter(suscan_analyzer_baseband_filter_func_t func, vo SU_ATTEMPT(suscan_analyzer_register_baseband_filter(this->instance, func, privdata)); } +void +Analyzer::setGain(std::string const &name, SUFLOAT value) +{ + SU_ATTEMPT(suscan_analyzer_set_gain(this->instance, name.c_str(), value)); +} + +void +Analyzer::setAntenna(std::string const &name) +{ + SU_ATTEMPT(suscan_analyzer_set_antenna(this->instance, name.c_str())); +} + void Analyzer::setFrequency(SUFREQ freq) { SU_ATTEMPT(suscan_analyzer_set_freq(this->instance, freq)); } +void +Analyzer::setParams(AnalyzerParams ¶ms) +{ + SU_ATTEMPT( + suscan_analyzer_set_params_async( + this->instance, + ¶ms.getCParams(), + 0)); +} + +void +Analyzer::setDCRemove(bool remove) +{ + SU_ATTEMPT( + suscan_analyzer_set_dc_remove( + this->instance, + remove ? SU_TRUE : SU_FALSE)); +} + +void +Analyzer::setIQReverse(bool remove) +{ + SU_ATTEMPT( + suscan_analyzer_set_iq_reverse( + this->instance, + remove ? SU_TRUE : SU_FALSE)); +} + +void +Analyzer::setAGC(bool enabled) +{ + SU_ATTEMPT( + suscan_analyzer_set_agc(this->instance, enabled ? SU_TRUE : SU_FALSE)); + +} + SUSCOUNT Analyzer::getSampleRate(void) const { @@ -126,24 +164,38 @@ Analyzer::halt(void) // Signal slots void -Analyzer::captureMessage(const Suscan::Message &msg) +Analyzer::captureMessage(quint32 type, void *data) { - switch (msg.getType()) { + switch (type) { + // Data messages + case SUSCAN_ANALYZER_MESSAGE_TYPE_INSPECTOR: + emit inspector_message(InspectorMessage(static_cast(data))); + break; + case SUSCAN_ANALYZER_MESSAGE_TYPE_PSD: - emit psd_message(static_cast(msg)); + emit psd_message(PSDMessage(static_cast(data))); break; - case SUSCAN_ANALYZER_MESSAGE_TYPE_EOS: - emit eos(); + case SUSCAN_ANALYZER_MESSAGE_TYPE_SAMPLES: + emit samples_message(SamplesMessage(static_cast(data))); break; + // Exit conditions. These have no data. case SUSCAN_WORKER_MSG_TYPE_HALT: emit halted(); break; + case SUSCAN_ANALYZER_MESSAGE_TYPE_EOS: + emit eos(); + break; + case SUSCAN_ANALYZER_MESSAGE_TYPE_READ_ERROR: emit read_error(); break; + + default: + // Everything else is disposed + suscan_analyzer_dispose_message(type, data); } } @@ -156,19 +208,139 @@ Analyzer::assertTypeRegistration(void) qRegisterMetaType(); qRegisterMetaType(); qRegisterMetaType(); + qRegisterMetaType(); + qRegisterMetaType(); Analyzer::registered = true; } } +void +Analyzer::open( + std::string const &inspClass, + Channel const &ch, + RequestId id) +{ + struct sigutils_channel c_ch = + sigutils_channel_INITIALIZER; + + c_ch.fc = static_cast(ch.fc); + c_ch.ft = static_cast(ch.ft); + c_ch.f_lo = static_cast(ch.fLow); + c_ch.f_hi = static_cast(ch.fHigh); + c_ch.bw = static_cast(ch.fHigh - ch.fLow); + + SU_ATTEMPT( + suscan_analyzer_open_async( + this->instance, + inspClass.c_str(), + &c_ch, + id)); +} + +void +Analyzer::openPrecise( + std::string const &inspClass, + Channel const &ch, + RequestId id) +{ + struct sigutils_channel c_ch = + sigutils_channel_INITIALIZER; + + c_ch.fc = static_cast(ch.fc); + c_ch.ft = static_cast(ch.ft); + c_ch.f_lo = static_cast(ch.fLow); + c_ch.f_hi = static_cast(ch.fHigh); + c_ch.bw = static_cast(ch.fHigh - ch.fLow); + + SU_ATTEMPT( + suscan_analyzer_open_ex_async( + this->instance, + inspClass.c_str(), + &c_ch, + SU_TRUE, + id)); +} + +void +Analyzer::setInspectorConfig(Handle handle, Config const &cfg, RequestId id) +{ + SU_ATTEMPT( + suscan_analyzer_set_inspector_config_async( + this->instance, + handle, + cfg.getInstance(), + id)); +} + +void +Analyzer::setInspectorId(Handle handle, InspectorId id, RequestId req_id) +{ + SU_ATTEMPT( + suscan_analyzer_set_inspector_id_async( + this->instance, + handle, + id, + req_id)); +} + +void +Analyzer::setInspectorFreq(Handle handle, SUFREQ freq, RequestId req_id) +{ + SU_ATTEMPT( + suscan_analyzer_set_inspector_freq_async( + this->instance, + handle, + freq, + req_id)); +} + +void +Analyzer::setInspectorBandwidth(Handle handle, SUFREQ bw, RequestId req_id) +{ + SU_ATTEMPT( + suscan_analyzer_set_inspector_bandwidth_async( + this->instance, + handle, + bw, + req_id)); +} + +void +Analyzer::setInspectorWatermark(Handle handle, SUSCOUNT wm, RequestId req_id) +{ + SU_ATTEMPT( + suscan_analyzer_set_inspector_watermark_async( + this->instance, + handle, + wm, + req_id)); +} + +void +Analyzer::setSpectrumSource(Handle handle, unsigned int src, RequestId id) +{ + SU_ATTEMPT( + suscan_analyzer_inspector_set_spectrum_async( + this->instance, + handle, + src, + id)); + +} + +void +Analyzer::closeInspector(Handle handle, RequestId id) +{ + SU_ATTEMPT(suscan_analyzer_close_async(this->instance, handle, id)); +} + // Object construction and destruction -Analyzer::Analyzer( - struct suscan_analyzer_params const& params, - Source::Config const& config) +Analyzer::Analyzer(AnalyzerParams ¶ms, Source::Config const &config) { assertTypeRegistration(); SU_ATTEMPT(this->instance = suscan_analyzer_new( - ¶ms, + ¶ms.getCParams(), config.instance, &mq.mq)); @@ -176,9 +348,9 @@ Analyzer::Analyzer( connect( this->asyncThread.get(), - SIGNAL(message(const Suscan::Message &)), + SIGNAL(message(quint32, void *)), this, - SLOT(captureMessage(const Suscan::Message &)), + SLOT(captureMessage(quint32, void *)), Qt::QueuedConnection); this->asyncThread.get()->start(); diff --git a/Suscan/AnalyzerParams.cpp b/Suscan/AnalyzerParams.cpp index 3cf0d72d..0b4c6321 100644 --- a/Suscan/AnalyzerParams.cpp +++ b/Suscan/AnalyzerParams.cpp @@ -1,6 +1,135 @@ -#include "AnalyzerParams.h" +// +// AnalyzerParams.cpp: Analyzer parameters +// Copyright (C) 2019 Gonzalo José Carracedo Carballal +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this program. If not, see +// +// -AnalyzerParams::AnalyzerParams() +#include + +using namespace Suscan; + +void +AnalyzerParams::updateExposedParams(void) +{ + this->channelUpdateInterval = this->c_params.channel_update_int; + this->psdUpdateInterval = this->c_params.psd_update_int; + this->spectrumAvgAlpha = this->c_params.detector_params.alpha; + this->sAvgAlpha = this->c_params.detector_params.beta; + this->nAvgAlpha = this->c_params.detector_params.gamma; + this->snr = this->c_params.detector_params.snr; + this->windowSize = this->c_params.detector_params.window_size; + + this->windowFunction = + static_cast(this->c_params.detector_params.window); +} + +AnalyzerParams::AnalyzerParams(void) : Serializable() +{ + this->updateExposedParams(); +} + +AnalyzerParams::AnalyzerParams(struct suscan_analyzer_params const ¶ms) +{ + this->c_params = params; + this->updateExposedParams(); +} + +struct suscan_analyzer_params const & +AnalyzerParams::getCParams(void) +{ + this->c_params.channel_update_int = this->channelUpdateInterval; + this->c_params.psd_update_int = this->psdUpdateInterval; + this->c_params.detector_params.alpha = this->spectrumAvgAlpha; + this->c_params.detector_params.beta = this->sAvgAlpha; + this->c_params.detector_params.gamma = this->nAvgAlpha; + this->c_params.detector_params.snr = this->snr; + this->c_params.detector_params.window_size = this->windowSize; + this->c_params.detector_params.window = + static_cast(this->windowFunction); + + return this->c_params; +} + +#define STRINGFY(x) #x +#define STORE(field) obj.set(STRINGFY(field), this->field) +#define LOAD(field) this->field = conf.get(STRINGFY(field), this->field) + +void +AnalyzerParams::deserialize(Object const &conf) +{ + std::string wFunc; + + LOAD(channelUpdateInterval); + LOAD(psdUpdateInterval); + LOAD(spectrumAvgAlpha); + LOAD(sAvgAlpha); + LOAD(nAvgAlpha); + LOAD(snr); + LOAD(windowSize); + + wFunc = conf.get("windowFunction", std::string("none")); + + if (wFunc == "none") + this->windowFunction = WindowFunction::NONE; + else if (wFunc == "hamming") + this->windowFunction = WindowFunction::HAMMING; + else if (wFunc == "hann") + this->windowFunction = WindowFunction::HANN; + else if (wFunc == "flat-top") + this->windowFunction = WindowFunction::FLAT_TOP; + else if (wFunc == "blackmann-harris") + this->windowFunction = WindowFunction::BLACKMANN_HARRIS; +} + +Object && +AnalyzerParams::serialize(void) { + Suscan::Object obj(SUSCAN_OBJECT_TYPE_OBJECT); + + obj.setClass("AnalyzerParams"); + + STORE(channelUpdateInterval); + STORE(psdUpdateInterval); + STORE(spectrumAvgAlpha); + STORE(sAvgAlpha); + STORE(nAvgAlpha); + STORE(snr); + STORE(windowSize); + + switch (this->windowFunction) { + case NONE: + obj.set("windowFunction", std::string("none")); + break; + + case HAMMING: + obj.set("windowFunction", std::string("hamming")); + break; + + case HANN: + obj.set("windowFunction", std::string("hann")); + break; + + case FLAT_TOP: + obj.set("windowFunction", std::string("flat-top")); + break; + + case BLACKMANN_HARRIS: + obj.set("windowFunction", std::string("blackmann-harris")); + break; + } + return this->persist(obj); } diff --git a/Suscan/Config.cpp b/Suscan/Config.cpp index e69de29b..f6ed0994 100644 --- a/Suscan/Config.cpp +++ b/Suscan/Config.cpp @@ -0,0 +1,97 @@ +// +// Object.cpp: Suscan objects implementation +// Copyright (C) 2019 Gonzalo José Carracedo Carballal +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this program. If not, see +// +// + +#include + +using namespace Suscan; + +FieldValue::FieldValue(struct suscan_field_value *inst) +{ + this->instance = inst; +} + +Config::Config() +{ + this->instance = nullptr; +} + +Config::~Config() +{ + if (this->owned) + suscan_config_destroy(this->instance); +} + +void +Config::populate(void) +{ + if (instance != nullptr) + for (int i = 0; i < instance->desc->field_count; ++i) + this->fields.push_back(FieldValue(instance->values[i])); +} + +Config::Config(suscan_config_t const *instance) +{ + SU_ATTEMPT(this->instance = suscan_config_dup(instance)); + this->owned = true; + this->populate(); +} + +Config::Config(suscan_config_t *instance) +{ + this->instance = instance; + this->owned = false; + this->populate(); +} + +FieldValue const * +Config::get(std::string const &name) const +{ + for (auto p = this->fields.begin(); + p != this->fields.end(); + ++p) { + if (p->getName() == name) + return &*p; + } + + return nullptr; +} + +ConfigContext::ConfigContext(suscan_config_context_t *ctx) +{ + this->ctx = ctx; +} + +ConfigContext::ConfigContext(std::string const &name) +{ + suscan_config_context_t *ctx; + + if ((ctx = suscan_config_context_lookup(name.c_str())) == nullptr) { + SU_ATTEMPT(suscan_confdb_use(name.c_str())); + SU_ATTEMPT(ctx = suscan_config_context_lookup(name.c_str())); + } + + this->ctx = ctx; +} + +Object +ConfigContext::listObject(void) const +{ + return Object( + (suscan_object_t *) suscan_config_context_get_list(this->ctx)); +} diff --git a/Suscan/Library.cpp b/Suscan/Library.cpp index 5e929cba..004202f3 100644 --- a/Suscan/Library.cpp +++ b/Suscan/Library.cpp @@ -75,12 +75,23 @@ walk_all_sources(suscan_source_config_t *config, void *privdata) return SU_TRUE; } +static SUBOOL +walk_all_devices(const suscan_source_device_t *device, unsigned int, void *privdata) +{ + Singleton *instance = static_cast(privdata); + + instance->registerSourceDevice(device); + + return SU_TRUE; +} + void Singleton::init_sources(void) { if (!this->sources_initd) { SU_ATTEMPT(suscan_init_sources()); suscan_source_config_walk(walk_all_sources, static_cast(this)); + suscan_source_device_walk(walk_all_devices, static_cast(this)); this->sources_initd = true; } } @@ -112,21 +123,224 @@ Singleton::init_inspectors(void) } } +bool +Singleton::haveAutoGain(std::string const &name) +{ + for (auto p = this->autoGains.begin(); + p != this->autoGains.end(); + ++p) { + try { + if (p->getField("name").value() == name) + return true; + } catch (Suscan::Exception const &) { + + } + } + + return false; +} + +bool +Singleton::havePalette(std::string const &name) +{ + for (auto p = this->palettes.begin(); + p != this->palettes.end(); + ++p) { + try { + if (p->getField("name").value() == name) + return true; + } catch (Suscan::Exception const &) { + + } + } + + return false; +} + +void +Singleton::init_palettes(void) +{ + unsigned int i, count; + ConfigContext ctx("palettes"); + Object list = ctx.listObject(); + + count = list.length(); + + for (i = 0; i < count; ++i) { + try { + if (!this->havePalette(list[i].getField("name").value())) + this->palettes.push_back(list[i]); + } catch (Suscan::Exception const &) { } + } +} + +void +Singleton::init_autogains(void) +{ + unsigned int i, count; + ConfigContext ctx("autogains"); + Object list = ctx.listObject(); + + count = list.length(); + + for (i = 0; i < count; ++i) { + try { + if (!this->haveAutoGain(list[i].getField("name").value())) + this->autoGains.push_back(list[i]); + } catch (Suscan::Exception const &) { } + } +} + +void +Singleton::init_ui_config(void) +{ + unsigned int i, count; + ConfigContext ctx("uiconfig"); + + Object list = ctx.listObject(); + + count = list.length(); + + for (i = 0; i < count; ++i) { + try { + this->uiConfig.push_back(list[i]); + } catch (Suscan::Exception const &) { } + } +} + +void +Singleton::sync(void) +{ + unsigned int i, count; + ConfigContext ctx("uiconfig"); + Object list = ctx.listObject(); + + count = static_cast(this->uiConfig.size()); + + // Sync all modified configurations + for (i = 0; i < count; ++i) { + if (!this->uiConfig[i].isBorrowed()) { + try { + list.put(this->uiConfig[i], i); + } catch (Suscan::Exception const &) { + list.append(this->uiConfig[i]); + } + } + } +} + // Singleton methods + void Singleton::registerSourceConfig(suscan_source_config_t *config) { - this->profiles.push_back(Source::Config(config)); + const char *label = suscan_source_config_get_label(config); + + if (label == nullptr) + label = "(Null profile)"; + + this->profiles[label] = Suscan::Source::Config(config); } -std::vector::const_iterator +ConfigMap::const_iterator Singleton::getFirstProfile(void) const { return this->profiles.begin(); } -std::vector::const_iterator +ConfigMap::const_iterator Singleton::getLastProfile(void) const { return this->profiles.end(); } + +Suscan::Source::Config * +Singleton::getProfile(std::string const &name) +{ + if (this->profiles.find(name) == this->profiles.end()) + return nullptr; + + return &this->profiles[name]; +} + +void +Singleton::saveProfile(Suscan::Source::Config const &profile) +{ + this->profiles[profile.label()] = profile; + + SU_ATTEMPT( + suscan_source_config_register( + this->profiles[profile.label()].instance)); +} + +void +Singleton::registerSourceDevice(const suscan_source_device_t *dev) +{ + this->devices.push_back(Source::Device(dev, 0)); +} + +std::vector::const_iterator +Singleton::getFirstDevice(void) const +{ + return this->devices.begin(); +} + +std::vector::const_iterator +Singleton::getLastDevice(void) const +{ + return this->devices.end(); +} + +std::vector::const_iterator +Singleton::getFirstPalette(void) const +{ + return this->palettes.begin(); +} + +std::vector::const_iterator +Singleton::getLastPalette(void) const +{ + return this->palettes.end(); +} + +std::vector::const_iterator +Singleton::getFirstAutoGain(void) const +{ + return this->autoGains.begin(); +} + +std::vector::const_iterator +Singleton::getLastAutoGain(void) const +{ + return this->autoGains.end(); +} + +std::vector::iterator +Singleton::getFirstUIConfig(void) +{ + return this->uiConfig.begin(); +} + +std::vector::iterator +Singleton::getLastUIConfig(void) +{ + return this->uiConfig.end(); +} + +void +Singleton::putUIConfig(unsigned int pos, Object &&rv) +{ + if (pos >= this->uiConfig.size()) + this->uiConfig.resize(pos + 1); + + this->uiConfig[pos] = std::move(rv); +} + +const Source::Device * +Singleton::getDeviceAt(unsigned int index) const +{ + if (index < this->devices.size()) + return &this->devices[index]; + + return nullptr; +} diff --git a/Suscan/Message.cpp b/Suscan/Message.cpp index b0481011..d9ac2c6f 100644 --- a/Suscan/Message.cpp +++ b/Suscan/Message.cpp @@ -50,16 +50,16 @@ Message::Message(uint32_t type, void *c_message) // Move constructor Message::Message(Message &&rv) { - this->type = rv.type; - this->c_message = std::move(rv.c_message); + std::swap(this->type, rv.type); + this->c_message.swap(rv.c_message); } // Move assignation Message & Message::operator=(Message &&rv) { - this->type = rv.type; - this->c_message = std::move(rv.c_message); + std::swap(this->type, rv.type); + this->c_message.swap(rv.c_message); return *this; } diff --git a/Suscan/Messages/InspectorMessage.cpp b/Suscan/Messages/InspectorMessage.cpp index a21da52a..e929f424 100644 --- a/Suscan/Messages/InspectorMessage.cpp +++ b/Suscan/Messages/InspectorMessage.cpp @@ -21,11 +21,136 @@ using namespace Suscan; -InspectorMessage::InspectorMessage() : Message() { } +InspectorMessage::InspectorMessage() : Message() { + this->message = nullptr; + printf("Create EMPTY inspector message\n"); +} InspectorMessage::InspectorMessage(struct suscan_analyzer_inspector_msg *msg) : - Message(SUSCAN_ANALYZER_MESSAGE_TYPE_INSPECTOR, msg) + Message(SUSCAN_ANALYZER_MESSAGE_TYPE_INSPECTOR, msg), + config(msg->kind == SUSCAN_ANALYZER_INSPECTOR_MSGKIND_GET_CONFIG || + msg->kind == SUSCAN_ANALYZER_INSPECTOR_MSGKIND_SET_CONFIG + ? msg->config + : nullptr) { + unsigned int i; + this->message = msg; + + this->sources.resize(static_cast(msg->spectsrc_count)); + for (i = 0; i < static_cast(msg->spectsrc_count); ++i) { + this->sources[i].name = msg->spectsrc_list[i]->name; + this->sources[i].desc = msg->spectsrc_list[i]->desc; + } + + this->estimators.resize(static_cast(msg->estimator_count)); + for (i = 0; i < static_cast(msg->estimator_count); ++i) { + this->estimators[i].name = msg->estimator_list[i]->name; + this->estimators[i].desc = msg->estimator_list[i]->desc; + this->estimators[i].field = msg->estimator_list[i]->field; + } +} + +SUFLOAT * +InspectorMessage::getSpectrumData(void) const +{ + if (this->message == nullptr) + return nullptr; + + return this->message->spectrum_data; +} + +SUSCOUNT +InspectorMessage::getSpectrumLength(void) const +{ + if (this->message == nullptr) + return 0; + + return this->message->spectrum_size; +} + +SUSCOUNT +InspectorMessage::getSpectrumRate(void) const +{ + if (this->message == nullptr) + return 0; + + return this->message->samp_rate; +} + +enum suscan_analyzer_inspector_msgkind +InspectorMessage::getKind(void) const +{ + if (this->message == nullptr) + return SUSCAN_ANALYZER_INSPECTOR_MSGKIND_WRONG_HANDLE; + + return this->message->kind; +} + + +RequestId +InspectorMessage::getRequestId(void) const +{ + if (this->message == nullptr) + return 99999999; + + return this->message->req_id; } +RequestId +InspectorMessage::getInspectorId(void) const +{ + if (this->message == nullptr) + return 99999999; + + return this->message->inspector_id; +} + +suscan_config_t const * +InspectorMessage::getCConfig(void) const +{ + return this->message->config; +} + +Handle +InspectorMessage::getHandle(void) const +{ + if (this->message == nullptr) + return 99999999; + + return static_cast(this->message->handle); +} + +std::string +InspectorMessage::getClass(void) const +{ + if (this->message == nullptr) + return "null"; + + return this->message->class_name; +} + +std::vector const & +InspectorMessage::getSpectrumSources(void) const +{ + return this->sources; +} + +std::vector const & +InspectorMessage::getEstimators(void) const +{ + return this->estimators; +} + +Channel +InspectorMessage::getChannel(void) const +{ + Channel ch; + + if (this->message != nullptr) { + ch.fc = this->message->channel.fc; + ch.fc = this->message->channel.bw; + } + + return ch; +} diff --git a/Suscan/Object.cpp b/Suscan/Object.cpp index e69de29b..5e0bbed4 100644 --- a/Suscan/Object.cpp +++ b/Suscan/Object.cpp @@ -0,0 +1,65 @@ +// +// Object.cpp: Suscan objects implementation +// Copyright (C) 2019 Gonzalo José Carracedo Carballal +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this program. If not, see +// +// + +#include + +using namespace Suscan; + +Object::Object(void) +{ + this->borrowed = true; + this->instance = nullptr; +} + +Object::Object(enum suscan_object_type type) +{ + this->borrowed = false; + + SU_ATTEMPT(this->instance = suscan_object_new(type)); +} + +Object::Object(suscan_object_t *instance) +{ + this->borrowed = true; + this->instance = instance; +} + +Object::Object(std::string const &url, const uint8_t *data, size_t size) +{ + this->borrowed = false; + + SU_ATTEMPT(this->instance = suscan_object_from_xml(url.c_str(), data, size)); +} + +Object::Object(Object &&rv) +{ + *this = std::move(rv); +} + +Object::Object(Object const &obj) : Object(obj.instance) +{ + +} + +Object::~Object() +{ + if (!this->borrowed) + if (this->instance != nullptr) + suscan_object_destroy(this->instance); +} diff --git a/Suscan/Serializable.cpp b/Suscan/Serializable.cpp index e69de29b..cfe5178f 100644 --- a/Suscan/Serializable.cpp +++ b/Suscan/Serializable.cpp @@ -0,0 +1,27 @@ +// +// Serializable.cpp: Interface for serializable objects +// Copyright (C) 2019 Gonzalo José Carracedo Carballal +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this program. If not, see +// +// + +#include + +using namespace Suscan; + +Serializable::~Serializable() +{ + +} diff --git a/Suscan/Source.cpp b/Suscan/Source.cpp index 5d7815de..8db54568 100644 --- a/Suscan/Source.cpp +++ b/Suscan/Source.cpp @@ -21,6 +21,60 @@ using namespace Suscan; +//////////////////////////// Source device wrapper /////////////////////////// +Source::GainDescription::GainDescription(const struct suscan_source_gain_desc *desc) +{ + this->def = desc->def; + this->max = desc->max; + this->min = desc->min; + this->step = desc->step; + this->name = std::string(desc->name); +} + +void +Source::Device::setDevice(const suscan_source_device_t *dev, unsigned int channel) +{ + int i; + + struct suscan_source_device_info info = + suscan_source_device_info_INITIALIZER; + + this->instance = dev; + + this->antennas.clear(); + this->gains.clear(); + + if (suscan_source_device_get_info(dev, channel, &info)) { + for (i = 0; i < info.antenna_count; ++i) + this->antennas.push_back(std::string(info.antenna_list[i])); + + for (i = 0; i < info.gain_desc_count; ++i) + this->gains.push_back(Source::GainDescription(info.gain_desc_list[i])); + + suscan_source_device_info_finalize(&info); + } +} + +Source::Device::Device(Source::Device &&rv) +{ + *this = rv; +} + +Source::Device::Device(const Source::Device &dev) +{ + this->setDevice(dev); +} + +Source::Device::Device(const suscan_source_device_t *dev, unsigned int channel) +{ + this->setDevice(dev, channel); +} + +Source::Device::Device() +{ + this->instance = nullptr; +} + //////////////////////////// Source config wrapper /////////////////////////// Source::Config::Config() @@ -45,7 +99,6 @@ Source::Config::Config(Config const &prev) } else { SU_ATTEMPT(this->instance = suscan_source_config_clone(prev.instance)); } - this->borrowed = prev.borrowed; } @@ -53,6 +106,7 @@ Source::Config::Config(Config &&rv) : Config() { std::swap(this->instance, rv.instance); std::swap(this->borrowed, rv.borrowed); + this->devWrapper = std::move(rv.devWrapper); } Source::Config::Config(suscan_source_config_t *config) @@ -61,6 +115,12 @@ Source::Config::Config(suscan_source_config_t *config) this->borrowed = true; } +Source::Config::Config(Suscan::Object const &obj) +{ + SU_ATTEMPT(this->instance = suscan_source_config_from_object(obj.getInstance())); + this->borrowed = false; +} + Source::Config::~Config() { if (this->instance != nullptr && !this->borrowed) @@ -95,6 +155,7 @@ Source::Config::operator=(Config &&rv) if (this != &rv) { std::swap(this->instance, rv.instance); std::swap(this->borrowed, rv.borrowed); + this->devWrapper = std::move(rv.devWrapper); } return *this; @@ -110,6 +171,34 @@ Source::Config::label(void) const return suscan_source_config_get_label(this->instance); } +Suscan::Object +Source::Config::serialize(void) +{ + suscan_object_t *obj = nullptr; + + SU_ATTEMPT(this->instance != nullptr); + + SU_ATTEMPT(obj = suscan_source_config_to_object(this->instance)); + + return Object::wrap(obj); +} + +std::string +Source::Config::getAntenna(void) const +{ + const char *ant; + + if (this->instance == nullptr) + return "N/C"; + + ant = suscan_source_config_get_antenna(this->instance); + + if (ant == nullptr) + return "N/C"; + + return ant; +} + SUFREQ Source::Config::getFreq(void) const { @@ -128,6 +217,51 @@ Source::Config::getSampleRate(void) const return suscan_source_config_get_samp_rate(this->instance); } +bool +Source::Config::getLoop(void) const +{ + if (this->instance == nullptr) + return true; + + return suscan_source_config_get_loop(this->instance) != SU_FALSE; +} + +bool +Source::Config::getDCRemove(void) const +{ + if (this->instance == nullptr) + return true; + + return suscan_source_config_get_dc_remove(this->instance) != SU_FALSE; +} + +bool +Source::Config::getIQBalance(void) const +{ + if (this->instance == nullptr) + return false; + + return suscan_source_config_get_iq_balance(this->instance) != SU_FALSE; +} + +SUFLOAT +Source::Config::getBandwidth(void) const +{ + if (this->instance == nullptr) + return 0; + + return suscan_source_config_get_bandwidth(this->instance); +} + +enum suscan_source_format +Source::Config::getFormat(void) const +{ + if (this->instance == nullptr) + return SUSCAN_SOURCE_FORMAT_AUTO; + + return suscan_source_config_get_format(this->instance); +} + enum suscan_source_type Source::Config::getType(void) const { @@ -137,6 +271,22 @@ Source::Config::getType(void) const return suscan_source_config_get_type(this->instance); } +std::string +Source::Config::getPath(void) const +{ + const char *path; + + if (this->instance == nullptr) + return ""; + + path = suscan_source_config_get_path(this->instance); + + if (path == nullptr) + return ""; + + return path; +} + void Source::Config::setSampleRate(unsigned int rate) { @@ -158,6 +308,81 @@ Source::Config::setPath(const std::string &path) path.c_str())); } +void +Source::Config::setFreq(SUFREQ freq) +{ + if (this->instance == nullptr) + return; + + suscan_source_config_set_freq(this->instance, freq); +} + +void +Source::Config::setBandwidth(SUFLOAT bw) +{ + if (this->instance == nullptr) + return; + + suscan_source_config_set_bandwidth(this->instance, bw); +} + +void +Source::Config::setLoop(bool value) +{ + if (this->instance == nullptr) + return; + + suscan_source_config_set_loop( + this->instance, + value ? SU_TRUE : SU_FALSE); +} + +void +Source::Config::setDCRemove(bool value) +{ + if (this->instance == nullptr) + return; + + suscan_source_config_set_dc_remove( + this->instance, + value ? SU_TRUE : SU_FALSE); +} + +void +Source::Config::setIQBalance(bool value) +{ + if (this->instance == nullptr) + return; + + suscan_source_config_set_iq_balance( + this->instance, + value ? SU_TRUE : SU_FALSE); +} + +void +Source::Config::setType(enum suscan_source_type type) +{ + if (this->instance == nullptr) + return; + + suscan_source_config_set_type_format( + this->instance, + type, + suscan_source_config_get_format(this->instance)); +} + +void +Source::Config::setFormat(enum suscan_source_format fmt) +{ + if (this->instance == nullptr) + return; + + suscan_source_config_set_type_format( + this->instance, + suscan_source_config_get_type(this->instance), + fmt); +} + void Source::Config::setLabel(const std::string &path) { @@ -171,15 +396,49 @@ Source::Config::setLabel(const std::string &path) } void -Source::Config::setSDRDevice(const suscan_source_device_t *dev) +Source::Config::setDevice(const Source::Device &dev) +{ + SU_ATTEMPT( + suscan_source_config_set_device( + this->instance, + dev.instance)); +} + +const Source::Device & +Source::Config::getDevice(void) +{ + if (this->instance != nullptr) { + if (this->devWrapper.getInstance() != + suscan_source_config_get_device(this->instance)) { + this->devWrapper.setDevice( + suscan_source_config_get_device(this->instance), + 0); + } + } + + return this->devWrapper; +} + +void +Source::Config::setGain(const std::string &name, SUFLOAT val) { if (this->instance == nullptr) return; SU_ATTEMPT( - suscan_source_config_set_device( + suscan_source_config_set_gain( this->instance, - dev)); + name.c_str(), + val)); +} + +SUFLOAT +Source::Config::getGain(const std::string &name) const +{ + if (this->instance == nullptr) + return 0; + + return suscan_source_config_get_gain(this->instance, name.c_str()); } ///////////////////////////////// Source Wrappers //////////////////////////// diff --git a/ToneControl.cpp b/ToneControl.cpp deleted file mode 100644 index 0b497003..00000000 --- a/ToneControl.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include "ToneControl.h" -#include "ui_ToneControl.h" - -ToneControl::ToneControl(QWidget *parent) : - QWidget(parent), - ui(new Ui::ToneControl) -{ - ui->setupUi(this); -} - -ToneControl::~ToneControl() -{ - delete ui; -} diff --git a/ToneControl.h b/ToneControl.h deleted file mode 100644 index d4d1579e..00000000 --- a/ToneControl.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef TONECONTROL_H -#define TONECONTROL_H - -#include - -namespace Ui { - class ToneControl; -} - -class ToneControl : public QWidget -{ - Q_OBJECT - - public: - explicit ToneControl(QWidget *parent = nullptr); - ~ToneControl(); - - private: - Ui::ToneControl *ui; -}; - -#endif // TONECONTROL_H diff --git a/ToneControl.ui b/ToneControl.ui deleted file mode 100644 index 3fd2e54b..00000000 --- a/ToneControl.ui +++ /dev/null @@ -1,21 +0,0 @@ - - - - - ToneControl - - - - 0 - 0 - 400 - 300 - - - - Form - - - - - diff --git a/UIMediator.cpp b/UIMediator.cpp deleted file mode 100644 index 7a10b800..00000000 --- a/UIMediator.cpp +++ /dev/null @@ -1,22 +0,0 @@ -// -// filename: description -// Copyright (C) 2018 Gonzalo José Carracedo Carballal -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Lesser General Public License as -// published by the Free Software Foundation, either version 3 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this program. If not, see -// -// -#ifndef APPLICATIONUI_CPP -#define APPLICATIONUI_CPP - -#endif // APPLICATIONUI_CPP diff --git a/UIMediator/AudioMediator.cpp b/UIMediator/AudioMediator.cpp index be1c8c09..f998cd46 100644 --- a/UIMediator/AudioMediator.cpp +++ b/UIMediator/AudioMediator.cpp @@ -1,6 +1,6 @@ // -// filename: description -// Copyright (C) 2018 Gonzalo José Carracedo Carballal +// AudioMediator.cpp: Mediate audio panel events +// Copyright (C) 2019 Gonzalo José Carracedo Carballal // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as @@ -16,3 +16,23 @@ // License along with this program. If not, see // // + +#include "UIMediator.h" + +using namespace SigDigger; + +void +UIMediator::connectAudioPanel(void) +{ + connect( + this->ui->audioPanel, + SIGNAL(changed(void)), + this, + SLOT(onAudioChanged(void))); +} + +void +UIMediator::onAudioChanged(void) +{ + emit audioChanged(); +} diff --git a/UIMediator/FftMediator.cpp b/UIMediator/FftMediator.cpp index e69de29b..dc13b03c 100644 --- a/UIMediator/FftMediator.cpp +++ b/UIMediator/FftMediator.cpp @@ -0,0 +1,103 @@ +// +// Spectrum.cpp: Coordinate source panel signals +// Copyright (C) 2019 Gonzalo José Carracedo Carballal +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this program. If not, see +// +// + +#include "UIMediator.h" + +using namespace SigDigger; + +void +UIMediator::connectFftPanel(void) +{ + connect( + this->ui->fftPanel, + SIGNAL(paletteChanged(void)), + this, + SLOT(onPaletteChanged(void))); + + connect( + this->ui->fftPanel, + SIGNAL(rangesChanged(void)), + this, + SLOT(onRangesChanged(void))); + + connect( + this->ui->fftPanel, + SIGNAL(averagerChanged(void)), + this, + SLOT(onAveragerChanged(void))); + + connect( + this->ui->fftPanel, + SIGNAL(fftSizeChanged(void)), + this, + SLOT(onFftSizeChanged(void))); + + connect( + this->ui->fftPanel, + SIGNAL(windowFunctionChanged(void)), + this, + SLOT(onWindowFunctionChanged(void))); +} + +void +UIMediator::onPaletteChanged(void) +{ + this->ui->spectrum->setPaletteGradient( + this->ui->fftPanel->getPaletteGradient()); +} + +void +UIMediator::onRangesChanged(void) +{ + this->ui->spectrum->setPandapterRange( + this->ui->fftPanel->getPandRangeMin(), + this->ui->fftPanel->getPandRangeMax()); + + this->ui->spectrum->setWfRange( + this->ui->fftPanel->getWfRangeMin(), + this->ui->fftPanel->getWfRangeMax()); + + this->ui->spectrum->setPanWfRatio(this->ui->fftPanel->getPanWfRatio()); + this->ui->spectrum->setZoom(this->ui->fftPanel->getFreqZoom()); + + this->ui->spectrum->setPeakDetect(this->ui->fftPanel->getPeakDetect()); + this->ui->spectrum->setPeakHold(this->ui->fftPanel->getPeakHold()); +} + +void +UIMediator::onAveragerChanged(void) +{ + this->averager.setAlpha(this->ui->fftPanel->getAveraging()); +} + +void +UIMediator::onFftSizeChanged(void) +{ + this->appConfig->analyzerParams.windowSize = this->ui->fftPanel->getFftSize(); + emit analyzerParamsChanged(); +} + +void +UIMediator::onWindowFunctionChanged(void) +{ + this->appConfig->analyzerParams.windowFunction = + this->ui->fftPanel->getWindowFunction(); + + emit analyzerParamsChanged(); +} diff --git a/UIMediator/InspectorMediator.cpp b/UIMediator/InspectorMediator.cpp index e69de29b..2d24e6a9 100644 --- a/UIMediator/InspectorMediator.cpp +++ b/UIMediator/InspectorMediator.cpp @@ -0,0 +1,53 @@ +// +// InspectorMediator.cpp: Coordinate inspector panel signals +// Copyright (C) 2019 Gonzalo José Carracedo Carballal +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this program. If not, see +// +// + +#include "UIMediator.h" + +using namespace SigDigger; + +void +UIMediator::connectInspectorPanel(void) +{ + connect( + this->ui->inspectorPanel, + SIGNAL(bandwidthChanged(int)), + this, + SLOT(onInspBandwidthChanged())); + + connect( + this->ui->inspectorPanel, + SIGNAL(requestOpenInspector(QString)), + this, + SLOT(onOpenInspector())); + + +} + +void +UIMediator::onInspBandwidthChanged(void) +{ + this->ui->spectrum->setFilterBandwidth( + this->ui->inspectorPanel->getBandwidth()); +} + +void +UIMediator::onOpenInspector(void) +{ + emit requestOpenInspector(); +} diff --git a/UIMediator/SourceMediator.cpp b/UIMediator/SourceMediator.cpp index be1c8c09..97f3cd37 100644 --- a/UIMediator/SourceMediator.cpp +++ b/UIMediator/SourceMediator.cpp @@ -1,6 +1,6 @@ // -// filename: description -// Copyright (C) 2018 Gonzalo José Carracedo Carballal +// SpectrumMediator.cpp: Coordinate source panel signals +// Copyright (C) 2019 Gonzalo José Carracedo Carballal // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as @@ -16,3 +16,96 @@ // License along with this program. If not, see // // + +#include "UIMediator.h" + +using namespace SigDigger; + +void +UIMediator::connectSourcePanel(void) +{ + connect( + this->ui->sourcePanel, + SIGNAL(toggleRecord(void)), + this, + SLOT(onToggleRecord(void))); + + connect( + this->ui->sourcePanel, + SIGNAL(throttleConfigChanged(void)), + this, + SLOT(onThrottleConfigChanged(void))); + + connect( + this->ui->sourcePanel, + SIGNAL(gainChanged(QString, float)), + this, + SLOT(onGainChanged(QString, float))); + + connect( + this->ui->sourcePanel, + SIGNAL(toggleDCRemove(void)), + this, + SLOT(onToggleDCRemove(void))); + + connect( + this->ui->sourcePanel, + SIGNAL(toggleIQReverse(void)), + this, + SLOT(onToggleIQReverse(void))); + + connect( + this->ui->sourcePanel, + SIGNAL(toggleAGCEnabled(void)), + this, + SLOT(onToggleAGCEnabled(void))); + + connect( + this->ui->sourcePanel, + SIGNAL(antennaChanged(QString)), + this, + SLOT(onAntennaChanged(QString))); +} + +void +UIMediator::onToggleRecord(void) +{ + emit toggleRecord(); +} + +void +UIMediator::onThrottleConfigChanged(void) +{ + this->ui->spectrum->setThrottling(this->ui->sourcePanel->isThrottleEnabled()); + emit throttleConfigChanged(); +} + +void +UIMediator::onGainChanged(QString name, float val) +{ + emit gainChanged(name, val); +} + +void +UIMediator::onToggleDCRemove(void) +{ + emit toggleDCRemove(); +} + +void +UIMediator::onToggleIQReverse(void) +{ + emit toggleIQReverse(); +} + +void +UIMediator::onToggleAGCEnabled(void) +{ + emit toggleAGCEnabled(); +} + +void +UIMediator::onAntennaChanged(QString name) +{ + emit antennaChanged(name); +} diff --git a/UIMediator/SpectrumMediator.cpp b/UIMediator/SpectrumMediator.cpp index be1c8c09..8ddb7779 100644 --- a/UIMediator/SpectrumMediator.cpp +++ b/UIMediator/SpectrumMediator.cpp @@ -1,5 +1,5 @@ // -// filename: description +// Spectrum.cpp: Coordinate spectrum signals // Copyright (C) 2018 Gonzalo José Carracedo Carballal // // This program is free software: you can redistribute it and/or modify @@ -16,3 +16,91 @@ // License along with this program. If not, see // // + +#include "UIMediator.h" + +using namespace SigDigger; + +void +UIMediator::connectSpectrum(void) +{ + connect( + this->ui->spectrum, + SIGNAL(bandwidthChanged(void)), + this, + SLOT(onBandwidthChanged(void))); + + connect( + this->ui->spectrum, + SIGNAL(frequencyChanged(qint64)), + this, + SLOT(onFrequencyChanged(qint64))); + + connect( + this->ui->spectrum, + SIGNAL(loChanged(qint64)), + this, + SLOT(onLoChanged(qint64))); + + connect( + this->ui->spectrum, + SIGNAL(rangeChanged(float, float)), + this, + SLOT(onRangeChanged(float, float))); + + connect( + this->ui->spectrum, + SIGNAL(zoomChanged(float)), + this, + SLOT(onZoomChanged(float))); +} + + +void +UIMediator::onBandwidthChanged(void) +{ + this->ui->inspectorPanel->setBandwidth(this->ui->spectrum->getBandwidth()); + + emit bandwidthChanged(this->ui->spectrum->getBandwidth()); +} + +void +UIMediator::onFrequencyChanged(qint64) +{ + qint64 freq = this->ui->spectrum->getCenterFreq() + + this->ui->spectrum->getLoFreq(); + this->ui->inspectorPanel->setDemodFrequency(freq); + this->appConfig->profile.setFreq(freq); + + emit frequencyChanged(this->ui->spectrum->getCenterFreq()); +} + +void +UIMediator::onLoChanged(qint64) +{ + qint64 freq = this->ui->spectrum->getCenterFreq() + + this->ui->spectrum->getLoFreq(); + this->ui->inspectorPanel->setDemodFrequency(freq); + + emit loChanged(this->ui->spectrum->getLoFreq()); +} + +void +UIMediator::onRangeChanged(float min, float max) +{ + this->ui->spectrum->setPandapterRange(min, max); + this->ui->fftPanel->setPandRangeMin(static_cast(min)); + this->ui->fftPanel->setPandRangeMax(static_cast(max)); + + if (this->ui->fftPanel->getRangeLock()) { + this->ui->spectrum->setWfRange(min, max); + this->ui->fftPanel->setWfRangeMin(static_cast(min)); + this->ui->fftPanel->setWfRangeMax(static_cast(max)); + } +} + +void +UIMediator::onZoomChanged(float level) +{ + this->ui->fftPanel->setFreqZoom(static_cast(level)); +} diff --git a/UIMediator/UIMediator.cpp b/UIMediator/UIMediator.cpp index ddf73c1a..a63afd55 100644 --- a/UIMediator/UIMediator.cpp +++ b/UIMediator/UIMediator.cpp @@ -1,6 +1,6 @@ // -// filename: description -// Copyright (C) 2018 Gonzalo José Carracedo Carballal +// UIMediator.cpp: User Interface mediator object +// Copyright (C) 2019 Gonzalo José Carracedo Carballal // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as @@ -23,7 +23,9 @@ #include "UIMediator.h" +#include #include +#include using namespace SigDigger; @@ -64,12 +66,12 @@ UIMediator::refreshUI(void) this->owner->setWindowTitle( "SigDigger - " - + QString::fromStdString(this->ui->configDialog->getProfile().label()) + + QString::fromStdString(this->getProfile()->label()) + " - " + stateString); } void -UIMediator::connectSpectrum(void) +UIMediator::connectMainWindow(void) { connect( this->ui->main->actionSetup, @@ -83,6 +85,12 @@ UIMediator::connectSpectrum(void) this, SLOT(onToggleCapture(bool))); + connect( + this->ui->main->actionAbout, + SIGNAL(triggered(bool)), + this, + SLOT(onToggleAbout(bool))); + connect( this->ui->main->mainTab, SIGNAL(tabCloseRequested(int)), @@ -95,6 +103,11 @@ UIMediator::UIMediator(QMainWindow *owner, AppUI *ui) this->owner = owner; this->ui = ui; + // Configure audio preview + this->audioPanelDock = new QDockWidget("Audio preview", owner); + this->audioPanelDock->setWidget(this->ui->audioPanel); + owner->addDockWidget(Qt::RightDockWidgetArea, this->audioPanelDock); + // Configure Source Panel this->sourcePanelDock = new QDockWidget("Source", owner); this->sourcePanelDock->setWidget(this->ui->sourcePanel); @@ -110,18 +123,12 @@ UIMediator::UIMediator(QMainWindow *owner, AppUI *ui) this->fftPanelDock->setWidget(this->ui->fftPanel); owner->addDockWidget(Qt::RightDockWidgetArea, this->fftPanelDock); - // Configure audio preview - this->audioPanelDock = new QDockWidget("Audio preview", owner); - this->audioPanelDock->setWidget(this->ui->audioPanel); - owner->addDockWidget(Qt::RightDockWidgetArea, this->audioPanelDock); - // Add baseband analyzer tab this->ui->main->mainTab->addTab(this->ui->spectrum, "Radio spectrum"); // Sort panels owner->tabifyDockWidget(this->sourcePanelDock, this->inspectorPanelDock); owner->tabifyDockWidget(this->inspectorPanelDock, this->fftPanelDock); - owner->tabifyDockWidget(this->fftPanelDock, this->audioPanelDock); this->sourcePanelDock->raise(); @@ -129,7 +136,12 @@ UIMediator::UIMediator(QMainWindow *owner, AppUI *ui) this->ui->spectrum->setPaletteGradient( this->ui->fftPanel->getPaletteGradient()); + this->connectMainWindow(); this->connectSpectrum(); + this->connectSourcePanel(); + this->connectFftPanel(); + this->connectAudioPanel(); + this->connectInspectorPanel(); } void @@ -143,8 +155,21 @@ void UIMediator::setSampleRate(unsigned int rate) { if (this->rate != rate) { + unsigned int bw = rate / 30; + + SUFREQ audioBw = SIGDIGGER_AUDIO_INSPECTOR_BANDWIDTH; + + if (audioBw > rate / 2) + audioBw = rate / 2; + + this->ui->fftPanel->setSampleRate(rate); + this->ui->inspectorPanel->setBandwidthLimits(0, rate / 2); this->ui->spectrum->setSampleRate(rate); this->ui->sourcePanel->setSampleRate(rate); + this->ui->inspectorPanel->setBandwidth(bw); + this->ui->spectrum->setFilterBandwidth(bw); + + this->ui->audioPanel->setBandwidth(static_cast(audioBw)); this->rate = rate; } } @@ -165,14 +190,19 @@ UIMediator::getState(void) const void UIMediator::feedPSD(const Suscan::PSDMessage &msg) { - this->ui->spectrum->setSampleRate(msg.getSampleRate()); - this->ui->sourcePanel->setSampleRate(msg.getSampleRate()); + this->setSampleRate(msg.getSampleRate()); this->averager.feed(msg); this->ui->spectrum->feed( this->averager.get(), static_cast(this->averager.size())); } +void +UIMediator::setCaptureSize(quint64 size) +{ + this->ui->sourcePanel->setCaptureSize(size); +} + Inspector * UIMediator::lookupInspector(Suscan::InspectorId handle) const { @@ -254,6 +284,7 @@ UIMediator::refreshProfile(void) this->ui->configDialog->setProfile(this->appConfig->profile); this->ui->spectrum->setCenterFreq( static_cast(this->appConfig->profile.getFreq())); + this->setSampleRate(this->appConfig->profile.getSampleRate()); } Suscan::Source::Config * @@ -262,22 +293,71 @@ UIMediator::getProfile(void) const return &this->appConfig->profile; } +Suscan::AnalyzerParams * +UIMediator::getAnalyzerParams(void) const +{ + return &this->appConfig->analyzerParams; +} + +unsigned int +UIMediator::getFftSize(void) const +{ + return this->appConfig->analyzerParams.windowSize; +} + Suscan::Serializable * -UIMediator::allocConfig() +UIMediator::allocConfig(void) { return this->appConfig = new AppConfig(this->ui); } +void +UIMediator::saveGeometry(void) +{ + this->appConfig->x = this->owner->geometry().x(); + this->appConfig->y = this->owner->geometry().y(); + this->appConfig->width = this->owner->geometry().width(); + this->appConfig->height = this->owner->geometry().height(); +} + void UIMediator::applyConfig(void) { + // Apply window config + QRect rec = QGuiApplication::primaryScreen()->geometry(); + + if (this->appConfig->x == -1) + this->appConfig->x = (rec.width() - this->appConfig->width) / 2; + if (this->appConfig->y == -1) + this->appConfig->y = (rec.height() - this->appConfig->height) / 2; + + this->owner->setGeometry( + this->appConfig->x, + this->appConfig->y, + this->appConfig->width, + this->appConfig->height); + + // The following controls reflect elements of the configuration that are + // not owned by them. We need to set them manually. this->ui->configDialog->setColors(this->appConfig->colors); this->ui->spectrum->setColorConfig(this->appConfig->colors); + this->ui->fftPanel->setWindowFunction(this->appConfig->analyzerParams.windowFunction); + this->ui->fftPanel->setFftSize(this->appConfig->analyzerParams.windowSize); + this->ui->fftPanel->setDefaultFftSize(SIGDIGGER_FFT_WINDOW_SIZE); + + // The rest of them are automatically deserialized this->ui->sourcePanel->applyConfig(); this->ui->fftPanel->applyConfig(); this->ui->inspectorPanel->applyConfig(); + this->ui->audioPanel->applyConfig(); this->refreshProfile(); + + // Artificially trigger slots to synchronize UI + this->onPaletteChanged(); + this->onRangesChanged(); + this->onAveragerChanged(); + this->onThrottleConfigChanged(); } UIMediator::~UIMediator() @@ -289,8 +369,14 @@ UIMediator::~UIMediator() void UIMediator::onTriggerSetup(bool) { + this->ui->configDialog->setProfile(*this->getProfile()); + this->ui->configDialog->setAnalyzerParams(*this->getAnalyzerParams()); + if (this->ui->configDialog->run()) { this->appConfig->profile = this->ui->configDialog->getProfile(); + + this->appConfig->analyzerParams = this->ui->configDialog->getAnalyzerParams(); + this->ui->fftPanel->setFftSize(this->getFftSize()); this->refreshProfile(); this->appConfig->colors = this->ui->configDialog->getColors(); @@ -311,6 +397,12 @@ UIMediator::onToggleCapture(bool state) } } +void +UIMediator::onToggleAbout(bool) +{ + this->ui->aboutDialog->exec(); +} + void UIMediator::closeInspectorTab(Inspector *insp) { @@ -338,22 +430,3 @@ UIMediator::onCloseInspectorTab(int ndx) } } -void -UIMediator::onWfBandwidthChanged(int min, int max) -{ - unsigned int bw = static_cast(max - min); - - this->setBandwidth(bw); -} - -void -UIMediator::onFrequencyChanged(void) -{ - -} - -void -UIMediator::onLoChanged(void) -{ - -} diff --git a/icons/Icons.qrc b/icons/Icons.qrc index dd9152af..4b890c12 100644 --- a/icons/Icons.qrc +++ b/icons/Icons.qrc @@ -1,15 +1,15 @@ - - - icons/icon-alpha.png - icons/icon-color-about.png - icons/icon-color.png - icons/icon-pro.png - icons/icon.png - icons/overlay-channels.png - icons/preferences.png - icons/select-source.png - icons/splash.png - icons/start-capture.png + + icon-alpha.png + icon-color-about.png + icon-color.png + icon-pro.png + icon.png + overlay-channels.png + preferences.png + select-source.png + splash.png + start-capture.png + about.png diff --git a/icons/icon-color.png b/icons/icon-color.png index 0955f7c9..5b31f12f 100644 Binary files a/icons/icon-color.png and b/icons/icon-color.png differ diff --git a/icons/icon-pro.png b/icons/icon-pro.png index 2923465c..b74bf152 100644 Binary files a/icons/icon-pro.png and b/icons/icon-pro.png differ diff --git a/icons/splash.png b/icons/splash.png index 813d1327..9c81a14b 100644 Binary files a/icons/splash.png and b/icons/splash.png differ diff --git a/icons/splash.xcf b/icons/splash.xcf index f013c155..4c506540 100644 Binary files a/icons/splash.xcf and b/icons/splash.xcf differ diff --git a/include/AppConfig.h b/include/AppConfig.h index da3e5d3e..8f72c298 100644 --- a/include/AppConfig.h +++ b/include/AppConfig.h @@ -1,4 +1,66 @@ +// +// AppConfig.h: Application configuration object +// Copyright (C) 2019 Gonzalo José Carracedo Carballal +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this program. If not, see +// +// + #ifndef APPCONFIG_H #define APPCONFIG_H +#include +#include +#include +#include + +#include "ColorConfig.h" + +#define SIGDIGGER_FFT_WINDOW_SIZE 4096u + +#define SIGDIGGER_MAX_SAMPLE_RATE 3000000 +#define SIGDIGGER_AUDIO_INSPECTOR_SAMPLE_RATE 44100 +#define SIGDIGGER_AUDIO_INSPECTOR_MAGIC_ID 0xa01d10ff +#define SIGDIGGER_AUDIO_INSPECTOR_BANDWIDTH 200000 +#define SIGDIGGER_AUDIO_INSPECTOR_REQID 0xaaaaaaaa + +namespace SigDigger { + class AppConfig : public Suscan::Serializable { + public: + Suscan::Source::Config profile; + Suscan::AnalyzerParams analyzerParams; + ColorConfig colors; + Suscan::Serializable *sourceConfig = nullptr; + Suscan::Serializable *fftConfig = nullptr; + Suscan::Serializable *inspectorConfig = nullptr; + Suscan::Serializable *audioConfig = nullptr; + + int width = 1280; + int height = 1024; + int x = -1; + int y = -1; + + // Methods + AppConfig(AppUI *ui = nullptr); + [[ noreturn ]] AppConfig(Suscan::Object const &conf); + + void loadDefaults(void); + + // Overriden methods + void deserialize(Suscan::Object const &conf) override; + Suscan::Object &&serialize(void) override; + }; +} + #endif // APPCONFIG_H diff --git a/include/AppUI.h b/include/AppUI.h index f730c498..a5b30337 100644 --- a/include/AppUI.h +++ b/include/AppUI.h @@ -19,4 +19,38 @@ #ifndef APPUI_H #define APPUI_H +#include "AboutDialog.h" +#include "SourcePanel.h" +#include "InspectorPanel.h" +#include "FftPanel.h" +#include "AudioPanel.h" +#include "MainSpectrum.h" +#include "ConfigDialog.h" +#include "Palette.h" +#include "AutoGain.h" +#include "Averager.h" +#include "DeviceGain.h" +#include "Inspector.h" +#include "ui_MainWindow.h" +#include "ConfigDialog.h" + +namespace SigDigger { + struct AppUI { + Ui_MainWindow *main = nullptr; + ConfigDialog *configDialog = nullptr; + MainSpectrum *spectrum = nullptr; + SourcePanel *sourcePanel = nullptr; + InspectorPanel *inspectorPanel = nullptr; + FftPanel *fftPanel = nullptr; + AudioPanel *audioPanel = nullptr; + AboutDialog *aboutDialog = nullptr; + std::map inspectorTable; + Suscan::InspectorId lastId = 0; + + AppUI(QMainWindow *); + void postLoadInit(QMainWindow *owner); + ~AppUI(); + }; +} + #endif // APPUI_H diff --git a/include/Application.h b/include/Application.h index 0fa19c03..5d014aca 100644 --- a/include/Application.h +++ b/include/Application.h @@ -1,6 +1,6 @@ // -// filename: description -// Copyright (C) 2018 Gonzalo José Carracedo Carballal +// Application.h: SigDigger main class +// Copyright (C) 2019 Gonzalo José Carracedo Carballal // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as @@ -16,7 +16,119 @@ // License along with this program. If not, see // // + #ifndef APPLICATION_H #define APPLICATION_H +#include +#include + +/* Local includes */ +#include "AppConfig.h" +#include "UIMediator.h" +#include "AudioPlayback.h" +#include "AsyncDataSaver.h" + +namespace SigDigger { + class Application : public QMainWindow { + Q_OBJECT + + // Suscan core object + std::unique_ptr analyzer = nullptr; + std::unique_ptr dataSaver = nullptr; + + bool profileSelected = false; + unsigned int currSampleRate; + bool filterInstalled = false; + + // UI + AppUI ui; + UIMediator *mediator = nullptr; + + // Audio + std::unique_ptr playBack = nullptr; + Suscan::Handle audioInspHandle = 0; + unsigned int audioSampleRate = 0; + suscan_config_t *audioCfgTemplate = nullptr; + bool audioInspectorOpened = false; + bool audioConfigured = false; + SUFREQ maxAudioBw; + SUFREQ lastAudioLo; + + // Delayed audio parameters + unsigned int delayedRate = 0; + SUFLOAT delayedCutOff = 0; + SUFLOAT delayedVolume = 0; + unsigned int delayedDemod = 0; + + // Private methods + QString getLogText(void); + void connectUI(void); + void connectAnalyzer(void); + void connectDataSaver(void); + int openCaptureFile(void); + void installDataSaver(int fd); + void uninstallDataSaver(void); + void setAudioInspectorParams( + unsigned int rate, + SUFLOAT cutOff, + SUFLOAT volume, + unsigned int demod); + SUFREQ getAudioInspectorLo(void) const; + SUFREQ getAudioInspectorBandwidth(void) const; + void assertAudioInspectorLo(void); + + public: + // Application methods + Suscan::Object &&getConfig(void); + void refreshConfig(void); + void run(Suscan::Object const &config); + + void startCapture(void); + void restartCapture(void); + void stopCapture(void); + void setThrottleEnabled(bool); + bool openAudio(unsigned int rate); + void closeAudio(void); + + AsyncDataSaver *getSaver(void) const; + + explicit Application(QWidget *parent = nullptr); + ~Application(); + + public slots: + // UI Slots + void onCaptureStart(void); + void onCaptureStop(void); + void onProfileChanged(void); + void onGainChanged(QString name, float val); + void onFrequencyChanged(qint64); + void onOpenInspector(void); + void onThrottleConfigChanged(void); + void onToggleRecord(void); + void onToggleDCRemove(void); + void onToggleIQReverse(void); + void onToggleAGCEnabled(void); + void onParamsChanged(void); + void onLoChanged(qint64); + void onBandwidthChanged(qreal); + void onAudioChanged(void); + void onAntennaChanged(QString antenna); + + // Analyzer slots + void onAnalyzerHalted(void); + void onAnalyzerReadError(void); + void onAnalyzerEos(void); + void onPSDMessage(const Suscan::PSDMessage &); + void onInspectorMessage(const Suscan::InspectorMessage &); + void onInspectorSamples(const Suscan::SamplesMessage &); + + // DataSaver slots + void onSaveError(void); + void onSaveSwamped(void); + void onSaveRate(qreal rate); + void onCommit(void); + }; +} + #endif // APPLICATION_H diff --git a/include/AutoGain.h b/include/AutoGain.h index 8f5ad11e..3ff270c7 100644 --- a/include/AutoGain.h +++ b/include/AutoGain.h @@ -1,4 +1,82 @@ +// +// AutoGain.h: AutoGain configurations +// Copyright (C) 2019 Gonzalo José Carracedo Carballal +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this program. If not, see +// +// + #ifndef AUTOGAIN_H #define AUTOGAIN_H +#include +#include + +namespace SigDigger { + struct GainTable { + std::string name; + std::vector gains; + + GainTable(); + GainTable(Suscan::Object const &obj); + + void deserialize(Suscan::Object const &obj); + }; + + struct GainConfig { + std::string name; + int value; + + GainConfig(std::string name, int value); + }; + + class AutoGain { + std::string name; + std::string driver; + std::vector gains; + int max = 0; + + public: + AutoGain(); + AutoGain(Suscan::Object const &obj); + + std::vector translateGain(int val) const; + void deserialize(const Suscan::Object &obj); + + std::string + getDriver(void) const + { + return this->driver; + } + + std::string + getName(void) const + { + return this->name; + } + + int + getMax(void) const + { + return this->max; + } + + int + getMin(void) const + { + return 0; + } + }; +} #endif // AUTOGAIN_H diff --git a/include/AutoGainSlider.h b/include/AutoGainSlider.h deleted file mode 100644 index 854eb8ba..00000000 --- a/include/AutoGainSlider.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef AUTOGAINSLIDER_H -#define AUTOGAINSLIDER_H - -#include - -namespace Ui { - class AutoGainSlider; -} - -class AutoGainSlider : public QWidget -{ - Q_OBJECT - - public: - explicit AutoGainSlider(QWidget *parent = nullptr); - ~AutoGainSlider(); - - private: - Ui::AutoGainSlider *ui; -}; - -#endif // AUTOGAINSLIDER_H diff --git a/include/Averager.h b/include/Averager.h index 774e427c..986843b2 100644 --- a/include/Averager.h +++ b/include/Averager.h @@ -1,5 +1,5 @@ // -// filename: description +// Averager.h: Simple PSD averager // Copyright (C) 2018 Gonzalo José Carracedo Carballal // // This program is free software: you can redistribute it and/or modify @@ -19,4 +19,39 @@ #ifndef AVERAGER_H #define AVERAGER_H +#include + +namespace SigDigger { + class Averager { + float *last = nullptr; + unsigned long bufsiz = 0; + float alpha = 1.; + + public: + void feed(Suscan::PSDMessage const &m); + void setAlpha(float alpha); + ~Averager(void); + + float * + get(void) const + { + return this->last; + } + + unsigned long + size(void) const + { + return this->bufsiz; + } + + void + reset(void) + { + if (this->last != nullptr) { + delete [] this->last; + this->bufsiz = 0; + } + } + }; +} #endif // AVERAGER_H diff --git a/include/ConfigDialog.h b/include/ConfigDialog.h index c160e265..cbcfdc27 100644 --- a/include/ConfigDialog.h +++ b/include/ConfigDialog.h @@ -1,5 +1,5 @@ // -// filename: description +// ConfigDialog.h: Configuration dialog window // Copyright (C) 2018 Gonzalo José Carracedo Carballal // // This program is free software: you can redistribute it and/or modify @@ -19,4 +19,94 @@ #ifndef CONFIGDIALOG_H #define CONFIGDIALOG_H +#include +#include +#include +#include +#include +#include + +namespace SigDigger { + class ConfigDialog : public QDialog + { + Q_OBJECT + + private: + Suscan::Source::Config profile; + Suscan::AnalyzerParams analyzerParams; + ColorConfig colors; + + bool accepted; + bool refreshing = false; + + // UI elements + Ui_Config *ui = nullptr; + SaveProfileDialog saveProfileDialog; + + void connectAll(void); + void populateCombos(void); + void refreshAntennas(void); + void refreshColorUi(void); + void refreshAnalyzerParamsUi(void); + void refreshProfileUi(void); + void refreshUi(void); + void refreshUiState(void); + void loadProfile(Suscan::Source::Config &config); + void saveAnalyzerParams(void); + void saveColors(void); + + static QString getBaseName(const QString &string); + + public: + void setProfile(const Suscan::Source::Config &profile); + void setAnalyzerParams(const Suscan::AnalyzerParams ¶ms); + void setColors(const ColorConfig &config); + void setGain(std::string const &name, float value); + void setFrequency(qint64 freq); + + float getGain(std::string const &name); + Suscan::Source::Config getProfile(void); + ColorConfig getColors(void); + Suscan::AnalyzerParams getAnalyzerParams(void); + + bool run(void); + explicit ConfigDialog(QWidget *parent = nullptr); + ~ConfigDialog(); + + static void + populateAntennaCombo( + Suscan::Source::Config &profile, + QComboBox *combo) + { + int index = 0; + combo->clear(); + + for (auto i = profile.getDevice().getFirstAntenna(); + i != profile.getDevice().getLastAntenna(); + ++i) { + combo->addItem(QString::fromStdString(*i)); + + if (profile.getAntenna() == *i) + index = static_cast( + i - profile.getDevice().getFirstAntenna()); + } + + combo->setCurrentIndex(index); + } + + public slots: + void onLoadProfileClicked(void); + void onToggleSourceType(bool); + void onDeviceChanged(int); + void onFormatChanged(int); + void onCheckButtonsToggled(bool); + void onLineEditsChanged(const QString &); + void onBandwidthChanged(double); + void onBrowseCaptureFile(void); + void onAccepted(void); + void onSaveProfile(void); + }; +}; + + #endif // CONFIGDIALOG_H diff --git a/include/DefaultGradient.h b/include/DefaultGradient.h index 535a0cef..a62eab86 100644 --- a/include/DefaultGradient.h +++ b/include/DefaultGradient.h @@ -1,4 +1,285 @@ +// +// DefaultGradient.h: Default Suscan gradient colors +// Copyright (C) 2019 Gonzalo José Carracedo Carballal +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this program. If not, see +// +// + #ifndef DEFAULTGRADIENT_H #define DEFAULTGRADIENT_H +#include + +static qreal wf_gradient[256][3] = { + {0.26700401, 0.00487433, 0.32941519}, + {0.26851048, 0.00960483, 0.33542652}, + {0.26994384, 0.01462494, 0.34137895}, + {0.27130489, 0.01994186, 0.34726862}, + {0.27259384, 0.02556309, 0.35309303}, + {0.27380934, 0.03149748, 0.35885256}, + {0.27495242, 0.03775181, 0.36454323}, + {0.27602238, 0.04416723, 0.37016418}, + {0.2770184 , 0.05034437, 0.37571452}, + {0.27794143, 0.05632444, 0.38119074}, + {0.27879067, 0.06214536, 0.38659204}, + {0.2795655 , 0.06783587, 0.39191723}, + {0.28026658, 0.07341724, 0.39716349}, + {0.28089358, 0.07890703, 0.40232944}, + {0.28144581, 0.0843197 , 0.40741404}, + {0.28192358, 0.08966622, 0.41241521}, + {0.28232739, 0.09495545, 0.41733086}, + {0.28265633, 0.10019576, 0.42216032}, + {0.28291049, 0.10539345, 0.42690202}, + {0.28309095, 0.11055307, 0.43155375}, + {0.28319704, 0.11567966, 0.43611482}, + {0.28322882, 0.12077701, 0.44058404}, + {0.28318684, 0.12584799, 0.44496 }, + {0.283072 , 0.13089477, 0.44924127}, + {0.28288389, 0.13592005, 0.45342734}, + {0.28262297, 0.14092556, 0.45751726}, + {0.28229037, 0.14591233, 0.46150995}, + {0.28188676, 0.15088147, 0.46540474}, + {0.28141228, 0.15583425, 0.46920128}, + {0.28086773, 0.16077132, 0.47289909}, + {0.28025468, 0.16569272, 0.47649762}, + {0.27957399, 0.17059884, 0.47999675}, + {0.27882618, 0.1754902 , 0.48339654}, + {0.27801236, 0.18036684, 0.48669702}, + {0.27713437, 0.18522836, 0.48989831}, + {0.27619376, 0.19007447, 0.49300074}, + {0.27519116, 0.1949054 , 0.49600488}, + {0.27412802, 0.19972086, 0.49891131}, + {0.27300596, 0.20452049, 0.50172076}, + {0.27182812, 0.20930306, 0.50443413}, + {0.27059473, 0.21406899, 0.50705243}, + {0.26930756, 0.21881782, 0.50957678}, + {0.26796846, 0.22354911, 0.5120084 }, + {0.26657984, 0.2282621 , 0.5143487 }, + {0.2651445 , 0.23295593, 0.5165993 }, + {0.2636632 , 0.23763078, 0.51876163}, + {0.26213801, 0.24228619, 0.52083736}, + {0.26057103, 0.2469217 , 0.52282822}, + {0.25896451, 0.25153685, 0.52473609}, + {0.25732244, 0.2561304 , 0.52656332}, + {0.25564519, 0.26070284, 0.52831152}, + {0.25393498, 0.26525384, 0.52998273}, + {0.25219404, 0.26978306, 0.53157905}, + {0.25042462, 0.27429024, 0.53310261}, + {0.24862899, 0.27877509, 0.53455561}, + {0.2468114 , 0.28323662, 0.53594093}, + {0.24497208, 0.28767547, 0.53726018}, + {0.24311324, 0.29209154, 0.53851561}, + {0.24123708, 0.29648471, 0.53970946}, + {0.23934575, 0.30085494, 0.54084398}, + {0.23744138, 0.30520222, 0.5419214 }, + {0.23552606, 0.30952657, 0.54294396}, + {0.23360277, 0.31382773, 0.54391424}, + {0.2316735 , 0.3181058 , 0.54483444}, + {0.22973926, 0.32236127, 0.54570633}, + {0.22780192, 0.32659432, 0.546532 }, + {0.2258633 , 0.33080515, 0.54731353}, + {0.22392515, 0.334994 , 0.54805291}, + {0.22198915, 0.33916114, 0.54875211}, + {0.22005691, 0.34330688, 0.54941304}, + {0.21812995, 0.34743154, 0.55003755}, + {0.21620971, 0.35153548, 0.55062743}, + {0.21429757, 0.35561907, 0.5511844 }, + {0.21239477, 0.35968273, 0.55171011}, + {0.2105031 , 0.36372671, 0.55220646}, + {0.20862342, 0.36775151, 0.55267486}, + {0.20675628, 0.37175775, 0.55311653}, + {0.20490257, 0.37574589, 0.55353282}, + {0.20306309, 0.37971644, 0.55392505}, + {0.20123854, 0.38366989, 0.55429441}, + {0.1994295 , 0.38760678, 0.55464205}, + {0.1976365 , 0.39152762, 0.55496905}, + {0.19585993, 0.39543297, 0.55527637}, + {0.19410009, 0.39932336, 0.55556494}, + {0.19235719, 0.40319934, 0.55583559}, + {0.19063135, 0.40706148, 0.55608907}, + {0.18892259, 0.41091033, 0.55632606}, + {0.18723083, 0.41474645, 0.55654717}, + {0.18555593, 0.4185704 , 0.55675292}, + {0.18389763, 0.42238275, 0.55694377}, + {0.18225561, 0.42618405, 0.5571201 }, + {0.18062949, 0.42997486, 0.55728221}, + {0.17901879, 0.43375572, 0.55743035}, + {0.17742298, 0.4375272 , 0.55756466}, + {0.17584148, 0.44128981, 0.55768526}, + {0.17427363, 0.4450441 , 0.55779216}, + {0.17271876, 0.4487906 , 0.55788532}, + {0.17117615, 0.4525298 , 0.55796464}, + {0.16964573, 0.45626209, 0.55803034}, + {0.16812641, 0.45998802, 0.55808199}, + {0.1666171 , 0.46370813, 0.55811913}, + {0.16511703, 0.4674229 , 0.55814141}, + {0.16362543, 0.47113278, 0.55814842}, + {0.16214155, 0.47483821, 0.55813967}, + {0.16066467, 0.47853961, 0.55811466}, + {0.15919413, 0.4822374 , 0.5580728 }, + {0.15772933, 0.48593197, 0.55801347}, + {0.15626973, 0.4896237 , 0.557936 }, + {0.15481488, 0.49331293, 0.55783967}, + {0.15336445, 0.49700003, 0.55772371}, + {0.1519182 , 0.50068529, 0.55758733}, + {0.15047605, 0.50436904, 0.55742968}, + {0.14903918, 0.50805136, 0.5572505 }, + {0.14760731, 0.51173263, 0.55704861}, + {0.14618026, 0.51541316, 0.55682271}, + {0.14475863, 0.51909319, 0.55657181}, + {0.14334327, 0.52277292, 0.55629491}, + {0.14193527, 0.52645254, 0.55599097}, + {0.14053599, 0.53013219, 0.55565893}, + {0.13914708, 0.53381201, 0.55529773}, + {0.13777048, 0.53749213, 0.55490625}, + {0.1364085 , 0.54117264, 0.55448339}, + {0.13506561, 0.54485335, 0.55402906}, + {0.13374299, 0.54853458, 0.55354108}, + {0.13244401, 0.55221637, 0.55301828}, + {0.13117249, 0.55589872, 0.55245948}, + {0.1299327 , 0.55958162, 0.55186354}, + {0.12872938, 0.56326503, 0.55122927}, + {0.12756771, 0.56694891, 0.55055551}, + {0.12645338, 0.57063316, 0.5498411 }, + {0.12539383, 0.57431754, 0.54908564}, + {0.12439474, 0.57800205, 0.5482874 }, + {0.12346281, 0.58168661, 0.54744498}, + {0.12260562, 0.58537105, 0.54655722}, + {0.12183122, 0.58905521, 0.54562298}, + {0.12114807, 0.59273889, 0.54464114}, + {0.12056501, 0.59642187, 0.54361058}, + {0.12009154, 0.60010387, 0.54253043}, + {0.11973756, 0.60378459, 0.54139999}, + {0.11951163, 0.60746388, 0.54021751}, + {0.11942341, 0.61114146, 0.53898192}, + {0.11948255, 0.61481702, 0.53769219}, + {0.11969858, 0.61849025, 0.53634733}, + {0.12008079, 0.62216081, 0.53494633}, + {0.12063824, 0.62582833, 0.53348834}, + {0.12137972, 0.62949242, 0.53197275}, + {0.12231244, 0.63315277, 0.53039808}, + {0.12344358, 0.63680899, 0.52876343}, + {0.12477953, 0.64046069, 0.52706792}, + {0.12632581, 0.64410744, 0.52531069}, + {0.12808703, 0.64774881, 0.52349092}, + {0.13006688, 0.65138436, 0.52160791}, + {0.13226797, 0.65501363, 0.51966086}, + {0.13469183, 0.65863619, 0.5176488 }, + {0.13733921, 0.66225157, 0.51557101}, + {0.14020991, 0.66585927, 0.5134268 }, + {0.14330291, 0.66945881, 0.51121549}, + {0.1466164 , 0.67304968, 0.50893644}, + {0.15014782, 0.67663139, 0.5065889 }, + {0.15389405, 0.68020343, 0.50417217}, + {0.15785146, 0.68376525, 0.50168574}, + {0.16201598, 0.68731632, 0.49912906}, + {0.1663832 , 0.69085611, 0.49650163}, + {0.1709484 , 0.69438405, 0.49380294}, + {0.17570671, 0.6978996 , 0.49103252}, + {0.18065314, 0.70140222, 0.48818938}, + {0.18578266, 0.70489133, 0.48527326}, + {0.19109018, 0.70836635, 0.48228395}, + {0.19657063, 0.71182668, 0.47922108}, + {0.20221902, 0.71527175, 0.47608431}, + {0.20803045, 0.71870095, 0.4728733 }, + {0.21400015, 0.72211371, 0.46958774}, + {0.22012381, 0.72550945, 0.46622638}, + {0.2263969 , 0.72888753, 0.46278934}, + {0.23281498, 0.73224735, 0.45927675}, + {0.2393739 , 0.73558828, 0.45568838}, + {0.24606968, 0.73890972, 0.45202405}, + {0.25289851, 0.74221104, 0.44828355}, + {0.25985676, 0.74549162, 0.44446673}, + {0.26694127, 0.74875084, 0.44057284}, + {0.27414922, 0.75198807, 0.4366009 }, + {0.28147681, 0.75520266, 0.43255207}, + {0.28892102, 0.75839399, 0.42842626}, + {0.29647899, 0.76156142, 0.42422341}, + {0.30414796, 0.76470433, 0.41994346}, + {0.31192534, 0.76782207, 0.41558638}, + {0.3198086 , 0.77091403, 0.41115215}, + {0.3277958 , 0.77397953, 0.40664011}, + {0.33588539, 0.7770179 , 0.40204917}, + {0.34407411, 0.78002855, 0.39738103}, + {0.35235985, 0.78301086, 0.39263579}, + {0.36074053, 0.78596419, 0.38781353}, + {0.3692142 , 0.78888793, 0.38291438}, + {0.37777892, 0.79178146, 0.3779385 }, + {0.38643282, 0.79464415, 0.37288606}, + {0.39517408, 0.79747541, 0.36775726}, + {0.40400101, 0.80027461, 0.36255223}, + {0.4129135 , 0.80304099, 0.35726893}, + {0.42190813, 0.80577412, 0.35191009}, + {0.43098317, 0.80847343, 0.34647607}, + {0.44013691, 0.81113836, 0.3409673 }, + {0.44936763, 0.81376835, 0.33538426}, + {0.45867362, 0.81636288, 0.32972749}, + {0.46805314, 0.81892143, 0.32399761}, + {0.47750446, 0.82144351, 0.31819529}, + {0.4870258 , 0.82392862, 0.31232133}, + {0.49661536, 0.82637633, 0.30637661}, + {0.5062713 , 0.82878621, 0.30036211}, + {0.51599182, 0.83115784, 0.29427888}, + {0.52577622, 0.83349064, 0.2881265 }, + {0.5356211 , 0.83578452, 0.28190832}, + {0.5455244 , 0.83803918, 0.27562602}, + {0.55548397, 0.84025437, 0.26928147}, + {0.5654976 , 0.8424299 , 0.26287683}, + {0.57556297, 0.84456561, 0.25641457}, + {0.58567772, 0.84666139, 0.24989748}, + {0.59583934, 0.84871722, 0.24332878}, + {0.60604528, 0.8507331 , 0.23671214}, + {0.61629283, 0.85270912, 0.23005179}, + {0.62657923, 0.85464543, 0.22335258}, + {0.63690157, 0.85654226, 0.21662012}, + {0.64725685, 0.85839991, 0.20986086}, + {0.65764197, 0.86021878, 0.20308229}, + {0.66805369, 0.86199932, 0.19629307}, + {0.67848868, 0.86374211, 0.18950326}, + {0.68894351, 0.86544779, 0.18272455}, + {0.69941463, 0.86711711, 0.17597055}, + {0.70989842, 0.86875092, 0.16925712}, + {0.72039115, 0.87035015, 0.16260273}, + {0.73088902, 0.87191584, 0.15602894}, + {0.74138803, 0.87344918, 0.14956101}, + {0.75188414, 0.87495143, 0.14322828}, + {0.76237342, 0.87642392, 0.13706449}, + {0.77285183, 0.87786808, 0.13110864}, + {0.78331535, 0.87928545, 0.12540538}, + {0.79375994, 0.88067763, 0.12000532}, + {0.80418159, 0.88204632, 0.11496505}, + {0.81457634, 0.88339329, 0.11034678}, + {0.82494028, 0.88472036, 0.10621724}, + {0.83526959, 0.88602943, 0.1026459 }, + {0.84556056, 0.88732243, 0.09970219}, + {0.8558096 , 0.88860134, 0.09745186}, + {0.86601325, 0.88986815, 0.09595277}, + {0.87616824, 0.89112487, 0.09525046}, + {0.88627146, 0.89237353, 0.09537439}, + {0.89632002, 0.89361614, 0.09633538}, + {0.90631121, 0.89485467, 0.09812496}, + {0.91624212, 0.89609127, 0.1007168 }, + {0.92610579, 0.89732977, 0.10407067}, + {0.93590444, 0.8985704 , 0.10813094}, + {0.94563626, 0.899815 , 0.11283773}, + {0.95529972, 0.90106534, 0.11812832}, + {0.96489353, 0.90232311, 0.12394051}, + {0.97441665, 0.90358991, 0.13021494}, + {0.98386829, 0.90486726, 0.13689671}, + {0.99324789, 0.90615657, 0.1439362 } +}; + + #endif // DEFAULTGRADIENT_H diff --git a/include/InspectorCtl.h b/include/InspectorCtl.h index ed166efc..9c78376e 100644 --- a/include/InspectorCtl.h +++ b/include/InspectorCtl.h @@ -1,4 +1,88 @@ +// +// InspectorCtl.h: Generic inspector control +// Copyright (C) 2019 Gonzalo José Carracedo Carballal +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this program. If not, see +// +// + + #ifndef INSPECTORCTL_H #define INSPECTORCTL_H +#include +#include + +namespace SigDigger { + class InspectorCtl : public QFrame { + Q_OBJECT + + bool refreshing = false; + bool dirty = false; + Suscan::Config *config = nullptr; + + public: + Suscan::Config *getConfig(void) const; + void registerWidget(const QWidget *widget, const char *signal); + InspectorCtl(QWidget *parent, Suscan::Config *config); + + void refreshEntry(std::string const &, qreal); + void refreshEntry(std::string const &, bool); + void refreshEntry(std::string const &, uint64_t); + + bool + getBoolean(std::string const &name) const + { + const Suscan::FieldValue *val; + + if ((val = this->getConfig()->get(name)) == nullptr) + throw Suscan::Exception("No such boolean property: " + name); + + return val->getBoolean(); + } + + qreal + getFloat(std::string const &name) const + { + const Suscan::FieldValue *val; + + if ((val = this->getConfig()->get(name)) == nullptr) + throw Suscan::Exception("No such float property: " + name); + + return static_cast(val->getFloat()); + } + + uint64_t + getUint64(std::string const &name) const + { + const Suscan::FieldValue *val; + + if ((val = this->getConfig()->get(name)) == nullptr) + throw Suscan::Exception("No such uint64 property: " + name); + + return val->getUint64(); + } + + virtual bool applicable(QString const &key) = 0; + virtual void refreshUi(void) = 0; + virtual void parseConfig(void) = 0; + + signals: + void changed(void); + + public slots: + void onWidgetActivated(void); + }; +} #endif // INSPECTORCTL_H diff --git a/include/InspectorUI.h b/include/InspectorUI.h index 7bafbc6e..b47d7ea7 100644 --- a/include/InspectorUI.h +++ b/include/InspectorUI.h @@ -1,4 +1,145 @@ +// +// InspectorUI.h: Dynamic inspector UI +// Copyright (C) 2019 Gonzalo José Carracedo Carballal +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this program. If not, see +// +// + #ifndef INSPECTORUI_H #define INSPECTORUI_H +#include +#include +#include +#include +#include +#include +#include + +#include "ThrottleableWidget.h" +#include "Decider.h" +#include "Palette.h" +#include "ColorConfig.h" +#include "DataSaverUI.h" +#include "AsyncDataSaver.h" + +namespace Ui { + class Inspector; +} + +namespace SigDigger { + class InspectorUI : public QObject { + Q_OBJECT + + public: + enum State { + DETACHED, + ATTACHED + }; + + private: + + bool scrolling = false; + bool demodulating = true; + bool recording = false; + unsigned int recordingRate = 0; + // Inspector config + Suscan::Config *config; // Weak + QWidget *owner; + + // Decider goes here + unsigned int bps = 0; + Decider decider; + SNREstimator estimator; + bool estimating = false; + struct timeval last_estimator_update; + std::vector buffer; + + // UI objects + std::vector palettes; + std::vector estimators; + std::vector spectsrcs; + + ThrottleControl throttle; + Ui::Inspector *ui = nullptr; + std::vector controls; + DataSaverUI *saverUI = nullptr; + std::unique_ptr dataSaver = nullptr; + + State state = DETACHED; + SUSCOUNT lastLen = 0; + SUSCOUNT lastRate = 0; + + void pushControl(InspectorCtl *ctl); + void setBps(unsigned int bps); + unsigned int getBps(void) const; + unsigned int getBaudRate(void) const; + std::string getClassName(void) const; + void populate(void); + void connectDataSaver(void); + + std::string captureFileName(void) const; + int fd = -1; + + public: + InspectorUI( + QWidget *owner, + Suscan::Config *config); + ~InspectorUI(); + + void feed(const SUCOMPLEX *data, unsigned int size); + void feedSpectrum(const SUFLOAT *data, SUSCOUNT len, SUSCOUNT rate); + void setState(enum State state); + void refreshUi(void); + bool setPalette(std::string const &str); + void addSpectrumSource(Suscan::SpectrumSource const &src); + void addEstimator(Suscan::Estimator const &estimator); + void setColors(ColorConfig const &colors); + bool installDataSaver(void); + void uninstallDataSaver(void); + + enum State getState(void) const; + + public slots: + void onInspectorControlChanged(); + void onOffsetChanged(unsigned int); + void onStrideChanged(unsigned int); + void onScrollBarChanged(int val); + void onCPUBurnClicked(void); + void onFPSReset(void); + void onFPSChanged(void); + void onSymViewControlsChanged(void); + void onSaveSymView(void); + void onClearSymView(void); + void onSpectrumConfigChanged(void); + void onSpectrumSourceChanged(void); + void onRangeChanged(void); + void onToggleSNR(void); + void onResetSNR(void); + void onToggleRecord(void); + + // DataSaver slots + void onSaveError(void); + void onSaveSwamped(void); + void onSaveRate(qreal rate); + void onCommit(void); + + signals: + void configChanged(void); + void setSpectrumSource(unsigned int index); + }; +} + #endif // INSPECTORUI_H diff --git a/include/Loader.h b/include/Loader.h index fd7cfd60..b7c2f88a 100644 --- a/include/Loader.h +++ b/include/Loader.h @@ -16,8 +16,8 @@ // License along with this program. If not, see // // -#ifndef QSTONES_H -#define QSTONES_H +#ifndef LOADER_H +#define LOADER_H #include #include @@ -26,11 +26,10 @@ #include -#include +#include "Application.h" -namespace QStones { - class InitThread: public QThread - { +namespace SigDigger { + class InitThread: public QThread { Q_OBJECT void run() override; @@ -47,6 +46,10 @@ namespace QStones { class Loader: public QSplashScreen { Q_OBJECT + unsigned int confIndex = 0; + void flushLog(void); + QString getLogText(void); + private: // Owned pointers std::unique_ptr initThread; // QT wants this to be a pointer @@ -60,6 +63,7 @@ namespace QStones { Loader(Application *app); ~Loader(); void load(void); + void saveConfig(void); public slots: void handleChange(const QString &state); @@ -68,4 +72,4 @@ namespace QStones { }; }; -#endif // QSTONES_H +#endif // LOADER_H diff --git a/include/Palette.h b/include/Palette.h index 20e193a2..502d4b75 100644 --- a/include/Palette.h +++ b/include/Palette.h @@ -1,4 +1,71 @@ +// +// Palette.h: Palette object +// Copyright (C) 2019 Gonzalo José Carracedo Carballal +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this program. If not, see +// +// + #ifndef PALETTE_H #define PALETTE_H +#include +#include +#include + +#define SIGDIGGER_PALETTE_MAX_STOPS 256 +#define SIGDIGGER_PALETTE_BITMAP_SZ ((SIGDIGGER_PALETTE_MAX_STOPS + 7) / 8) + +#define SIGDIGGER_PALETTE_THUMB_WIDTH 64 +#define SIGDIGGER_PALETTE_THUMB_HEIGHT 20 + +namespace SigDigger { + class Palette { + std::string name; + QColor gradient[SIGDIGGER_PALETTE_MAX_STOPS]; + uint8_t bitmap[SIGDIGGER_PALETTE_BITMAP_SZ]; + QImage thumbnail; + + void updateThumbnail(void); + + public: + Palette(); + Palette(std::string const &name); + Palette(std::string const &name, qreal gradient[][3]); + Palette(const Suscan::Object &obj); + void compose(void); + void deserialize(const Suscan::Object &obj); + void addStop(unsigned int stop, const QColor &color); + + const QImage & + getThumbnail(void) const + { + return this->thumbnail; + } + + std::string + getName(void) const + { + return this->name; + } + + const QColor * + getGradient(void) const + { + return this->gradient; + } + }; +} + #endif // PALETTE_H diff --git a/include/Suscan/Analyzer.h b/include/Suscan/Analyzer.h index 573ff951..50a1f8e3 100644 --- a/include/Suscan/Analyzer.h +++ b/include/Suscan/Analyzer.h @@ -27,6 +27,8 @@ #include #include #include +#include +#include #include #include @@ -53,12 +55,14 @@ namespace Suscan { signals: void psd_message(const Suscan::PSDMessage &message); + void inspector_message(const Suscan::InspectorMessage &message); + void samples_message(const Suscan::SamplesMessage &message); void read_error(void); void eos(void); void halted(void); public slots: - void captureMessage(const Suscan::Message &message); + void captureMessage(quint32 type, void *data); public: SUSCOUNT getSampleRate(void) const; @@ -66,12 +70,30 @@ namespace Suscan { void *read(uint32_t &type); void registerBaseBandFilter(suscan_analyzer_baseband_filter_func_t, void *); void setFrequency(SUFREQ freq); + void setGain(std::string const &name, SUFLOAT val); + void setAntenna(std::string const &name); void setThrottle(unsigned int throttle); + void setParams(AnalyzerParams ¶ms); + void setDCRemove(bool remove); + void setIQReverse(bool reverse); + void setAGC(bool enabled); + void halt(void); - Analyzer( - struct suscan_analyzer_params const& params, - Source::Config const& config); + // Analyzer asynchronous requests + void open(std::string const &inspClass, Channel const &ch, RequestId id); + void openPrecise(std::string const &inspClass, Channel const &ch, RequestId id); + + void setInspectorConfig(Handle handle, Config const &cfg, RequestId id); + void setInspectorId(Handle handle, InspectorId id, RequestId req_id); + void setInspectorFreq(Handle handle, SUFREQ fc, RequestId req_id); + void setInspectorBandwidth(Handle handle, SUFREQ bw, RequestId req_id); + void setInspectorWatermark(Handle handle, SUSCOUNT watermark, RequestId id); + void setSpectrumSource(Handle handle, unsigned int source, RequestId id); + void closeInspector(Handle handle, RequestId id); + + // Constructors + Analyzer(AnalyzerParams ¶ms, Source::Config const& config); ~Analyzer(); }; @@ -88,7 +110,7 @@ namespace Suscan { AsyncThread(Analyzer *); signals: - void message(const Suscan::Message &); + void message(quint32 type, void *data); }; }; diff --git a/include/Suscan/AnalyzerParams.cpp b/include/Suscan/AnalyzerParams.cpp deleted file mode 100644 index 3cf0d72d..00000000 --- a/include/Suscan/AnalyzerParams.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include "AnalyzerParams.h" - -AnalyzerParams::AnalyzerParams() -{ - -} diff --git a/include/Suscan/AnalyzerParams.h b/include/Suscan/AnalyzerParams.h index 4410ee24..8ce9a952 100644 --- a/include/Suscan/AnalyzerParams.h +++ b/include/Suscan/AnalyzerParams.h @@ -1,11 +1,63 @@ -#ifndef ANALYZERPARAMS_H -#define ANALYZERPARAMS_H +// +// AnalyzerParams.h: Analyzer parameters +// Copyright (C) 2019 Gonzalo José Carracedo Carballal +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this program. If not, see +// +// +#ifndef CPP_ANALYZERPARAMS_H +#define CPP_ANALYZERPARAMS_H -class AnalyzerParams : public Suscan::Serializable -{ - public: - AnalyzerParams(); -}; +#include -#endif // ANALYZERPARAMS_H \ No newline at end of file +#include + +namespace Suscan { + class AnalyzerParams : public Serializable + { + struct suscan_analyzer_params c_params = + suscan_analyzer_params_INITIALIZER; + + void updateExposedParams(void); + + public: + enum WindowFunction { + NONE = SU_CHANNEL_DETECTOR_WINDOW_NONE, + HAMMING = SU_CHANNEL_DETECTOR_WINDOW_HAMMING, + HANN = SU_CHANNEL_DETECTOR_WINDOW_HANN, + FLAT_TOP = SU_CHANNEL_DETECTOR_WINDOW_FLAT_TOP, + BLACKMANN_HARRIS = SU_CHANNEL_DETECTOR_WINDOW_BLACKMANN_HARRIS + }; + + float channelUpdateInterval; + float psdUpdateInterval; + float spectrumAvgAlpha; + float sAvgAlpha; + float nAvgAlpha; + float snr; + unsigned int windowSize; + WindowFunction windowFunction; + + struct suscan_analyzer_params const &getCParams(void); + + void deserialize(Object const &conf) override; + Object &&serialize(void) override; + + AnalyzerParams(); + AnalyzerParams(struct suscan_analyzer_params const ¶ms); + }; +} + +#endif // CPP_ANALYZERPARAMS_H diff --git a/include/Suscan/Channel.h b/include/Suscan/Channel.h index a4dac510..3145880d 100644 --- a/include/Suscan/Channel.h +++ b/include/Suscan/Channel.h @@ -1,4 +1,35 @@ -#ifndef CHANNEL_H -#define CHANNEL_H +// +// Channel.h: Channel description +// Copyright (C) 2019 Gonzalo José Carracedo Carballal +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this program. If not, see +// +// + +#ifndef CPP_CHANNEL_H +#define CPP_CHANNEL_H + +#include + +namespace Suscan { + struct Channel { + SUFREQ ft = 0; // Tuner frequency + SUFREQ fc = 0; // Center frequency + SUFREQ fLow = 0; // Lower cutoff + SUFREQ fHigh = 0; // Higher cutoff + SUFREQ bw = 0; + }; +} #endif // CHANNEL_H diff --git a/include/Suscan/Config.h b/include/Suscan/Config.h index 6b3aeb10..89be5167 100644 --- a/include/Suscan/Config.h +++ b/include/Suscan/Config.h @@ -1,4 +1,173 @@ -#ifndef CONFIG_H -#define CONFIG_H +// +// Object.h: Suscan config +// Copyright (C) 2019 Gonzalo José Carracedo Carballal +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this program. If not, see +// +// + +#ifndef CPP_SUSCAN_CONFIG_H +#define CPP_SUSCAN_CONFIG_H + +#include +#include +#include +#include +#include + +namespace Suscan { + class FieldValue { + struct suscan_field_value *instance = nullptr; + + public: + FieldValue(struct suscan_field_value *inst); + + enum suscan_field_type + getType(void) const + { + return this->instance->field->type; + } + + std::string + getName(void) const + { + return this->instance->field->name; + } + + std::string + getDescription(void) const + { + return this->instance->field->desc; + } + + uint64_t + getUint64(void) const + { + return this->instance->as_int; + } + + bool + getBoolean(void) const + { + return this->instance->as_bool != SU_FALSE; + } + + SUFLOAT + getFloat(void) const + { + return this->instance->as_float; + } + + std::string + getString(void) const + { + return this->instance->as_string; + } + }; + + class Config { + suscan_config_t *instance = nullptr; + bool owned = false; + std::vector fields; + + void populate(void); + + public: + Config(); + Config(const suscan_config_t *instance); + Config(suscan_config_t *instance); + ~Config(); + + FieldValue const *get(std::string const &name) const; + + const suscan_config_t * + getInstance(void) const + { + return this->instance; + } + + void + set(std::string const &name, uint64_t val) + { + SU_ATTEMPT( + suscan_config_set_integer(this->instance, name.c_str(), val)); + } + + void + set(std::string const &name, SUFLOAT val) + { + SU_ATTEMPT( + suscan_config_set_float(this->instance, name.c_str(), val)); + } + + void + set(std::string const &name, bool val) + { + SU_ATTEMPT( + suscan_config_set_bool( + this->instance, + name.c_str(), + val ? SU_TRUE : SU_FALSE)); + } + + void + set(std::string const &name, std::string const &val) + { + SU_ATTEMPT( + suscan_config_set_string( + this->instance, + name.c_str(), + val.c_str())); + } + + bool + hasPrefix(std::string const &name) const + { + return + suscan_config_desc_has_prefix( + instance->desc, + name.c_str()) != SU_FALSE; + } + + std::vector::const_iterator + begin(void) const + { + return this->fields.begin(); + } + + std::vector::const_iterator + end(void) const + { + return this->fields.end(); + } + }; + + class ConfigContext { + suscan_config_context_t *ctx; + + public: + ConfigContext(suscan_config_context_t *instance); + ConfigContext(std::string const &name); + void save(void) const; + Object listObject(void) const; + + static void + saveAll(void) + { + SU_ATTEMPT(suscan_confdb_save_all()); + } + }; +} #endif // CONFIG_H diff --git a/include/Suscan/Estimator.h b/include/Suscan/Estimator.h index c6381081..70b6bbfc 100644 --- a/include/Suscan/Estimator.h +++ b/include/Suscan/Estimator.h @@ -1,4 +1,33 @@ -#ifndef ESTIMATOR_H -#define ESTIMATOR_H +// +// Estimator.h: Parameter estimator +// Copyright (C) 2019 Gonzalo José Carracedo Carballal +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this program. If not, see +// +// -#endif // ESTIMATOR_H +#ifndef CPP_ESTIMATOR_H +#define CPP_ESTIMATOR_H + +#include + +namespace Suscan { + struct Estimator { + std::string name; + std::string desc; + std::string field; + }; +} + +#endif // CPP_ESTIMATOR_H diff --git a/include/Suscan/Library.h b/include/Suscan/Library.h index 05f4b9d6..19347774 100644 --- a/include/Suscan/Library.h +++ b/include/Suscan/Library.h @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -32,13 +33,20 @@ #include #include +#include + namespace Suscan { + typedef std::map ConfigMap; + class Singleton { - private: static Singleton *instance; static Logger *logger; - std::vector profiles; + std::vector devices; + ConfigMap profiles; + std::vector palettes; + std::vector autoGains; + std::vector uiConfig; bool codecs_initd; bool sources_initd; @@ -49,17 +57,47 @@ namespace Suscan { Singleton(); ~Singleton(); + bool havePalette(std::string const &name); + bool haveAutoGain(std::string const &name); + public: void init_codecs(void); void init_sources(void); void init_estimators(void); void init_spectrum_sources(void); void init_inspectors(void); + void init_palettes(void); + void init_autogains(void); + void init_ui_config(void); + + void sync(void); void registerSourceConfig(suscan_source_config_t *config); - std::vector::const_iterator getFirstProfile(void) const; - std::vector::const_iterator getLastProfile(void) const; + void registerSourceDevice(const suscan_source_device_t *dev); + + + ConfigMap::const_iterator getFirstProfile(void) const; + ConfigMap::const_iterator getLastProfile(void) const; + Suscan::Source::Config *getProfile(std::string const &name); + void saveProfile(Suscan::Source::Config const &name); + + std::vector::const_iterator getFirstDevice(void) const; + std::vector::const_iterator getLastDevice(void) const; + + + std::vector::const_iterator getFirstPalette(void) const; + std::vector::const_iterator getLastPalette(void) const; + + std::vector::const_iterator getFirstAutoGain(void) const; + std::vector::const_iterator getLastAutoGain(void) const; + + std::vector::iterator getFirstUIConfig(void); + std::vector::iterator getLastUIConfig(void); + + void putUIConfig(unsigned int where, Object &&rv); + + const Source::Device *getDeviceAt(unsigned int index) const; static Singleton *get_instance(void); }; diff --git a/include/Suscan/Message.h b/include/Suscan/Message.h index b5e9000b..321b4ff0 100644 --- a/include/Suscan/Message.h +++ b/include/Suscan/Message.h @@ -27,6 +27,10 @@ #include namespace Suscan { + typedef uint32_t RequestId; + typedef uint32_t InspectorId; + typedef SUHANDLE Handle; + class Message { private: uint32_t type; diff --git a/include/Suscan/Messages/InspectorMessage.h b/include/Suscan/Messages/InspectorMessage.h index 53841382..a042b8d5 100644 --- a/include/Suscan/Messages/InspectorMessage.h +++ b/include/Suscan/Messages/InspectorMessage.h @@ -16,11 +16,16 @@ // License along with this program. If not, see // // + #ifndef MESSAGES_INSPECTOR_MESSAGE_H #define MESSAGES_INSPECTOR_MESSAGE_H #include #include +#include +#include +#include +#include #include @@ -28,8 +33,25 @@ namespace Suscan { class InspectorMessage: public Message { private: struct suscan_analyzer_inspector_msg *message = nullptr; // Convenience reference + std::vector sources; + std::vector estimators; + + Config config; public: + enum suscan_analyzer_inspector_msgkind getKind(void) const; + suscan_config_t const *getCConfig(void) const; + RequestId getRequestId(void) const; + InspectorId getInspectorId(void) const; + Handle getHandle(void) const; + SUFLOAT *getSpectrumData(void) const; + SUSCOUNT getSpectrumLength(void) const; + SUSCOUNT getSpectrumRate(void) const; + std::string getClass(void) const; + std::vector const &getSpectrumSources(void) const; + std::vector const &getEstimators(void) const; + Channel getChannel(void) const; + InspectorMessage(); InspectorMessage(struct suscan_analyzer_inspector_msg *msg); }; diff --git a/include/Suscan/Messages/SamplesMessage.h b/include/Suscan/Messages/SamplesMessage.h index 24781b0e..5bd9a76b 100644 --- a/include/Suscan/Messages/SamplesMessage.h +++ b/include/Suscan/Messages/SamplesMessage.h @@ -30,6 +30,33 @@ namespace Suscan { struct suscan_analyzer_sample_batch_msg *message = nullptr; // Convenience reference public: + InspectorId + getInspectorId(void) const + { + if (this->message == nullptr) + return 999999999; + + return static_cast(this->message->inspector_id); + } + + unsigned int + getCount(void) const + { + if (this->message == nullptr) + return 0; + + return this->message->sample_count; + } + + const SUCOMPLEX * + getSamples(void) const + { + if (this->message == nullptr) + return nullptr; + + return this->message->samples; + } + SamplesMessage(); SamplesMessage(struct suscan_analyzer_sample_batch_msg *msg); }; diff --git a/include/Suscan/Object.h b/include/Suscan/Object.h index ee42debf..2e657447 100644 --- a/include/Suscan/Object.h +++ b/include/Suscan/Object.h @@ -1,4 +1,293 @@ -#ifndef OBJECT_H -#define OBJECT_H +// +// Object.h: Suscan objects +// Copyright (C) 2019 Gonzalo José Carracedo Carballal +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this program. If not, see +// +// + +#ifndef CPP_SUSCAN_OBJECT_H +#define CPP_SUSCAN_OBJECT_H + +#include + +#include + +namespace Suscan { + class Object { + suscan_object_t *instance = nullptr; + bool borrowed = true; + + public: + Object(); + Object(enum suscan_object_type type); + Object(suscan_object_t *instance); + Object(std::string const &url, const uint8_t *data, size_t size); + Object(const Object &obj); + Object(Object &&rv); + + ~Object(); + + static Object + wrap(suscan_object_t *instance) + { + Object obj; + + if (instance == nullptr) + throw Suscan::Exception("Attempting to wrap null object"); + + obj.instance = instance; + obj.borrowed = false; + + return obj; + } + + Object & + operator=(const Object &obj) + { + this->borrowed = true; + this->instance = obj.instance; + + return *this; + } + + Object & + operator=(Object &&obj) + { + std::swap(this->borrowed, obj.borrowed); + std::swap(this->instance, obj.instance); + + return *this; + } + + bool + operator==(const Object &obj) + { + return this->instance == obj.instance; + } + + bool + isBorrowed(void) const + { + return this->borrowed; + } + + bool + isHollow(void) const + { + return this->instance == nullptr; + } + + suscan_object_t * + getInstance(void) const + { + return this->instance; + } + + std::string + getClass(void) const + { + const char *className = suscan_object_get_class(this->instance); + return className == nullptr ? "" : className; + } + + void + setClass(std::string const &name) + { + SU_ATTEMPT(suscan_object_set_class(this->instance, name.c_str())); + } + + enum suscan_object_type + getType(void) const { + return suscan_object_get_type(this->instance); + } + + Object + getField(std::string const &field) const + { + suscan_object_t *obj; + + SU_ATTEMPT(obj = suscan_object_get_field(this->instance, field.c_str())); + + return Object(obj); + } + + void + setField(std::string const &field, Object &&obj) + { + if (obj.isBorrowed()) + throw Suscan::Exception("Cannot set borrowed objects as object fields"); + + SU_ATTEMPT(suscan_object_set_field(this->instance, field.c_str(), obj.instance)); + + obj.borrowed = true; + } + + void + setField(std::string const &field, Object &obj) + { + if (obj.isBorrowed()) + throw Suscan::Exception("Cannot set borrowed objects as object fields"); + + SU_ATTEMPT(suscan_object_set_field(this->instance, field.c_str(), obj.instance)); + + obj.borrowed = true; + } + + unsigned int + getFieldCount(void) const + { + return suscan_object_field_count(this->instance); + } + + Object + getFieldByIndex(unsigned int field) const + { + suscan_object_t *obj; + + SU_ATTEMPT(obj = suscan_object_get_field_by_index(this->instance, field)); + + return Object(obj); + } + + int + get(std::string const &field, int dfl) const + { + return suscan_object_get_field_int(this->instance, field.c_str(), dfl); + } + + bool + get(std::string const &field, bool dfl) const + { + return suscan_object_get_field_bool( + this->instance, + field.c_str(), + dfl == SU_FALSE ? false : true) != SU_FALSE; + } + + unsigned int + get(std::string const &field, unsigned int dfl) const + { + return suscan_object_get_field_uint(this->instance, field.c_str(), dfl); + } + + SUFLOAT + get(std::string const &field, SUFLOAT dfl) const + { + return suscan_object_get_field_float(this->instance, field.c_str(), dfl); + } + + std::string + get(std::string const &field, std::string const &dfl) const + { + const char *val; + + val = suscan_object_get_field_value(this->instance, field.c_str()); + + if (val == nullptr) + return dfl; + + return val; + } + + void + set(std::string const &field, int val) + { + SU_ATTEMPT(suscan_object_set_field_int(this->instance, field.c_str(), val)); + } + + void + set(std::string const &field, unsigned int val) + { + SU_ATTEMPT(suscan_object_set_field_uint(this->instance, field.c_str(), val)); + } + + void + set(std::string const &field, bool val) + { + SU_ATTEMPT(suscan_object_set_field_bool(this->instance, field.c_str(), val != SU_FALSE)); + } + + void + set(std::string const &field, SUFLOAT val) + { + SU_ATTEMPT(suscan_object_set_field_float(this->instance, field.c_str(), val)); + } + + void + set(std::string const &field, std::string const &val) + { + SU_ATTEMPT(suscan_object_set_field_value(this->instance, field.c_str(), val.c_str())); + } + + std::string + name(void) const + { + return suscan_object_get_name(this->instance); + } + + std::string + value(void) const + { + return suscan_object_get_value(this->instance); + } + + // Set-type objects + unsigned int + length(void) const + { + return suscan_object_set_get_count(this->instance); + } + + Object + operator [] (unsigned int index) const + { + suscan_object_t *obj; + + SU_ATTEMPT(obj = suscan_object_set_get(this->instance, index)); + + return Object(obj); + } + + void + put(Object &obj, unsigned int index) + { + if (obj.isBorrowed()) + throw Suscan::Exception("Cannot put borrowed objects into a set"); + + SU_ATTEMPT(suscan_object_set_put(this->instance, index, obj.instance)); + + obj.borrowed = true; + } + + void + remove(unsigned int index) + { + SU_ATTEMPT(suscan_object_set_delete(this->instance, index)); + } + + void + append(Object &obj) + { + if (obj.isBorrowed()) + throw Suscan::Exception("Cannot put borrowed objects into a set"); + + SU_ATTEMPT(suscan_object_set_append(this->instance, obj.instance)); + + obj.borrowed = true; + } + }; +} #endif // OBJECT_H diff --git a/include/Suscan/Serializable.h b/include/Suscan/Serializable.h index 713a1e65..158aba08 100644 --- a/include/Suscan/Serializable.h +++ b/include/Suscan/Serializable.h @@ -1,4 +1,55 @@ -#ifndef SERIALIZABLE_H -#define SERIALIZABLE_H +// +// Serializable.h: Interface for serializable objects +// Copyright (C) 2019 Gonzalo José Carracedo Carballal +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this program. If not, see +// +// + +#ifndef CPP_SERIALIZABLE_H +#define CPP_SERIALIZABLE_H + +#include + +namespace Suscan { + class Serializable { + Object storage; + + public: + void + putStorage(Object &&obj) + { + this->storage = std::move(obj); + } + + Object && + takeStorage(void) + { + return std::move(this->storage); + } + + Object && + persist(Object &obj) + { + this->putStorage(std::move(obj)); + return this->takeStorage(); + } + + virtual void deserialize(Object const &conf) = 0; + virtual Object &&serialize(void) = 0; + virtual ~Serializable(); + }; +} #endif // SERIALIZABLE_H diff --git a/include/Suscan/Source.h b/include/Suscan/Source.h index e42a8d04..f3cb041a 100644 --- a/include/Suscan/Source.h +++ b/include/Suscan/Source.h @@ -20,8 +20,10 @@ #ifndef CPP_SOURCE_H #define CPP_SOURCE_H -#include +#include +#include +#include #include namespace Suscan { @@ -35,14 +37,169 @@ namespace Suscan { public: class Config; - + class Device; + class GainDescription; Source(Config const&); ~Source(); }; + class Source::GainDescription { + std::string name; + SUFLOAT min; + SUFLOAT max; + SUFLOAT step; + SUFLOAT def; + + public: + GainDescription(const struct suscan_source_gain_desc *desc); + + std::string + getName(void) const + { + return this->name; + } + + SUFLOAT + getMin(void) const + { + return this->min; + } + + SUFLOAT + getMax(void) const + { + return this->max; + } + + SUFLOAT + getStep(void) const + { + return this->step; + } + + SUFLOAT + getDefault(void) const + { + return this->def; + } + }; + + class Source::Device { + const suscan_source_device_t *instance; // Always borrowed + std::vector antennas; + std::vector gains; + + friend class Config; + + public: + Device(); // Dummy constructor because Qt wants it + Device(const Device &dev); + Device(Device &&rv); + Device(const suscan_source_device_t *dev, unsigned int channel); + void setDevice(const suscan_source_device_t *dev, unsigned int channel); + + Device & + operator = (const Device &dev) + { + if (this != &dev) { + this->setDevice(dev.instance, 0); + } + + return *this; + } + + Device & + operator = (Device &&dev) + { + if (this != &dev) { + std::swap(this->instance, dev.instance); + std::swap(this->antennas, dev.antennas); + std::swap(this->gains, dev.gains); + } + return *this; + } + + const suscan_source_device_t * + getInstance(void) const + { + return this->instance; + } + + void + setDevice(const Device &dev) + { + this->setDevice(dev.instance, 0); + } + + bool + equals(const Device &dev) const + { + return this->instance == dev.instance; + } + + std::string + getDriver(void) const + { + if (this->instance == nullptr) + return ""; + return suscan_source_device_get_driver(this->instance); + } + + std::string + getDesc(void) const + { + if (this->instance == nullptr) + return ""; + return suscan_source_device_get_desc(this->instance); + } + + int + getIndex(void) const + { + if (this->instance == nullptr) + return -1; + return suscan_source_device_get_index(this->instance); + } + + bool + isPopulated(void) const + { + if (this->instance == nullptr) + return false; + return suscan_source_device_is_populated(this->instance); + } + + + std::vector::const_iterator + getFirstAntenna(void) const + { + return this->antennas.begin(); + } + + std::vector::const_iterator + getLastAntenna(void) const + { + return this->antennas.end(); + } + + std::vector::const_iterator + getFirstGain(void) const + { + return this->gains.begin(); + } + + std::vector::const_iterator + getLastGain(void) const + { + return this->gains.end(); + } + + }; + class Source::Config { private: bool borrowed; + Device devWrapper; // Convenience friendship friend class Analyzer; @@ -54,16 +211,37 @@ namespace Suscan { SUFREQ getFreq(void) const; unsigned int getSampleRate() const; enum suscan_source_type getType(void) const; + bool getLoop(void) const; + std::string getPath(void) const; + std::string getAntenna(void) const; + bool getDCRemove(void) const; + bool getIQBalance(void) const; + SUFLOAT getBandwidth(void) const; + SUFLOAT getGain(const std::string &) const; + const Source::Device &getDevice(void); + enum suscan_source_format getFormat(void) const; + + void setFreq(SUFREQ freq); + void setBandwidth(SUFLOAT bw); + void setLoop(bool); + void setDCRemove(bool); + void setIQBalance(bool); + void setFormat(enum suscan_source_format fmt); + void setType(enum suscan_source_type type); void setLabel(const std::string &); void setPath(const std::string &); - void setSDRDevice(const suscan_source_device_t *); void setSampleRate(unsigned int value); + void setDevice(const Source::Device &dev); + void setGain(const std::string &, SUFLOAT); Config& operator=(const Config &); Config& operator=(Config &&); + Suscan::Object serialize(void); + Config(); + Config(const Suscan::Object &obj); Config(suscan_source_config_t *); Config(const Config &); Config(Config &&); diff --git a/include/Suscan/SpectrumSource.h b/include/Suscan/SpectrumSource.h index 1bd322d1..84b315a9 100644 --- a/include/Suscan/SpectrumSource.h +++ b/include/Suscan/SpectrumSource.h @@ -1,4 +1,32 @@ -#ifndef SPECTRUMSOURCE_H -#define SPECTRUMSOURCE_H +// +// SpectrumSource.h: Spectrum source description +// Copyright (C) 2019 Gonzalo José Carracedo Carballal +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Lesser General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this program. If not, see +// +// + +#ifndef CPP_SPECTRUMSOURCE_H +#define CPP_SPECTRUMSOURCE_H + +#include + +namespace Suscan { + struct SpectrumSource { + std::string name; + std::string desc; + }; +} #endif // SPECTRUMSOURCE_H diff --git a/include/UIMediator.h b/include/UIMediator.h index 48fbc1ea..ee402941 100644 --- a/include/UIMediator.h +++ b/include/UIMediator.h @@ -1,4 +1,4 @@ -// +// // filename: description // Copyright (C) 2018 Gonzalo José Carracedo Carballal // @@ -19,23 +19,157 @@ #ifndef APPLICATIONUI_H #define APPLICATIONUI_H - +#include +#include +#include +#include namespace SigDigger { - class Application; - struct ApplicationUI { - Ui_MainWindow *mainWindow; - ConfigDialog *configDialog; - std::vector palettes; + class UIMediator : public PersistentWidget { + Q_OBJECT public: - bool setPalette(std::string const &str); - void setPandRange(float min, float max); - void setWfRange(float min, float max); + enum State { + HALTED, + HALTING, + RUNNING, + RESTARTING + }; + + private: + // Convenience pointers + AppConfig *appConfig = nullptr; + + // Static part of UI + QMainWindow *owner = nullptr; + AppUI *ui = nullptr; + QDockWidget *sourcePanelDock = nullptr; + QDockWidget *inspectorPanelDock = nullptr; + QDockWidget *fftPanelDock = nullptr; + QDockWidget *audioPanelDock = nullptr; + + // UI Data + Averager averager; + unsigned int rate = 0; + + // UI State + State state = HALTED; + + // Private methods + void connectMainWindow(void); + void connectSpectrum(void); + void connectSourcePanel(void); + void connectFftPanel(void); + void connectAudioPanel(void); + void connectInspectorPanel(void); + + void refreshUI(void); + + // Behavioral methods + void setSampleRate(unsigned int rate); + void setBandwidth(unsigned int bandwidth); + void refreshProfile(void); + + void setCurrentAutoGain(void); + static QString getInspectorTabTitle(Suscan::InspectorMessage const &msg); + + public: + // UI State + void setState(enum State); + State getState(void) const; + + // Data methods + void feedPSD(const Suscan::PSDMessage &msg); + void setCaptureSize(quint64 size); + + // Inspector handling + Inspector *lookupInspector(Suscan::InspectorId id) const; + Inspector *addInspectorTab( + Suscan::InspectorMessage const &msg, + Suscan::InspectorId &oId); + void closeInspectorTab(Inspector *insp); + void detachAllInspectors(void); + + // Convenience getters + Suscan::Source::Config *getProfile(void) const; + Suscan::AnalyzerParams *getAnalyzerParams(void) const; + unsigned int getFftSize(void) const; + + // Mediated setters + void setRecordState(bool state); + void setIORate(qreal rate); + void saveGeometry(void); + + // Overriden methods + Suscan::Serializable *allocConfig() override; + void applyConfig(void) override; + + UIMediator(QMainWindow *owner, AppUI *ui); + ~UIMediator() override; + + signals: + void captureStart(void); + void captureEnd(void); + void profileChanged(); + void colorsChanged(ColorConfig config); + + void frequencyChanged(qint64); + void loChanged(qint64); + void bandwidthChanged(qreal bw); + + void toggleRecord(void); + void throttleConfigChanged(void); + void gainChanged(QString name, float val); + void toggleIQReverse(void); + void toggleDCRemove(void); + void toggleAGCEnabled(void); + void antennaChanged(QString); + + void saveStateChanged(void); + void requestOpenInspector(void); + void inspectorClosed(Suscan::Handle handle); + void analyzerParamsChanged(void); + + void audioChanged(void); + + public slots: + // Main Window slots + void onTriggerSetup(bool); + void onToggleCapture(bool); + void onToggleAbout(bool); + void onCloseInspectorTab(int index); + + // Spectrum slots + void onBandwidthChanged(void); + void onFrequencyChanged(qint64); + void onLoChanged(qint64); + void onRangeChanged(float, float); + void onZoomChanged(float); + + // Source panel + void onToggleRecord(void); + void onThrottleConfigChanged(void); + void onGainChanged(QString name, float val); + void onToggleDCRemove(void); + void onToggleIQReverse(void); + void onToggleAGCEnabled(void); + void onAntennaChanged(QString name); + + // Fft Panel + void onPaletteChanged(void); + void onRangesChanged(void); + void onAveragerChanged(void); + void onFftSizeChanged(void); + void onWindowFunctionChanged(void); + + // Audio panel + void onAudioChanged(void); + + // Inspector + void onInspBandwidthChanged(void); + void onOpenInspector(void); - ApplicationUI(Application *owner); - ~ApplicationUI(); }; }; diff --git a/main.cpp b/main.cpp index d605eb68..22e59585 100644 --- a/main.cpp +++ b/main.cpp @@ -16,14 +16,31 @@ // License along with this program. If not, see // // -#include "MainWindow.h" + #include +#include + +#include "Loader.h" + +using namespace SigDigger; -int main(int argc, char *argv[]) +int +main(int argc, char *argv[]) { - QApplication a(argc, argv); - MainWindow w; - w.show(); + int ret; + + QApplication app(argc, argv); + + Application main_app; + Loader loader(&main_app); + + loader.load(); + + ret = app.exec(); + + std::cout << "Saving config..." << std::endl; + + loader.saveConfig(); - return a.exec(); + return ret; } diff --git a/ui/AboutDialog.cpp b/ui/AboutDialog.cpp deleted file mode 100644 index 892af10b..00000000 --- a/ui/AboutDialog.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include "AboutDialog.h" -#include "ui_AboutDialog.h" - -AboutDialog::AboutDialog(QWidget *parent) : - QDialog(parent), - ui(new Ui::AboutDialog) -{ - ui->setupUi(this); -} - -AboutDialog::~AboutDialog() -{ - delete ui; -} diff --git a/ui/AboutDialog.h b/ui/AboutDialog.h deleted file mode 100644 index ec800a05..00000000 --- a/ui/AboutDialog.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef ABOUTDIALOG_H -#define ABOUTDIALOG_H - -#include - -namespace Ui { - class AboutDialog; -} - -class AboutDialog : public QDialog -{ - Q_OBJECT - - public: - explicit AboutDialog(QWidget *parent = nullptr); - ~AboutDialog(); - - private: - Ui::AboutDialog *ui; -}; - -#endif // ABOUTDIALOG_H diff --git a/ui/AboutDialog.ui b/ui/AboutDialog.ui index 240a1c2e..d7047db7 100644 --- a/ui/AboutDialog.ui +++ b/ui/AboutDialog.ui @@ -1,39 +1,255 @@ + - - - AboutDialog - + 0 0 - 400 - 300 + 771 + 493 - Dialog + About SigDigger - - - - 30 - 240 - 341 - 32 - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - + + true + + + + + + <html><head/><body><p><span style=" font-size:18pt; font-weight:600;">SigDigger - A free digital signal analyzer for GNU/Linux</span></p><p>Brought to you with love and kindness by Gonzalo J. Carracedo</p><p><a href="http://actinid.org"><span style=" text-decoration: underline; color:#0000ff;">http://actinid.org</span></a></p></body></html> + + + Qt::RichText + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + 0 + 0 + + + + + 128 + 128 + + + + + + + :/icons/icon-color.png + + + true + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + 0 + + + + Authors + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Cantarell'; font-size:11pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Gonzalo José Carracedo Carballal &lt;</span><a href="mailto:BatchDrake@gmail.com"><span style=" font-weight:600; text-decoration: underline; color:#0000ff;">BatchDrake@gmail.com</span></a><span style=" font-weight:600;">&gt;</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Sigutils (DSP library), Suscan (analyzer core) and Qt interface</p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Waterfall control, range slider and the overall GUI distribution were shamelessly copied from <span style=" font-weight:600;">Alexandru Csete</span>'s <a href="http://gqrx.dk/"><span style=" text-decoration: underline; color:#0000ff;">GQRX</span></a>. Original source authorship is by <span style=" font-weight:600;">Moe Wheatley</span> (AE4JY). Check it out!</p></body></html> + + + + + + + + License - Original code + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Cantarell'; font-size:11pt; font-weight:400; font-style:normal;"> +<p align="center" style=" margin-top:19px; margin-bottom:13px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:large; font-weight:600; color:#333333; background-color:#ffffff;">GNU GENERAL PUBLIC LICENSE</span></p> +<p align="center" style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">Version 3, 29 June 2007</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">Copyright © 2007 Free Software Foundation, Inc. &lt;</span><a href="https://fsf.org/"><span style=" font-family:'Times New Roman'; font-size:16px; text-decoration: underline; color:#100070;">https://fsf.org/</span></a><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222;">&gt;</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.</span></p> +<p style=" margin-top:19px; margin-bottom:13px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><a name="preamble"></a><span style=" font-family:'Times New Roman'; font-size:large; font-weight:600; color:#333333;">P</span><span style=" font-family:'Times New Roman'; font-size:large; font-weight:600; color:#333333;">reamble</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">The GNU General Public License is a free, copyleft license for software and other kinds of works.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">The precise terms and conditions for copying, distribution and modification follow.</span></p> +<p style=" margin-top:19px; margin-bottom:13px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><a name="terms"></a><span style=" font-family:'Times New Roman'; font-size:large; font-weight:600; color:#333333;">T</span><span style=" font-family:'Times New Roman'; font-size:large; font-weight:600; color:#333333;">ERMS AND CONDITIONS</span></p> +<p style=" margin-top:19px; margin-bottom:13px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><a name="section0"></a><span style=" font-family:'Times New Roman'; font-size:medium; font-weight:600; color:#333333;">0</span><span style=" font-family:'Times New Roman'; font-size:medium; font-weight:600; color:#333333;">. Definitions.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">“This License” refers to version 3 of the GNU General Public License.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">“Copyright” also means copyright-like laws that apply to other kinds of works, such as semiconductor masks.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">“The Program” refers to any copyrightable work licensed under this License. Each licensee is addressed as “you”. “Licensees” and “recipients” may be individuals or organizations.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">To “modify” a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a “modified version” of the earlier work or a work “based on” the earlier work.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">A “covered work” means either the unmodified Program or a work based on the Program.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">To “propagate” a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">To “convey” a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">An interactive user interface displays “Appropriate Legal Notices” to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion.</span></p> +<p style=" margin-top:19px; margin-bottom:13px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><a name="section1"></a><span style=" font-family:'Times New Roman'; font-size:medium; font-weight:600; color:#333333;">1</span><span style=" font-family:'Times New Roman'; font-size:medium; font-weight:600; color:#333333;">. Source Code.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">The “source code” for a work means the preferred form of the work for making modifications to it. “Object code” means any non-source form of a work.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">A “Standard Interface” means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">The “System Libraries” of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A “Major Component”, in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">The “Corresponding Source” for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">The Corresponding Source for a work in source code form is that same work.</span></p> +<p style=" margin-top:19px; margin-bottom:13px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><a name="section2"></a><span style=" font-family:'Times New Roman'; font-size:medium; font-weight:600; color:#333333;">2</span><span style=" font-family:'Times New Roman'; font-size:medium; font-weight:600; color:#333333;">. Basic Permissions.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary.</span></p> +<p style=" margin-top:19px; margin-bottom:13px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><a name="section3"></a><span style=" font-family:'Times New Roman'; font-size:medium; font-weight:600; color:#333333;">3</span><span style=" font-family:'Times New Roman'; font-size:medium; font-weight:600; color:#333333;">. Protecting Users' Legal Rights From Anti-Circumvention Law.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures.</span></p> +<p style=" margin-top:19px; margin-bottom:13px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><a name="section4"></a><span style=" font-family:'Times New Roman'; font-size:medium; font-weight:600; color:#333333;">4</span><span style=" font-family:'Times New Roman'; font-size:medium; font-weight:600; color:#333333;">. Conveying Verbatim Copies.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee.</span></p> +<p style=" margin-top:19px; margin-bottom:13px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><a name="section5"></a><span style=" font-family:'Times New Roman'; font-size:medium; font-weight:600; color:#333333;">5</span><span style=" font-family:'Times New Roman'; font-size:medium; font-weight:600; color:#333333;">. Conveying Modified Source Versions.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions:</span></p> +<ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" font-family:'Times New Roman'; font-size:16px; color:#222222;" style=" margin-top:17px; margin-bottom:0px; margin-left:37px; margin-right:17px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px;">a) The work must carry prominent notices stating that you modified it, and giving a relevant date.</span></li> +<li style=" font-family:'Times New Roman'; font-size:16px; color:#222222;" style=" margin-top:10px; margin-bottom:0px; margin-left:37px; margin-right:17px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px;">b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to “keep intact all notices”.</span></li> +<li style=" font-family:'Times New Roman'; font-size:16px; color:#222222;" style=" margin-top:10px; margin-bottom:0px; margin-left:37px; margin-right:17px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px;">c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it.</span></li> +<li style=" font-family:'Times New Roman'; font-size:16px; color:#222222;" style=" margin-top:10px; margin-bottom:17px; margin-left:37px; margin-right:17px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px;">d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so.</span></li></ul> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an “aggregate” if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate.</span></p> +<p style=" margin-top:19px; margin-bottom:13px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><a name="section6"></a><span style=" font-family:'Times New Roman'; font-size:medium; font-weight:600; color:#333333;">6</span><span style=" font-family:'Times New Roman'; font-size:medium; font-weight:600; color:#333333;">. Conveying Non-Source Forms.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways:</span></p> +<ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" font-family:'Times New Roman'; font-size:16px; color:#222222;" style=" margin-top:17px; margin-bottom:0px; margin-left:37px; margin-right:17px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px;">a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange.</span></li> +<li style=" font-family:'Times New Roman'; font-size:16px; color:#222222;" style=" margin-top:10px; margin-bottom:0px; margin-left:37px; margin-right:17px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px;">b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge.</span></li> +<li style=" font-family:'Times New Roman'; font-size:16px; color:#222222;" style=" margin-top:10px; margin-bottom:0px; margin-left:37px; margin-right:17px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px;">c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b.</span></li> +<li style=" font-family:'Times New Roman'; font-size:16px; color:#222222;" style=" margin-top:10px; margin-bottom:0px; margin-left:37px; margin-right:17px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px;">d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements.</span></li> +<li style=" font-family:'Times New Roman'; font-size:16px; color:#222222;" style=" margin-top:10px; margin-bottom:17px; margin-left:37px; margin-right:17px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px;">e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d.</span></li></ul> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">A “User Product” is either (1) a “consumer product”, which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, “normally used” refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">“Installation Information” for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM).</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying.</span></p> +<p style=" margin-top:19px; margin-bottom:13px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><a name="section7"></a><span style=" font-family:'Times New Roman'; font-size:medium; font-weight:600; color:#333333;">7</span><span style=" font-family:'Times New Roman'; font-size:medium; font-weight:600; color:#333333;">. Additional Terms.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">“Additional permissions” are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms:</span></p> +<ul style="margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;"><li style=" font-family:'Times New Roman'; font-size:16px; color:#222222;" style=" margin-top:17px; margin-bottom:0px; margin-left:37px; margin-right:17px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px;">a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or</span></li> +<li style=" font-family:'Times New Roman'; font-size:16px; color:#222222;" style=" margin-top:10px; margin-bottom:0px; margin-left:37px; margin-right:17px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px;">b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or</span></li> +<li style=" font-family:'Times New Roman'; font-size:16px; color:#222222;" style=" margin-top:10px; margin-bottom:0px; margin-left:37px; margin-right:17px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px;">c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or</span></li> +<li style=" font-family:'Times New Roman'; font-size:16px; color:#222222;" style=" margin-top:10px; margin-bottom:0px; margin-left:37px; margin-right:17px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px;">d) Limiting the use for publicity purposes of names of licensors or authors of the material; or</span></li> +<li style=" font-family:'Times New Roman'; font-size:16px; color:#222222;" style=" margin-top:10px; margin-bottom:0px; margin-left:37px; margin-right:17px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px;">e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or</span></li> +<li style=" font-family:'Times New Roman'; font-size:16px; color:#222222;" style=" margin-top:10px; margin-bottom:17px; margin-left:37px; margin-right:17px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:16px;">f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors.</span></li></ul> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">All other non-permissive additional terms are considered “further restrictions” within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way.</span></p> +<p style=" margin-top:19px; margin-bottom:13px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><a name="section8"></a><span style=" font-family:'Times New Roman'; font-size:medium; font-weight:600; color:#333333;">8</span><span style=" font-family:'Times New Roman'; font-size:medium; font-weight:600; color:#333333;">. Termination.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11).</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10.</span></p> +<p style=" margin-top:19px; margin-bottom:13px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><a name="section9"></a><span style=" font-family:'Times New Roman'; font-size:medium; font-weight:600; color:#333333;">9</span><span style=" font-family:'Times New Roman'; font-size:medium; font-weight:600; color:#333333;">. Acceptance Not Required for Having Copies.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so.</span></p> +<p style=" margin-top:19px; margin-bottom:13px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><a name="section10"></a><span style=" font-family:'Times New Roman'; font-size:medium; font-weight:600; color:#333333;">1</span><span style=" font-family:'Times New Roman'; font-size:medium; font-weight:600; color:#333333;">0. Automatic Licensing of Downstream Recipients.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">An “entity transaction” is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it.</span></p> +<p style=" margin-top:19px; margin-bottom:13px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><a name="section11"></a><span style=" font-family:'Times New Roman'; font-size:medium; font-weight:600; color:#333333;">1</span><span style=" font-family:'Times New Roman'; font-size:medium; font-weight:600; color:#333333;">1. Patents.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">A “contributor” is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's “contributor version”.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">A contributor's “essential patent claims” are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, “control” includes the right to grant patent sublicenses in a manner consistent with the requirements of this License.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">In the following three paragraphs, a “patent license” is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To “grant” such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. “Knowingly relying” means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">A patent license is “discriminatory” if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law.</span></p> +<p style=" margin-top:19px; margin-bottom:13px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><a name="section12"></a><span style=" font-family:'Times New Roman'; font-size:medium; font-weight:600; color:#333333;">1</span><span style=" font-family:'Times New Roman'; font-size:medium; font-weight:600; color:#333333;">2. No Surrender of Others' Freedom.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program.</span></p> +<p style=" margin-top:19px; margin-bottom:13px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><a name="section13"></a><span style=" font-family:'Times New Roman'; font-size:medium; font-weight:600; color:#333333;">1</span><span style=" font-family:'Times New Roman'; font-size:medium; font-weight:600; color:#333333;">3. Use with the GNU Affero General Public License.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such.</span></p> +<p style=" margin-top:19px; margin-bottom:13px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><a name="section14"></a><span style=" font-family:'Times New Roman'; font-size:medium; font-weight:600; color:#333333;">1</span><span style=" font-family:'Times New Roman'; font-size:medium; font-weight:600; color:#333333;">4. Revised Versions of this License.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License “or any later version” applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version.</span></p> +<p style=" margin-top:19px; margin-bottom:13px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><a name="section15"></a><span style=" font-family:'Times New Roman'; font-size:medium; font-weight:600; color:#333333;">1</span><span style=" font-family:'Times New Roman'; font-size:medium; font-weight:600; color:#333333;">5. Disclaimer of Warranty.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.</span></p> +<p style=" margin-top:19px; margin-bottom:13px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><a name="section16"></a><span style=" font-family:'Times New Roman'; font-size:medium; font-weight:600; color:#333333;">1</span><span style=" font-family:'Times New Roman'; font-size:medium; font-weight:600; color:#333333;">6. Limitation of Liability.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.</span></p> +<p style=" margin-top:19px; margin-bottom:13px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><a name="section17"></a><span style=" font-family:'Times New Roman'; font-size:medium; font-weight:600; color:#333333;">1</span><span style=" font-family:'Times New Roman'; font-size:medium; font-weight:600; color:#333333;">7. Interpretation of Sections 15 and 16.</span></p> +<p style=" margin-top:17px; margin-bottom:17px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; background-color:#ffffff;"><span style=" font-family:'Times New Roman'; font-size:16px; color:#222222; background-color:#ffffff;">If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee.</span></p> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html> + + + + + + + + License - Gqrx controls + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Cantarell'; font-size:11pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">This Software is released under the &quot;Simplified BSD License&quot; </p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Copyright 2010 Moe Wheatley. All rights reserved.<br />Copyright 2011-2013 Alexandru Csete OZ9AEC<br />Copyright 2018 Gonzalo José Carracedo Carballal </p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:</p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.</p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.</p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">THIS SOFTWARE IS PROVIDED BY Moe Wheatley ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Moe Wheatley OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</p> +<p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">The views and conclusions contained in the software and documentation are those of the authors and should not be interpreted as representing official policies, either expressed or implied, of Moe Wheatley.</p></body></html> + + + + + + + + - - + + + buttonBox diff --git a/ui/AfcControl.ui b/ui/AfcControl.ui index 2109539d..6c98bd67 100644 --- a/ui/AfcControl.ui +++ b/ui/AfcControl.ui @@ -6,7 +6,7 @@ 0 0 - 241 + 229 166 @@ -71,7 +71,11 @@ - + + + 1000000.000000000000000 + + @@ -154,7 +158,11 @@ - + + + 1000000.000000000000000 + + diff --git a/ui/Config.ui b/ui/Config.ui index 7e540775..3eb07eca 100644 --- a/ui/Config.ui +++ b/ui/Config.ui @@ -6,8 +6,8 @@ 0 0 - 540 - 449 + 528 + 431 @@ -38,12 +38,18 @@ - 9 + 6 - - 4 + + 6 + + + 6 + + + 6 - + 3 @@ -89,8 +95,20 @@ QFrame::Raised + + 6 + + + 6 + + + 6 + + + 6 + - 4 + 3 @@ -272,13 +290,19 @@ - 9 + 6 - - 4 + + 6 - - 2 + + 6 + + + 6 + + + 3 @@ -378,8 +402,20 @@ Channel detector parameters + + 6 + + + 6 + + + 6 + + + 6 + - 4 + 3 @@ -478,8 +514,20 @@ Window function + + 6 + + + 6 + + + 6 + + + 6 + - 4 + 3 @@ -553,8 +601,20 @@ Analyzer data rates + + 6 + + + 6 + + + 6 + + + 6 + - 4 + 3 @@ -600,6 +660,18 @@ Colors + + 6 + + + 6 + + + 6 + + + 3 + @@ -851,7 +923,7 @@ - + diff --git a/ui/MainWindow.ui b/ui/MainWindow.ui index b3e7c29a..e4067d0f 100644 --- a/ui/MainWindow.ui +++ b/ui/MainWindow.ui @@ -14,7 +14,7 @@ SigDigger - + :/icons/icon-color.png:/icons/icon-color.png @@ -55,7 +55,7 @@ 0 0 1251 - 20 + 25 @@ -67,6 +67,7 @@ Help + @@ -95,8 +96,8 @@ - + @@ -104,35 +105,35 @@ true - + :/icons/start-capture.png:/icons/start-capture.png Run - + - - :/icons/select-source.png:/icons/select-source.png + + :/icons/preferences.png:/icons/preferences.png - Choose profile + Settings - + - - :/icons/preferences.png:/icons/preferences.png + + :/icons/about.png:/icons/about.png - Settings + About SigDigger - + diff --git a/ui/SaveProfileDialog.cpp b/ui/SaveProfileDialog.cpp deleted file mode 100644 index 1cd92d56..00000000 --- a/ui/SaveProfileDialog.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include "SaveProfileDialog.h" -#include "ui_SaveProfileDialog.h" - -SaveProfileDialog::SaveProfileDialog(QWidget *parent) : - QDialog(parent), - ui(new Ui::SaveProfileDialog) -{ - ui->setupUi(this); -} - -SaveProfileDialog::~SaveProfileDialog() -{ - delete ui; -} diff --git a/ui/SaveProfileDialog.h b/ui/SaveProfileDialog.h deleted file mode 100644 index deb57384..00000000 --- a/ui/SaveProfileDialog.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef SAVEPROFILEDIALOG_H -#define SAVEPROFILEDIALOG_H - -#include - -namespace Ui { - class SaveProfileDialog; -} - -class SaveProfileDialog : public QDialog -{ - Q_OBJECT - - public: - explicit SaveProfileDialog(QWidget *parent = nullptr); - ~SaveProfileDialog(); - - private: - Ui::SaveProfileDialog *ui; -}; - -#endif // SAVEPROFILEDIALOG_H diff --git a/ui/SaveProfileDialog.ui b/ui/SaveProfileDialog.ui index 5764efda..a664bd8e 100644 --- a/ui/SaveProfileDialog.ui +++ b/ui/SaveProfileDialog.ui @@ -1,38 +1,44 @@ + - - - SaveProfileDialog - + 0 0 400 - 300 + 80 - Dialog + Save profile - - - - 30 - 240 - 341 - 32 - - - - Qt::Horizontal - - - QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + New profile name + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + -