Highlight decodes of Tx stations not using LoTW in past year.

File "lotw-user-activity.csv", downloaded from ARRL, should be put in
WSJT-X resources and (still to do): installed in a better location.
This commit is contained in:
Joe Taylor 2018-09-01 09:53:38 -04:00
parent ae8b6faf19
commit db713bfb26
3 changed files with 34 additions and 3 deletions

View File

@ -73,7 +73,8 @@ void DisplayText::insertLineSpacer(QString const& line)
appendText (line, "#d3d3d3"); appendText (line, "#d3d3d3");
} }
void DisplayText::appendText(QString const& text, QColor bg, QString const& call1, QString const& call2) void DisplayText::appendText(QString const& text, QColor bg,
QString const& call1, QString const& call2)
{ {
auto cursor = textCursor (); auto cursor = textCursor ();
cursor.movePosition (QTextCursor::End); cursor.movePosition (QTextCursor::End);
@ -142,7 +143,9 @@ void DisplayText::appendText(QString const& text, QColor bg, QString const& call
} }
format.setBackground (bg); format.setBackground (bg);
format.clearForeground (); format.clearForeground ();
// format.setForeground(QColor("#cc0000")); //For flagging LoTW users if(call2.size()>0 and !m_LoTW.contains(call2)) {
format.setForeground(QColor("#cc0000")); //Mark LoTW non-users
}
cursor.insertText(text.mid (text_index), format); cursor.insertText(text.mid (text_index), format);
// position so viewport scrolled to left // position so viewport scrolled to left

View File

@ -47,7 +47,6 @@ private:
bool m_bPrincipalPrefix; bool m_bPrincipalPrefix;
QString appendWorkedB4(QString message, QString const& callsign, QString grid, QColor * bg, QString appendWorkedB4(QString message, QString const& callsign, QString grid, QColor * bg,
LogBook const& logBook, QString currentBand); LogBook const& logBook, QString currentBand);
QFont char_font_; QFont char_font_;
QAction * erase_action_; QAction * erase_action_;
QHash<QString, QPair<QColor, QColor>> highlighted_calls_; QHash<QString, QPair<QColor, QColor>> highlighted_calls_;
@ -62,4 +61,6 @@ private:
QColor m_color_TxMsg; QColor m_color_TxMsg;
}; };
extern QHash<QString,int> m_LoTW;
#endif // DISPLAYTEXT_H #endif // DISPLAYTEXT_H

View File

@ -162,6 +162,7 @@ int fast_jhpeak {0};
int fast_jh2 {0}; int fast_jh2 {0};
int narg[15]; int narg[15];
QVector<QColor> g_ColorTbl; QVector<QColor> g_ColorTbl;
QHash<QString,int> m_LoTW;
namespace namespace
{ {
@ -931,6 +932,32 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
ui->cbMenus->setChecked(true); ui->cbMenus->setChecked(true);
ui->cbMenus->setChecked(false); ui->cbMenus->setChecked(false);
} }
QFile f("c:/tmp/lotw-user-activity.csv");
if(f.open(QIODevice::ReadOnly | QIODevice::Text)) {
QTextStream s(&f);
QString line,call;
int nLoTW=0;
int i1;
QDateTime now=QDateTime::currentDateTime();
QDateTime callDateTime;
// Read and process the file of Hound callers.
while(!s.atEnd()) {
line=s.readLine();
i1=line.indexOf(",");
call=line.left(i1);
line=line.mid(i1+1);
i1=line.indexOf(",");
callDateTime=QDateTime::fromString(line.left(i1),"yyyy-MM-dd");
int ndays=callDateTime.daysTo(now);
if(ndays < 366) {
nLoTW++;
m_LoTW[call]=ndays;
}
}
f.close();
}
// this must be the last statement of constructor // this must be the last statement of constructor
if (!m_valid) throw std::runtime_error {"Fatal initialization exception"}; if (!m_valid) throw std::runtime_error {"Fatal initialization exception"};
} }