From a65061cddeef4953ba44a285b24fa34c2a4094fd Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Tue, 4 Jul 2017 14:39:07 +0000 Subject: [PATCH] Correct the save/restore behavior of hiding menus and controls. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7782 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- mainwindow.cpp | 18 ++++++++---------- mainwindow.h | 2 +- mainwindow.ui | 12 ------------ widegraph.cpp | 3 ++- 4 files changed, 11 insertions(+), 24 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 85f92f536..80b3eba24 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -886,6 +886,10 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple, m_config.my_callsign()=="G4WJS" || m_config.my_callsign () == "G3PQA") { ui->actionWSPR_LF->setEnabled(true); } + if(!ui->cbMenus->isChecked()) { + ui->cbMenus->setChecked(true); + ui->cbMenus->setChecked(false); + } // this must be the last statement of constructor if (!m_valid) throw std::runtime_error {"Fatal initialization exception"}; @@ -950,7 +954,7 @@ void MainWindow::writeSettings() m_settings->setValue ("AstroDisplayed", m_astroWidget && m_astroWidget->isVisible()); m_settings->setValue ("MsgAvgDisplayed", m_msgAvgWidget && m_msgAvgWidget->isVisible()); m_settings->setValue ("FreeText", ui->freeTextMsg->currentText ()); - m_settings->setValue ("HideControls", ui->actionHide_Controls->isChecked ()); + m_settings->setValue("ShowMenus",ui->cbMenus->isChecked()); m_settings->endGroup(); m_settings->beginGroup("Common"); @@ -1003,7 +1007,6 @@ void MainWindow::writeSettings() void MainWindow::readSettings() { m_settings->beginGroup("MainWindow"); - ui->actionHide_Controls->setChecked (m_settings->value("HideControls", false).toBool ()); restoreGeometry (m_settings->value ("geometry", saveGeometry ()).toByteArray ()); m_geometryNoControls = m_settings->value ("geometryNoControls",saveGeometry()).toByteArray(); restoreState (m_settings->value ("state", saveState ()).toByteArray ()); @@ -1015,6 +1018,7 @@ void MainWindow::readSettings() auto displayMsgAvg = m_settings->value ("MsgAvgDisplayed", false).toBool (); if (m_settings->contains ("FreeText")) ui->freeTextMsg->setCurrentText ( m_settings->value ("FreeText").toString ()); + ui->cbMenus->setChecked(m_settings->value("ShowMenus",true).toBool()); m_settings->endGroup(); // do this outside of settings group because it uses groups internally @@ -1674,12 +1678,6 @@ void MainWindow::keyPressEvent (QKeyEvent * e) } } break; - case Qt::Key_M: - if(e->modifiers() & Qt::ControlModifier) { - ui->actionHide_Controls->toggle (); - return; - } - break; case Qt::Key_F4: clearDX (); ui->dxCallEntry->setFocus(); @@ -2067,7 +2065,7 @@ void MainWindow::on_actionFast_Graph_triggered() // This allows the window to shrink by removing certain things // and reducing space used by controls -void MainWindow::on_actionHide_Controls_toggled (bool checked) +void MainWindow::hideMenus(bool checked) { int spacing = checked ? 1 : 6; if (checked) { @@ -6422,5 +6420,5 @@ void MainWindow::update_watchdog_label () void MainWindow::on_cbMenus_toggled(bool b) { - on_actionHide_Controls_toggled (!b); + hideMenus(!b); } diff --git a/mainwindow.h b/mainwindow.h index baa7a352d..3e55f681e 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -253,7 +253,6 @@ private slots: void on_actionEcho_triggered(); void on_actionISCAT_triggered(); void on_actionFast_Graph_triggered(); - void on_actionHide_Controls_toggled (bool chaecked); void fast_decode_done(); void on_actionMeasure_reference_spectrum_triggered(); void on_actionErase_reference_spectrum_triggered(); @@ -296,6 +295,7 @@ private: void astroUpdate (); void writeAllTxt(QString message); void FT8_AutoSeq(QString message); + void hideMenus(bool b); NetworkAccessManager m_network_manager; bool m_valid; diff --git a/mainwindow.ui b/mainwindow.ui index 903462577..46a946602 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -2375,7 +2375,6 @@ QPushButton[state="ok"] { - @@ -2925,17 +2924,6 @@ QPushButton[state="ok"] { - - - true - - - Hide menus and labels - - - Reduces window size by removing controls and some spacing - - true diff --git a/widegraph.cpp b/widegraph.cpp index 0ccc5e73e..10c01fe6d 100644 --- a/widegraph.cpp +++ b/widegraph.cpp @@ -87,7 +87,8 @@ WideGraph::WideGraph(QSettings * settings, QWidget *parent) : int m_fMin = m_settings->value ("Fmin", 2500).toInt (); ui->fSplitSpinBox->setValue (m_fMin); setRxRange (); - ui->controls_widget->setVisible(!m_settings->value("HideControls", false).toBool ()); + ui->controls_widget->setVisible(!m_settings->value("HideControls",false).toBool()); + ui->cbControls->setChecked(!m_settings->value("HideControls",false).toBool()); } saveSettings (); // update config with defaults