From 775008be48d263cd9a3c5be97484755a36f3169b Mon Sep 17 00:00:00 2001 From: Jordan Sherer Date: Fri, 7 Sep 2018 10:12:40 -0400 Subject: [PATCH] Added configuration options to style transmit and receive text --- Configuration.cpp | 238 +++++++--- Configuration.hpp | 13 +- Configuration.ui | 1050 +++++++++++++++++++++++---------------------- mainwindow.cpp | 113 ++++- mainwindow.ui | 4 +- 5 files changed, 811 insertions(+), 607 deletions(-) diff --git a/Configuration.cpp b/Configuration.cpp index f1699f6..eb7ab5c 100644 --- a/Configuration.cpp +++ b/Configuration.cpp @@ -433,7 +433,6 @@ private: void insert_station (); Q_SLOT void on_font_push_button_clicked (); - Q_SLOT void on_decoded_text_font_push_button_clicked (); Q_SLOT void on_PTT_port_combo_box_activated (int); Q_SLOT void on_CAT_port_combo_box_activated (int); Q_SLOT void on_CAT_serial_baud_combo_box_currentIndexChanged (int); @@ -467,9 +466,13 @@ private: Q_SLOT void handle_transceiver_failure (QString const& reason); Q_SLOT void on_pbCQmsg_clicked(); Q_SLOT void on_pbMyCall_clicked(); - Q_SLOT void on_pbTxMsg_clicked(); - Q_SLOT void on_pbNewDXCC_clicked(); - Q_SLOT void on_pbNewCall_clicked(); + Q_SLOT void on_rxBackgroundButton_clicked(); + Q_SLOT void on_rxForegroundButton_clicked(); + Q_SLOT void on_rxFontButton_clicked(); + Q_SLOT void on_txBackgroundButton_clicked(); + Q_SLOT void on_txForegroundButton_clicked(); + Q_SLOT void on_txFontButton_clicked(); + Q_SLOT void on_cbFox_clicked (bool); Q_SLOT void on_cbHound_clicked (bool); Q_SLOT void on_cbx2ToneSpacing_clicked(bool); @@ -503,8 +506,11 @@ private: QFont font_; QFont next_font_; - QFont decoded_text_font_; - QFont next_decoded_text_font_; + QFont rx_text_font_; + QFont next_rx_text_font_; + + QFont tx_text_font_; + QFont next_tx_text_font_; bool restart_sound_input_device_; bool restart_sound_output_device_; @@ -561,12 +567,18 @@ private: QString reply_; int callsign_aging_; int activity_aging_; - QColor color_CQ_; - QColor next_color_CQ_; - QColor color_MyCall_; - QColor next_color_MyCall_; - QColor color_ReceivedMsg_; - QColor next_color_ReceivedMsg_; + QColor color_cq_; + QColor next_color_cq_; + QColor color_mycall_; + QColor next_color_mycall_; + QColor color_rx_background_; + QColor next_color_rx_background_; + QColor color_rx_foreground_; + QColor next_color_rx_foreground_; + QColor color_tx_background_; + QColor next_color_tx_background_; + QColor color_tx_foreground_; + QColor next_color_tx_foreground_; QColor color_DXCC_; QColor next_color_DXCC_; QColor color_NewCall_; @@ -671,13 +683,17 @@ bool Configuration::restart_audio_output () const {return m_->restart_sound_outp auto Configuration::type_2_msg_gen () const -> Type2MsgGen {return m_->type_2_msg_gen_;} bool Configuration::use_dynamic_grid() const {return m_->use_dynamic_info_; } QString Configuration::my_callsign () const {return m_->my_callsign_;} -QColor Configuration::color_CQ () const {return m_->color_CQ_;} -QColor Configuration::color_MyCall () const {return m_->color_MyCall_;} -QColor Configuration::color_ReceivedMsg () const {return m_->color_ReceivedMsg_;} +QColor Configuration::color_CQ () const {return m_->color_cq_;} +QColor Configuration::color_MyCall () const {return m_->color_mycall_;} +QColor Configuration::color_rx_background () const {return m_->color_rx_background_;} +QColor Configuration::color_rx_foreground () const {return m_->color_rx_foreground_;} +QColor Configuration::color_tx_background () const {return m_->color_tx_background_;} +QColor Configuration::color_tx_foreground () const {return m_->color_tx_foreground_;} QColor Configuration::color_DXCC () const {return m_->color_DXCC_;} QColor Configuration::color_NewCall () const {return m_->color_NewCall_;} QFont Configuration::text_font () const {return m_->font_;} -QFont Configuration::decoded_text_font () const {return m_->decoded_text_font_;} +QFont Configuration::rx_text_font () const {return m_->rx_text_font_;} +QFont Configuration::tx_text_font () const {return m_->tx_text_font_;} qint32 Configuration::id_interval () const {return m_->id_interval_;} qint32 Configuration::ntrials() const {return m_->ntrials_;} qint32 Configuration::aggressive() const {return m_->aggressive_;} @@ -1244,11 +1260,14 @@ void Configuration::impl::initialize_models () ui_->cq_message_line_edit->setText(cq_.toUpper()); ui_->reply_message_line_edit->setText (reply_.toUpper()); ui_->use_dynamic_grid->setChecked(use_dynamic_info_); - ui_->labCQ->setStyleSheet(QString("background: %1").arg(color_CQ_.name())); - ui_->labMyCall->setStyleSheet(QString("background: %1").arg(color_MyCall_.name())); - ui_->labTx->setStyleSheet(QString("background: %1").arg(color_ReceivedMsg_.name())); - ui_->labDXCC->setStyleSheet(QString("background: %1").arg(color_DXCC_.name())); - ui_->labNewCall->setStyleSheet(QString("background: %1").arg(color_NewCall_.name())); + ui_->labCQ->setStyleSheet(QString("background: %1").arg(color_cq_.name())); + ui_->labMyCall->setStyleSheet(QString("background: %1").arg(color_mycall_.name())); + + ui_->rxLabel->setStyleSheet(QString("background: %1").arg(color_rx_background_.name())); + ui_->txLabel->setStyleSheet(QString("background: %1").arg(color_tx_background_.name())); + ui_->rxForegroundLabel->setStyleSheet(QString("background: %1; color: %2").arg(color_rx_background_.name()).arg(color_rx_foreground_.name())); + ui_->txForegroundLabel->setStyleSheet(QString("background: %1; color: %2").arg(color_rx_background_.name()).arg(color_tx_foreground_.name())); + ui_->CW_id_interval_spin_box->setValue (id_interval_); ui_->sbNtrials->setValue (ntrials_); ui_->sbTxDelay->setValue (txDelay_); @@ -1376,9 +1395,12 @@ void Configuration::impl::read_settings () my_qth_ = settings_->value("MyQTH", QString {}).toString(); cq_ = settings_->value("CQMessage", QString {"CQCQCQ"}).toString(); reply_ = settings_->value("Reply", QString {"HW CPY?"}).toString(); - next_color_CQ_ = color_CQ_ = settings_->value("colorCQ","#66ff66").toString(); - next_color_MyCall_ = color_MyCall_ = settings_->value("colorMyCall","#ff6666").toString(); - next_color_ReceivedMsg_ = color_ReceivedMsg_ = settings_->value("colorReceivedMsg","#ffeaa7").toString(); + next_color_cq_ = color_cq_ = settings_->value("colorCQ","#66ff66").toString(); + next_color_mycall_ = color_mycall_ = settings_->value("colorMyCall","#ff6666").toString(); + next_color_rx_background_ = color_rx_background_ = settings_->value("color_rx_background","#ffeaa7").toString(); + next_color_rx_foreground_ = color_rx_foreground_ = settings_->value("color_rx_foreground","#000000").toString(); + next_color_tx_background_ = color_tx_background_ = settings_->value("color_tx_background","#ffffff").toString(); + next_color_tx_foreground_ = color_tx_foreground_ = settings_->value("color_tx_foreground","#000000").toString(); next_color_DXCC_ = color_DXCC_ = settings_->value("colorDXCC","#ff00ff").toString(); next_color_NewCall_ = color_NewCall_ = settings_->value("colorNewCall","#ffaaff").toString(); @@ -1386,23 +1408,39 @@ void Configuration::impl::read_settings () && next_font_ != font_) { font_ = next_font_; - Q_EMIT self_->text_font_changed (font_); + Q_EMIT self_->gui_text_font_changed (font_); } else { next_font_ = font_; } - if (next_decoded_text_font_.fromString (settings_->value ("DecodedTextFont", "Courier, 10").toString ()) - && next_decoded_text_font_ != decoded_text_font_) + + if (next_tx_text_font_.fromString (settings_->value ("TXTextFont", QGuiApplication::font ().toString ()).toString ()) + && next_tx_text_font_ != tx_text_font_) { - decoded_text_font_ = next_decoded_text_font_; - Q_EMIT self_->decoded_text_font_changed (decoded_text_font_); + tx_text_font_ = next_tx_text_font_; + Q_EMIT self_->tx_text_font_changed (tx_text_font_); } else { - next_decoded_text_font_ = decoded_text_font_; + next_tx_text_font_ = tx_text_font_; } + ui_->txFontButton->setText(QString("Font (%1 %2)").arg(next_tx_text_font_.family()).arg(next_tx_text_font_.pointSize())); + + if (next_rx_text_font_.fromString (settings_->value ("RXTextFont", QGuiApplication::font ().toString ()).toString ()) + && next_rx_text_font_ != rx_text_font_) + { + rx_text_font_ = next_rx_text_font_; + Q_EMIT self_->rx_text_font_changed (rx_text_font_); + } + else + { + next_rx_text_font_ = rx_text_font_; + } + + ui_->rxFontButton->setText(QString("Font (%1 %2)").arg(next_rx_text_font_.family()).arg(next_rx_text_font_.pointSize())); + id_interval_ = settings_->value ("IDint", 0).toInt (); ntrials_ = settings_->value ("nTrials", 6).toInt (); txDelay_ = settings_->value ("TxDelay",0.2).toDouble(); @@ -1575,13 +1613,17 @@ void Configuration::impl::write_settings () settings_->setValue ("Reply", reply_); settings_->setValue ("CallsignAging", callsign_aging_); settings_->setValue ("ActivityAging", activity_aging_); - settings_->setValue("colorCQ",color_CQ_); - settings_->setValue("colorMyCall",color_MyCall_); - settings_->setValue("colorReceivedMsg",color_ReceivedMsg_); + settings_->setValue("colorCQ",color_cq_); + settings_->setValue("colorMyCall",color_mycall_); + settings_->setValue("color_rx_background",color_rx_background_); + settings_->setValue("color_rx_foreground",color_rx_foreground_); + settings_->setValue("color_tx_background",color_tx_background_); + settings_->setValue("color_tx_foreground",color_tx_foreground_); settings_->setValue("colorDXCC",color_DXCC_); settings_->setValue("colorNewCall",color_NewCall_); settings_->setValue ("Font", font_.toString ()); - settings_->setValue ("DecodedTextFont", decoded_text_font_.toString ()); + settings_->setValue ("RXTextFont", rx_text_font_.toString ()); + settings_->setValue ("TXTextFont", tx_text_font_.toString ()); settings_->setValue ("IDint", id_interval_); settings_->setValue ("nTrials", ntrials_); settings_->setValue ("TxDelay", txDelay_); @@ -1937,18 +1979,27 @@ void Configuration::impl::accept () if (next_font_ != font_) { font_ = next_font_; - Q_EMIT self_->text_font_changed (font_); + Q_EMIT self_->gui_text_font_changed (font_); } - if (next_decoded_text_font_ != decoded_text_font_) + if (next_tx_text_font_ != tx_text_font_) { - decoded_text_font_ = next_decoded_text_font_; - Q_EMIT self_->decoded_text_font_changed (decoded_text_font_); + tx_text_font_ = next_tx_text_font_; + Q_EMIT self_->tx_text_font_changed (tx_text_font_); } - color_CQ_ = next_color_CQ_; - color_MyCall_ = next_color_MyCall_; - color_ReceivedMsg_ = next_color_ReceivedMsg_; + if (next_rx_text_font_ != rx_text_font_) + { + rx_text_font_ = next_rx_text_font_; + Q_EMIT self_->rx_text_font_changed (rx_text_font_); + } + + color_cq_ = next_color_cq_; + color_mycall_ = next_color_mycall_; + color_rx_background_ = next_color_rx_background_; + color_rx_foreground_ = next_color_rx_foreground_; + color_tx_background_ = next_color_tx_background_; + color_tx_foreground_ = next_color_tx_foreground_; color_DXCC_ = next_color_DXCC_; color_NewCall_ = next_color_NewCall_; @@ -2176,64 +2227,115 @@ void Configuration::impl::on_font_push_button_clicked () next_font_ = QFontDialog::getFont (0, next_font_, this); } +QColor getColor(QColor initial, QWidget *parent, QString title){ + QList custom = { + QColor("#66FF66"), + QColor("#FF6666"), + QColor("#FFEAA7") + }; + + auto d = new QColorDialog(initial, parent); + d->setWindowTitle(title); + for(int i = 0; i < custom.length(); i++){ + d->setCustomColor(i, custom.at(i)); + } + + if(d->exec() == QColorDialog::Accepted){ + return d->selectedColor(); + } else { + return initial; + } +} + void Configuration::impl::on_pbCQmsg_clicked() { - auto new_color = QColorDialog::getColor(next_color_CQ_, this, "CQ and BEACON Messages Color"); + auto new_color = getColor(next_color_cq_, this, "CQ Messages Color"); if (new_color.isValid ()) { - next_color_CQ_ = new_color; - ui_->labCQ->setStyleSheet(QString("background: %1").arg(next_color_CQ_.name())); + next_color_cq_ = new_color; + ui_->labCQ->setStyleSheet(QString("background: %1").arg(next_color_cq_.name())); } } void Configuration::impl::on_pbMyCall_clicked() { - auto new_color = QColorDialog::getColor(next_color_MyCall_, this, "Directed Messages Color"); + auto new_color = getColor(next_color_mycall_, this, "Directed Messages Color"); if (new_color.isValid ()) { - next_color_MyCall_ = new_color; - ui_->labMyCall->setStyleSheet(QString("background: %1").arg(next_color_MyCall_.name())); + next_color_mycall_ = new_color; + ui_->labMyCall->setStyleSheet(QString("background: %1").arg(next_color_mycall_.name())); } } -void Configuration::impl::on_pbTxMsg_clicked() +void Configuration::impl::on_rxBackgroundButton_clicked() { - auto new_color = QColorDialog::getColor(next_color_ReceivedMsg_, this, "Received Messages Textarea Color"); + auto new_color = getColor(next_color_rx_background_, this, "Received Messages Background Color"); if (new_color.isValid ()) { - next_color_ReceivedMsg_ = new_color; - ui_->labTx->setStyleSheet(QString("background: %1").arg(next_color_ReceivedMsg_.name())); + next_color_rx_background_ = new_color; + ui_->rxLabel->setStyleSheet(QString("background: %1").arg(next_color_rx_background_.name())); + ui_->rxForegroundLabel->setStyleSheet(QString("background: %1; color: %2").arg(next_color_rx_background_.name()).arg(next_color_rx_foreground_.name())); + ui_->txForegroundLabel->setStyleSheet(QString("background: %1; color: %2").arg(next_color_rx_background_.name()).arg(next_color_tx_foreground_.name())); } } -void Configuration::impl::on_pbNewDXCC_clicked() +void Configuration::impl::on_rxForegroundButton_clicked() { - auto new_color = QColorDialog::getColor(next_color_DXCC_, this, "New DXCC Messages Color"); + auto new_color = getColor(next_color_rx_foreground_, this, "Received Messages Foreground Color"); if (new_color.isValid ()) { - next_color_DXCC_ = new_color; - ui_->labDXCC->setStyleSheet(QString("background: %1").arg(next_color_DXCC_.name())); + next_color_rx_foreground_ = new_color; + ui_->rxLabel->setStyleSheet(QString("background: %1").arg(next_color_rx_background_.name())); + ui_->rxForegroundLabel->setStyleSheet(QString("background: %1; color: %2").arg(next_color_rx_background_.name()).arg(next_color_rx_foreground_.name())); + ui_->txForegroundLabel->setStyleSheet(QString("background: %1; color: %2").arg(next_color_rx_background_.name()).arg(next_color_tx_foreground_.name())); } } -void Configuration::impl::on_pbNewCall_clicked() +void Configuration::impl::on_rxFontButton_clicked () { - auto new_color = QColorDialog::getColor(next_color_NewCall_, this, "New Call Messages Color"); - if (new_color.isValid ()) - { - next_color_NewCall_ = new_color; - ui_->labNewCall->setStyleSheet(QString("background: %1").arg(next_color_NewCall_.name())); - } -} - -void Configuration::impl::on_decoded_text_font_push_button_clicked () -{ - next_decoded_text_font_ = QFontDialog::getFont (0, decoded_text_font_ , this + next_rx_text_font_ = QFontDialog::getFont (0, rx_text_font_ , this , tr ("Font Chooser") #if QT_VERSION >= 0x050201 - , QFontDialog::MonospacedFonts + , 0 #endif ); + ui_->rxFontButton->setText(QString("Font (%1 %2)").arg(next_rx_text_font_.family()).arg(next_rx_text_font_.pointSize())); +} + +void Configuration::impl::on_txBackgroundButton_clicked() +{ + auto new_color = getColor(next_color_tx_background_, this, "Transmitted Messages Background Color"); + if (new_color.isValid ()) + { + next_color_tx_background_ = new_color; + ui_->txLabel->setStyleSheet(QString("background: %1").arg(next_color_tx_background_.name())); + ui_->rxForegroundLabel->setStyleSheet(QString("background: %1; color: %2").arg(next_color_rx_background_.name()).arg(next_color_rx_foreground_.name())); + ui_->txForegroundLabel->setStyleSheet(QString("background: %1; color: %2").arg(next_color_rx_background_.name()).arg(next_color_tx_foreground_.name())); + } +} + +void Configuration::impl::on_txForegroundButton_clicked() +{ + auto new_color = getColor(next_color_tx_foreground_, this, "Transmitted Messages Foreground Color"); + if (new_color.isValid ()) + { + next_color_tx_foreground_ = new_color; + ui_->txLabel->setStyleSheet(QString("background: %1").arg(next_color_tx_background_.name())); + ui_->rxForegroundLabel->setStyleSheet(QString("background: %1; color: %2").arg(next_color_rx_background_.name()).arg(next_color_rx_foreground_.name())); + ui_->txForegroundLabel->setStyleSheet(QString("background: %1; color: %2").arg(next_color_rx_background_.name()).arg(next_color_tx_foreground_.name())); + } +} + +void Configuration::impl::on_txFontButton_clicked () +{ + next_tx_text_font_ = QFontDialog::getFont (0, tx_text_font_ , this + , tr ("Font Chooser") +#if QT_VERSION >= 0x050201 + , 0 +#endif + ); + + ui_->txFontButton->setText(QString("Font (%1 %2)").arg(next_tx_text_font_.family()).arg(next_tx_text_font_.pointSize())); } void Configuration::impl::on_PTT_port_combo_box_activated (int /* index */) diff --git a/Configuration.hpp b/Configuration.hpp index 6033082..5de2981 100644 --- a/Configuration.hpp +++ b/Configuration.hpp @@ -104,7 +104,8 @@ public: QString cq_message () const; QString reply_message () const; QFont text_font () const; - QFont decoded_text_font () const; + QFont rx_text_font () const; + QFont tx_text_font () const; qint32 id_interval () const; qint32 ntrials() const; qint32 aggressive() const; @@ -178,7 +179,10 @@ public: Type2MsgGen type_2_msg_gen () const; QColor color_CQ () const; QColor color_MyCall () const; - QColor color_ReceivedMsg () const; + QColor color_rx_background () const; + QColor color_rx_foreground () const; + QColor color_tx_background () const; + QColor color_tx_foreground () const; QColor color_DXCC () const; QColor color_NewCall () const; bool pwrBandTxMemory () const; @@ -271,8 +275,9 @@ public: // These signals indicate a font has been selected and accepted for // the application text and decoded text respectively. // - Q_SIGNAL void text_font_changed (QFont); - Q_SIGNAL void decoded_text_font_changed (QFont); + Q_SIGNAL void gui_text_font_changed (QFont); + Q_SIGNAL void tx_text_font_changed (QFont); + Q_SIGNAL void rx_text_font_changed (QFont); Q_SIGNAL void colors_changed (); // diff --git a/Configuration.ui b/Configuration.ui index 8fc2811..40e7941 100644 --- a/Configuration.ui +++ b/Configuration.ui @@ -2569,530 +2569,545 @@ Right click for insert and delete options. UI - - - - 0 - 0 - 671 - 621 - - - - - 0 - 0 - - - - - - - - - - - true - - - - 80 - 20 - - - - QLabel{background-color: #ffeaa7} - - - K1ABC - - - Qt::AlignCenter - - - - - - - - 80 - 20 - - - - QLabel{background-color: #ff6666} - - - K1ABC - - - Qt::AlignCenter - - - - - - - - 140 - 0 - - - - CQ - - - - - - - false - - - - 140 - 0 - - - - false - - - New DXCC - - - - - - - true - - - Set the font characteristics for the application. - - - UI Font... - - - - - - - - 140 - 0 - - - - Directed Message - - - - - - - - 80 - 20 - - - - QLabel{background-color: #66ff66} - - - K1ABC - - - Qt::AlignCenter - - - - - - - false - - - - 80 - 20 - - - - false - - - QLabel{background-color: #66ffff} - - - K1ABC - - - Qt::AlignCenter - - - - - - - true - - - - 140 - 0 - - - - Received Message Textarea - - - - - - - false - - - - 140 - 0 - - - - false - - - New Call - - - - - - - false - - - - 80 - 20 - - - - false - - - QLabel{background-color: #ff66ff} - - - K1ABC - - - Qt::AlignCenter - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - 0 - 0 - 100 - 30 - - - - false - - - - - - false - - - Miscellaneous - - - - - - Degrade S/N of .wav file: - - - sbDegrade - - - - - - - For offline sensitivity tests - - - dB - - - 1 - - - 1.000000000000000 - - - - - - - Receiver bandwidth: - - - sbBandwidth - - - - - - - For offline sensitivity tests - - - Hz - - - 6000 - - - 100 - - - 2500 - - - - - - - Tx delay: - - - sbTxDelay - - - - - - - Minimum delay between assertion of PTT and start of Tx audio. - - - s - - - 1 - - - 0.000000000000000 - - - 0.500000000000000 - - - 0.100000000000000 - - - - - - - <html><head/><body><p>Generate Tx audio with twice the normal tone spacing. Intended for special LF/MF transmitters that use a divide-by-2 before generating RF.</p></body></html> - - - x 2 Tone Spacing - - - - - - - false - - - <html><head/><body><p>Generate Tx audio with four times the normal tone spacing. Intended for special LF/MF transmitters that use a divide-by-4 before generating RF.</p></body></html> - - - x 4 Tone Spacing - - - - - - - - - - false - - - <html><head/><body><p>User-selectable parameters for JT65 VHF/UHF/Microwave decoding.</p></body></html> - - - JT65 VHF/UHF/Microwave decoding parameters - - - - - - Random erasure patterns: - - - sbNtrials - - - - - - - <html><head/><body><p>Maximum number of erasure patterns for stochastic soft-decision Reed Solomon decoder is 10^(n/2).</p></body></html> - - - 0 - - - 12 - - - 6 - - - - - - - Aggressive decoding level: - - - sbAggressive - - - - - - - <html><head/><body><p>Higher levels will increase the probability of decoding, but will also increase probability of a false decode.</p></body></html> - - - 10 - - - - - - - Two-pass decoding - - - true - - - - - - - - - - Qt::Vertical - - - - 0 - 0 - - - - - - - - false - - - - 0 - 50 - - - - FT8 DXpedition mode - - - - - 9 - 10 - 231 - 31 - + + + + + + 0 + 0 + + + + + + + Global - - - + + + + + true + - Fox is the DXpedition station + Set the font characteristics for the application. - Fox - - - - - - - Everybody else is a Hound - - - Hound + Application Font - - - - - + + + + + Band Activity Background + + + + + + + 80 + 20 + + + + QLabel{background-color: #66ff66} + + + K1ABC + + + Qt::AlignCenter + + + + + + + + 140 + 0 + + + + CQ Color + + + + + + + + 140 + 0 + + + + Directed Message Color + + + + + + + + 80 + 20 + + + + QLabel{background-color: #ff6666} + + + K1ABC + + + Qt::AlignCenter + + + + + + + + + + Message Background + + + + + + true + + + + 80 + 20 + + + + QLabel{background-color: #ffeaa7} + + + K1ABC + + + Qt::AlignCenter + + + + + + + true + + + + 140 + 0 + + + + Receive Background Color + + + + + + + true + + + + 80 + 20 + + + + QLabel{background-color: #FFF} + + + K1ABC + + + Qt::AlignCenter + + + + + + + Transmit Background Color + + + + + + + + + + Messages Received + + + + + + Font + + + + + + + Foreground Color + + + + + + + QLabel{background-color: #ffeaa7} + + + K1ABC + + + Qt::AlignCenter + + + + + + + + + + Messages Transmitted + + + + + + Foreground Color + + + + + + + Font + + + + + + + QLabel{background-color: #ffeaa7} + + + K1ABC + + + Qt::AlignCenter + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + 0 + 0 + 100 + 30 + + + + false + + + + + + false + + + Miscellaneous + + + + + + Degrade S/N of .wav file: + + + sbDegrade + + + + + + + For offline sensitivity tests + + + dB + + + 1 + + + 1.000000000000000 + + + + + + + Receiver bandwidth: + + + sbBandwidth + + + + + + + For offline sensitivity tests + + + Hz + + + 6000 + + + 100 + + + 2500 + + + + + + + Tx delay: + + + sbTxDelay + + + + + + + Minimum delay between assertion of PTT and start of Tx audio. + + + s + + + 1 + + + 0.000000000000000 + + + 0.500000000000000 + + + 0.100000000000000 + + + + + + + <html><head/><body><p>Generate Tx audio with twice the normal tone spacing. Intended for special LF/MF transmitters that use a divide-by-2 before generating RF.</p></body></html> + + + x 2 Tone Spacing + + + + + + + false + + + <html><head/><body><p>Generate Tx audio with four times the normal tone spacing. Intended for special LF/MF transmitters that use a divide-by-4 before generating RF.</p></body></html> + + + x 4 Tone Spacing + + + + + + + + + + false + + + <html><head/><body><p>User-selectable parameters for JT65 VHF/UHF/Microwave decoding.</p></body></html> + + + JT65 VHF/UHF/Microwave decoding parameters + + + + + + Random erasure patterns: + + + sbNtrials + + + + + + + <html><head/><body><p>Maximum number of erasure patterns for stochastic soft-decision Reed Solomon decoder is 10^(n/2).</p></body></html> + + + 0 + + + 12 + + + 6 + + + + + + + Aggressive decoding level: + + + sbAggressive + + + + + + + <html><head/><body><p>Higher levels will increase the probability of decoding, but will also increase probability of a false decode.</p></body></html> + + + 10 + + + + + + + Two-pass decoding + + + true + + + + + + + + + + Qt::Vertical + + + + 0 + 0 + + + + + + + + false + + + + 0 + 50 + + + + FT8 DXpedition mode + + + + + 9 + 10 + 231 + 31 + + + + + + + Fox is the DXpedition station + + + Fox + + + + + + + Everybody else is a Hound + + + Hound + + + + + + + + + + + + @@ -3184,11 +3199,6 @@ soundcard changes calibration_intercept_spin_box frequencies_table_view stations_table_view - pbCQmsg - pbMyCall - pbTxMsg - pbNewDXCC - pbNewCall sbNtrials sbAggressive cbTwoPass diff --git a/mainwindow.cpp b/mainwindow.cpp index 7e76d04..3445852 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -65,6 +65,9 @@ #include "ui_mainwindow.h" #include "moc_mainwindow.cpp" +#define STATE_RX 1 +#define STATE_TX 2 + extern "C" { //----------------------------------------------------- C and Fortran routines @@ -277,6 +280,52 @@ namespace } return ""; } + + void setTextEditFont(QTextEdit *edit, QFont font){ + edit->setFont(font); + edit->setFontFamily(font.family()); + edit->setFontItalic(font.italic()); + edit->setFontPointSize(font.pointSize()); + edit->setFontUnderline(font.underline()); + edit->setFontWeight(font.weight()); + + auto d = edit->document(); + d->setDefaultFont(font); + edit->setDocument(d); + + auto c = edit->textCursor(); + c.select(QTextCursor::Document); + auto cf = c.blockCharFormat(); + cf.setFont(font); + c.mergeBlockCharFormat(cf); + + edit->updateGeometry(); + } + + void setTextEditBackground(QTextEdit *edit, QColor color){ + edit->setStyleSheet(QString("QTextEdit{ background: %1 }").arg(color.name())); + } + + void highlightBlock(QTextBlock block, QFont font, QColor foreground, QColor background){ + QTextCursor cursor(block); + + // Set background color + QTextBlockFormat blockFormat = cursor.blockFormat(); + blockFormat.setBackground(background); + cursor.setBlockFormat(blockFormat); + + // Set font + for (QTextBlock::iterator it = cursor.block().begin(); !(it.atEnd()); ++it) { + QTextCharFormat charFormat = it.fragment().charFormat(); + charFormat.setFont(font); + charFormat.setForeground(QBrush(foreground)); + + QTextCursor tempCursor = cursor; + tempCursor.setPosition(it.fragment().position()); + tempCursor.setPosition(it.fragment().position() + it.fragment().length(), QTextCursor::KeepAnchor); + tempCursor.setCharFormat(charFormat); + } + } } //--------------------------------------------------- MainWindow constructor @@ -628,14 +677,37 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple, // defer initialization until after construction otherwise menu // fonts do not get set QTimer::singleShot (0, this, SLOT (initialize_fonts ())); - connect (&m_config, &Configuration::text_font_changed, [this] (QFont const& font) { + connect (&m_config, &Configuration::gui_text_font_changed, [this] (QFont const& font) { set_application_font (font); - }); - connect (&m_config, &Configuration::decoded_text_font_changed, [this] (QFont const& font) { - setDecodedTextFont (font); - }); + }); + connect (&m_config, &Configuration::rx_text_font_changed, [this] (QFont const&) { + setTextEditFont(ui->textEditRX, m_config.rx_text_font()); + }); + connect (&m_config, &Configuration::tx_text_font_changed, [this] (QFont const&) { + setTextEditFont(ui->extFreeTextMsgEdit, m_config.tx_text_font()); + }); connect (&m_config, &Configuration::colors_changed, [this](){ - ui->textEditRX->setStyleSheet(QString("QTextEdit{ background: %1 }").arg(m_config.color_ReceivedMsg().name())); + setTextEditBackground(ui->textEditRX, m_config.color_rx_background()); + setTextEditBackground(ui->extFreeTextMsgEdit, m_config.color_tx_background()); + + // rehighlight + auto d = ui->textEditRX->document(); + if(d){ + for(int i = 0; i < d->lineCount(); i++){ + auto b = d->findBlockByLineNumber(i); + + switch(b.userState()){ + case STATE_RX: + highlightBlock(b, m_config.rx_text_font(), m_config.color_rx_foreground(), QColor(Qt::transparent)); + break; + case STATE_TX: + highlightBlock(b, m_config.tx_text_font(), m_config.color_tx_foreground(), QColor(Qt::transparent)); + break; + } + } + } + + }); setWindowTitle (program_title ()); @@ -1376,7 +1448,9 @@ void MainWindow::not_GA_warning_message () void MainWindow::initialize_fonts () { set_application_font (m_config.text_font ()); - setDecodedTextFont (m_config.decoded_text_font ()); + + setTextEditFont(ui->textEditRX, m_config.rx_text_font()); + setTextEditFont(ui->extFreeTextMsgEdit, m_config.tx_text_font()); } void MainWindow::splash_done () @@ -1716,7 +1790,7 @@ void MainWindow::readSettings() //ui->bandHorizontalWidget->setGeometry( m_settings->value("PanelWaterfallGeometry", ui->bandHorizontalWidget->geometry()).toRect()); //qDebug() << m_settings->value("PanelTopGeometry") << ui->extFreeTextMsg; - ui->textEditRX->setStyleSheet(QString("QTextEdit { background: %1 }").arg(m_config.color_ReceivedMsg().name())); + ui->textEditRX->setStyleSheet(QString("QTextEdit { background: %1 }").arg(m_config.color_rx_background().name())); { auto const& coeffs = m_settings->value ("PhaseEqualizationCoefficients" @@ -2898,6 +2972,7 @@ void MainWindow::on_actionFox_Log_triggered() void MainWindow::on_actionMessage_averaging_triggered() { +#if 0 if (!m_msgAvgWidget) { m_msgAvgWidget.reset (new MessageAveraging {m_settings, m_config.decoded_text_font ()}); @@ -2908,6 +2983,7 @@ void MainWindow::on_actionMessage_averaging_triggered() m_msgAvgWidget->showNormal(); m_msgAvgWidget->raise (); m_msgAvgWidget->activateWindow (); +#endif } void MainWindow::on_actionOpen_triggered() //Open File @@ -4347,7 +4423,7 @@ void MainWindow::guiUpdate() write_transmit_entry ("ALL.TXT"); if (m_config.TX_messages ()) { ui->decodedTextBrowser2->displayTransmittedText(m_currentMessage,m_modeTx, - ui->TxFreqSpinBox->value(),m_config.color_ReceivedMsg(),m_bFastMode); + ui->TxFreqSpinBox->value(),m_config.color_rx_background(),m_bFastMode); } } @@ -4451,7 +4527,7 @@ void MainWindow::guiUpdate() if (m_config.TX_messages () && !m_tune && !m_config.bFox()) { ui->decodedTextBrowser2->displayTransmittedText(current_message, m_modeTx, - ui->TxFreqSpinBox->value(),m_config.color_ReceivedMsg(),m_bFastMode); + ui->TxFreqSpinBox->value(),m_config.color_rx_background(),m_bFastMode); } switch (m_ntx) @@ -5904,7 +5980,6 @@ void MainWindow::writeNoticeTextToUI(QDateTime date, QString text){ ui->textEditRX->verticalScrollBar()->setValue(ui->textEditRX->verticalScrollBar()->maximum()); } - int MainWindow::writeMessageTextToUI(QDateTime date, QString text, int freq, bool bold, int block){ auto c = ui->textEditRX->textCursor(); @@ -5943,7 +6018,13 @@ int MainWindow::writeMessageTextToUI(QDateTime date, QString text, int freq, boo c.insertHtml(QString("%1 - (%2) - %3").arg(date.time().toString()).arg(freq).arg(text)); } - c.movePosition(QTextCursor::End); + if(bold){ + c.block().setUserState(STATE_TX); + highlightBlock(c.block(), m_config.tx_text_font(), m_config.color_tx_foreground(), QColor(Qt::transparent)); + } else { + c.block().setUserState(STATE_RX); + highlightBlock(c.block(), m_config.rx_text_font(), m_config.color_rx_foreground(), QColor(Qt::transparent)); + } ui->textEditRX->ensureCursorVisible(); ui->textEditRX->verticalScrollBar()->setValue(ui->textEditRX->verticalScrollBar()->maximum()); @@ -6110,6 +6191,9 @@ void MainWindow::on_extFreeTextMsgEdit_currentTextChanged (QString const& text) ui->extFreeTextMsgEdit->setPlainText(x); QTextCursor c = ui->extFreeTextMsgEdit->textCursor(); c.setPosition(pos < maxpos ? pos : maxpos, QTextCursor::MoveAnchor); + + highlightBlock(c.block(), m_config.tx_text_font(), QColor(Qt::black), QColor(Qt::transparent)); + ui->extFreeTextMsgEdit->setTextCursor(c); } @@ -6121,6 +6205,9 @@ void MainWindow::on_extFreeTextMsgEdit_currentTextChanged (QString const& text) ui->startTxButton->setText("Send"); ui->startTxButton->setEnabled(false); } + + + } int MainWindow::currentFreqOffset(){ @@ -11235,7 +11322,7 @@ void MainWindow::foxGenWaveform(int i,QString fm) QString txModeArg; txModeArg.sprintf("FT8fox %d",i+1); ui->decodedTextBrowser2->displayTransmittedText(fm.trimmed(), txModeArg, - ui->TxFreqSpinBox->value()+60*i,m_config.color_ReceivedMsg(),m_bFastMode); + ui->TxFreqSpinBox->value()+60*i,m_config.color_rx_background(),m_bFastMode); foxcom_.i3bit[i]=0; if(fm.indexOf("<")>0) foxcom_.i3bit[i]=1; strncpy(&foxcom_.cmsg[i][0],fm.toLatin1(),40); //Copy this message into cmsg[i] diff --git a/mainwindow.ui b/mainwindow.ui index b35a9d1..67f1300 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -1073,7 +1073,7 @@ background-color: #00ff00; - 12 + 14 false @@ -1102,7 +1102,7 @@ background-color: #00ff00; - 12 + 14