diff --git a/Configuration.cpp b/Configuration.cpp index 27644b4..6dc7dc3 100644 --- a/Configuration.cpp +++ b/Configuration.cpp @@ -591,6 +591,7 @@ private: QStringList my_groups_; QStringList auto_whitelist_; QStringList auto_blacklist_; + QStringList highlight_words_; QString eot_; QString my_info_; QString cq_; @@ -1010,6 +1011,10 @@ QSet Configuration::auto_blacklist() const { return QSet::fromList(m_->auto_blacklist_); } +QSet Configuration::highlight_words() const { + return QSet::fromList(m_->highlight_words_); +} + QString Configuration::eot() const { return m_->eot_; } @@ -1406,6 +1411,7 @@ void Configuration::impl::initialize_models () ui_->groups_line_edit->setText(my_groups_.join(", ")); ui_->auto_whitelist_line_edit->setText(auto_whitelist_.join(", ")); ui_->auto_blacklist_line_edit->setText(auto_blacklist_.join(", ")); + ui_->highlightTextEdit->setText(highlight_words_.join(", ")); ui_->eot_line_edit->setText(eot_.trimmed().left(2)); ui_->info_message_line_edit->setText (my_info_.toUpper()); ui_->cq_message_line_edit->setText(cq_.toUpper().replace("CQCQCQ", "CQ CQ CQ")); @@ -1560,6 +1566,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(); + highlight_words_ = settings_->value("HighlightWords", QStringList{"CQ"}).toStringList(); callsign_aging_ = settings_->value ("CallsignAging", 0).toInt (); activity_aging_ = settings_->value ("ActivityAging", 2).toInt (); eot_ = settings_->value("EOTCharacter", QString{"\u2662"}).toString().trimmed().left(2); @@ -1830,6 +1837,7 @@ void Configuration::impl::write_settings () settings_->setValue ("MyGroups", my_groups_); settings_->setValue ("AutoWhitelist", auto_whitelist_); settings_->setValue ("AutoBlacklist", auto_blacklist_); + settings_->setValue ("HighlightWords", highlight_words_); settings_->setValue ("EOTCharacter", eot_); settings_->setValue ("MyInfo", my_info_); settings_->setValue ("CQMessage", cq_); @@ -2125,7 +2133,7 @@ QStringList splitGroups(QString groupsString, bool filter){ return groups; } -QStringList splitCalls(QString callsString){ +QStringList splitWords(QString callsString){ QStringList calls; if(callsString.isEmpty()){ return calls; @@ -2159,7 +2167,7 @@ bool Configuration::impl::validate () } } - foreach(auto call, splitCalls(ui_->auto_whitelist_line_edit->text().toUpper().trimmed())){ + foreach(auto call, splitWords(ui_->auto_whitelist_line_edit->text().toUpper().trimmed())){ if(!Varicode::isValidCallsign(call, nullptr)){ MessageBox::critical_message (this, QString("%1 is not a valid callsign to whitelist").arg(call)); return false; @@ -2429,8 +2437,9 @@ void Configuration::impl::accept () my_callsign_ = ui_->callsign_line_edit->text ().toUpper().trimmed(); my_grid_ = ui_->grid_line_edit->text ().toUpper().trimmed(); my_groups_ = splitGroups(ui_->groups_line_edit->text().toUpper().trimmed(), true); - auto_whitelist_ = splitCalls(ui_->auto_whitelist_line_edit->text().toUpper().trimmed()); - auto_blacklist_ = splitCalls(ui_->auto_blacklist_line_edit->text().toUpper().trimmed()); + auto_whitelist_ = splitWords(ui_->auto_whitelist_line_edit->text().toUpper().trimmed()); + auto_blacklist_ = splitWords(ui_->auto_blacklist_line_edit->text().toUpper().trimmed()); + highlight_words_ = splitWords(ui_->highlightTextEdit->toPlainText().toUpper().trimmed()); cq_ = ui_->cq_message_line_edit->text().toUpper(); reply_ = ui_->reply_message_line_edit->text().toUpper(); eot_ = ui_->eot_line_edit->text().trimmed().left(2); diff --git a/Configuration.hpp b/Configuration.hpp index 8ccc39a..a0d6b81 100644 --- a/Configuration.hpp +++ b/Configuration.hpp @@ -102,6 +102,7 @@ public: void removeGroup(QString const &group); QSet auto_whitelist() const; QSet auto_blacklist() const; + QSet highlight_words() const; int activity_aging() const; int callsign_aging() const; QString eot() const; diff --git a/Configuration.ui b/Configuration.ui index 8675d77..9cb3a22 100644 --- a/Configuration.ui +++ b/Configuration.ui @@ -23,7 +23,7 @@ Select tab to change configuration parameters. - 0 + 7 @@ -36,7 +36,7 @@ - 1 + 0 @@ -278,7 +278,7 @@ 0 0 - 724 + 615 808 @@ -3229,7 +3229,7 @@ QListView::item:hover { true - + 0 @@ -3238,209 +3238,272 @@ QListView::item:hover { 378 - + 0 + + 0 + 0 0 - - - - Foreground Color + + + + 0 - - - - - - - 80 - 20 - + + 0 - - QLabel{background-color: #66ff66} + + 0 - - K1ABC - - - Qt::AlignCenter - - - - - - - - 140 - 0 - - - - CQ Background - - - - - - - Font - - - - - - - - 80 - 20 - - - - QLabel{background-color: #3498db}<?xml version="1.0" encoding="UTF-8"?> + + + + Font + + + + + + + + 80 + 20 + + + + QLabel{background-color: #66ff66} + + + K1ABC + + + Qt::AlignCenter + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Foreground Color + + + + + + + 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/> +<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 - - - - - - - - 80 - 20 - - - - QLabel{background-color: white}<?xml version="1.0" encoding="UTF-8"?> + + + K1ABC + + + Qt::AlignCenter + + + + + + + + 140 + 0 + + + + Directed Messages Background + + + + + + + Table Background + + + + + + + + 80 + 20 + + + + QLabel{background-color: #ff6666} + + + K1ABC + + + Qt::AlignCenter + + + + + + + + 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/> +<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 - - + + + K1ABC + + + Qt::AlignCenter + + + + + + + + 140 + 0 + + + + Highlight Background + + + + - - - + + + + Qt::Vertical + + + QSizePolicy::Fixed + + - 140 - 0 + 20 + 10 + + + + - Directed Messages Background + Highlight Activity Containing These Words (comma separated): - - - - Selected Row Background + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">CQ</p></body></html> - - - - Table Background - - - - + Qt::Vertical @@ -3448,7 +3511,7 @@ QListView::item:hover { 20 - 40 + 348 @@ -4203,12 +4266,6 @@ soundcard changes font_push_button tabWidget scrollArea_8 - tableForegroundButton - pbCQmsg - tableFontButton - pbMyCall - tableSelectedRowBackgroundButton - tableBackgroundButton scrollArea_9 txFontButton rxFontButton @@ -4297,12 +4354,12 @@ soundcard changes + + - - diff --git a/mainwindow.cpp b/mainwindow.cpp index 284cf54..91bb4d7 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -11536,30 +11536,6 @@ void MainWindow::displayBandActivity() { } textItem->setTextAlignment(flag); - if ( - Varicode::startsWithCQ(text.last()) || - text.last().contains(QRegularExpression {"\\b(CQCQCQ|CQ)\\b"}) - ){ - offsetItem->setBackground(QBrush(m_config.color_CQ())); - tdriftItem->setBackground(QBrush(m_config.color_CQ())); - ageItem->setBackground(QBrush(m_config.color_CQ())); - snrItem->setBackground(QBrush(m_config.color_CQ())); - textItem->setBackground(QBrush(m_config.color_CQ())); - } - - bool isDirectedAllCall = false; - - // TODO: jsherer - there's a potential here for a previous allcall to poison the highlight. - if ( - (isDirectedOffset(offset, &isDirectedAllCall) && !isDirectedAllCall) || isMyCallIncluded(text.last()) - ) { - offsetItem->setBackground(QBrush(m_config.color_MyCall())); - tdriftItem->setBackground(QBrush(m_config.color_MyCall())); - ageItem->setBackground(QBrush(m_config.color_MyCall())); - snrItem->setBackground(QBrush(m_config.color_MyCall())); - textItem->setBackground(QBrush(m_config.color_MyCall())); - } - ui->tableWidgetRXAll->setItem(row, col++, textItem); if (isOffsetSelected) { @@ -11567,6 +11543,21 @@ void MainWindow::displayBandActivity() { ui->tableWidgetRXAll->item(row, i)->setSelected(true); } } + + bool isDirectedAllCall = false; + if( + (isDirectedOffset(offset, &isDirectedAllCall) && !isDirectedAllCall) || isMyCallIncluded(text.last()) + ){ + for(int i = 0; i < ui->tableWidgetRXAll->columnCount(); i++){ + ui->tableWidgetRXAll->item(row, i)->setBackground(QBrush(m_config.color_MyCall())); + } + } + + if (!text.isEmpty() && m_config.highlight_words().intersects(QSet::fromList(text.last().replace(":", " ").replace(">"," ").split(" ")))){ + for(int i = 0; i < ui->tableWidgetRXAll->columnCount(); i++){ + ui->tableWidgetRXAll->item(row, i)->setBackground(QBrush(m_config.color_CQ())); + } + } } } @@ -11863,6 +11854,12 @@ void MainWindow::displayCallActivity() { ui->tableWidgetCalls->item(row, i)->setSelected(true); } } + + if (m_config.highlight_words().contains(call)){ + for(int i = 0; i < ui->tableWidgetCalls->columnCount(); i++){ + ui->tableWidgetCalls->item(row, i)->setBackground(QBrush(m_config.color_CQ())); + } + } } // Set table color