From abe4ad6a0d614fad8ccd2f21e5f740e5aaa9189b Mon Sep 17 00:00:00 2001 From: Bill Somerville Date: Tue, 14 Mar 2017 14:23:20 +0000 Subject: [PATCH] Improve wide graph control hiding and layouts Thanks to Mike, W9MDB, for this contribution. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7604 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- widegraph.cpp | 59 +-- widegraph.h | 6 +- widegraph.ui | 982 ++++++++++++++++++++++---------------------------- 3 files changed, 433 insertions(+), 614 deletions(-) diff --git a/widegraph.cpp b/widegraph.cpp index 8b4e50639..990532ffc 100644 --- a/widegraph.cpp +++ b/widegraph.cpp @@ -83,9 +83,7 @@ WideGraph::WideGraph(QSettings * settings, QWidget *parent) : int m_fMin = m_settings->value ("Fmin", 2500).toInt (); ui->fSplitSpinBox->setValue (m_fMin); setRxRange (m_fMin); - m_bHideControls = m_settings->value("HideControls", false).toBool (); - m_bHideControls = !m_bHideControls; // we're not toggling here so we start in opposite state - on_hideControls(); + ui->controls_widget->setVisible(!m_settings->value("HideControls", false).toBool ()); m_settings->endGroup(); saveSettings (); // update config with defaults @@ -116,57 +114,6 @@ void WideGraph::closeEvent (QCloseEvent * e) QDialog::closeEvent (e); } -void WideGraph::on_hideControls() -{ - m_bHideControls = !m_bHideControls; - ui->verticalLayout->setEnabled(!m_bHideControls); - ui->gridLayout->setEnabled(!m_bHideControls); - ui->horizontalLayout->setEnabled(!m_bHideControls); - ui->horizontalLayout_2->setEnabled(!m_bHideControls); - ui->horizontalLayout_3->setEnabled(!m_bHideControls); - if (!m_bHideControls) { - ui->adjust_palette_push_button->show(); - ui->labPalette->show(); - ui->smoSpinBox->show(); - ui->cbFlatten->show(); - ui->cbRef->show(); - ui->bppSpinBox->show(); - ui->fSplitSpinBox->show(); - ui->fStartSpinBox->show(); - ui->gain2dSlider->show(); - ui->gainSlider->show(); - ui->line->show(); - ui->line_2->show(); - ui->paletteComboBox->show(); - ui->sbPercent2dPlot->show(); - ui->spec2dComboBox->show(); - ui->waterfallAvgSpinBox->show(); - ui->zero2dSlider->show(); - ui->zeroSlider->show(); - } - else { - ui->adjust_palette_push_button->hide(); - ui->labPalette->hide(); - ui->smoSpinBox->hide(); - ui->cbFlatten->hide(); - ui->cbRef->hide(); - ui->bppSpinBox->hide(); - ui->fSplitSpinBox->hide(); - ui->fStartSpinBox->hide(); - ui->gain2dSlider->hide(); - ui->gainSlider->hide(); - ui->line->hide(); - ui->line_2->hide(); - ui->paletteComboBox->hide(); - ui->sbPercent2dPlot->hide(); - ui->spec2dComboBox->hide(); - ui->waterfallAvgSpinBox->hide(); - ui->zero2dSlider->hide(); - ui->zeroSlider->hide(); - ui->widePlot->adjustSize(); - } -} - void WideGraph::saveSettings() //saveSettings { m_settings->beginGroup ("WideGraph"); @@ -191,7 +138,7 @@ void WideGraph::saveSettings() //saveS m_settings->setValue ("Fmin", m_fMin); m_settings->setValue("Flatten",m_bFlatten); m_settings->setValue("UseRef",m_bRef); - m_settings->setValue("HideControls",m_bHideControls); + m_settings->setValue("HideControls",!ui->controls_widget->isVisible()); m_settings->endGroup (); } @@ -275,7 +222,7 @@ void WideGraph::keyPressEvent(QKeyEvent *e) //F1 break; case Qt::Key_M: if(e->modifiers() & Qt::ControlModifier) { - on_hideControls(); + ui->controls_widget->setVisible(!ui->controls_widget->isVisible()); } break; default: diff --git a/widegraph.h b/widegraph.h index aba5bd265..55e0a0289 100644 --- a/widegraph.h +++ b/widegraph.h @@ -63,8 +63,8 @@ public slots: void setDialFreq(double d); protected: - virtual void keyPressEvent( QKeyEvent *e ); - void closeEvent (QCloseEvent *); + void keyPressEvent (QKeyEvent *e) override; + void closeEvent (QCloseEvent *) override; private slots: void on_waterfallAvgSpinBox_valueChanged(int arg1); @@ -82,7 +82,6 @@ private slots: void on_zero2dSlider_valueChanged(int value); void on_smoSpinBox_valueChanged(int n); void on_sbPercent2dPlot_valueChanged(int n); - void on_hideControls(); private: void readPalette(); @@ -107,7 +106,6 @@ private: bool m_bFlatten; bool m_bRef; bool m_bHaveTransmitted; //Set true at end of a WSPR transmission - bool m_bHideControls; QString m_mode; QString m_modeTx; QString m_waterfallPalette; diff --git a/widegraph.ui b/widegraph.ui index ec03f2bca..59255b58e 100644 --- a/widegraph.ui +++ b/widegraph.ui @@ -10,18 +10,12 @@ 395 - - - 0 - 0 - - Dialog - + - 0 + 1 0 @@ -36,560 +30,440 @@ 0 - - - - - true - - - - 0 - 0 - - - - - 400 - 100 - - - - QFrame::StyledPanel - - - QFrame::Sunken - - - 1 - - - - - - - 10 - - - - - <html><head/><body><p>Select data for spectral display</p></body></html> - - - 0 - - + + + true + + + + 400 + 100 + + + + QFrame::NoFrame + + + QFrame::Plain + + + 1 + + + + + + + + 0 + 0 + + + + + 0 + + + 0 + + + 0 + + + 0 + + + 5 + + + 0 + + + + + + 0 + 0 + + + + + 80 + 0 + + + + Spectrum gain + + + -50 + + + 50 + + + Qt::Horizontal + + + QSlider::TicksAbove + + + + + + + - Current + Palette + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + <html><head/><body><p>Enter definition for a new color palette.</p></body></html> - - - Cumulative + Adjust... + + + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + Waterfall gain + + + -50 + + + 50 + + + Qt::Horizontal + + + QSlider::TicksAbove + + + + + + + <html><head/><body><p>Set fractional size of spectrum in this window.</p></body></html> + + + Qt::AlignCenter + + + % + + + Spec + + + 100 + + + 5 + + + 30 + + + + + + + + + <html><head/><body><p>Flatten spectral baseline over the full displayed interval.</p></body></html> - - - Linear Avg + Flatten + + + + + + + <html><head/><body><p>Compute and save a reference spectrum. (Not yet fully implemented.)</p></body></html> - - - Reference + Ref Spec - - - - - - - - 0 - 0 - - - - - 100 - 0 - - - - - 120 - 16777215 - - - - <html><head/><body><p>Decode JT9 only above this frequency</p></body></html> - - - JT9 - - - JT65 - - - 0 - - - 5000 - - - 100 - - - 3000 - - - - - - - - 0 - 0 - - - - - 80 - 0 - - - - - 125 - 16777215 - - - - Select waterfall palette - - - - - - - - 80 - 0 - - - - - 150 - 16777215 - - - - Spectrum gain - - - -50 - - - 50 - - - 0 - - - Qt::Horizontal - - - QSlider::TicksAbove - - - - - - - - 0 - 0 - - - - - 100 - 0 - - - - - 120 - 16777215 - - - - Compression factor for frequency scale - - - - - - Bins/Pixel - - - 1 - - - 1000 - - - 1 - - - 2 - - - - - - - - 80 - 0 - - - - - 150 - 16777215 - - - - Waterfall gain - - - -50 - - - 50 - - - 0 - - - Qt::Horizontal - - - QSlider::TicksAbove - - - - - - - - 0 - 0 - - - - - 90 - 0 - - - - - 100 - 16777215 - - - - <html><head/><body><p>Frequency at left edge of waterfall</p></body></html> - - - Hz - - - Start - - - 5000 - - - 100 - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 0 - 0 - - - - - 90 - 0 - - - - - 100 - 16777215 - - - - Number of FFTs averaged (controls waterfall scrolling rate) - - - N Avg - - - 1 - - - 20 - - - - - - - Qt::Vertical - - - - - - - Qt::Vertical - - - - - - - - - Palette - - - Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter - - - - - - - - 65 - 16777215 - - - - <html><head/><body><p>Enter definition for a new color palette.</p></body></html> - - - Adjust... - - - - - - - - - - 80 - 0 - - - - - 150 - 16777215 - - - - Spectrum zero - - - -50 - - - 50 - - - Qt::Horizontal - - - QSlider::TicksAbove - - - - - - - - 80 - 0 - - - - - 150 - 16777215 - - - - Waterfall zero - - - -50 - - - 50 - - - 0 - - - Qt::Horizontal - - - QSlider::TicksAbove - - - - - - - - - false - - - - 90 - 0 - - - - - 75 - 16777215 - - - - Smoothing of Linear Average spectrum - - - Qt::AlignCenter - - - - - - Smooth - - - 1 - - - 7 - - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 90 - 0 - - - - - 75 - 16777215 - - - - <html><head/><body><p>Set fractional size of spectrum in this window.</p></body></html> - - - Qt::AlignCenter - - - % - - - Spec - - - 100 - - - 5 - - - 30 - - - - - - - - - <html><head/><body><p>Flatten spectral baseline over the full displayed interval.</p></body></html> - - - Flatten - - - - - - - <html><head/><body><p>Compute and save a reference spectrum. (Not yet fully implemented.)</p></body></html> - - - Ref Spec - - - - - - - - + + + + + + + + false + + + Smoothing of Linear Average spectrum + + + Qt::AlignCenter + + + + + + Smooth + + + 1 + + + 7 + + + + + + + Compression factor for frequency scale + + + + + + Bins/Pixel + + + 1 + + + 1000 + + + 1 + + + 2 + + + + + + + Select waterfall palette + + + + + + + <html><head/><body><p>Select data for spectral display</p></body></html> + + + 0 + + + + Current + + + + + Cumulative + + + + + Linear Avg + + + + + Reference + + + + + + + + <html><head/><body><p>Frequency at left edge of waterfall</p></body></html> + + + Hz + + + Start + + + 5000 + + + 100 + + + + + + + <html><head/><body><p>Decode JT9 only above this frequency</p></body></html> + + + JT9 + + + JT65 + + + 0 + + + 5000 + + + 100 + + + 3000 + + + + + + + Number of FFTs averaged (controls waterfall scrolling rate) + + + N Avg + + + 1 + + + 20 + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + Waterfall zero + + + -50 + + + 50 + + + Qt::Horizontal + + + QSlider::TicksAbove + + + + + + + + 0 + 0 + + + + + 80 + 0 + + + + Spectrum zero + + + -50 + + + 50 + + + Qt::Horizontal + + + QSlider::TicksAbove + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Vertical + + + + + + + Qt::Vertical + + + + +