summaryrefslogtreecommitdiff
path: root/models
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2020-05-11 22:17:58 +0200
committerChristoph Berg <myon@debian.org>2020-05-11 22:17:58 +0200
commit32a41b1abe1a4aab0892c9c2051be6ba5b379f1e (patch)
treec6e107c1ee4d70610e43a7912e57c720334a08c7 /models
parent08299e8b2bf50ba90daf570f57def529dd29d6e7 (diff)
New upstream version 2.2.0~rc1+repackupstream/2.2.0_rc1+repack
Diffstat (limited to 'models')
-rw-r--r--models/Bands.cpp4
-rw-r--r--models/CabrilloLog.cpp17
-rw-r--r--models/DecodeHighlightingModel.cpp2
-rw-r--r--models/FoxLog.cpp12
4 files changed, 13 insertions, 22 deletions
diff --git a/models/Bands.cpp b/models/Bands.cpp
index e24d4296..832c3618 100644
--- a/models/Bands.cpp
+++ b/models/Bands.cpp
@@ -51,7 +51,7 @@ namespace
int constexpr table_rows ()
{
- return sizeof (ADIF_bands) / sizeof (ADIF_bands[0]);
+ return sizeof ADIF_bands / sizeof ADIF_bands[0];
}
}
@@ -79,7 +79,7 @@ QString Bands::find (Frequency f) const
int Bands::find (QString const& band) const
{
int result {-1};
- for (auto i = 0u; i < table_rows (); ++i)
+ for (auto i = 0; i < table_rows (); ++i)
{
if (band == ADIF_bands[i].name_)
{
diff --git a/models/CabrilloLog.cpp b/models/CabrilloLog.cpp
index dfba3d43..b0459e19 100644
--- a/models/CabrilloLog.cpp
+++ b/models/CabrilloLog.cpp
@@ -50,20 +50,17 @@ public:
else
{
value = QSqlTableModel::data (model_index, role);
- if (model_index.column () == fieldIndex ("frequency") && Qt::DisplayRole == role)
+ if (Qt::DisplayRole == role)
{
- value = Radio::frequency_MHz_string (value.value<Radio::Frequency> (), 3); // kHz precision
- }
- else if (model_index.column () == fieldIndex ("when")
- && (Qt::DisplayRole == role || Qt::EditRole == role))
- { // adjust date/time to Qt format
- auto t = QDateTime::fromMSecsSinceEpoch (value.toULongLong () * 1000ull, Qt::UTC);
- if (Qt::DisplayRole == role)
+ if (model_index.column () == fieldIndex ("frequency"))
{
+ value = Radio::frequency_MHz_string (value.value<Radio::Frequency> (), 3); // kHz precision
+ }
+ else if (model_index.column () == fieldIndex ("when"))
+ { // adjust date/time to Qt format
QLocale locale;
- return locale.toString (t, locale.dateFormat (QLocale::ShortFormat) + " hh:mm:ss");
+ value = locale.toString (QDateTime::fromMSecsSinceEpoch (value.toULongLong () * 1000ull, Qt::UTC), locale.dateFormat (QLocale::ShortFormat) + " hh:mm:ss");
}
- value = t;
}
}
return value;
diff --git a/models/DecodeHighlightingModel.cpp b/models/DecodeHighlightingModel.cpp
index 4a1205eb..c4e9f758 100644
--- a/models/DecodeHighlightingModel.cpp
+++ b/models/DecodeHighlightingModel.cpp
@@ -45,7 +45,7 @@ QList<DecodeHighlightingModel::HighlightInfo> const DecodeHighlightingModel::imp
, {Highlight::CallBand, false, {}, {{0x99, 0xff, 0xff}}}
, {Highlight::LotW, false, {{0x99, 0x00, 0x00}}, {}}
, {Highlight::CQ, true, {}, {{0x66, 0xff, 0x66}}}
- , {Highlight::Tx, true, {}, {{Qt::yellow}}}
+ , {Highlight::Tx, true, {}, {Qt::yellow}}
};
bool operator == (DecodeHighlightingModel::HighlightInfo const& lhs, DecodeHighlightingModel::HighlightInfo const& rhs)
diff --git a/models/FoxLog.cpp b/models/FoxLog.cpp
index ad02cd2b..3ba7d2c2 100644
--- a/models/FoxLog.cpp
+++ b/models/FoxLog.cpp
@@ -26,16 +26,10 @@ public:
QVariant data (QModelIndex const& index, int role) const
{
auto value = QSqlTableModel::data (index, role);
- if (index.column () == fieldIndex ("when")
- && (Qt::DisplayRole == role || Qt::EditRole == role))
+ if (index.column () == fieldIndex ("when") && Qt::DisplayRole == role)
{
- auto t = QDateTime::fromMSecsSinceEpoch (value.toULongLong () * 1000ull, Qt::UTC);
- if (Qt::DisplayRole == role)
- {
- QLocale locale;
- return locale.toString (t, locale.dateFormat (QLocale::ShortFormat) + " hh:mm:ss");
- }
- value = t;
+ QLocale locale;
+ value = locale.toString (QDateTime::fromMSecsSinceEpoch (value.toULongLong () * 1000ull, Qt::UTC), locale.dateFormat (QLocale::ShortFormat) + " hh:mm:ss");
}
return value;
}