mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-25 21:58:38 -05:00
Set the color highlighting scheme at startup, or after a call to Settings.
This commit is contained in:
parent
c7b9892517
commit
0fbc9f3514
@ -152,8 +152,7 @@ void DisplayText::appendText(QString const& text, QColor bg, QString const& call
|
||||
}
|
||||
|
||||
QString DisplayText::appendDXCCWorkedB4(QString message, QString const& callsign, QColor * bg,
|
||||
LogBook const& logBook, QColor color_CQ, QColor color_DXCC, QColor color_NewCall,
|
||||
QColor color_NewCallBand, QString currentBand)
|
||||
LogBook const& logBook, QString currentBand)
|
||||
{
|
||||
// allow for seconds
|
||||
int padding {message.indexOf (" ") > 4 ? 2 : 0};
|
||||
@ -183,19 +182,19 @@ QString DisplayText::appendDXCCWorkedB4(QString message, QString const& callsign
|
||||
if (!countryWorkedBefore) {
|
||||
// therefore not worked call either
|
||||
appendage += "!";
|
||||
*bg = color_DXCC;
|
||||
*bg = m_color_DXCC;
|
||||
} else {
|
||||
if (!callWorkedBefore) {
|
||||
// but have worked the country
|
||||
appendage += "~";
|
||||
*bg = color_NewCall;
|
||||
*bg = m_color_NewCall;
|
||||
} else {
|
||||
if(!callB4onBand) {
|
||||
appendage += "~";
|
||||
*bg = color_NewCallBand;
|
||||
*bg = m_color_NewCallBand;
|
||||
} else {
|
||||
appendage += " "; // have worked this call before
|
||||
*bg = color_CQ;
|
||||
*bg = m_color_CQ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -244,9 +243,6 @@ QString DisplayText::appendDXCCWorkedB4(QString message, QString const& callsign
|
||||
|
||||
void DisplayText::displayDecodedText(DecodedText const& decodedText, QString const& myCall,
|
||||
bool displayDXCCEntity, LogBook const& logBook,
|
||||
QColor color_CQ, QColor color_MyCall,
|
||||
QColor color_DXCC, QColor color_NewCall,
|
||||
QColor color_NewCallBand,
|
||||
QString currentBand, bool ppfx, bool bCQonly)
|
||||
{
|
||||
m_bPrincipalPrefix=ppfx;
|
||||
@ -257,7 +253,7 @@ void DisplayText::displayDecodedText(DecodedText const& decodedText, QString con
|
||||
|| decodedText.string ().contains (" QRZ "))
|
||||
{
|
||||
CQcall = true;
|
||||
bg = color_CQ;
|
||||
bg = m_color_CQ;
|
||||
}
|
||||
if(bCQonly and !CQcall) return;
|
||||
if (myCall != "" and (
|
||||
@ -266,7 +262,7 @@ void DisplayText::displayDecodedText(DecodedText const& decodedText, QString con
|
||||
or decodedText.indexOf ("/" + myCall + " ") >= 0
|
||||
or decodedText.indexOf ("<" + myCall + " ") >= 0
|
||||
or decodedText.indexOf (" " + myCall + ">") >= 0)) {
|
||||
bg = color_MyCall;
|
||||
bg = m_color_MyCall;
|
||||
}
|
||||
auto message = decodedText.string();
|
||||
QString dxCall;
|
||||
@ -276,14 +272,12 @@ void DisplayText::displayDecodedText(DecodedText const& decodedText, QString con
|
||||
if (displayDXCCEntity && CQcall)
|
||||
// if enabled add the DXCC entity and B4 status to the end of the
|
||||
// preformated text line t1
|
||||
message = appendDXCCWorkedB4 (message, decodedText.CQersCall (), &bg, logBook, color_CQ,
|
||||
color_DXCC, color_NewCall, color_NewCallBand, currentBand);
|
||||
message = appendDXCCWorkedB4 (message, decodedText.CQersCall (), &bg, logBook, currentBand);
|
||||
appendText (message.trimmed (), bg, decodedText.call (), dxCall);
|
||||
}
|
||||
|
||||
|
||||
void DisplayText::displayTransmittedText(QString text, QString modeTx, qint32 txFreq,
|
||||
QColor color_TxMsg, bool bFastMode)
|
||||
void DisplayText::displayTransmittedText(QString text, QString modeTx, qint32 txFreq,bool bFastMode)
|
||||
{
|
||||
QString t1=" @ ";
|
||||
if(modeTx=="FT8") t1=" ~ ";
|
||||
@ -303,7 +297,7 @@ void DisplayText::displayTransmittedText(QString text, QString modeTx, qint32 tx
|
||||
t = QDateTime::currentDateTimeUtc().toString("hhmm") + \
|
||||
" Tx " + t2 + t1 + text;
|
||||
}
|
||||
appendText (t, color_TxMsg);
|
||||
appendText (t, m_color_TxMsg);
|
||||
}
|
||||
|
||||
void DisplayText::displayQSY(QString text)
|
||||
@ -409,3 +403,19 @@ void DisplayText::highlight_callsign (QString const& callsign, QColor const& bg,
|
||||
}
|
||||
setCurrentCharFormat (old_format);
|
||||
}
|
||||
|
||||
void DisplayText::setDecodedTextColors(QColor color_CQ, QColor color_MyCall,
|
||||
QColor color_DXCC, QColor color_DXCCband,QColor color_NewCall,QColor color_NewCallBand,
|
||||
QColor color_NewGrid, QColor color_NewGridBand,QColor color_TxMsg)
|
||||
{
|
||||
// Save the color highlighting scheme selected by the user.
|
||||
m_color_CQ=color_CQ;
|
||||
m_color_DXCC=color_DXCC;
|
||||
m_color_DXCCband=color_DXCCband;
|
||||
m_color_MyCall=color_MyCall;
|
||||
m_color_NewCall=color_NewCall;
|
||||
m_color_NewCallBand=color_NewCallBand;
|
||||
m_color_NewGrid=color_NewGrid;
|
||||
m_color_NewGridBand=color_NewGridBand;
|
||||
m_color_TxMsg=color_TxMsg;
|
||||
}
|
||||
|
@ -23,13 +23,14 @@ public:
|
||||
void setContentFont (QFont const&);
|
||||
void insertLineSpacer(QString const&);
|
||||
void displayDecodedText(DecodedText const& decodedText, QString const& myCall,
|
||||
bool displayDXCCEntity, LogBook const& logBook, QColor color_CQ, QColor color_MyCall,
|
||||
QColor color_DXCC, QColor color_NewCall, QColor color_NewCallBand,
|
||||
bool displayDXCCEntity, LogBook const& logBook,
|
||||
QString currentBand="", bool ppfx=false, bool bCQonly=false);
|
||||
void displayTransmittedText(QString text, QString modeTx, qint32 txFreq,
|
||||
QColor color_TxMsg, bool bFastMode);
|
||||
void displayTransmittedText(QString text, QString modeTx, qint32 txFreq, bool bFastMode);
|
||||
void displayQSY(QString text);
|
||||
void displayFoxToBeCalled(QString t, QColor bg);
|
||||
void setDecodedTextColors(QColor color_CQ, QColor color_MyCall, QColor color_DXCC,
|
||||
QColor color_DXCCband, QColor color_NewCall, QColor color_NewCallBand,
|
||||
QColor color_NewGrid, QColor color_NewGridBand, QColor color_TxMsg);
|
||||
|
||||
Q_SIGNAL void selectCallsign (Qt::KeyboardModifiers);
|
||||
Q_SIGNAL void erased ();
|
||||
@ -45,12 +46,20 @@ protected:
|
||||
private:
|
||||
bool m_bPrincipalPrefix;
|
||||
QString appendDXCCWorkedB4(QString message, QString const& callsign, QColor * bg,
|
||||
LogBook const& logBook, QColor color_CQ, QColor color_DXCC,
|
||||
QColor color_NewCall, QColor color_NewCallBand, QString currentBand);
|
||||
LogBook const& logBook, QString currentBand);
|
||||
|
||||
QFont char_font_;
|
||||
QAction * erase_action_;
|
||||
QHash<QString, QPair<QColor, QColor>> highlighted_calls_;
|
||||
QColor m_color_CQ;
|
||||
QColor m_color_MyCall;
|
||||
QColor m_color_DXCC;
|
||||
QColor m_color_DXCCband;
|
||||
QColor m_color_NewCall;
|
||||
QColor m_color_NewCallBand;
|
||||
QColor m_color_NewGrid;
|
||||
QColor m_color_NewGridBand;
|
||||
QColor m_color_TxMsg;
|
||||
};
|
||||
|
||||
#endif // DISPLAYTEXT_H
|
||||
|
@ -737,7 +737,8 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
|
||||
auto t = "UTC dB DT Freq Message";
|
||||
ui->decodedTextLabel->setText(t);
|
||||
ui->decodedTextLabel2->setText(t);
|
||||
readSettings(); //Restore user's setup params
|
||||
readSettings(); //Restore user's setup parameters
|
||||
setColorHighlighting(); //Set the color highlighting scheme for decoded text.
|
||||
m_audioThread.start (m_audioThreadPriority);
|
||||
|
||||
#ifdef WIN32
|
||||
@ -1293,8 +1294,7 @@ void MainWindow::dataSink(qint64 frames)
|
||||
QString t=QString::fromLatin1(line);
|
||||
DecodedText decodedtext {t};
|
||||
ui->decodedTextBrowser->displayDecodedText (decodedtext,m_baseCall,m_config.DXCC(),
|
||||
m_logBook,m_config.color_CQ(),m_config.color_MyCall(),m_config.color_DXCC(),
|
||||
m_config.color_NewCall(),m_config.color_NewCallBand(),m_currentBand, m_config.ppfx());
|
||||
m_logBook,m_currentBand, m_config.ppfx());
|
||||
if (ui->measure_check_box->isChecked ()) {
|
||||
// Append results text to file "fmt.all".
|
||||
QFile f {m_config.writeable_data_dir ().absoluteFilePath ("fmt.all")};
|
||||
@ -1534,8 +1534,7 @@ void MainWindow::fastSink(qint64 frames)
|
||||
QString message {QString::fromLatin1 (line)};
|
||||
DecodedText decodedtext {message.replace (QChar::LineFeed, "")};
|
||||
ui->decodedTextBrowser->displayDecodedText (decodedtext,m_baseCall,m_config.DXCC(),
|
||||
m_logBook,m_config.color_CQ(),m_config.color_MyCall(),m_config.color_DXCC(),
|
||||
m_config.color_NewCall(),m_config.color_NewCallBand(),m_currentBand,m_config.ppfx());
|
||||
m_logBook,m_currentBand,m_config.ppfx());
|
||||
m_bDecoded=true;
|
||||
auto_sequence (decodedtext, ui->sbFtol->value (), std::numeric_limits<unsigned>::max ());
|
||||
if (m_mode != "ISCAT") postDecode (true, decodedtext.string ());
|
||||
@ -1671,10 +1670,8 @@ void MainWindow::on_actionSettings_triggered() //Setup Dialog
|
||||
if(m_config.single_decode() or m_mode=="JT4") {
|
||||
ui->label_6->setText("Single-Period Decodes");
|
||||
ui->label_7->setText("Average Decodes");
|
||||
} else {
|
||||
// ui->label_6->setText("Band Activity");
|
||||
// ui->label_7->setText("Rx Frequency");
|
||||
}
|
||||
|
||||
update_watchdog_label ();
|
||||
if(!m_splitMode) ui->cbCQTx->setChecked(false);
|
||||
if(!m_config.enable_VHF_features()) {
|
||||
@ -1686,8 +1683,23 @@ void MainWindow::on_actionSettings_triggered() //Setup Dialog
|
||||
}
|
||||
m_opCall=m_config.opCall();
|
||||
}
|
||||
setColorHighlighting();
|
||||
}
|
||||
|
||||
void MainWindow::setColorHighlighting()
|
||||
{
|
||||
//Inform the decoded text windows about our color-highlighting scheme.
|
||||
ui->decodedTextBrowser->setDecodedTextColors(m_config.color_CQ(),m_config.color_MyCall(),
|
||||
m_config.color_DXCC(),m_config.color_DXCCband(),m_config.color_NewCall(),
|
||||
m_config.color_NewCallBand(),m_config.color_NewGrid(),m_config.color_NewGridBand(),
|
||||
m_config.color_TxMsg());
|
||||
ui->decodedTextBrowser2->setDecodedTextColors(m_config.color_CQ(),m_config.color_MyCall(),
|
||||
m_config.color_DXCC(),m_config.color_DXCCband(),m_config.color_NewCall(),
|
||||
m_config.color_NewCallBand(),m_config.color_NewGrid(),m_config.color_NewGridBand(),
|
||||
m_config.color_TxMsg());
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_monitorButton_clicked (bool checked)
|
||||
{
|
||||
if (!m_transmitting) {
|
||||
@ -2778,8 +2790,7 @@ void::MainWindow::fast_decode_done()
|
||||
DecodedText decodedtext {message.replace (QChar::LineFeed, "")};
|
||||
if(!m_bFastDone) {
|
||||
ui->decodedTextBrowser->displayDecodedText (decodedtext,m_baseCall,m_config.DXCC(),
|
||||
m_logBook,m_config.color_CQ(),m_config.color_MyCall(),m_config.color_DXCC(),
|
||||
m_config.color_NewCall(),m_config.color_NewCallBand(),m_currentBand,m_config.ppfx());
|
||||
m_logBook,m_currentBand,m_config.ppfx());
|
||||
}
|
||||
|
||||
t=message.mid(10,5).toFloat();
|
||||
@ -2920,16 +2931,12 @@ void MainWindow::readFromStdout() //readFromStdout
|
||||
// This hack sets the font. Surely there's a better way!
|
||||
DecodedText dt{"."};
|
||||
ui->decodedTextBrowser->displayDecodedText(dt,m_baseCall,m_config.DXCC(),
|
||||
m_logBook,m_config.color_CQ(),m_config.color_MyCall(),
|
||||
m_config.color_DXCC(), m_config.color_NewCall(),m_config.color_NewCallBand(),
|
||||
m_currentBand,m_config.ppfx());
|
||||
m_logBook,m_currentBand,m_config.ppfx());
|
||||
m_bDisplayedOnce=true;
|
||||
}
|
||||
} else {
|
||||
ui->decodedTextBrowser->displayDecodedText(decodedtext,m_baseCall,m_config.DXCC(),
|
||||
m_logBook,m_config.color_CQ(),m_config.color_MyCall(),
|
||||
m_config.color_DXCC(), m_config.color_NewCall(),m_config.color_NewCallBand(),
|
||||
m_currentBand,m_config.ppfx(),
|
||||
m_logBook,m_currentBand,m_config.ppfx(),
|
||||
(ui->cbCQonly->isVisible() and ui->cbCQonly->isChecked()));
|
||||
}
|
||||
}
|
||||
@ -2964,9 +2971,7 @@ void MainWindow::readFromStdout() //readFromStdout
|
||||
// This msg is within 10 hertz of our tuned frequency, or a JT4 or JT65 avg,
|
||||
// or contains MyCall
|
||||
ui->decodedTextBrowser2->displayDecodedText(decodedtext,m_baseCall,false,
|
||||
m_logBook,m_config.color_CQ(),m_config.color_MyCall(),
|
||||
m_config.color_DXCC(),m_config.color_NewCall(),m_config.color_NewCallBand(),
|
||||
m_currentBand,m_config.ppfx());
|
||||
m_logBook,m_currentBand,m_config.ppfx());
|
||||
|
||||
if(m_mode!="JT4") {
|
||||
bool b65=decodedtext.isJT65();
|
||||
@ -3575,7 +3580,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_TxMsg(),m_bFastMode);
|
||||
ui->TxFreqSpinBox->value(),m_bFastMode);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3676,7 +3681,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_TxMsg(),m_bFastMode);
|
||||
ui->TxFreqSpinBox->value(),m_bFastMode);
|
||||
}
|
||||
|
||||
switch (m_ntx)
|
||||
@ -4472,8 +4477,7 @@ void MainWindow::processMessage (DecodedText const& message, Qt::KeyboardModifie
|
||||
if (s1!=s2 and !message.isTX()) {
|
||||
if (!s2.contains(m_baseCall) or m_mode=="MSK144") { // Taken care of elsewhere if for_us and slow mode
|
||||
ui->decodedTextBrowser2->displayDecodedText(message, m_baseCall,false,
|
||||
m_logBook,m_config.color_CQ(), m_config.color_MyCall(), m_config.color_DXCC(),
|
||||
m_config.color_NewCall(),m_config.color_NewCallBand(),m_currentBand,m_config.ppfx());
|
||||
m_logBook,m_currentBand,m_config.ppfx());
|
||||
}
|
||||
m_QSOText = s2;
|
||||
}
|
||||
@ -8099,7 +8103,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_TxMsg(),m_bFastMode);
|
||||
ui->TxFreqSpinBox->value()+60*i,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]
|
||||
|
@ -33,7 +33,6 @@
|
||||
#include "DisplayManual.hpp"
|
||||
#include "psk_reporter.h"
|
||||
#include "logbook/logbook.h"
|
||||
#include "commons.h"
|
||||
#include "astro.h"
|
||||
#include "MessageBox.hpp"
|
||||
#include "NetworkAccessManager.hpp"
|
||||
@ -328,6 +327,7 @@ private:
|
||||
void auto_sequence (DecodedText const& message, unsigned start_tolerance, unsigned stop_tolerance);
|
||||
void hideMenus(bool b);
|
||||
void foxTest();
|
||||
void setColorHighlighting();
|
||||
|
||||
NetworkAccessManager m_network_manager;
|
||||
bool m_valid;
|
||||
|
Loading…
Reference in New Issue
Block a user