diff --git a/displaytext.cpp b/displaytext.cpp index b20d3bbbb..5318762e8 100644 --- a/displaytext.cpp +++ b/displaytext.cpp @@ -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 diff --git a/displaytext.h b/displaytext.h index 8fb1d8bd7..f19ef2c71 100644 --- a/displaytext.h +++ b/displaytext.h @@ -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> highlighted_calls_; @@ -62,4 +61,6 @@ private: QColor m_color_TxMsg; }; + extern QHash m_LoTW; + #endif // DISPLAYTEXT_H diff --git a/mainwindow.cpp b/mainwindow.cpp index bb6ad3c26..ac6c06ec8 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -162,6 +162,7 @@ int fast_jhpeak {0}; int fast_jh2 {0}; int narg[15]; QVector g_ColorTbl; +QHash 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"}; }