summaryrefslogtreecommitdiff
path: root/models
diff options
context:
space:
mode:
Diffstat (limited to 'models')
-rwxr-xr-xmodels/CabrilloLog.cpp16
-rwxr-xr-xmodels/CabrilloLog.hpp2
-rwxr-xr-xmodels/FrequencyList.cpp2
3 files changed, 19 insertions, 1 deletions
diff --git a/models/CabrilloLog.cpp b/models/CabrilloLog.cpp
index b0459e19..77166859 100755
--- a/models/CabrilloLog.cpp
+++ b/models/CabrilloLog.cpp
@@ -73,7 +73,9 @@ public:
Configuration const * configuration_;
QSqlQuery mutable dupe_query_;
QSqlQuery mutable export_query_;
+ QSqlQuery mutable qso_count_query_;
bool adding_row_;
+ int n_qso();
};
CabrilloLog::impl::impl (CabrilloLog * self, Configuration const * configuration)
@@ -109,6 +111,7 @@ CabrilloLog::impl::impl (CabrilloLog * self, Configuration const * configuration
{
Q_EMIT self_->data_changed ();
}
+ Q_EMIT self_->qso_count_changed(self_->n_qso());
});
SQL_error_check (*this, &QSqlTableModel::select);
@@ -132,6 +135,10 @@ CabrilloLog::impl::impl (CabrilloLog * self, Configuration const * configuration
" cabrillo_log_v2 "
" ORDER BY "
" \"when\"");
+
+ SQL_error_check (qso_count_query_, &QSqlQuery::prepare,
+ "SELECT COUNT(*) FROM cabrillo_log_v2");
+
}
void CabrilloLog::impl::create_table ()
@@ -234,8 +241,10 @@ bool CabrilloLog::add_QSO (Frequency frequency, QString const& mode, QDateTime c
m_->adding_row_ = true;
auto ok = m_->insertRecord (-1, record);
transaction.submit ();
+
m_->adding_row_ = false;
m_->setEditStrategy (QSqlTableModel::OnFieldChange);
+ Q_EMIT this->qso_count_changed(this->n_qso());
return ok;
}
@@ -256,6 +265,13 @@ bool CabrilloLog::dupe (Frequency frequency, QString const& call) const
return false;
}
+int CabrilloLog::n_qso()
+{
+ SQL_error_check (m_->qso_count_query_, static_cast<bool (QSqlQuery::*) ()> (&QSqlQuery::exec));
+ m_->qso_count_query_.first();
+ return m_->qso_count_query_.value(0).toInt();
+}
+
void CabrilloLog::reset ()
{
// synchronize model
diff --git a/models/CabrilloLog.hpp b/models/CabrilloLog.hpp
index 97d8f0d8..68b76fc2 100755
--- a/models/CabrilloLog.hpp
+++ b/models/CabrilloLog.hpp
@@ -31,6 +31,7 @@ public:
bool add_QSO (Frequency, QString const& mode, QDateTime const&, QString const& call
, QString const& report_sent, QString const& report_received);
bool dupe (Frequency, QString const& call) const;
+ int n_qso();
QSqlTableModel * model ();
void reset ();
@@ -38,6 +39,7 @@ public:
worked_set unique_DXCC_entities (AD1CCty const *) const;
Q_SIGNAL void data_changed () const;
+ Q_SIGNAL void qso_count_changed (int) const;
private:
class impl;
diff --git a/models/FrequencyList.cpp b/models/FrequencyList.cpp
index 034af895..cac85ea5 100755
--- a/models/FrequencyList.cpp
+++ b/models/FrequencyList.cpp
@@ -278,10 +278,10 @@ namespace
{50318000, Modes::FT4, IARURegions::ALL}, // provisional
{50323000, Modes::FT8, IARURegions::ALL},
- {70100000, Modes::FT8, IARURegions::R1},
{70102000, Modes::JT65, IARURegions::R1},
{70104000, Modes::JT9, IARURegions::R1},
{70091000, Modes::WSPR, IARURegions::R1},
+ {70154000, Modes::FT8, IARURegions::R1},
{70230000, Modes::MSK144, IARURegions::R1},
{144116000, Modes::Q65, IARURegions::ALL},