Fixed display of allcalls. No longer red

This commit is contained in:
Jordan Sherer 2018-08-16 11:31:10 -04:00
parent 612df625ed
commit ad4e567392
2 changed files with 29 additions and 14 deletions

View File

@ -6197,7 +6197,7 @@ bool MainWindow::isFreqOffsetFree(int f, int bw){
} }
// if this frequency is in our directed cache, it's always "free" // if this frequency is in our directed cache, it's always "free"
if(m_rxDirectedCache.contains(f/10*10)){ if(isDirectedOffset(f, nullptr)){
return true; return true;
} }
@ -8381,16 +8381,24 @@ void MainWindow::markOffsetRecent(int offset){
m_rxRecentCache.insert(offset/10*10+10, new QDateTime(QDateTime::currentDateTimeUtc()), 10); m_rxRecentCache.insert(offset/10*10+10, new QDateTime(QDateTime::currentDateTimeUtc()), 10);
} }
bool MainWindow::isDirectedOffset(int offset){ bool MainWindow::isDirectedOffset(int offset, bool *pIsAllCall){
return ( bool isDirected = (
m_rxDirectedCache.contains(offset/10*10) && m_rxDirectedCache.contains(offset/10*10) &&
m_rxDirectedCache[offset/10*10]->secsTo(QDateTime::currentDateTimeUtc()) < 300 m_rxDirectedCache[offset/10*10]->date.secsTo(QDateTime::currentDateTimeUtc()) < 300
); );
if(isDirected){
if(pIsAllCall) *pIsAllCall = m_rxDirectedCache[offset/10*10]->isAllcall;
}
return isDirected;
} }
void MainWindow::markOffsetDirected(int offset){ void MainWindow::markOffsetDirected(int offset, bool isAllCall){
m_rxDirectedCache.insert(offset/10*10, new QDateTime(QDateTime::currentDateTimeUtc()), 10); CachedDirectedType *d1 = new CachedDirectedType{ isAllCall, QDateTime::currentDateTimeUtc() };
m_rxDirectedCache.insert(offset/10*10+10, new QDateTime(QDateTime::currentDateTimeUtc()), 10); CachedDirectedType *d2 = new CachedDirectedType{ isAllCall, QDateTime::currentDateTimeUtc() };
m_rxDirectedCache.insert(offset/10*10, d1, 10);
m_rxDirectedCache.insert(offset/10*10+10, d2, 10);
} }
bool MainWindow::isMyCallIncluded(const QString &text){ bool MainWindow::isMyCallIncluded(const QString &text){
@ -8463,8 +8471,9 @@ void MainWindow::processRxActivity() {
// if this is a (recent) directed offset, bump the cache, and display... // if this is a (recent) directed offset, bump the cache, and display...
// this will allow a directed free text command followed by non-buffered data frames. // this will allow a directed free text command followed by non-buffered data frames.
if(isDirectedOffset(d.freq)){ bool isDirectedAllCall = false;
markOffsetDirected(d.freq); if(isDirectedOffset(d.freq, &isDirectedAllCall)){
markOffsetDirected(d.freq, isDirectedAllCall);
shouldDisplay = true; shouldDisplay = true;
} }
@ -8745,7 +8754,7 @@ void MainWindow::processCommandActivity() {
} }
// and mark the offset as a directed offset so future free text is displayed // and mark the offset as a directed offset so future free text is displayed
markOffsetDirected(ad.freq); markOffsetDirected(ad.freq, isAllCall);
// construct a reply, if needed // construct a reply, if needed
QString reply; QString reply;
@ -9073,7 +9082,8 @@ void MainWindow::displayBandActivity() {
textItem->setBackground(QBrush(m_config.color_CQ())); textItem->setBackground(QBrush(m_config.color_CQ()));
} }
if (isDirectedOffset(offset)) { bool isDirectedAllCall = false;
if (isDirectedOffset(offset, &isDirectedAllCall) && !isDirectedAllCall) {
offsetItem->setBackground(QBrush(m_config.color_MyCall())); offsetItem->setBackground(QBrush(m_config.color_MyCall()));
ageItem->setBackground(QBrush(m_config.color_MyCall())); ageItem->setBackground(QBrush(m_config.color_MyCall()));
snrItem->setBackground(QBrush(m_config.color_MyCall())); snrItem->setBackground(QBrush(m_config.color_MyCall()));

View File

@ -724,6 +724,11 @@ private:
} }
}; };
struct CachedDirectedType {
bool isAllcall;
QDateTime date;
};
QPriorityQueue<PrioritizedMessage> m_txMessageQueue; // messages to be sent QPriorityQueue<PrioritizedMessage> m_txMessageQueue; // messages to be sent
QQueue<QString> m_txFrameQueue; // frames to be sent QQueue<QString> m_txFrameQueue; // frames to be sent
QQueue<ActivityDetail> m_rxActivityQueue; // all rx activity queue QQueue<ActivityDetail> m_rxActivityQueue; // all rx activity queue
@ -732,7 +737,7 @@ private:
QMap<QString, QString> m_compoundCallCache; // base callsign -> compound callsign QMap<QString, QString> m_compoundCallCache; // base callsign -> compound callsign
QCache<QString, QDateTime> m_txAllcallCommandCache; // callsign -> last tx QCache<QString, QDateTime> m_txAllcallCommandCache; // callsign -> last tx
QCache<int, QDateTime> m_rxRecentCache; // freq -> last rx QCache<int, QDateTime> m_rxRecentCache; // freq -> last rx
QCache<int, QDateTime> m_rxDirectedCache; // freq -> last directed rx QCache<int, CachedDirectedType> m_rxDirectedCache; // freq -> last directed rx
QCache<QString, int> m_rxCallCache; // call -> last freq seen QCache<QString, int> m_rxCallCache; // call -> last freq seen
QMap<int, int> m_rxFrameBlockNumbers; // freq -> block QMap<int, int> m_rxFrameBlockNumbers; // freq -> block
QMap<int, QList<ActivityDetail>> m_bandActivity; // freq -> [(text, last timestamp), ...] QMap<int, QList<ActivityDetail>> m_bandActivity; // freq -> [(text, last timestamp), ...]
@ -836,8 +841,8 @@ private:
QString callsignSelected(); QString callsignSelected();
bool isRecentOffset(int offset); bool isRecentOffset(int offset);
void markOffsetRecent(int offset); void markOffsetRecent(int offset);
bool isDirectedOffset(int offset); bool isDirectedOffset(int offset, bool *pIsAllCall);
void markOffsetDirected(int offset); void markOffsetDirected(int offset, bool isAllCall);
void processActivity(bool force=false); void processActivity(bool force=false);
void processRxActivity(); void processRxActivity();
void processCompoundActivity(); void processCompoundActivity();