Added CQ messages color back in, separate from primary and secondary highlighting

This commit is contained in:
Jordan Sherer 2019-07-11 20:29:32 -04:00
parent b4b1abd62d
commit e5883a14b9
4 changed files with 231 additions and 168 deletions

View File

@ -467,6 +467,7 @@ private:
Q_SLOT void on_calibration_slope_ppm_spin_box_valueChanged (double);
Q_SLOT void handle_transceiver_update (TransceiverState const&, unsigned sequence_number);
Q_SLOT void handle_transceiver_failure (QString const& reason);
Q_SLOT void on_cqMessagesButton_clicked();
Q_SLOT void on_primaryHighlightButton_clicked();
Q_SLOT void on_secondaryHighlightButton_clicked();
Q_SLOT void on_pbMyCall_clicked();
@ -591,6 +592,8 @@ private:
QColor next_color_primary_highlight_;
QColor color_secondary_highlight_;
QColor next_color_secondary_highlight_;
QColor color_cq_;
QColor next_color_cq_;
QColor color_mycall_;
QColor next_color_mycall_;
@ -728,6 +731,7 @@ QColor Configuration::color_table_highlight() const { return m_->color_table_hi
QColor Configuration::color_table_foreground() const { return m_->color_table_foreground_; }
QColor Configuration::color_primary_highlight () const {return m_->color_primary_highlight_;}
QColor Configuration::color_secondary_highlight () const {return m_->color_secondary_highlight_;}
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_;}
@ -1417,6 +1421,7 @@ void Configuration::impl::initialize_models ()
ui_->tableSelectionBackgroundLabel->setStyleSheet(QString("background: %1; color: %2").arg(next_color_table_highlight_.name()).arg(next_color_table_foreground_.name()));
ui_->primaryHighlightLabel->setStyleSheet(QString("background: %1; color: %2").arg(next_color_primary_highlight_.name()).arg(next_color_table_foreground_.name()));
ui_->secondaryHighlightLabel->setStyleSheet(QString("background: %1; color: %2").arg(next_color_secondary_highlight_.name()).arg(next_color_table_foreground_.name()));
ui_->cqMessagesLabel->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()));
@ -1559,7 +1564,7 @@ void Configuration::impl::read_settings ()
my_groups_ = settings_->value("MyGroups", QStringList{}).toStringList();
auto_whitelist_ = settings_->value("AutoWhitelist", QStringList{}).toStringList();
auto_blacklist_ = settings_->value("AutoBlacklist", QStringList{}).toStringList();
primary_highlight_words_ = settings_->value("PrimaryHighlightWords", QStringList{"CQ"}).toStringList();
primary_highlight_words_ = settings_->value("PrimaryHighlightWords", QStringList{}).toStringList();
secondary_highlight_words_ = settings_->value("SecondaryHighlightWords", QStringList{}).toStringList();
callsign_aging_ = settings_->value ("CallsignAging", 0).toInt ();
activity_aging_ = settings_->value ("ActivityAging", 2).toInt ();
@ -1567,7 +1572,8 @@ void Configuration::impl::read_settings ()
my_info_ = settings_->value("MyInfo", QString {}).toString();
cq_ = settings_->value("CQMessage", QString {"CQ CQ CQ <MYGRID4>"}).toString();
reply_ = settings_->value("Reply", QString {"HW CPY?"}).toString();
next_color_primary_highlight_ = color_primary_highlight_ = settings_->value("colorPrimary", settings_->value("colorCQ","#66ff66").toString()).toString();
next_color_cq_ = color_cq_ = settings_->value("colorCQ","#66ff66").toString();
next_color_primary_highlight_ = color_primary_highlight_ = settings_->value("colorPrimary", "#f1c40f").toString();
next_color_secondary_highlight_ = color_secondary_highlight_ = settings_->value("colorSecondary","#ffff66").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();
@ -1837,7 +1843,8 @@ void Configuration::impl::write_settings ()
settings_->setValue ("Reply", reply_);
settings_->setValue ("CallsignAging", callsign_aging_);
settings_->setValue ("ActivityAging", activity_aging_);
settings_->setValue("colorCQ",color_primary_highlight_);
settings_->setValue("colorCQ", color_cq_);
settings_->setValue("colorPrimary", color_primary_highlight_);
settings_->setValue("colorSecondary",color_secondary_highlight_);
settings_->setValue("colorMyCall",color_mycall_);
settings_->setValue("color_rx_background",color_rx_background_);
@ -2333,6 +2340,7 @@ void Configuration::impl::accept ()
color_primary_highlight_ = next_color_primary_highlight_;
color_secondary_highlight_ = next_color_secondary_highlight_;
color_cq_ = next_color_cq_;
color_mycall_ = next_color_mycall_;
color_rx_background_ = next_color_rx_background_;
color_rx_foreground_ = next_color_rx_foreground_;
@ -2625,6 +2633,15 @@ QColor getColor(QColor initial, QWidget *parent, QString title){
}
}
void Configuration::impl::on_cqMessagesButton_clicked(){
auto new_color = getColor(next_color_cq_, this, "CQ Messages Color");
if (new_color.isValid ())
{
next_color_cq_ = new_color;
ui_->cqMessagesLabel->setStyleSheet(QString("background: %1; color: %2").arg(next_color_cq_.name()).arg(next_color_table_foreground_.name()));
}
}
void Configuration::impl::on_primaryHighlightButton_clicked()
{
auto new_color = getColor(next_color_primary_highlight_, this, "Primary Highlight Color");
@ -2687,6 +2704,7 @@ void Configuration::impl::on_tableForegroundButton_clicked()
ui_->tableSelectionBackgroundLabel->setStyleSheet(QString("background: %1; color: %2").arg(next_color_table_highlight_.name()).arg(next_color_table_foreground_.name()));
ui_->primaryHighlightLabel->setStyleSheet(QString("background: %1; color: %2").arg(next_color_primary_highlight_.name()).arg(next_color_table_foreground_.name()));
ui_->secondaryHighlightLabel->setStyleSheet(QString("background: %1; color: %2").arg(next_color_secondary_highlight_.name()).arg(next_color_table_foreground_.name()));
ui_->cqMessagesLabel->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()));
}
}

View File

@ -206,6 +206,7 @@ public:
QColor color_table_foreground() const;
QColor color_primary_highlight () const;
QColor color_secondary_highlight () const;
QColor color_CQ () const;
QColor color_MyCall () const;
QColor color_rx_background () const;
QColor color_rx_foreground () const;

View File

@ -23,7 +23,7 @@
<string>Select tab to change configuration parameters.</string>
</property>
<property name="currentIndex">
<number>0</number>
<number>6</number>
</property>
<widget class="QWidget" name="general_tab">
<attribute name="title">
@ -277,8 +277,8 @@
<property name="geometry">
<rect>
<x>0</x>
<y>-355</y>
<width>724</width>
<y>0</y>
<width>615</width>
<height>808</height>
</rect>
</property>
@ -1022,8 +1022,8 @@ radio interface behave as expected.</string>
<property name="geometry">
<rect>
<x>0</x>
<y>-49</y>
<width>718</width>
<y>0</y>
<width>264</width>
<height>435</height>
</rect>
</property>
@ -1443,7 +1443,7 @@ a few, particularly some Kenwood rigs, require it).</string>
<property name="geometry">
<rect>
<x>0</x>
<y>-104</y>
<y>0</y>
<width>718</width>
<height>490</height>
</rect>
@ -3002,7 +3002,7 @@ QListView::item:hover {
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>2</number>
<number>0</number>
</property>
<property name="tabBarAutoHide">
<bool>false</bool>
@ -3038,7 +3038,7 @@ QListView::item:hover {
<x>0</x>
<y>0</y>
<width>724</width>
<height>387</height>
<height>418</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_14">
@ -3065,18 +3065,51 @@ QListView::item:hover {
<property name="bottomMargin">
<number>0</number>
</property>
<item row="11" column="1">
<widget class="QLineEdit" name="secondaryHighlightLineEdit"/>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="tableFontButton">
<item row="8" column="1">
<widget class="QPushButton" name="primaryHighlightButton">
<property name="minimumSize">
<size>
<width>140</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Font</string>
<string>Primary Highlight Background</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="tableBackgroundLabel">
<item row="10" column="1">
<spacer name="verticalSpacer_17">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="tableForegroundButton">
<property name="text">
<string>Foreground Color</string>
</property>
</widget>
</item>
<item row="9" column="0">
<widget class="QLabel" name="label_25">
<property name="text">
<string>Highlight these words or callsigns with the primary background color (comma separated):</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="tableSelectionBackgroundLabel">
<property name="minimumSize">
<size>
<width>80</width>
@ -3084,7 +3117,7 @@ QListView::item:hover {
</size>
</property>
<property name="styleSheet">
<string notr="true">QLabel{background-color: white}&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
<string notr="true">QLabel{background-color: #3498db}&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;ui version=&quot;4.0&quot;&gt;
&lt;widget name=&quot;__qt_fake_top_level&quot;&gt;
&lt;widget class=&quot;QLabel&quot; name=&quot;labCQ&quot;&gt;
@ -3125,21 +3158,27 @@ QListView::item:hover {
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QPushButton" name="pbMyCall">
<item row="8" column="0">
<widget class="QLabel" name="primaryHighlightLabel">
<property name="minimumSize">
<size>
<width>140</width>
<height>0</height>
<width>80</width>
<height>20</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">QLabel{background-color: #f1c40f}</string>
</property>
<property name="text">
<string>Directed Messages Background</string>
<string>K1ABC</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="2" column="1">
<spacer name="verticalSpacer">
<item row="7" column="1">
<spacer name="verticalSpacer_11">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
@ -3151,44 +3190,8 @@ QListView::item:hover {
</property>
</spacer>
</item>
<item row="7" column="0">
<widget class="QLabel" name="primaryHighlightLabel">
<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>
</item>
<item row="8" column="0">
<widget class="QLabel" name="label_25">
<property name="text">
<string>Highlight these words or callsigns with the primary background color (comma separated):</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QPushButton" name="tableForegroundButton">
<property name="text">
<string>Foreground Color</string>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QPushButton" name="primaryHighlightButton">
<item row="11" column="1">
<widget class="QPushButton" name="secondaryHighlightButton">
<property name="minimumSize">
<size>
<width>140</width>
@ -3196,10 +3199,13 @@ QListView::item:hover {
</size>
</property>
<property name="text">
<string>Primary Highlight Background</string>
<string>Secondary Highlight Background</string>
</property>
</widget>
</item>
<item row="12" column="1">
<widget class="QLineEdit" name="secondaryHighlightLineEdit"/>
</item>
<item row="3" column="1">
<widget class="QPushButton" name="tableBackgroundButton">
<property name="text">
@ -3257,54 +3263,8 @@ QListView::item:hover {
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QPushButton" name="tableSelectedRowBackgroundButton">
<property name="text">
<string>Selected Row Background</string>
</property>
</widget>
</item>
<item row="6" column="1">
<spacer name="verticalSpacer_11">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="10" column="1">
<widget class="QPushButton" name="secondaryHighlightButton">
<property name="minimumSize">
<size>
<width>140</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Secondary Highlight Background</string>
</property>
</widget>
</item>
<item row="9" column="1">
<spacer name="verticalSpacer_17">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="10" column="0">
<widget class="QLabel" name="secondaryHighlightLabel">
<item row="3" column="0">
<widget class="QLabel" name="tableBackgroundLabel">
<property name="minimumSize">
<size>
<width>80</width>
@ -3312,58 +3272,7 @@ QListView::item:hover {
</size>
</property>
<property name="styleSheet">
<string notr="true">QLabel{background-color: #ffff66}</string>
</property>
<property name="text">
<string>K1ABC</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="labMyCall">
<property name="minimumSize">
<size>
<width>80</width>
<height>20</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">QLabel{background-color: #ff6666}</string>
</property>
<property name="text">
<string>K1ABC</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="8" column="1">
<widget class="QLineEdit" name="primaryHighlightLineEdit"/>
</item>
<item row="11" column="0">
<widget class="QLabel" name="label_20">
<property name="text">
<string>Highlight these words or callsigns with the secondary background color (comma separated):</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="tableSelectionBackgroundLabel">
<property name="minimumSize">
<size>
<width>80</width>
<height>20</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">QLabel{background-color: #3498db}&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
<string notr="true">QLabel{background-color: white}&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;ui version=&quot;4.0&quot;&gt;
&lt;widget name=&quot;__qt_fake_top_level&quot;&gt;
&lt;widget class=&quot;QLabel&quot; name=&quot;labCQ&quot;&gt;
@ -3404,6 +3313,129 @@ QListView::item:hover {
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="tableFontButton">
<property name="text">
<string>Font</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="cqMessagesLabel">
<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>
</item>
<item row="6" column="0">
<widget class="QLabel" name="labMyCall">
<property name="minimumSize">
<size>
<width>80</width>
<height>20</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">QLabel{background-color: #ff6666}</string>
</property>
<property name="text">
<string>K1ABC</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item row="6" column="1">
<widget class="QPushButton" name="pbMyCall">
<property name="minimumSize">
<size>
<width>140</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>Directed Messages Background</string>
</property>
</widget>
</item>
<item row="5" column="1">
<widget class="QPushButton" name="cqMessagesButton">
<property name="minimumSize">
<size>
<width>140</width>
<height>0</height>
</size>
</property>
<property name="text">
<string>CQ Messages Background</string>
</property>
</widget>
</item>
<item row="12" column="0">
<widget class="QLabel" name="label_20">
<property name="text">
<string>Highlight these words or callsigns with the secondary background color (comma separated):</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="QLineEdit" name="primaryHighlightLineEdit"/>
</item>
<item row="4" column="1">
<widget class="QPushButton" name="tableSelectedRowBackgroundButton">
<property name="text">
<string>Selected Row Background</string>
</property>
</widget>
</item>
<item row="2" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="11" column="0">
<widget class="QLabel" name="secondaryHighlightLabel">
<property name="minimumSize">
<size>
<width>80</width>
<height>20</height>
</size>
</property>
<property name="styleSheet">
<string notr="true">QLabel{background-color: #ffff66}</string>
</property>
<property name="text">
<string>K1ABC</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
@ -3458,8 +3490,8 @@ QListView::item:hover {
<rect>
<x>0</x>
<y>0</y>
<width>738</width>
<height>378</height>
<width>233</width>
<height>253</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_5">

View File

@ -11583,6 +11583,12 @@ void MainWindow::displayBandActivity() {
if(!text.isEmpty()){
auto words = QSet<QString>::fromList(joined.replace(":", " ").replace(">"," ").split(" "));
if(words.contains("CQ")){
for(int i = 0; i < ui->tableWidgetRXAll->columnCount(); i++){
ui->tableWidgetRXAll->item(row, i)->setBackground(QBrush(m_config.color_CQ()));
}
}
auto matchingSecondaryWords = m_config.secondary_highlight_words() & words;
if (!matchingSecondaryWords.isEmpty()){
for(int i = 0; i < ui->tableWidgetRXAll->columnCount(); i++){
@ -11894,6 +11900,12 @@ void MainWindow::displayCallActivity() {
}
}
if(hasCQ){
for(int i = 0; i < ui->tableWidgetRXAll->columnCount(); i++){
ui->tableWidgetCalls->item(row, i)->setBackground(QBrush(m_config.color_CQ()));
}
}
if (m_config.secondary_highlight_words().contains(call)){
for(int i = 0; i < ui->tableWidgetCalls->columnCount(); i++){
ui->tableWidgetCalls->item(row, i)->setBackground(QBrush(m_config.color_secondary_highlight()));