diff options
| author | Christoph Berg <myon@debian.org> | 2025-09-15 23:04:33 +0200 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2025-09-15 23:04:33 +0200 |
| commit | e1c678ef00f0159bbeb5571e5ebb0d4697121334 (patch) | |
| tree | 6547edef81a62a812a4d0f64e03fda226b5f0a7e /widgets/activeStations.cpp | |
| parent | b9daa22c4c3ad51cd4bc0ef624a19f21d01c9305 (diff) | |
| parent | 0a13f1fdb9928b6d012569dd65f7f6ef18fac2f8 (diff) | |
Update upstream source from tag 'upstream/3.0.0_rc1+repack'
Update to upstream version '3.0.0~rc1+repack'
with Debian dir 68c212e23136fecf9ebc6f12ff355579224d27ee
Diffstat (limited to 'widgets/activeStations.cpp')
| -rwxr-xr-x | widgets/activeStations.cpp | 127 |
1 files changed, 119 insertions, 8 deletions
diff --git a/widgets/activeStations.cpp b/widgets/activeStations.cpp index 7703f080..e5dbaceb 100755 --- a/widgets/activeStations.cpp +++ b/widgets/activeStations.cpp @@ -23,8 +23,9 @@ ActiveStations::ActiveStations(QSettings * settings, QFont const& font, QWidget changeFont (font);
read_settings ();
ui->header_label2->setText(" N Call Grid Az S/N Freq Tx Age Pts");
- connect(ui->RecentStationsPlainTextEdit, SIGNAL(selectionChanged()), this, SLOT(select()));
connect(ui->cbReadyOnly, SIGNAL(toggled(bool)), this, SLOT(on_cbReadyOnly_toggled(bool)));
+ connect(ui->cbWantedOnly, SIGNAL(toggled(bool)), this, SLOT(on_cbWantedOnly_toggled(bool)));
+ connect(ui->RecentStationsPlainTextEdit, SIGNAL(cursorPositionChanged()), this, SLOT(on_textEdit_clicked()));
}
ActiveStations::~ActiveStations()
@@ -39,6 +40,26 @@ void ActiveStations::changeFont (QFont const& font) updateGeometry ();
}
+void ActiveStations::clearStations() {
+ m_textbuffer.clear();
+ m_decodes_by_frequency.clear();
+}
+
+void ActiveStations::addLine(QString line) {
+ QString m_textbuffer = "";
+ // "012700 -1 0.2 210 ~ KJ7COA JA2HGF -14"
+ unsigned freq = line.mid(16, 4).toUInt();
+ m_decodes_by_frequency[freq] = line;
+ // show them in frequency order
+ QMap<int, QString>::const_iterator i = m_decodes_by_frequency.constBegin();
+ m_textbuffer.clear();
+ while (i != m_decodes_by_frequency.constEnd()) {
+ m_textbuffer.append(i.value());
+ ++i;
+ }
+ this->displayRecentStations(m_mode, m_textbuffer);
+}
+
void ActiveStations::read_settings ()
{
SettingsGroup group {settings_, "ActiveStations"};
@@ -46,6 +67,7 @@ void ActiveStations::read_settings () ui->sbMaxRecent->setValue(settings_->value("MaxRecent",10).toInt());
ui->sbMaxAge->setValue(settings_->value("MaxAge",10).toInt());
ui->cbReadyOnly->setChecked(settings_->value("ReadyOnly",false).toBool());
+ ui->cbWantedOnly->setChecked(settings_->value("# WantedOnly",false).toBool());
}
void ActiveStations::write_settings ()
@@ -55,11 +77,80 @@ void ActiveStations::write_settings () settings_->setValue("MaxRecent",ui->sbMaxRecent->value());
settings_->setValue("MaxAge",ui->sbMaxAge->value());
settings_->setValue("ReadyOnly",ui->cbReadyOnly->isChecked());
+ settings_->setValue("WantedOnly",ui->cbWantedOnly->isChecked());
+}
+
+void ActiveStations::setupUi(QString mode) {
+ if(mode!=m_mode) {
+ m_mode=mode;
+ ui->cbReadyOnly->setText(" Ready only");
+ if(m_mode=="Q65") {
+ ui->header_label2->setText(" N Frx Fsked S/N Q65 Call Grid Tx Age");
+ ui->label->setText("QSOs:");
+ ui->cbReadyOnly->setText("* CQ only");
+ } else if(m_mode=="Q65-pileup") {
+ ui->header_label2->setText(" N Freq Call Grid El Age(h)");
+ ui->cbWantedOnly->setText(QCoreApplication::translate("ActiveStations", "Wanted only", nullptr));
+ } else if(m_mode=="Fox Mode" || m_mode=="SuperFox Mode" ) {
+ ui->header_label2->setText(" UTC dB DT Freq " + tr("Message"));
+ ui->cbWantedOnly->setText(QCoreApplication::translate("ActiveStations", "My call only", nullptr));
+ this->setClickOK(true);
+ } else {
+ ui->header_label2->setText(" N Call Grid Az S/N Freq Tx Age Pts");
+ ui->label->setText("Rate:");
+ ui->cbWantedOnly->setText(QCoreApplication::translate("ActiveStations", "Wanted only", nullptr));
+ }
+ bool b=(m_mode.left(3)=="Q65");
+ bool is_fox_mode =(m_mode=="Fox Mode");
+ ui->bandChanges->setVisible(!b && !is_fox_mode);
+ ui->cbReadyOnly->setVisible(m_mode != "Q65-pileup" && !is_fox_mode);
+ ui->cbWantedOnly->setVisible(m_mode != "Q65-pileup"); // this is used for "My call only" in Fox mode
+ ui->label_2->setVisible(!b && !is_fox_mode);
+ ui->label_3->setVisible(!b && !is_fox_mode);
+ ui->score->setVisible(!b && !is_fox_mode);
+ ui->sbMaxRecent->setVisible(!b && !is_fox_mode);
+
+ b=(m_mode!="Q65-pileup" && !is_fox_mode);
+ ui->sbMaxAge->setVisible(b);
+ ui->label->setVisible(b);
+ ui->rate->setVisible(b);
+ }
}
-void ActiveStations::displayRecentStations(QString const& t)
+void ActiveStations::displayRecentStations(QString mode, QString const& t)
{
+ setupUi(mode);
+
+ bool bClickOK=m_clickOK;
+ m_clickOK=false;
ui->RecentStationsPlainTextEdit->setPlainText(t);
+
+//White background for Q65-60x decodes, yellow for Q65-30x:
+ int i0=0;
+ int i1=0;
+ int npos=0;
+ int nlines=t.count("\n");
+ QTextCursor cursor=ui->RecentStationsPlainTextEdit->textCursor();
+ QTextCharFormat fmt;
+ for(int i=0; i<nlines; i++) {
+ i1=t.indexOf("\n",i0);
+ npos=t.indexOf(QRegularExpression(" 30[ABCD] "), i0);
+ if(npos>0) {
+ cursor.setPosition(npos);
+ cursor.select(QTextCursor::LineUnderCursor);
+ fmt.setBackground(QBrush(Qt::yellow));
+ fmt.setForeground(QBrush(Qt::black));
+ } else {
+ cursor.setPosition(i0+10);
+ cursor.select(QTextCursor::LineUnderCursor);
+ fmt.clearForeground();
+ fmt.clearBackground();
+ }
+ cursor.setCharFormat(fmt);
+ i0=i1+1;
+ }
+
+ m_clickOK=bClickOK;
}
int ActiveStations::maxRecent()
@@ -72,14 +163,23 @@ int ActiveStations::maxAge() return ui->sbMaxAge->value();
}
-void ActiveStations::select()
+void ActiveStations::on_textEdit_clicked()
{
if(m_clickOK) {
- qint64 msec=QDateTime::currentMSecsSinceEpoch();
- if((msec-m_msec0)<500) return;
- m_msec0=msec;
- int nline=ui->RecentStationsPlainTextEdit->textCursor().blockNumber();
- emit callSandP(nline);
+ QTextCursor cursor;
+ QString text;
+ cursor = ui->RecentStationsPlainTextEdit->textCursor();
+ cursor.movePosition(QTextCursor::StartOfBlock);
+ cursor.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor);
+ text = cursor.selectedText();
+ if(text!="") {
+ int nline=text.left(2).toInt();
+ if(QGuiApplication::keyboardModifiers().testFlag(Qt::ControlModifier)) nline=-nline;
+ if ("Fox Mode" != m_mode && "SuperFox Mode" != m_mode)
+ emit callSandP(nline);
+ else
+ emit queueActiveWindowHound(text);
+ }
}
}
@@ -104,6 +204,17 @@ void ActiveStations::on_cbReadyOnly_toggled(bool b) emit activeStationsDisplay();
}
+bool ActiveStations::wantedOnly()
+{
+ return ui->cbWantedOnly->isChecked();
+}
+
+void ActiveStations::on_cbWantedOnly_toggled(bool b)
+{
+ m_bWantedOnly=b;
+ emit activeStationsDisplay();
+}
+
void ActiveStations::setRate(int n)
{
ui->rate->setText(QString::number(n));
|
