mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-15 08:31:57 -05:00
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:
parent
ae8b6faf19
commit
db713bfb26
@ -73,7 +73,8 @@ void DisplayText::insertLineSpacer(QString const& line)
|
||||
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 ();
|
||||
cursor.movePosition (QTextCursor::End);
|
||||
@ -142,7 +143,9 @@ void DisplayText::appendText(QString const& text, QColor bg, QString const& call
|
||||
}
|
||||
format.setBackground (bg);
|
||||
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);
|
||||
|
||||
// position so viewport scrolled to left
|
||||
|
@ -47,7 +47,6 @@ private:
|
||||
bool m_bPrincipalPrefix;
|
||||
QString appendWorkedB4(QString message, QString const& callsign, QString grid, QColor * bg,
|
||||
LogBook const& logBook, QString currentBand);
|
||||
|
||||
QFont char_font_;
|
||||
QAction * erase_action_;
|
||||
QHash<QString, QPair<QColor, QColor>> highlighted_calls_;
|
||||
@ -62,4 +61,6 @@ private:
|
||||
QColor m_color_TxMsg;
|
||||
};
|
||||
|
||||
extern QHash<QString,int> m_LoTW;
|
||||
|
||||
#endif // DISPLAYTEXT_H
|
||||
|
@ -162,6 +162,7 @@ int fast_jhpeak {0};
|
||||
int fast_jh2 {0};
|
||||
int narg[15];
|
||||
QVector<QColor> g_ColorTbl;
|
||||
QHash<QString,int> m_LoTW;
|
||||
|
||||
namespace
|
||||
{
|
||||
@ -931,6 +932,32 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple,
|
||||
ui->cbMenus->setChecked(true);
|
||||
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
|
||||
if (!m_valid) throw std::runtime_error {"Fatal initialization exception"};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user