summaryrefslogtreecommitdiff
path: root/Modes.cpp
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2018-12-19 23:01:50 +0100
committerChristoph Berg <myon@debian.org>2018-12-19 23:01:50 +0100
commit5c60c77adff9a54fd5f94f9915b22ccd8c4c5a3b (patch)
tree410fa358a5f73260a579b4d669730f319a4d2609 /Modes.cpp
parent6c82050de806dcdafaed0077400a6c3396a4a159 (diff)
parente0737c56c1e384e05064a0c6e1ac46979371041b (diff)
Update upstream source from tag 'upstream/2.0.0+repack'
Update to upstream version '2.0.0+repack' with Debian dir 55dbb3a6a7eb189e187dd79f732623ca0b56116d
Diffstat (limited to 'Modes.cpp')
-rw-r--r--Modes.cpp106
1 files changed, 0 insertions, 106 deletions
diff --git a/Modes.cpp b/Modes.cpp
deleted file mode 100644
index a04c0928..00000000
--- a/Modes.cpp
+++ /dev/null
@@ -1,106 +0,0 @@
-#include "Modes.hpp"
-
-#include <algorithm>
-
-#include <QString>
-#include <QVariant>
-#include <QModelIndex>
-
-#include "moc_Modes.cpp"
-
-namespace
-{
- // human readable strings for each Mode enumeration value
- char const * const mode_names[] =
- {
- "All",
- "JT65",
- "JT9",
- "JT4",
- "WSPR",
- "Echo",
- "ISCAT",
- "MSK144",
- "QRA64",
- "FreqCal",
- "FT8"
- };
- std::size_t constexpr mode_names_size = sizeof (mode_names) / sizeof (mode_names[0]);
-}
-
-Modes::Modes (QObject * parent)
- : QAbstractListModel {parent}
-{
- static_assert (mode_names_size == MODES_END_SENTINAL_AND_COUNT,
- "mode_names array must match Mode enumeration");
-}
-
-char const * Modes::name (Mode m)
-{
- return mode_names[static_cast<int> (m)];
-}
-
-auto Modes::value (QString const& s) -> Mode
-{
- auto end = mode_names + mode_names_size;
- auto p = std::find_if (mode_names, end
- , [&s] (char const * const name) {
- return name == s;
- });
- return p != end ? static_cast<Mode> (p - mode_names) : ALL;
-}
-
-QVariant Modes::data (QModelIndex const& index, int role) const
-{
- QVariant item;
-
- if (index.isValid ())
- {
- auto const& row = index.row ();
- switch (role)
- {
- case Qt::ToolTipRole:
- case Qt::AccessibleDescriptionRole:
- item = tr ("Mode");
- break;
-
- case Qt::EditRole:
- item = static_cast<Mode> (row);
- break;
-
- case Qt::DisplayRole:
- case Qt::AccessibleTextRole:
- item = mode_names[row];
- break;
-
- case Qt::TextAlignmentRole:
- item = Qt::AlignHCenter + Qt::AlignVCenter;
- break;
- }
- }
-
- return item;
-}
-
-QVariant Modes::headerData (int section, Qt::Orientation orientation, int role) const
-{
- QVariant result;
-
- if (Qt::DisplayRole == role && Qt::Horizontal == orientation)
- {
- result = tr ("Mode");
- }
- else
- {
- result = QAbstractListModel::headerData (section, orientation, role);
- }
-
- return result;
-}
-
-#if !defined (QT_NO_DEBUG_STREAM)
-ENUM_QDEBUG_OPS_IMPL (Modes, Mode);
-#endif
-
-ENUM_QDATASTREAM_OPS_IMPL (Modes, Mode);
-ENUM_CONVERSION_OPS_IMPL (Modes, Mode);