diff options
Diffstat (limited to 'models')
| -rw-r--r-- | models/DecodeHighlightingModel.cpp | 22 | ||||
| -rw-r--r-- | models/DecodeHighlightingModel.hpp | 1 | ||||
| -rw-r--r-- | models/FrequencyList.cpp | 18 | ||||
| -rw-r--r-- | models/FrequencyList.hpp | 1 | ||||
| -rw-r--r-- | models/StationList.cpp | 18 | ||||
| -rw-r--r-- | models/StationList.hpp | 1 |
6 files changed, 44 insertions, 17 deletions
diff --git a/models/DecodeHighlightingModel.cpp b/models/DecodeHighlightingModel.cpp index d6c7a028..01b039e6 100644 --- a/models/DecodeHighlightingModel.cpp +++ b/models/DecodeHighlightingModel.cpp @@ -5,9 +5,10 @@ #include <QList> #include <QBrush> #include <QColor> - #include <QFont> +#include <QFont> #include <QMap> #include <QVector> +#include <QTextStream> #include <QDataStream> #include <QMetaType> #include <QDebug> @@ -72,16 +73,23 @@ QDataStream& operator >> (QDataStream& is, DecodeHighlightingModel::HighlightInf >> item.background_; } +QString DecodeHighlightingModel::HighlightInfo::toString () const +{ + QString string; + QTextStream ots {&string}; + ots << "HighlightInfo(" + << highlight_name (type_) << ", " + << enabled_ << ", " + << foreground_.color ().name () << ", " + << background_.color ().name () << ')'; + return string; +} + #if !defined (QT_NO_DEBUG_STREAM) QDebug operator << (QDebug debug, DecodeHighlightingModel::HighlightInfo const& item) { QDebugStateSaver save {debug}; - debug.nospace () << "HighlightInfo(" - << item.type_ << ", " - << item.enabled_ << ", " - << item.foreground_ << ", " - << item.background_ << ')'; - return debug; + return debug.nospace () << item.toString (); } #endif diff --git a/models/DecodeHighlightingModel.hpp b/models/DecodeHighlightingModel.hpp index afb66276..e173b9f4 100644 --- a/models/DecodeHighlightingModel.hpp +++ b/models/DecodeHighlightingModel.hpp @@ -30,6 +30,7 @@ public: bool enabled_; QBrush foreground_; QBrush background_; + QString toString () const; }; using HighlightItems = QList<HighlightInfo>; diff --git a/models/FrequencyList.cpp b/models/FrequencyList.cpp index 7523b20a..3c4a4301 100644 --- a/models/FrequencyList.cpp +++ b/models/FrequencyList.cpp @@ -13,6 +13,7 @@ #include <QVector> #include <QStringList> #include <QMimeData> +#include <QTextStream> #include <QDataStream> #include <QByteArray> #include <QDebugStateSaver> @@ -347,14 +348,21 @@ namespace QDebug operator << (QDebug debug, FrequencyList_v2::Item const& item) { QDebugStateSaver saver {debug}; - debug.nospace () << "FrequencyItem(" - << item.frequency_ << ", " - << item.region_ << ", " - << item.mode_ << ')'; - return debug; + return debug.nospace () << item.toString (); } #endif +QString FrequencyList_v2::Item::toString () const +{ + QString string; + QTextStream qts {&string}; + qts << "FrequencyItem(" + << Radio::frequency_MHz_string (frequency_) << ", " + << IARURegions::name (region_) << ", " + << Modes::name (mode_) << ')'; + return string; +} + QDataStream& operator << (QDataStream& os, FrequencyList_v2::Item const& item) { return os << item.frequency_ diff --git a/models/FrequencyList.hpp b/models/FrequencyList.hpp index aa93352a..a3b9c117 100644 --- a/models/FrequencyList.hpp +++ b/models/FrequencyList.hpp @@ -52,6 +52,7 @@ public: Frequency frequency_; Mode mode_; Region region_; + QString toString () const; }; using FrequencyItems = QList<Item>; using BandSet = QSet<QString>; diff --git a/models/StationList.cpp b/models/StationList.cpp index 202cac0e..ff8d153f 100644 --- a/models/StationList.cpp +++ b/models/StationList.cpp @@ -13,6 +13,7 @@ #include <QMimeData> #include <QDataStream> #include <QByteArray> +#include <QTextStream> #include <QDebug> #include <QDebugStateSaver> @@ -26,14 +27,21 @@ QDebug operator << (QDebug debug, StationList::Station const& station) { QDebugStateSaver saver {debug}; - debug.nospace () << "Station(" - << station.band_name_ << ", " - << station.offset_ << ", " - << station.antenna_description_ << ')'; - return debug; + return debug.nospace () << station.toString (); } #endif +QString StationList::Station::toString () const +{ + QString string; + QTextStream ots {&string}; + ots << "Station(" + << band_name_ << ", " + << Radio::frequency_MHz_string (offset_) << ", " + << antenna_description_ << ')'; + return string; +} + QDataStream& operator << (QDataStream& os, StationList::Station const& station) { return os << station.band_name_ diff --git a/models/StationList.hpp b/models/StationList.hpp index 3b0955c1..92c149fe 100644 --- a/models/StationList.hpp +++ b/models/StationList.hpp @@ -56,6 +56,7 @@ public: QString band_name_; FrequencyDelta offset_; QString antenna_description_; + QString toString () const; }; using Stations = QList<Station>; |
