diff options
| author | Christoph Berg <myon@debian.org> | 2022-08-08 23:08:17 +0200 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2022-08-08 23:08:17 +0200 |
| commit | 43bebfbad6e7ba026bd3d55720c7d9e12a7ef8ef (patch) | |
| tree | fac973fdc7378510849f4d749cd311176c023ebb /models | |
| parent | d47341d71ff3df889c1180eb7bfb4fc0272eb26b (diff) | |
New upstream version 2.6.0~rc2+repackupstream/2.6.0_rc2+repack
Diffstat (limited to 'models')
| -rwxr-xr-x | models/CabrilloLog.cpp | 16 | ||||
| -rwxr-xr-x | models/CabrilloLog.hpp | 2 | ||||
| -rwxr-xr-x | models/FrequencyList.cpp | 2 |
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}, |
