Skip to content

Commit

Permalink
Add checkbox to disable connection quality warning
Browse files Browse the repository at this point in the history
  • Loading branch information
BatchDrake committed Sep 16, 2024
1 parent 8fd8e34 commit 10191b4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 2 additions & 0 deletions App/AppConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ AppConfig::serialize(void)
obj.set("fullScreen", this->fullScreen);
obj.set("sidePanelRatio", this->sidePanelRatio);
obj.set("disableHighRateWarning", this->disableHighRateWarning);
obj.set("disableConnectionQualityWarning", this->disableConnectionQualityWarning);
obj.set("loFreq", this->loFreq);
obj.set("bandwidth", this->bandwidth);
obj.set("lastLoadedFile", this->lastLoadedFile);
Expand Down Expand Up @@ -138,6 +139,7 @@ AppConfig::deserialize(Suscan::Object const &conf)
TRYSILENT(this->fullScreen = conf.get("fullScreen", this->fullScreen));
TRYSILENT(this->sidePanelRatio = conf.get("sidePanelRatio", this->sidePanelRatio));
TRYSILENT(this->disableHighRateWarning = conf.get("disableHighRateWarning", this->disableHighRateWarning));
TRYSILENT(this->disableConnectionQualityWarning = conf.get("disableConnectionQualityWarning", this->disableHighRateWarning));
TRYSILENT(this->loFreq = conf.get("loFreq", this->loFreq));
TRYSILENT(this->bandwidth = conf.get("bandwidth", this->bandwidth));
TRYSILENT(this->lastLoadedFile = conf.get("lastLoadedFile", this->lastLoadedFile));
Expand Down
15 changes: 14 additions & 1 deletion UIMediator/SpectrumMediator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "MainSpectrum.h"
#include <InspectionWidgetFactory.h>
#include <SuWidgetsHelpers.h>
#include <QCheckBox>

using namespace SigDigger;

Expand Down Expand Up @@ -86,13 +87,25 @@ UIMediator::feedPSD(const Suscan::PSDMessage &msg)
if ((m_psdDelta - interval) / interval
> SIGDIGGER_UI_MEDIATOR_PSD_MAX_LAG) {
if (m_laggedMsgBox == nullptr) {
QCheckBox *cb = new QCheckBox("Do not show again");
m_laggedMsgBox = new QMessageBox(m_owner);
m_laggedMsgBox->setWindowTitle("Connection quality warning");
m_laggedMsgBox->setWindowModality(Qt::NonModal);
m_laggedMsgBox->setIcon(QMessageBox::Icon::Warning);
m_laggedMsgBox->setCheckBox(cb);

QObject::connect(
cb,
&QCheckBox::stateChanged,
[this](int state) {
if (static_cast<Qt::CheckState>(state) == Qt::CheckState::Checked) {
m_appConfig->disableConnectionQualityWarning = true;
}
});
}

if (m_laggedMsgBox->isHidden()) {
if (m_laggedMsgBox->isHidden()
&& !m_appConfig->disableConnectionQualityWarning) {
m_laggedMsgBox->setText(
QString::asprintf(
"The rate at which spectrum data is arriving is slower than "
Expand Down
2 changes: 1 addition & 1 deletion include/AppConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ namespace SigDigger {
int y = -1;
qreal sidePanelRatio = .16;
bool disableHighRateWarning = false;

bool disableConnectionQualityWarning = false;
int loFreq = 0;
unsigned int bandwidth = 0;

Expand Down

0 comments on commit 10191b4

Please sign in to comment.