From a7849c5b726476411a36e0b0c5ea69258e0afc82 Mon Sep 17 00:00:00 2001 From: Jordan Sherer Date: Thu, 15 Nov 2018 21:57:04 -0500 Subject: [PATCH] Added push button bold style for colorblindness --- mainwindow.cpp | 107 +++++ mainwindow.h | 9 + mainwindow.ui | 1097 +++++++++++++++++++++--------------------------- 3 files changed, 599 insertions(+), 614 deletions(-) diff --git a/mainwindow.cpp b/mainwindow.cpp index 2b5e4e4..9c367e1 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -1406,6 +1406,35 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple, ui->heartbeatButton->setContextMenuPolicy(Qt::ActionsContextMenu); ui->heartbeatButton->addAction(heartbeatNow); + + int width = 75; + /* + QList btns; + foreach(auto child, ui->buttonGrid->children()){ + if(!child->isWidgetType()){ + continue; + } + + if(!child->objectName().contains("Button")){ + continue; + } + + auto b = qobject_cast(child); + width = qMax(width, b->geometry().width()); + btns.append(b); + } + */ + auto buttonLayout = ui->buttonGrid->layout(); + auto gridButtonLayout = qobject_cast(buttonLayout); + gridButtonLayout->setColumnMinimumWidth(0, width); + gridButtonLayout->setColumnMinimumWidth(1, width); + gridButtonLayout->setColumnMinimumWidth(2, width); + gridButtonLayout->setColumnMinimumWidth(3, width); + gridButtonLayout->setColumnStretch(0, 1); + gridButtonLayout->setColumnStretch(1, 1); + gridButtonLayout->setColumnStretch(2, 1); + gridButtonLayout->setColumnStretch(3, 1); + pskSetLocal(); aprsSetLocal(); @@ -2595,6 +2624,34 @@ void MainWindow::on_autoButton_clicked (bool checked) } } +void MainWindow::on_autoReplyButton_toggled(bool checked){ + resetPushButtonToggleText(ui->autoReplyButton); +} + +void MainWindow::on_monitorButton_toggled(bool checked){ + resetPushButtonToggleText(ui->monitorButton); +} + +void MainWindow::on_monitorTxButton_toggled(bool checked){ + resetPushButtonToggleText(ui->monitorTxButton); +} + +void MainWindow::on_selcalButton_toggled(bool checked){ + resetPushButtonToggleText(ui->selcalButton); +} + +void MainWindow::on_tuneButton_toggled(bool checked){ + resetPushButtonToggleText(ui->tuneButton); +} + +void MainWindow::on_spotButton_toggled(bool checked){ + resetPushButtonToggleText(ui->spotButton); +} + +void MainWindow::on_heartbeatButton_toggled(bool checked){ + resetPushButtonToggleText(ui->heartbeatButton); +} + void MainWindow::auto_tx_mode (bool state) { ui->autoButton->setChecked (state); @@ -4430,6 +4487,7 @@ void MainWindow::guiUpdate() tx_status_label.setText(t.trimmed()); } } + } else if(m_monitoring) { if (m_tx_watchdog) { tx_status_label.setStyleSheet ("QLabel{background-color: #ff0000}"); @@ -7296,7 +7354,52 @@ void MainWindow::stopTuneATU() m_bTxTime=false; } +void MainWindow::resetPushButtonToggleText(QPushButton *btn){ + bool checked = btn->isChecked(); + auto style = btn->styleSheet(); + if(checked){ + style = style.replace("font-weight:normal;", "font-weight:bold;"); + } else { + style = style.replace("font-weight:bold;", "font-weight:normal;"); + } + btn->setStyleSheet(style); + + +#if PUSH_BUTTON_CHECKMARK + auto on = "✓ "; + auto text = btn->text(); + if(checked){ + btn->setText(on + text.replace(on, "")); + } else { + btn->setText(text.replace(on, "")); + } +#endif + +#if PUSH_BUTTON_MIN_WIDTH + int width = 0; + QList btns; + foreach(auto child, ui->buttonGrid->children()){ + if(!child->isWidgetType()){ + continue; + } + + if(!child->objectName().contains("Button")){ + continue; + } + + auto b = qobject_cast(child); + width = qMax(width, b->geometry().width()); + btns.append(b); + } + + foreach(auto child, btns){ + child->setMinimumWidth(width); + } +#endif +} + void MainWindow::on_monitorTxButton_clicked(){ + ui->monitorTxButton->setChecked(false); on_stopTxButton_clicked(); } @@ -7830,6 +7933,8 @@ void MainWindow::aprsSetLocal () void MainWindow::transmitDisplay (bool transmitting) { + ui->monitorTxButton->setChecked(transmitting); + if (transmitting == m_transmitting) { if (transmitting) { ui->signal_meter_widget->setValue(0,0); @@ -7873,8 +7978,10 @@ void MainWindow::transmitDisplay (bool transmitting) } // TODO: jsherer - encapsulate this in a function? + /* ui->monitorButton->setVisible(!transmitting); ui->monitorTxButton->setVisible(transmitting); + */ } void MainWindow::on_sbFtol_valueChanged(int value) diff --git a/mainwindow.h b/mainwindow.h index 9846a3d..8b9c95a 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -187,6 +187,7 @@ private slots: void on_actionAbout_triggered(); void on_autoButton_clicked (bool); void on_labDialFreq_clicked(); + void resetPushButtonToggleText(QPushButton *btn); void on_monitorTxButton_clicked(); void on_stopTxButton_clicked(); void on_stopButton_clicked(); @@ -344,6 +345,14 @@ private slots: void stop_tuning (); void stopTuneATU(); void auto_tx_mode(bool); + void on_autoReplyButton_toggled(bool checked); + void on_monitorButton_toggled(bool checked); + void on_monitorTxButton_toggled(bool checked); + void on_selcalButton_toggled(bool checked); + void on_tuneButton_toggled(bool checked); + void on_spotButton_toggled(bool checked); + void on_heartbeatButton_toggled(bool checked); + void on_actionMessage_averaging_triggered(); void on_actionFox_Log_triggered(); void on_actionInclude_averaging_toggled (bool); diff --git a/mainwindow.ui b/mainwindow.ui index ade9eb6..56ebf7c 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -6,7 +6,7 @@ 0 0 - 872 + 994 605 @@ -170,13 +170,13 @@ 6 - 18 + 10 6 - 18 + 0 6 @@ -303,8 +303,8 @@ QPushButton[oob="true"] { - 40 - 20 + 10 + 10 @@ -328,16 +328,16 @@ QPushButton[oob="true"] { 6 - 18 + 0 - 6 + 10 - 18 + 0 - 6 + 10 @@ -460,24 +460,37 @@ color : white; - 40 - 20 + 10 + 10 - + 0 0 + + + 0 + 0 + + - QFrame { - color:white; - background-color:rgb(0,0,0); + QPushButton { + background-color:lightgray; + padding:0.25em 0.25em; font-weight:normal; + border-style:solid; + border-width:0px; + border-radius:2px; + } + +QPushButton:checked { + background-color:#6699ff; } @@ -486,203 +499,101 @@ color : white; QFrame::Plain - - - - - Qt::Vertical + + + QLayout::SetMinimumSize + + + 0 + + + 10 + + + 10 + + + 10 + + + 10 + + + + + true - - - 20 - 40 - - - - - - - + 0 0 - 75 + 0 30 - 0 - 30 + 16777215 + 16777215 - - - true - - - - 0 - 0 - 75 - 30 - - - - - 0 - 0 - - - - - 75 - 30 - - - - - 0 - 30 - - - - <html><head/><body><p>Enable or disable the receiver</p></body></html> - - - QPushButton { -font-family: helvetica; -font-weight: bold; -background-color: lightgray; -color: black; -border-style: solid; -border-radius:2px; -border-width:0px; -border-color: gray; -font-size:90%; -min-width:75px; -min-height:30px; -/*max-width:60px;*/ -max-height:30px; -} -QPushButton[state="error"] { -background-color: red; -} -QPushButton[state="warning"] { -background-color: yellow; -} -QPushButton[state="ok"] { -background-color: #00ff00; -} -QPushButton:checked { -background-color: #00ff00; + + + 9 + + + + <html><head/><body><p>Enable or disable spotting of callsigns heard to PSKReporter</p></body></html> + + + QPushButton { + background-color:lightgray; + padding:0.25em 0.25em; font-weight:normal; + border-style:solid; + border-width:0px; + border-radius:2px; + } + +QPushButton:checked { + background-color:#6699ff; } - - - RX - - - true - - - - - true - - - - 0 - 0 - 75 - 30 - - - - - 0 - 0 - - - - - 75 - 30 - - - - - 0 - 30 - - - - false - - - QPushButton { -font-family: helvetica; -font-weight: bold; -color: black; -border-style: solid; -border-radius:2px; -border-width:0px; -border-color: gray; -font-size:90%; -min-width:75px; -min-height:30px; -/*max-width:60px;*/ -max-height:30px; -background-color: yellow; -} - - - - TX - - - false - - + + + SPOT + + + true + + + false + - - - - Qt::Vertical - - - - 20 - 40 - - - - - + true - + 0 0 - 75 - 30 + 0 + 0 - 0 - 30 + 16777215 + 16777215 @@ -691,35 +602,6 @@ background-color: yellow; <html><head/><body><p>Enable or disable automatic station replies to directed queries</p></body></html> - - QPushButton { -font-family: helvetica; -font-weight: bold; -background-color: lightgray; -color: black; -border-style: solid; -border-radius:2px; -border-width:0px; -border-color: gray; -font-size:90%; -min-width:75px; -min-height:30px; -/*max-width:60px;*/ -max-height:30px; -} -QPushButton[state="error"] { -background-color: red; -} -QPushButton[state="warning"] { -background-color: orange; -} -QPushButton[state="ok"] { -background-color: #00ff00; -} -QPushButton:checked { -background-color: #6699ff; -} - ACTIVE @@ -728,59 +610,103 @@ background-color: #6699ff; - - + + true - + 0 0 - 75 + 0 30 16777215 + 16777215 + + + + + 9 + + + + <html><head/><body><p>Enable or disable the receiver</p></body></html> + + + QPushButton { + background-color:lightgray; + padding:0.25em 0.25em; font-weight:normal; + border-style:solid; + border-width:0px; + border-radius:2px; + } + +QPushButton:checked { + background-color:#00ff00; +} + + + RX + + + true + + + false + + + + + + + true + + + + 0 + 0 + + + + + 0 30 + + + 16777215 + 16777215 + + + + + 9 + + <html><head/><body><p>Transmit a tuning tone</p></body></html> QPushButton { -font-family: helvetica; -font-weight: bold; -background-color: lightgray; -color: black; -border-style: solid; -border-radius:2px; -border-width:0px; -border-color: gray; -font-size:90%; -min-width:75px; -min-height:30px; -/*max-width:60px;*/ -max-height:30px; -} -QPushButton[state="error"] { -background-color: red; -} -QPushButton[state="warning"] { -background-color: orange; -} -QPushButton[state="ok"] { -background-color: #00ff00; -} -QPushButton:checked { -background-color: #6699ff; + background-color:lightgray; + padding:0.25em 0.25em; font-weight:normal; + border-style:solid; + border-width:0px; + border-radius:2px; + } + +QPushButton:checked { + background-color:#6699ff; } @@ -789,263 +715,108 @@ background-color: #6699ff; true + + false + - - - - Qt::Vertical - - - - 20 - 40 - - - - - - + + true - + 0 0 - 75 + 0 30 - 0 - 30 + 16777215 + 16777215 - - <html><head/><body><p>Enable or disable automatic station replies to directed queries</p></body></html> - - - QPushButton { -font-family: helvetica; -font-weight: bold; -background-color: lightgray; -color: black; -border-style: solid; -border-radius:2px; -border-width:0px; -border-color: gray; -font-size:90%; -min-width:75px; -min-height:30px; -/*max-width:60px;*/ -max-height:30px; -} -QPushButton[state="error"] { -background-color: red; -} -QPushButton[state="warning"] { -background-color: orange; -} -QPushButton[state="ok"] { -background-color: #00ff00; -} -QPushButton:checked { -background-color: #6699ff; -} - - - AUTO - - - true - - - - - - - true - - - - 0 - 0 - - - - - 75 - 30 - - - - - 0 - 30 - - - - <html><head/><body><p>Enable or disable spotting of callsigns heard to PSKReporter</p></body></html> - - - QPushButton { -font-family: helvetica; -font-weight: bold; -background-color: lightgray; -color: black; -border-style: solid; -border-radius:2px; -border-width:0px; -border-color: gray; -font-size:90%; -min-width:75px; -min-height:30px; -/*max-width:60px;*/ -max-height:30px; -} -QPushButton[state="error"] { -background-color: red; -} -QPushButton[state="warning"] { -background-color: orange; -} -QPushButton[state="ok"] { -background-color: #00ff00; -} -QPushButton:checked { -background-color: #00ff00; -} - - - SPOT - - - true - - - - - - - true - - - - 0 - 0 - - - - - 75 - 30 - - - - - 0 - 30 - + + + 9 + true - - <html><head/><body><p>Insert a new entry into the log</p></body></html> - QPushButton { -font-family: helvetica; -font-weight: bold; -background-color: lightgray; -color: black; -border-style: solid; -border-radius:2px; -border-width:0px; -border-color: gray; -font-size:90%; -min-width:75px; -min-height:30px; -/*max-width:60px;*/ -max-height:30px; -} -QPushButton:pressed { -background-color: darkgray; -} -QPushButton[state="error"] { -background-color: red; -} -QPushButton[state="warning"] { -background-color: orange; -} -QPushButton[state="ok"] { -background-color: #00ff00; + background-color:lightgray; + padding:0.25em 0.25em; font-weight:normal; + border-style:solid; + border-width:0px; + border-radius:2px; + } + +QPushButton:checked { + background-color:#ff0000; } - LOG + TX + + + true + + + false - + true - + 0 0 - 75 + 0 30 - 0 - 30 + 16777215 + 16777215 + + + 9 + + <html><head/><body><p>Enable or disable the automatic heartbeat transmission</p></body></html> QPushButton { -font-family: helvetica; -font-weight: bold; -background-color: lightgray; -color: black; -border-style: solid; -border-radius:2px; -border-width:0px; -border-color: gray; -font-size:90%; -min-width:75px; -min-height:30px; -/*max-width:60px;*/ -max-height:30px; -} -QPushButton[state="error"] { -background-color: red; -} -QPushButton[state="warning"] { -background-color: orange; -} -QPushButton[state="ok"] { -background-color: #00ff00; -} -QPushButton:checked { -background-color: #6699ff; + background-color:lightgray; + padding:0.25em 0.25em; font-weight:normal; + border-style:solid; + border-width:0px; + border-radius:2px; + } + +QPushButton:checked { + background-color:#6699ff; } @@ -1054,31 +825,39 @@ background-color: #6699ff; true + + false + - + true - + 0 0 - 75 + 0 30 - 0 - 30 + 16777215 + 16777215 + + + 9 + + true @@ -1087,31 +866,15 @@ background-color: #6699ff; QPushButton { -font-family: helvetica; -font-weight: bold; -background-color: lightgray; -color: black; -border-style: solid; -border-radius:2px; -border-width:0px; -border-color: gray; -font-size:90%; -min-width:75px; -min-height:30px; -/*max-width:60px;*/ -max-height:30px; -} -QPushButton[state="error"] { -background-color: red; -} -QPushButton[state="warning"] { -background-color: orange; -} -QPushButton[state="ok"] { -background-color: #00ff00; -} -QPushButton:checked { -background-color: #6699ff; + background-color:lightgray; + padding:0.25em 0.25em; font-weight:normal; + border-style:solid; + border-width:0px; + border-radius:2px; + } + +QPushButton:checked { + background-color:#6699ff; } @@ -1120,53 +883,153 @@ background-color: #6699ff; true + + false + - - + + + + true + + + + 0 + 0 + + - 75 + 0 30 + + + 16777215 + 16777215 + + + + + 9 + + - <html><head/><body><p>Stop transmitting</p></body></html> + <html><head/><body><p>Enable or disable automatic station replies to directed queries</p></body></html> QPushButton { -font-family: helvetica; -font-weight: bold; -background-color: lightgray; -color: black; -border-style: solid; -border-radius:2px; -border-width:0px; -border-color: gray; -font-size:90%; -min-width:75px; -min-height:30px; -/*max-width:60px;*/ -max-height:30px; -} -QPushButton:pressed { -background-color: darkgray; -} -QPushButton[state="error"] { -background-color: red; -} -QPushButton[state="warning"] { -background-color: orange; -} -QPushButton[state="ok"] { -background-color: #00ff00; + background-color:lightgray; + padding:0.25em 0.25em; font-weight:normal; + border-style:solid; + border-width:0px; + border-radius:2px; + } + +QPushButton:checked { + background-color:#6699ff; } - HALT + AUTO + + + true + + + false + + + + true + + + + 0 + 0 + + + + + 0 + 30 + + + + + 16777215 + 16777215 + + + + + 9 + + + + true + + + <html><head/><body><p>Insert a new entry into the log</p></body></html> + + + QPushButton { + background-color:lightgray; + padding:0.25em 0.25em; font-weight:normal; + border-style:solid; + border-width:0px; + border-radius:2px; + } + +QPushButton:checked { + background-color:#6699ff; +} + + + LOG + + + false + + + + + + + Qt::Vertical + + + QSizePolicy::MinimumExpanding + + + + 20 + 10 + + + + + + + + Qt::Vertical + + + QSizePolicy::MinimumExpanding + + + + 20 + 10 + + + + @@ -1498,54 +1361,6 @@ QTextEdit[transmitting="true"] { 0 - - - - - 0 - 30 - - - - <html><head/><body><p>Reply to a CQ</p></body></html> - - - Reply - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 40 - 20 - - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 40 - 20 - - - - @@ -1562,8 +1377,126 @@ QTextEdit[transmitting="true"] { + + + + + 75 + 30 + + + + <html><head/><body><p>Stop transmitting</p></body></html> + + + Halt + + + + + + + Qt::Horizontal + + + QSizePolicy::Preferred + + + + 20 + 10 + + + + + + + + + 0 + 30 + + + + <html><head/><body><p>Send your station message</p></body></html> + + + QTC + + + + + + + + 0 + 30 + + + + <html><head/><body><p>Send an SNR message</p></body></html> + + + SNR + + + + + + + Qt::Horizontal + + + QSizePolicy::Preferred + + + + 20 + 10 + + + + + + + + + 0 + 30 + + + + <html><head/><body><p>Reply to a CQ</p></body></html> + + + Reply + + + + + + + + 0 + 30 + + + + <html><head/><body><p>Send a saved message</p></body></html> + + + Saved + + + + + + 0 + 0 + + 0 @@ -1613,39 +1546,7 @@ QTextEdit[transmitting="true"] { - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 40 - 20 - - - - - - - - - 0 - 30 - - - - <html><head/><body><p>Send your station message</p></body></html> - - - QTC - - - - + false @@ -1677,38 +1578,6 @@ color:#555; - - - - - 0 - 30 - - - - <html><head/><body><p>Send a saved message</p></body></html> - - - Saved - - - - - - - - 0 - 30 - - - - <html><head/><body><p>Send an SNR message</p></body></html> - - - SNR - - - @@ -4730,7 +4599,7 @@ list. The list can be maintained in Settings (F2). 0 0 - 872 + 994 22