From afbcf35d1c21777abcc836d6ae768f2e2040f159 Mon Sep 17 00:00:00 2001 From: Jordan Sherer Date: Sat, 15 Sep 2018 17:33:19 -0400 Subject: [PATCH] Added test button to notification sounds --- Configuration.cpp | 135 +++++++- Configuration.hpp | 5 + Configuration.ui | 831 +++++++++++++++++++++++++++++----------------- 3 files changed, 653 insertions(+), 318 deletions(-) diff --git a/Configuration.cpp b/Configuration.cpp index 15bf061..301f42a 100644 --- a/Configuration.cpp +++ b/Configuration.cpp @@ -156,6 +156,7 @@ #include #include #include +#include #include #include #include @@ -433,6 +434,7 @@ private: void insert_station (); Q_SLOT void on_font_push_button_clicked (); + Q_SLOT void on_tableFontButton_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); @@ -461,8 +463,10 @@ private: Q_SLOT void on_save_path_select_push_button_clicked (bool); Q_SLOT void on_azel_path_select_push_button_clicked (bool); Q_SLOT void on_sound_dm_path_select_push_button_clicked(); + Q_SLOT void on_sound_dm_path_test_push_button_clicked(); Q_SLOT void on_sound_dm_path_reset_push_button_clicked(); Q_SLOT void on_sound_am_path_select_push_button_clicked(); + Q_SLOT void on_sound_am_path_test_push_button_clicked(); Q_SLOT void on_sound_am_path_reset_push_button_clicked(); Q_SLOT void on_calibration_intercept_spin_box_valueChanged (double); Q_SLOT void on_calibration_slope_ppm_spin_box_valueChanged (double); @@ -470,6 +474,9 @@ 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_tableBackgroundButton_clicked(); + Q_SLOT void on_tableSelectedRowBackgroundButton_clicked(); + Q_SLOT void on_tableForegroundButton_clicked(); Q_SLOT void on_rxBackgroundButton_clicked(); Q_SLOT void on_rxForegroundButton_clicked(); Q_SLOT void on_rxFontButton_clicked(); @@ -515,6 +522,9 @@ private: QFont font_; QFont next_font_; + QFont table_font_; + QFont next_table_font_; + QFont rx_text_font_; QFont next_rx_text_font_; @@ -583,6 +593,14 @@ private: QColor next_color_cq_; QColor color_mycall_; QColor next_color_mycall_; + + QColor color_table_background_; + QColor next_color_table_background_; + QColor color_table_highlight_; + QColor next_color_table_highlight_; + QColor color_table_foreground_; + QColor next_color_table_foreground_; + QColor color_rx_background_; QColor next_color_rx_background_; QColor color_rx_foreground_; @@ -698,6 +716,9 @@ 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_table_background() const { return m_->color_table_background_; } +QColor Configuration::color_table_highlight() const { return m_->color_table_highlight_; } +QColor Configuration::color_table_foreground() const { return m_->color_table_foreground_; } 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_;} @@ -707,6 +728,7 @@ QColor Configuration::color_compose_background () const {return m_->color_compos QColor Configuration::color_compose_foreground () const {return m_->color_compose_foreground_;} QColor Configuration::color_DXCC () const {return m_->color_DXCC_;} QColor Configuration::color_NewCall () const {return m_->color_NewCall_;} +QFont Configuration::table_font () const {return m_->table_font_;} QFont Configuration::text_font () const {return m_->font_;} QFont Configuration::rx_text_font () const {return m_->rx_text_font_;} QFont Configuration::tx_text_font () const {return m_->tx_text_font_;} @@ -1280,10 +1302,13 @@ 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_->rxLabel->setStyleSheet(QString("background: %1").arg(color_rx_background_.name())); + ui_->tableBackgroundLabel->setStyleSheet(QString("background: %1; color: %2").arg(next_color_table_background_.name()).arg(next_color_table_foreground_.name())); + ui_->tableSelectionBackgroundLabel->setStyleSheet(QString("background: %1; color: %2").arg(next_color_table_highlight_.name()).arg(next_color_table_foreground_.name())); + ui_->labCQ->setStyleSheet(QString("background: %1; color: %2").arg(next_color_cq_.name()).arg(next_color_table_foreground_.name())); + ui_->labMyCall->setStyleSheet(QString("background: %1; color: %2").arg(next_color_mycall_.name()).arg(next_color_table_foreground_.name())); + + ui_->rxLabel->setStyleSheet(QString("background: %1; color: %2").arg(color_rx_background_.name()).arg(color_rx_foreground_.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_->composeLabel->setStyleSheet(QString("background: %1; color: %2").arg(color_compose_background_.name()).arg(color_compose_foreground_.name())); @@ -1428,6 +1453,10 @@ void Configuration::impl::read_settings () next_color_DXCC_ = color_DXCC_ = settings_->value("colorDXCC","#ff00ff").toString(); next_color_NewCall_ = color_NewCall_ = settings_->value("colorNewCall","#ffaaff").toString(); + next_color_table_background_ = color_table_background_ = settings_->value("colorTableBackground", "#ffffff").toString(); + next_color_table_highlight_ = color_table_highlight_ = settings_->value("colorTableHighlight", "#3498db").toString(); + next_color_table_foreground_ = color_table_foreground_ = settings_->value("colorTableForeground","#000000").toString(); + if (next_font_.fromString (settings_->value ("Font", QGuiApplication::font ().toString ()).toString ()) && next_font_ != font_) { @@ -1476,9 +1505,20 @@ void Configuration::impl::read_settings () { next_compose_text_font_ = compose_text_font_; } - ui_->composeFontButton->setText(QString("Font (%1 %2)").arg(next_compose_text_font_.family()).arg(next_compose_text_font_.pointSize())); + if (next_table_font_.fromString (settings_->value ("tableFont", QGuiApplication::font ().toString ()).toString ()) + && next_table_font_ != table_font_) + { + table_font_ = next_table_font_; + Q_EMIT self_->table_font_changed (table_font_); + } + else + { + next_table_font_ = table_font_; + } + ui_->tableFontButton->setText(QString("Font (%1 %2)").arg(next_table_font_.family()).arg(next_table_font_.pointSize())); + id_interval_ = settings_->value ("IDint", 0).toInt (); ntrials_ = settings_->value ("nTrials", 6).toInt (); txDelay_ = settings_->value ("TxDelay",0.2).toDouble(); @@ -1666,9 +1706,18 @@ void Configuration::impl::write_settings () settings_->setValue("color_tx_foreground",color_tx_foreground_); settings_->setValue("colorDXCC",color_DXCC_); settings_->setValue("colorNewCall",color_NewCall_); + + settings_->setValue("colorTableBackground",color_table_background_); + settings_->setValue("colorTableHighlight",color_table_highlight_); + settings_->setValue("colorTableForeground",color_table_foreground_); + + settings_->setValue ("Font", font_.toString ()); settings_->setValue ("RXTextFont", rx_text_font_.toString ()); settings_->setValue ("TXTextFont", tx_text_font_.toString ()); + settings_->setValue ("composeTextFont", compose_text_font_.toString ()); + settings_->setValue ("tableFont", table_font_.toString()); + settings_->setValue ("IDint", id_interval_); settings_->setValue ("nTrials", ntrials_); settings_->setValue ("TxDelay", txDelay_); @@ -2048,6 +2097,12 @@ void Configuration::impl::accept () Q_EMIT self_->compose_text_font_changed (compose_text_font_); } + if (next_table_font_ != table_font_) + { + table_font_ = next_table_font_; + Q_EMIT self_->table_font_changed (table_font_); + } + color_cq_ = next_color_cq_; color_mycall_ = next_color_mycall_; color_rx_background_ = next_color_rx_background_; @@ -2057,6 +2112,9 @@ void Configuration::impl::accept () color_tx_foreground_ = next_color_tx_foreground_; color_DXCC_ = next_color_DXCC_; color_NewCall_ = next_color_NewCall_; + color_table_background_ = next_color_table_background_; + color_table_highlight_ = next_color_table_highlight_; + color_table_foreground_ = next_color_table_foreground_; Q_EMIT self_->colors_changed(); @@ -2287,11 +2345,19 @@ void Configuration::impl::on_font_push_button_clicked () ui_->font_push_button->setText(QString("Application Font (%1 %2)").arg(next_font_.family()).arg(next_font_.pointSize())); } +void Configuration::impl::on_tableFontButton_clicked () +{ + next_table_font_ = QFontDialog::getFont (0, next_table_font_, this); + ui_->tableFontButton->setText(QString("Table Font (%1 %2)").arg(next_table_font_.family()).arg(next_table_font_.pointSize())); +} + + QColor getColor(QColor initial, QWidget *parent, QString title){ QList custom = { QColor("#66FF66"), QColor("#FF6666"), - QColor("#FFEAA7") + QColor("#FFEAA7"), + QColor("#3498DB") }; auto d = new QColorDialog(initial, parent); @@ -2313,7 +2379,7 @@ void Configuration::impl::on_pbCQmsg_clicked() if (new_color.isValid ()) { next_color_cq_ = new_color; - ui_->labCQ->setStyleSheet(QString("background: %1").arg(next_color_cq_.name())); + ui_->labCQ->setStyleSheet(QString("background: %1; color: %2").arg(next_color_cq_.name()).arg(next_color_table_foreground_.name())); } } @@ -2323,7 +2389,40 @@ void Configuration::impl::on_pbMyCall_clicked() if (new_color.isValid ()) { next_color_mycall_ = new_color; - ui_->labMyCall->setStyleSheet(QString("background: %1").arg(next_color_mycall_.name())); + ui_->labMyCall->setStyleSheet(QString("background: %1; color: %2").arg(next_color_mycall_.name()).arg(next_color_table_foreground_.name())); + } +} + +void Configuration::impl::on_tableBackgroundButton_clicked() +{ + auto new_color = getColor(next_color_table_background_, this, "Table Background Color"); + if (new_color.isValid ()) + { + next_color_table_background_ = new_color; + ui_->tableBackgroundLabel->setStyleSheet(QString("background: %1; color: %2").arg(next_color_table_background_.name()).arg(next_color_table_foreground_.name())); + } +} + +void Configuration::impl::on_tableSelectedRowBackgroundButton_clicked() +{ + auto new_color = getColor(next_color_table_highlight_, this, "Table Selected Row Background Color"); + if (new_color.isValid ()) + { + next_color_table_highlight_ = new_color; + ui_->tableSelectionBackgroundLabel->setStyleSheet(QString("background: %1; color: %2").arg(next_color_table_highlight_.name()).arg(next_color_table_foreground_.name())); + } +} + +void Configuration::impl::on_tableForegroundButton_clicked() +{ + auto new_color = getColor(next_color_table_foreground_, this, "Table Foreground Color"); + if (new_color.isValid ()) + { + next_color_table_foreground_ = new_color; + ui_->tableBackgroundLabel->setStyleSheet(QString("background: %1; color: %2").arg(next_color_table_background_.name()).arg(next_color_table_foreground_.name())); + ui_->tableSelectionBackgroundLabel->setStyleSheet(QString("background: %1; color: %2").arg(next_color_table_highlight_.name()).arg(next_color_table_foreground_.name())); + ui_->labCQ->setStyleSheet(QString("background: %1; color: %2").arg(next_color_cq_.name()).arg(next_color_table_foreground_.name())); + ui_->labMyCall->setStyleSheet(QString("background: %1; color: %2").arg(next_color_mycall_.name()).arg(next_color_table_foreground_.name())); } } @@ -2333,7 +2432,7 @@ void Configuration::impl::on_rxBackgroundButton_clicked() if (new_color.isValid ()) { next_color_rx_background_ = new_color; - ui_->rxLabel->setStyleSheet(QString("background: %1").arg(next_color_rx_background_.name())); + ui_->rxLabel->setStyleSheet(QString("background: %1; color: %2").arg(color_rx_background_.name()).arg(color_rx_foreground_.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())); } @@ -2345,7 +2444,7 @@ void Configuration::impl::on_rxForegroundButton_clicked() if (new_color.isValid ()) { next_color_rx_foreground_ = new_color; - ui_->rxLabel->setStyleSheet(QString("background: %1").arg(next_color_rx_background_.name())); + ui_->rxLabel->setStyleSheet(QString("background: %1; color: %2").arg(color_rx_background_.name()).arg(color_rx_foreground_.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())); } @@ -2805,6 +2904,15 @@ void Configuration::impl::on_sound_dm_path_select_push_button_clicked(){ } } +void Configuration::impl::on_sound_dm_path_test_push_button_clicked(){ + auto path = ui_->sound_dm_path_display_label->text(); + if(path.isEmpty()){ + return; + } + + QSound::play(path); +} + void Configuration::impl::on_sound_dm_path_reset_push_button_clicked(){ ui_->sound_dm_path_display_label->clear(); } @@ -2827,6 +2935,15 @@ void Configuration::impl::on_sound_am_path_select_push_button_clicked(){ } } +void Configuration::impl::on_sound_am_path_test_push_button_clicked(){ + auto path = ui_->sound_am_path_display_label->text(); + if(path.isEmpty()){ + return; + } + + QSound::play(path); +} + void Configuration::impl::on_sound_am_path_reset_push_button_clicked(){ ui_->sound_am_path_display_label->clear(); } diff --git a/Configuration.hpp b/Configuration.hpp index 5561086..3a2bec4 100644 --- a/Configuration.hpp +++ b/Configuration.hpp @@ -103,6 +103,7 @@ public: QString my_qth () const; QString cq_message () const; QString reply_message () const; + QFont table_font() const; QFont text_font () const; QFont rx_text_font () const; QFont tx_text_font () const; @@ -181,6 +182,9 @@ public: QString sound_am_path() const; QString rig_name () const; Type2MsgGen type_2_msg_gen () const; + QColor color_table_background() const; + QColor color_table_highlight() const; + QColor color_table_foreground() const; QColor color_CQ () const; QColor color_MyCall () const; QColor color_rx_background () const; @@ -284,6 +288,7 @@ public: Q_SIGNAL void tx_text_font_changed (QFont); Q_SIGNAL void rx_text_font_changed (QFont); Q_SIGNAL void compose_text_font_changed (QFont); + Q_SIGNAL void table_font_changed (QFont); Q_SIGNAL void colors_changed (); // diff --git a/Configuration.ui b/Configuration.ui index b303b24..128fdad 100644 --- a/Configuration.ui +++ b/Configuration.ui @@ -2592,13 +2592,17 @@ Right click for insert and delete options. 0 - - + + - Directed Message Received: + Clear - - azel_path_select_push_button + + + + + + Clear @@ -2618,20 +2622,13 @@ Right click for insert and delete options. - - + + Select - - - - Clear - - - @@ -2642,6 +2639,23 @@ Right click for insert and delete options. + + + + Select + + + + + + + Directed Message Received: + + + azel_path_select_push_button + + + @@ -2658,17 +2672,17 @@ Right click for insert and delete options. - - + + - Select + Test - + - Clear + Test @@ -2745,297 +2759,496 @@ Right click for insert and delete options. - - - Band Activity Background: + + + 0 - - - - - - 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 - - - - + + false + + + + Band && Call Activity + + + + 0 + + + 18 + + + + + + + + false + + + + + + + 80 + 20 + + + + QLabel{background-color: white}<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <widget name="__qt_fake_top_level"> + <widget class="QLabel" name="labCQ"> + <property name="geometry"> + <rect> + <x>12</x> + <y>32</y> + <width>302</width> + <height>25</height> + </rect> + </property> + <property name="minimumSize"> + <size> + <width>80</width> + <height>20</height> + </size> + </property> + <property name="styleSheet"> + <string notr="true">QLabel{background-color: #66ff66}</string> + </property> + <property name="text"> + <string>K1ABC</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </widget> + <resources/> +</ui> + + + + K1ABC + + + Qt::AlignCenter + + + + + + + + 140 + 0 + + + + Directed Message Color + + + + + + + + 140 + 0 + + + + CQ Color + + + + + + + + 80 + 20 + + + + QLabel{background-color: #66ff66} + + + K1ABC + + + Qt::AlignCenter + + + + + + + Selected Row Background + + + + + + + + 80 + 20 + + + + QLabel{background-color: #3498db}<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <widget name="__qt_fake_top_level"> + <widget class="QLabel" name="labCQ"> + <property name="geometry"> + <rect> + <x>12</x> + <y>32</y> + <width>302</width> + <height>25</height> + </rect> + </property> + <property name="minimumSize"> + <size> + <width>80</width> + <height>20</height> + </size> + </property> + <property name="styleSheet"> + <string notr="true">QLabel{background-color: #66ff66}</string> + </property> + <property name="text"> + <string>K1ABC</string> + </property> + <property name="alignment"> + <set>Qt::AlignCenter</set> + </property> + </widget> + </widget> + <resources/> +</ui> + + + + K1ABC + + + Qt::AlignCenter + + + + + + + + 80 + 20 + + + + QLabel{background-color: #ff6666} + + + K1ABC + + + Qt::AlignCenter + + + + + + + Foreground Color + + + + + + + Font + + + + + + + Table Background + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + + + + Messages + + + + 0 + + + 18 + + + + + + + + + + + Font + + + + + + + true + + + + 140 + 0 + + + + Textbox Background Color + + + + + + + Foreground Color + + + + + + + QLabel{background-color: #ffeaa7} + + + K1ABC + + + Qt::AlignCenter + + + + + + + true + + + + 80 + 20 + + + + QLabel{background-color: #ffeaa7} + + + K1ABC + + + Qt::AlignCenter + + + + + + + QLabel{background-color: #ffeaa7} + + + K1ABC + + + Qt::AlignCenter + + + + + + + Transmitted: + + + + + + + Font + + + + + + + Foreground Color + + + + + + + Received: + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Qt::Vertical + + + QSizePolicy::Minimum + + + + 20 + 20 + + + + + + + + Qt::Vertical + + + QSizePolicy::Minimum + + + + 20 + 20 + + + + + + + + + + + + Composition + + + + 0 + + + 18 + + + + + + + + + + + Textbox Background Color + + + + + + + true + + + + 80 + 20 + + + + QLabel{background-color: #FFF} + + + K1ABC + + + Qt::AlignCenter + + + + + + + Foreground Color + + + + + + + Font + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + - - - - Messages: - - - - - - Font - - - - - - - true - - - - 140 - 0 - - - - Textbox Color - - - - - - - Foreground Color - - - - - - - QLabel{background-color: #ffeaa7} - - - K1ABC - - - Qt::AlignCenter - - - - - - - true - - - - 80 - 20 - - - - QLabel{background-color: #ffeaa7} - - - K1ABC - - - Qt::AlignCenter - - - - - - - QLabel{background-color: #ffeaa7} - - - K1ABC - - - Qt::AlignCenter - - - - - - - Transmitted: - - - - - - - Font - - - - - - - Foreground Color - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - Received: - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - Message Composition: - - - - - - Textbox Color - - - - - - - Font - - - - - - - true - - - - 80 - 20 - - - - QLabel{background-color: #FFF} - - - K1ABC - - - Qt::AlignCenter - - - - - - - Foreground Color - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - @@ -3477,11 +3690,11 @@ soundcard changes - - + +