diff --git a/widgets/activeStations.cpp b/widgets/activeStations.cpp index 9c6a7d061..e286ec0a5 100644 --- a/widgets/activeStations.cpp +++ b/widgets/activeStations.cpp @@ -47,11 +47,8 @@ void ActiveStations::setContentFont(QFont const& font) cursor.mergeCharFormat (charFormat); cursor.clearSelection (); cursor.movePosition (QTextCursor::End); - - // position so viewport scrolled to left cursor.movePosition (QTextCursor::Up); cursor.movePosition (QTextCursor::StartOfLine); - ui->ActiveStationsPlainTextEdit->setTextCursor (cursor); ui->ActiveStationsPlainTextEdit->ensureCursorVisible (); } @@ -60,15 +57,34 @@ void ActiveStations::read_settings () { SettingsGroup group {settings_, "ActiveStations"}; restoreGeometry (settings_->value ("window/geometry").toByteArray ()); + ui->sbMaxRecent->setValue(settings_->value("MaxRecent",10).toInt()); + ui->sbMaxAge->setValue(settings_->value("MaxAge",10).toInt()); } void ActiveStations::write_settings () { SettingsGroup group {settings_, "ActiveStations"}; settings_->setValue ("window/geometry", saveGeometry ()); + settings_->setValue("MaxRecent",ui->sbMaxRecent->value()); + settings_->setValue("MaxAge",ui->sbMaxAge->value()); } void ActiveStations::displayActiveStations(QString const& t) { ui->ActiveStationsPlainTextEdit->setPlainText(t); } + +void ActiveStations::displayRecentStations(QString const& t) +{ + ui->RecentStationsPlainTextEdit->setPlainText(t); +} + +int ActiveStations::maxRecent() +{ + return ui->sbMaxRecent->value(); +} + +int ActiveStations::maxAge() +{ + return ui->sbMaxAge->value(); +} diff --git a/widgets/activeStations.h b/widgets/activeStations.h index 24bda01ac..de8b6214c 100644 --- a/widgets/activeStations.h +++ b/widgets/activeStations.h @@ -20,7 +20,10 @@ public: explicit ActiveStations(QSettings *, QFont const&, QWidget * parent = 0); ~ActiveStations(); void displayActiveStations(QString const&); + void displayRecentStations(QString const&); void changeFont (QFont const&); + int maxRecent(); + int maxAge(); private: void read_settings (); diff --git a/widgets/activeStations.ui b/widgets/activeStations.ui index 4ab3ea464..d5210ab89 100644 --- a/widgets/activeStations.ui +++ b/widgets/activeStations.ui @@ -18,11 +18,27 @@ + + + 0 + 2 + + QPlainTextEdit::NoWrap + + + + + 0 + 1 + + + + @@ -33,6 +49,76 @@ + + + + + + + 0 + 0 + + + + + 100 + 0 + + + + Max Age + + + 4 + + + 10 + + + 4 + + + + + + + + 0 + 0 + + + + + 100 + 0 + + + + Max Recent + + + 20 + + + 10 + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp index 9df5bcc90..8a1cb8417 100644 --- a/widgets/mainwindow.cpp +++ b/widgets/mainwindow.cpp @@ -3406,12 +3406,14 @@ void MainWindow::ARRL_Digi_Update(DecodedText dt) if(bCQ or deGrid=="RR73" or deGrid=="73") rc.ready2call=true; rc.decodeTime=m_latestDecodeTime; m_recentCall[deCall]=rc; + /* ac=m_activeCall[deCall]; if(rc.ready2call != bCQ) { qDebug() << "aa" << deCall << ac.grid4 << ac.az << rc.dialFreq/1000000.0 << rc.audioFreq << rc.snr << rc.decodeTime << ac.points << rc.ready2call << bCQ; } + */ } } @@ -3421,7 +3423,7 @@ void MainWindow::ARRL_Digi_Display() QString deCall; int age=0; int i=0; - int maxAge=4; + int maxAge=m_ActiveStationsWidget->maxAge(); int points=0; int maxPoints=0; int indx[1000]; @@ -3433,7 +3435,7 @@ void MainWindow::ARRL_Digi_Display() deCall=icall.key(); age=int((m_latestDecodeTime - icall.value().decodeTime)/m_TRperiod + 0.5); if(age>maxAge) { - qDebug() << "bb" << i << deCall << "removed"; +// qDebug() << "bb" << i << deCall << "removed"; icall.remove(); } else { i++; @@ -3443,18 +3445,18 @@ void MainWindow::ARRL_Digi_Display() QString t1; t1 = t1.asprintf(" %2d %2d",age,points); t1 = (deCall + " ").left(6) + " " + m_activeCall[deCall].grid4 + t1; -// qDebug() << "cc" << t1 << m_activeCall.count() << m_recentCall.count() << pts[i-1]; list.append(t1); } } - int nmax=i; - indexx_(pts,&nmax,indx); + int maxRecent=qMin(i,m_ActiveStationsWidget->maxRecent()); + indexx_(pts,&maxRecent,indx); QString t; - for(int j=nmax-1; j>=0; j--) { + for(int j=maxRecent-1; j>=0; j--) { int k=indx[j]-1; t += (list[k] + "\n"); } - if(m_ActiveStationsWidget!=NULL) m_ActiveStationsWidget->displayActiveStations(t); + if(m_ActiveStationsWidget!=NULL) m_ActiveStationsWidget->displayRecentStations(t); + qDebug() << "dd" << maxRecent << maxAge; } void MainWindow::readFromStdout() //readFromStdout