diff --git a/Configuration.cpp b/Configuration.cpp
index a2adce827..5aef7f775 100644
--- a/Configuration.cpp
+++ b/Configuration.cpp
@@ -550,6 +550,7 @@ private:
bool prompt_to_log_;
bool insert_blank_;
bool DXCC_;
+ bool ppfx_;
bool clear_DX_;
bool miles_;
bool quick_call_;
@@ -650,6 +651,7 @@ bool Configuration::report_in_comments () const {return m_->report_in_comments_;
bool Configuration::prompt_to_log () const {return m_->prompt_to_log_;}
bool Configuration::insert_blank () const {return m_->insert_blank_;}
bool Configuration::DXCC () const {return m_->DXCC_;}
+bool Configuration::ppfx() const {return m_->ppfx_;}
bool Configuration::clear_DX () const {return m_->clear_DX_;}
bool Configuration::miles () const {return m_->miles_;}
bool Configuration::quick_call () const {return m_->quick_call_;}
@@ -1120,6 +1122,7 @@ void Configuration::impl::initialize_models ()
ui_->prompt_to_log_check_box->setChecked (prompt_to_log_);
ui_->insert_blank_check_box->setChecked (insert_blank_);
ui_->DXCC_check_box->setChecked (DXCC_);
+ ui_->ppfx_check_box->setChecked (ppfx_);
ui_->clear_DX_check_box->setChecked (clear_DX_);
ui_->miles_check_box->setChecked (miles_);
ui_->quick_call_check_box->setChecked (quick_call_);
@@ -1356,6 +1359,7 @@ void Configuration::impl::read_settings ()
prompt_to_log_ = settings_->value ("PromptToLog", false).toBool ();
insert_blank_ = settings_->value ("InsertBlank", false).toBool ();
DXCC_ = settings_->value ("DXCCEntity", false).toBool ();
+ ppfx_ = settings_->value ("PrincipalPrefix", false).toBool ();
clear_DX_ = settings_->value ("ClearCallGrid", false).toBool ();
miles_ = settings_->value ("Miles", false).toBool ();
quick_call_ = settings_->value ("QuickCall", false).toBool ();
@@ -1453,6 +1457,7 @@ void Configuration::impl::write_settings ()
settings_->setValue ("PromptToLog", prompt_to_log_);
settings_->setValue ("InsertBlank", insert_blank_);
settings_->setValue ("DXCCEntity", DXCC_);
+ settings_->setValue ("PrincipalPrefix", ppfx_);
settings_->setValue ("ClearCallGrid", clear_DX_);
settings_->setValue ("Miles", miles_);
settings_->setValue ("QuickCall", quick_call_);
@@ -1858,6 +1863,7 @@ void Configuration::impl::accept ()
prompt_to_log_ = ui_->prompt_to_log_check_box->isChecked ();
insert_blank_ = ui_->insert_blank_check_box->isChecked ();
DXCC_ = ui_->DXCC_check_box->isChecked ();
+ ppfx_ = ui_->ppfx_check_box->isChecked ();
clear_DX_ = ui_->clear_DX_check_box->isChecked ();
miles_ = ui_->miles_check_box->isChecked ();
quick_call_ = ui_->quick_call_check_box->isChecked ();
diff --git a/Configuration.hpp b/Configuration.hpp
index 2b5df527a..1f4a19245 100644
--- a/Configuration.hpp
+++ b/Configuration.hpp
@@ -114,6 +114,7 @@ public:
bool prompt_to_log () const;
bool insert_blank () const;
bool DXCC () const;
+ bool ppfx() const;
bool clear_DX () const;
bool miles () const;
bool quick_call () const;
diff --git a/Configuration.ui b/Configuration.ui
index ca9443730..3c4831933 100644
--- a/Configuration.ui
+++ b/Configuration.ui
@@ -253,6 +253,13 @@
+ -
+
+
+ Show principal prefix instead of country name
+
+
+
@@ -2746,12 +2753,12 @@ soundcard changes
-
-
-
-
-
+
+
+
+
+
diff --git a/displaytext.cpp b/displaytext.cpp
index cf150488e..58a61ade8 100644
--- a/displaytext.cpp
+++ b/displaytext.cpp
@@ -121,7 +121,6 @@ QString DisplayText::appendDXCCWorkedB4(QString message, QString const& callsign
if(!call.contains(QRegExp("[0-9]|[A-Z]"))) return message;
logBook.match(/*in*/call,/*out*/countryName,callWorkedBefore,countryWorkedBefore);
-
message = message.trimmed ();
QString appendage;
if (!countryWorkedBefore) // therefore not worked call either
@@ -143,25 +142,32 @@ QString DisplayText::appendDXCCWorkedB4(QString message, QString const& callsign
}
}
+ int i1=countryName.indexOf(";");
+ if(m_bPrincipalPrefix) {
+ int i2=countryName.lastIndexOf(";");
+ if(i1>0) countryName=countryName.mid(i1+2,i2-i1-2);
+ } else {
+ if(i1>0) countryName=countryName.mid(0,i1-1);
// do some obvious abbreviations
- countryName.replace ("Islands", "Is.");
- countryName.replace ("Island", "Is.");
- countryName.replace ("North ", "N. ");
- countryName.replace ("Northern ", "N. ");
- countryName.replace ("South ", "S. ");
- countryName.replace ("East ", "E. ");
- countryName.replace ("Eastern ", "E. ");
- countryName.replace ("West ", "W. ");
- countryName.replace ("Western ", "W. ");
- countryName.replace ("Central ", "C. ");
- countryName.replace (" and ", " & ");
- countryName.replace ("Republic", "Rep.");
- countryName.replace ("United States", "U.S.A.");
- countryName.replace ("Fed. Rep. of ", "");
- countryName.replace ("French ", "Fr.");
- countryName.replace ("Asiatic", "AS");
- countryName.replace ("European", "EU");
- countryName.replace ("African", "AF");
+ countryName.replace ("Islands", "Is.");
+ countryName.replace ("Island", "Is.");
+ countryName.replace ("North ", "N. ");
+ countryName.replace ("Northern ", "N. ");
+ countryName.replace ("South ", "S. ");
+ countryName.replace ("East ", "E. ");
+ countryName.replace ("Eastern ", "E. ");
+ countryName.replace ("West ", "W. ");
+ countryName.replace ("Western ", "W. ");
+ countryName.replace ("Central ", "C. ");
+ countryName.replace (" and ", " & ");
+ countryName.replace ("Republic", "Rep.");
+ countryName.replace ("United States", "U.S.A.");
+ countryName.replace ("Fed. Rep. of ", "");
+ countryName.replace ("French ", "Fr.");
+ countryName.replace ("Asiatic", "AS");
+ countryName.replace ("European", "EU");
+ countryName.replace ("African", "AF");
+ }
appendage += countryName;
@@ -181,8 +187,9 @@ QString DisplayText::appendDXCCWorkedB4(QString message, QString const& callsign
void DisplayText::displayDecodedText(DecodedText const& decodedText, QString const& myCall,
bool displayDXCCEntity, LogBook const& logBook,
QColor color_CQ, QColor color_MyCall,
- QColor color_DXCC, QColor color_NewCall)
+ QColor color_DXCC, QColor color_NewCall,bool ppfx)
{
+ m_bPrincipalPrefix=ppfx;
QColor bg {Qt::white};
bool CQcall = false;
if (decodedText.string ().contains (" CQ ")
diff --git a/displaytext.h b/displaytext.h
index 12e3a52f0..445ae7513 100644
--- a/displaytext.h
+++ b/displaytext.h
@@ -20,8 +20,8 @@ public:
void setContentFont (QFont const&);
void insertLineSpacer(QString const&);
void displayDecodedText(DecodedText const& decodedText, QString const& myCall, bool displayDXCCEntity,
- LogBook const& logBook, QColor color_CQ, QColor color_MyCall,
- QColor color_DXCC, QColor color_NewCall);
+ LogBook const& logBook, QColor color_CQ, QColor color_MyCall,
+ QColor color_DXCC, QColor color_NewCall, bool ppfx);
void displayTransmittedText(QString text, QString modeTx, qint32 txFreq,
QColor color_TxMsg, bool bFastMode);
void displayQSY(QString text);
@@ -37,6 +37,7 @@ protected:
void mouseDoubleClickEvent(QMouseEvent *e);
private:
+ bool m_bPrincipalPrefix;
QString appendDXCCWorkedB4(QString message, QString const& callsign, QColor * bg, LogBook const& logBook,
QColor color_CQ, QColor color_DXCC, QColor color_NewCall);
diff --git a/logbook/countrydat.cpp b/logbook/countrydat.cpp
index 7f3d613ba..85fd2f793 100644
--- a/logbook/countrydat.cpp
+++ b/logbook/countrydat.cpp
@@ -18,7 +18,7 @@
#include "countrydat.h"
#include
#include
-
+#include
void CountryDat::init(const QString filename)
{
@@ -91,6 +91,11 @@ void CountryDat::load()
QString name = _extractName(line1);
if (name.length()>0)
{
+ QString continent=line1.mid(36,2);
+ QString principalPrefix=line1.mid(69,4);
+ int i1=principalPrefix.indexOf(":");
+ if(i1>0) principalPrefix=principalPrefix.mid(0,i1);
+ name += "; " + principalPrefix + "; " + continent;
_countryNames << name;
bool more = true;
QStringList prefixs;
diff --git a/logbook/logbook.cpp b/logbook/logbook.cpp
index 48d6a2a6f..e938910d7 100644
--- a/logbook/logbook.cpp
+++ b/logbook/logbook.cpp
@@ -75,6 +75,7 @@ void LogBook::match(/*in*/const QString call,
QString currentBand = ""; // match any band
callWorkedBefore = _log.match(call,currentBand,currentMode);
countryName = _countries.find(call);
+// qDebug() << "B" << countryName;
if (countryName.length() > 0) // country was found
countryWorkedBefore = _worked.getHasWorked(countryName);
diff --git a/mainwindow.cpp b/mainwindow.cpp
index 4ef0eb131..38a0b7c5a 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -1260,7 +1260,7 @@ void MainWindow::dataSink(qint64 frames)
DecodedText decodedtext {t, false, m_config.my_grid ()};
ui->decodedTextBrowser->displayDecodedText (decodedtext,m_baseCall,m_config.DXCC(),
m_logBook,m_config.color_CQ(),m_config.color_MyCall(),m_config.color_DXCC(),
- m_config.color_NewCall());
+ m_config.color_NewCall(),m_config.ppfx());
if (ui->measure_check_box->isChecked ()) {
// Append results text to file "fmt.all".
QFile f {m_config.writeable_data_dir ().absoluteFilePath ("fmt.all")};
@@ -1497,7 +1497,7 @@ void MainWindow::fastSink(qint64 frames)
DecodedText decodedtext {message.replace (QChar::LineFeed, ""), bcontest, m_config.my_grid ()};
ui->decodedTextBrowser->displayDecodedText (decodedtext,m_baseCall,m_config.DXCC(),
m_logBook,m_config.color_CQ(),m_config.color_MyCall(),m_config.color_DXCC(),
- m_config.color_NewCall());
+ m_config.color_NewCall(),m_config.ppfx());
m_bDecoded=true;
auto_sequence (decodedtext, ui->sbFtol->value (), std::numeric_limits::max ());
if (m_mode != "ISCAT") postDecode (true, decodedtext.string ());
@@ -2702,7 +2702,7 @@ void::MainWindow::fast_decode_done()
if(!m_bFastDone) {
ui->decodedTextBrowser->displayDecodedText (decodedtext,m_baseCall,m_config.DXCC(),
m_logBook,m_config.color_CQ(),m_config.color_MyCall(),m_config.color_DXCC(),
- m_config.color_NewCall());
+ m_config.color_NewCall(),m_config.ppfx());
}
t=message.mid(10,5).toFloat();
@@ -2777,6 +2777,10 @@ void MainWindow::decodeDone ()
if(ui->textBrowser3->toPlainText().indexOf(c2) >= 0) b=true;
if(ui->textBrowser4->toPlainText().indexOf(c2) >= 0) b=true;
if(!b) {
+ QString countryName;
+ bool callWorkedBefore,countryWorkedBefore;
+ m_logBook.match(/*in*/c2,/*out*/countryName,callWorkedBefore,countryWorkedBefore);
+ qDebug() << "D" << t0 << countryName;
t += (t0 + "\n"); //Don't list calls already in QSO or in the stack
}
}
@@ -2888,13 +2892,13 @@ void MainWindow::readFromStdout() //readFromStdout
DecodedText dt{".",false," "};
ui->decodedTextBrowser->displayDecodedText(dt,m_baseCall,m_config.DXCC(),
m_logBook,m_config.color_CQ(),m_config.color_MyCall(),
- m_config.color_DXCC(), m_config.color_NewCall());
+ m_config.color_DXCC(), m_config.color_NewCall(),m_config.ppfx());
m_bDisplayedOnce=true;
}
} else {
ui->decodedTextBrowser->displayDecodedText(decodedtext,m_baseCall,m_config.DXCC(),
m_logBook,m_config.color_CQ(),m_config.color_MyCall(),
- m_config.color_DXCC(), m_config.color_NewCall());
+ m_config.color_DXCC(), m_config.color_NewCall(),m_config.ppfx());
}
}
@@ -2928,7 +2932,7 @@ void MainWindow::readFromStdout() //readFromStdout
// or contains MyCall
ui->decodedTextBrowser2->displayDecodedText(decodedtext,m_baseCall,false,
m_logBook,m_config.color_CQ(),m_config.color_MyCall(),
- m_config.color_DXCC(),m_config.color_NewCall());
+ m_config.color_DXCC(),m_config.color_NewCall(),m_config.ppfx());
if(m_mode!="JT4") {
bool b65=decodedtext.isJT65();
@@ -4239,7 +4243,7 @@ void MainWindow::processMessage (DecodedText const& message, Qt::KeyboardModifie
if (s1!=s2 and !message.isTX()) {
ui->decodedTextBrowser2->displayDecodedText(message, m_baseCall,
false, m_logBook,m_config.color_CQ(), m_config.color_MyCall(),
- m_config.color_DXCC(),m_config.color_NewCall());
+ m_config.color_DXCC(),m_config.color_NewCall(),m_config.ppfx());
m_QSOText = s2;
}