From a21e46cb4a4c8701a9831ba1f1678c78d42f939e Mon Sep 17 00:00:00 2001 From: Jordan Sherer Date: Tue, 17 Dec 2019 10:39:18 -0500 Subject: [PATCH] Reorganized waterfall controls and timing controls under one sizeable pane --- mainwindow.cpp | 93 +-- mainwindow.h | 6 - mainwindow.ui | 176 +----- widegraph.cpp | 76 +++ widegraph.h | 8 + widegraph.ui | 1599 ++++++++++++++++++++++++++---------------------- 6 files changed, 978 insertions(+), 980 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 7396001..4e68284 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -2192,8 +2192,7 @@ void MainWindow::writeSettings() m_settings->setValue("BandActivityVisible", ui->tableWidgetRXAll->isVisible()); m_settings->setValue("BandHBActivityVisible", ui->actionShow_Band_Heartbeats_and_ACKs->isChecked()); m_settings->setValue("TextVerticalSplitter", ui->textVerticalSplitter->saveState()); - m_settings->setValue("ShowTimeDrift", ui->driftSyncFrame->isVisible()); - m_settings->setValue("TimeDrift", ui->driftSpinBox->value()); + m_settings->setValue("TimeDrift", DriftingDateTime::drift()); m_settings->setValue("ShowTooltips", ui->actionShow_Tooltips->isChecked()); m_settings->setValue("ShowStatusbar", ui->statusBar->isVisible()); m_settings->setValue("RXActivity", ui->textEditRX->toHtml()); @@ -2340,8 +2339,7 @@ void MainWindow::readSettings() if(!verticalState.isEmpty()){ ui->textVerticalSplitter->restoreState(verticalState); } - ui->driftSyncFrame->setVisible(m_settings->value("ShowTimeDrift", false).toBool()); - ui->driftSpinBox->setValue(m_settings->value("TimeDrift", 0).toInt()); + setDrift(m_settings->value("TimeDrift", 0).toInt()); ui->actionShow_Tooltips->setChecked(m_settings->value("ShowTooltips", true).toBool()); ui->actionShow_Statusbar->setChecked(m_settings->value("ShowStatusbar",true).toBool()); ui->statusBar->setVisible(ui->actionShow_Statusbar->isChecked()); @@ -2841,8 +2839,6 @@ void MainWindow::on_menuWindow_aboutToShow(){ ui->actionShow_Waterfall->setChecked(vsizes.last() > 0); ui->actionShow_Waterfall_Controls->setChecked(m_wideGraph->controlsVisible()); ui->actionShow_Waterfall_Controls->setEnabled(ui->actionShow_Waterfall->isChecked()); - ui->actionShow_Time_Drift_Controls->setChecked(ui->driftSyncFrame->isVisible()); - ui->actionShow_Time_Drift_Controls->setEnabled(ui->actionShow_Waterfall->isChecked()); QMenu * sortBandMenu = new QMenu(this->menuBar()); //ui->menuWindow); buildBandActivitySortByMenu(sortBandMenu); @@ -3026,10 +3022,6 @@ void MainWindow::on_actionShow_Waterfall_Controls_triggered(bool checked){ m_wideGraph->setControlsVisible(checked); } -void MainWindow::on_actionShow_Time_Drift_Controls_triggered(bool checked){ - ui->driftSyncFrame->setVisible(checked); -} - void MainWindow::on_actionReset_Window_Sizes_triggered(){ auto size = this->centralWidget()->size(); @@ -9118,78 +9110,6 @@ void MainWindow::on_freeTextMsg_currentTextChanged (QString const& text) { } -void MainWindow::on_driftSpinBox_valueChanged(int n){ - if(n == DriftingDateTime::drift()){ - return; - } - - setDrift(n); -} - -void MainWindow::on_driftSyncButton_clicked(){ - auto now = QDateTime::currentDateTimeUtc(); - - int n = 0; - int nPos = m_TRperiod - (now.time().second() % m_TRperiod); - int nNeg = (now.time().second() % m_TRperiod) - m_TRperiod; - - if(abs(nNeg) < nPos){ - n = nNeg; - } else { - n = nPos; - } - - setDrift(n * 1000); -} - -void MainWindow::on_driftSyncEndButton_clicked(){ - auto now = QDateTime::currentDateTimeUtc(); - - int n = 0; - int nPos = m_TRperiod - (now.time().second() % m_TRperiod); - int nNeg = (now.time().second() % m_TRperiod) - m_TRperiod; - - if(abs(nNeg) < nPos){ - n = nNeg + 2; - } else { - n = nPos - 2; - } - - setDrift(n * 1000); -} - -void MainWindow::on_driftSyncMinuteButton_clicked(){ - auto now = QDateTime::currentDateTimeUtc(); - int n = 0; - int s = now.time().second(); - - if(s < 30){ - n = -s; - } else { - n = 60 - s; - } - - setDrift(n * 1000); -} - -void MainWindow::on_driftSyncResetButton_clicked(){ - setDrift(0); - resetTimeDeltaAverage(); -} - -void MainWindow::setDrift(int n){ - DriftingDateTime::setDrift(n); - - qDebug() << qSetRealNumberPrecision(12) << "Average delta:" << m_timeDeltaMsMMA; - qDebug() << qSetRealNumberPrecision(12) << "Drift milliseconds:" << n; - qDebug() << qSetRealNumberPrecision(12) << "Clock time:" << QDateTime::currentDateTimeUtc(); - qDebug() << qSetRealNumberPrecision(12) << "Drifted time:" << DriftingDateTime::currentDateTimeUtc(); - - if(ui->driftSpinBox->value() != n){ - ui->driftSpinBox->setValue(n); - } -} - void MainWindow::on_rptSpinBox_valueChanged(int n) { int step=ui->rptSpinBox->singleStep(); @@ -10380,7 +10300,6 @@ void MainWindow::observeTimeDeltaForAverage(float delta){ if(m_timeDeltaMsMMA < -(float)m_TRperiod || m_timeDeltaMsMMA > (float)m_TRperiod){ resetTimeDeltaAverage(); } - ui->driftAvgLabel->setText(QString("Avg Time Delta: %1 ms").arg((int)m_timeDeltaMsMMA)); } void MainWindow::resetTimeDeltaAverage(){ @@ -10392,6 +10311,14 @@ void MainWindow::resetTimeDeltaAverage(){ } +void MainWindow::setDrift(int n){ + // drifting functionality moved to the widegraph + m_wideGraph->setDrift(n); + + // reset the average if we set a new drift + resetTimeDeltaAverage(); +} + void MainWindow::processIdleActivity() { auto now = DriftingDateTime::currentDateTimeUtc(); diff --git a/mainwindow.h b/mainwindow.h index 04ef26a..b534cc1 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -200,7 +200,6 @@ private slots: void on_actionShow_Call_Activity_triggered(bool checked); void on_actionShow_Waterfall_triggered(bool checked); void on_actionShow_Waterfall_Controls_triggered(bool checked); - void on_actionShow_Time_Drift_Controls_triggered(bool checked); void on_actionReset_Window_Sizes_triggered(); void on_actionSettings_triggered(); void openSettings(int tab=0); @@ -356,11 +355,6 @@ private slots: int findFreeFreqOffset(int fmin, int fmax, int bw); void checkRepeat(); QString calculateDistance(QString const& grid, int *pDistance=nullptr, int *pAzimuth=nullptr); - void on_driftSpinBox_valueChanged(int n); - void on_driftSyncButton_clicked(); - void on_driftSyncEndButton_clicked(); - void on_driftSyncMinuteButton_clicked(); - void on_driftSyncResetButton_clicked(); void setDrift(int n); void on_rptSpinBox_valueChanged(int n); void killFile(); diff --git a/mainwindow.ui b/mainwindow.ui index 98a400e..711a6fc 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -1955,172 +1955,6 @@ background: qlineargradient(x1:0, y1:0, x2:1, y2:1, stop:0 #2ecc71, stop:1 #00FF - - - - - 0 - 0 - - - - - 0 - 0 - - - - QFrame::NoFrame - - - QFrame::Plain - - - 0 - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - false - - - Avg Time Delta: 0 ms - - - - - - - 0 - - - 0 - - - - - - 0 - 30 - - - - Sync Time Drift to Now (Minute Start) - - - - - - - - 0 - 30 - - - - <html><head/><body><p>Observe signals in the waterfall and click this to synchronize your time drift with the start of a TX cycle.</p></body></html> - - - Sync Time Drift to Now (TX Start) - - - - - - - - 0 - 30 - - - - <html><head/><body><p>Observe signals in the waterfall and click this to synchronize your time drift with the end of a TX cycle.</p></body></html> - - - Sync Time Drift to Now (TX End) - - - - - - - - 0 - 30 - - - - Reset your time drift to zero. - - - Reset Time Drift - - - - - - - - 0 - 0 - - - - - 100 - 30 - - - - false - - - Qt::AlignCenter - - - QAbstractSpinBox::PlusMinus - - - ms - - - Time Drift - - - -30000 - - - 30000 - - - 100 - - - - - - - - @@ -4723,7 +4557,6 @@ list. The list can be maintained in Settings (F2). - @@ -5502,13 +5335,8 @@ list. The list can be maintained in Settings (F2). Show Wa&terfall Controls - - - - true - - - Show Time &Drift Controls + + Shift+F4 diff --git a/widegraph.cpp b/widegraph.cpp index c0186fd..4f86193 100644 --- a/widegraph.cpp +++ b/widegraph.cpp @@ -116,6 +116,11 @@ WideGraph::WideGraph(QSettings * settings, QWidget *parent) : ui->controls_widget->setVisible(!m_settings->value("HideControls", false).toBool()); ui->cbControls->setChecked(!m_settings->value("HideControls", false).toBool()); + auto splitState = m_settings->value("SplitState").toByteArray(); + if(!splitState.isEmpty()){ + ui->splitter->restoreState(splitState); + } + setFilter(m_settings->value("FilterMinimum", 500).toInt(), m_settings->value("FilterMaximum", 2500).toInt()); setFilterEnabled(m_settings->value("FilterEnabled", false).toBool()); } @@ -177,6 +182,7 @@ void WideGraph::saveSettings() //saveS m_settings->setValue ("FilterMinimum", m_filterMinimum); m_settings->setValue ("FilterMaximum", m_filterMaximum); m_settings->setValue ("FilterEnabled", m_filterEnabled); + m_settings->setValue ("SplitState", ui->splitter->saveState()); } void WideGraph::drawRed(int ia, int ib) @@ -664,3 +670,73 @@ void WideGraph::setRedFile(QString fRed) void WideGraph::setTurbo(bool turbo){ ui->widePlot->setTurbo(turbo); } + +void WideGraph::on_driftSpinBox_valueChanged(int n){ + if(n == DriftingDateTime::drift()){ + return; + } + + setDrift(n); +} + +void WideGraph::on_driftSyncButton_clicked(){ + auto now = QDateTime::currentDateTimeUtc(); + + int n = 0; + int nPos = m_TRperiod - (now.time().second() % m_TRperiod); + int nNeg = (now.time().second() % m_TRperiod) - m_TRperiod; + + if(abs(nNeg) < nPos){ + n = nNeg; + } else { + n = nPos; + } + + setDrift(n * 1000); +} + +void WideGraph::on_driftSyncEndButton_clicked(){ + auto now = QDateTime::currentDateTimeUtc(); + + int n = 0; + int nPos = m_TRperiod - (now.time().second() % m_TRperiod); + int nNeg = (now.time().second() % m_TRperiod) - m_TRperiod; + + if(abs(nNeg) < nPos){ + n = nNeg + 2; + } else { + n = nPos - 2; + } + + setDrift(n * 1000); +} + +void WideGraph::on_driftSyncMinuteButton_clicked(){ + auto now = QDateTime::currentDateTimeUtc(); + int n = 0; + int s = now.time().second(); + + if(s < 30){ + n = -s; + } else { + n = 60 - s; + } + + setDrift(n * 1000); +} + +void WideGraph::on_driftSyncResetButton_clicked(){ + setDrift(0); +} + +void WideGraph::setDrift(int n){ + DriftingDateTime::setDrift(n); + + qDebug() << qSetRealNumberPrecision(12) << "Drift milliseconds:" << n; + qDebug() << qSetRealNumberPrecision(12) << "Clock time:" << QDateTime::currentDateTimeUtc(); + qDebug() << qSetRealNumberPrecision(12) << "Drifted time:" << DriftingDateTime::currentDateTimeUtc(); + + if(ui->driftSpinBox->value() != n){ + ui->driftSpinBox->setValue(n); + } +} diff --git a/widegraph.h b/widegraph.h index 4c8a369..0a8dd67 100644 --- a/widegraph.h +++ b/widegraph.h @@ -71,6 +71,7 @@ public slots: void setDialFreq(double d); void setControlsVisible(bool visible); bool controlsVisible(); + void setDrift(int n); protected: void keyPressEvent (QKeyEvent *e) override; @@ -98,6 +99,13 @@ private slots: void on_filterMaxSpinBox_valueChanged(int n); void on_filterCheckBox_toggled(bool b); + void on_driftSpinBox_valueChanged(int n); + void on_driftSyncButton_clicked(); + void on_driftSyncEndButton_clicked(); + void on_driftSyncMinuteButton_clicked(); + void on_driftSyncResetButton_clicked(); + + private: void readPalette (); void setRxRange (); diff --git a/widegraph.ui b/widegraph.ui index d900a79..32dfa25 100644 --- a/widegraph.ui +++ b/widegraph.ui @@ -13,7 +13,7 @@ Dialog - + 1 @@ -30,739 +30,904 @@ 0 - - + + + + 0 + 0 + + + true - - - 0 - 0 - + + Qt::Horizontal - - - 400 - 10 - - - - QFrame::NoFrame - - - QFrame::Plain - - - 1 - - - - - 5 - 0 - 77 - 17 - + + + true - - false + + + 4 + 0 + - - Controls + + + 400 + 10 + - - false + + QFrame::NoFrame + + QFrame::Plain + + + 1 + + + + + 5 + 0 + 77 + 17 + + + + false + + + Controls + + + false + + - - - - - - - 0 - 0 - - - - - 0 + + + + 0 + 0 + - - 0 - - - 0 - - - 0 - - - 5 - - - 0 - - - - - - 0 - 0 - - - - QTabWidget::South - - - QTabWidget::Rounded - - - 0 - - - false - - - - Control - - - - 2 - - - 2 - - - 2 - - - 2 - - - - - true - - - - - 0 - 0 - 1156 - 142 - + + + 0 + + + 0 + + + 0 + + + 0 + + + 5 + + + 0 + + + + + + 0 + 0 + + + + QTabWidget::North + + + QTabWidget::Rounded + + + 0 + + + false + + + + Control + + + + 2 + + + 2 + + + 2 + + + 2 + + + + + true - - - - - <html><head/><body><p>Frequency at left edge of waterfall</p></body></html> - - - Hz - - - Start - - - 5000 - - - 100 - - - 500 - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 40 - 20 - - - - - - - - Hz - - - Center - - - 500 - - - 5000 - - - 1500 - - - - - - - QSY - - - false - - - - - - - Enable the software filter - - - Enable Filter - - - - - - - Compression factor for frequency scale - - - - - - Bins/Pixel - - - 1 - - - 1000 - - - 1 - - - 5 - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 40 - 20 - - - - - - - - false - - - <html><head/><body><p>Set the software filter width in Hz. This filter prevents signals outside the filter range from being processed by the decoder.</p></body></html> - - - - - - Hz - - - Min: - - - 5000 - - - 10 - - - 500 - - - - - - - false - - - Hz - - - Max: - - - 5000 - - - 10 - - - 2600 - - - - - - - Hz - - - Offset - - - 5000 - - - 1 - - - 1500 - - - - - - - Qt::Vertical - - - - 0 - 0 - - - - - + + + + 0 + 0 + 671 + 332 + + + + + + + Dial + + + + + + QAbstractSpinBox::PlusMinus + + + Hz + + + Offset + + + 5000 + + + 1 + + + 1500 + + + + + + + + + + QSY + + + + + + QSY + + + false + + + + + + + QAbstractSpinBox::PlusMinus + + + Hz + + + Center + + + 500 + + + 5000 + + + 1500 + + + + + + + + + + Filter + + + + + + Enable the software filter + + + Enable Filter + + + + + + + false + + + <html><head/><body><p>Set the software filter width in Hz. This filter prevents signals outside the filter range from being processed by the decoder.</p></body></html> + + + QAbstractSpinBox::PlusMinus + + + + + + Hz + + + Min: + + + 5000 + + + 10 + + + 500 + + + + + + + false + + + QAbstractSpinBox::PlusMinus + + + Hz + + + Max: + + + 5000 + + + 10 + + + 2600 + + + + + + + + - - - - - - - Display - - - - 2 - - - 2 - - - 2 - - - 2 - - - - - true - - - - - 0 - 0 - 1156 - 142 - + + + + + + Display + + + + 2 + + + 2 + + + 2 + + + 2 + + + + + true - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 40 - 20 - - - - - - - - - - Number of FFTs averaged (controls waterfall scrolling rate) - - - N Avg - - - 1 - - - 50 - - - - - - - <html><head/><body><p>Flatten spectral baseline over the full displayed interval.</p></body></html> - - - Flatten - - - - - - - false - - - <html><head/><body><p>Compute and save a reference spectrum. (Not yet fully implemented.)</p></body></html> - - - Ref Spec - - - - - - - - - <html><head/><body><p>Set fractional size of spectrum in this window.</p></body></html> - - - Qt::AlignCenter - - - % - - - Spec - - - 100 - - - 5 - - - 0 - - - - - - - - 0 - 0 - - - - - 100 - 0 - - - - - 200 - 16777215 - - - - Waterfall gain - - - -50 - - - 50 - - - Qt::Horizontal - - - QSlider::TicksAbove - - - - - - - - 0 - 0 - - - - - 100 - 0 - - - - - 200 - 16777215 - - - - Spectrum gain - - - -50 - - - 50 - - - Qt::Horizontal - - - QSlider::TicksAbove - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 40 - 20 - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 40 - 20 - - - - - - - - - - Palette - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - <html><head/><body><p>Enter definition for a new color palette.</p></body></html> - - - Adjust... - - - false - - - - - - - - - Select waterfall palette - - - - - - - - 0 - 0 - - - - - 100 - 0 - - - - - 200 - 16777215 - - - - Waterfall zero - - - -50 - - - 50 - - - Qt::Horizontal - - - QSlider::TicksAbove - - - - - - - - 0 - 0 - - - - - 100 - 0 - - - - - 200 - 16777215 - - - - Spectrum zero - - - -50 - - - 50 - - - Qt::Horizontal - - - QSlider::TicksAbove - - - - - - - false - - - Smoothing of Linear Average spectrum - - - Qt::AlignCenter - - - - - - Smooth - - - 1 - - - 7 - - - - - - - <html><head/><body><p>Select data for spectral display</p></body></html> - - - 0 - - - - Current + + + + 0 + 0 + 671 + 609 + + + + + + + Size - - - - Cumulative + + + + + <html><head/><body><p>Frequency at left edge of waterfall</p></body></html> + + + QAbstractSpinBox::PlusMinus + + + Hz + + + Start + + + 5000 + + + 100 + + + 500 + + + + + + + Compression factor for frequency scale + + + QAbstractSpinBox::PlusMinus + + + + + + Bins/Pixel + + + 1 + + + 1000 + + + 1 + + + 5 + + + + + + + + + + Palette - - - - Linear Avg + + + + + Select waterfall palette + + + + + + + <html><head/><body><p>Enter definition for a new color palette.</p></body></html> + + + Adjust... + + + false + + + + + + + + + + Averaging - - - - - - - Qt::Vertical - - - - 0 - 0 - - - - - + + + + + + + Number of FFTs averaged (controls waterfall scrolling rate) + + + QAbstractSpinBox::PlusMinus + + + N Avg + + + 1 + + + 50 + + + + + + + <html><head/><body><p>Flatten spectral baseline over the full displayed interval.</p></body></html> + + + Flatten + + + + + + + false + + + <html><head/><body><p>Compute and save a reference spectrum. (Not yet fully implemented.)</p></body></html> + + + Ref Spec + + + + + + + + + <html><head/><body><p>Select data for spectral display</p></body></html> + + + 0 + + + + Current + + + + + Cumulative + + + + + Linear Avg + + + + + + + + false + + + Smoothing of Linear Average spectrum + + + Qt::AlignCenter + + + QAbstractSpinBox::PlusMinus + + + + + + Smooth + + + 1 + + + 7 + + + + + + + + + + Waterfall + + + + + + Gain: + + + + + + + + 0 + 0 + + + + + 100 + 0 + + + + + 16777215 + 16777215 + + + + Waterfall gain + + + -50 + + + 50 + + + Qt::Horizontal + + + QSlider::TicksAbove + + + + + + + + 0 + 0 + + + + + 100 + 0 + + + + + 16777215 + 16777215 + + + + Waterfall zero + + + -50 + + + 50 + + + Qt::Horizontal + + + QSlider::TicksAbove + + + + + + + Zero: + + + + + + + + + + Spectrum + + + + + + Height: + + + + + + + <html><head/><body><p>Set fractional size of spectrum in this window.</p></body></html> + + + Qt::AlignCenter + + + QAbstractSpinBox::PlusMinus + + + % + + + + + + 100 + + + 5 + + + 0 + + + + + + + + 0 + 0 + + + + + 100 + 0 + + + + + 16777215 + 16777215 + + + + Spectrum gain + + + -50 + + + 50 + + + Qt::Horizontal + + + QSlider::TicksAbove + + + + + + + + 0 + 0 + + + + + 100 + 0 + + + + + 16777215 + 16777215 + + + + Spectrum zero + + + -50 + + + 50 + + + Qt::Horizontal + + + QSlider::TicksAbove + + + + + + + Gain: + + + + + + + Zero: + + + + + + + + - - - + + + + + + Timing + + + + 2 + + + 2 + + + 2 + + + 2 + + + + + true + + + + + 0 + 0 + 671 + 192 + + + + + + + + 0 + 0 + + + + + 0 + 30 + + + + false + + + Qt::AlignCenter + + + QAbstractSpinBox::PlusMinus + + + ms + + + Time Drift + + + -30000 + + + 30000 + + + 100 + + + + + + + + 0 + 30 + + + + Sync Time Drift to Now (Minute Start) + + + + + + + + 0 + 30 + + + + <html><head/><body><p>Observe signals in the waterfall and click this to synchronize your time drift with the start of a TX cycle.</p></body></html> + + + Sync Time Drift to Now (TX Start) + + + + + + + + 0 + 30 + + + + <html><head/><body><p>Observe signals in the waterfall and click this to synchronize your time drift with the end of a TX cycle.</p></body></html> + + + Sync Time Drift to Now (TX End) + + + + + + + + 0 + 30 + + + + Reset your time drift to zero. + + + Reset Time Drift + + + + + + + + + - - - + + +