2015-05-28 19:22:17 -04:00
|
|
|
#ifndef MODES_HPP__
|
|
|
|
#define MODES_HPP__
|
|
|
|
|
|
|
|
#include <QAbstractListModel>
|
|
|
|
|
|
|
|
#include "qt_helpers.hpp"
|
|
|
|
|
2016-06-04 10:59:01 -04:00
|
|
|
class QString;
|
|
|
|
class QVariant;
|
|
|
|
class QModelIndex;
|
|
|
|
|
|
|
|
//
|
|
|
|
// Class Modes - Qt model that implements a list of data modes
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// Responsibilities
|
|
|
|
//
|
|
|
|
// Provides a single column list model that contains the human
|
|
|
|
// readable string version of the data mode in the display role. Also
|
|
|
|
// provided is a translatable column header string and tool tip
|
|
|
|
// string.
|
|
|
|
//
|
|
|
|
//
|
|
|
|
// Collaborations
|
|
|
|
//
|
|
|
|
// Implements a concrete sub-class of the QAbstractListModel class.
|
|
|
|
//
|
2015-05-28 19:22:17 -04:00
|
|
|
class Modes final
|
|
|
|
: public QAbstractListModel
|
|
|
|
{
|
2016-04-06 13:11:02 -04:00
|
|
|
Q_OBJECT
|
2015-05-28 19:22:17 -04:00
|
|
|
|
|
|
|
public:
|
2016-06-04 10:59:01 -04:00
|
|
|
//
|
|
|
|
// This enumeration contains the supported modes, to complement this
|
|
|
|
// an array of human readable strings in the implementation
|
|
|
|
// (Modes.cpp) must be maintained in parallel.
|
|
|
|
//
|
2015-05-28 19:22:17 -04:00
|
|
|
enum Mode
|
|
|
|
{
|
2017-07-07 19:11:41 -04:00
|
|
|
ALL, // matches with all modes
|
2015-05-28 19:22:17 -04:00
|
|
|
JT65,
|
|
|
|
JT9,
|
|
|
|
JT4,
|
|
|
|
WSPR,
|
2015-06-04 12:42:38 -04:00
|
|
|
Echo,
|
2015-11-17 20:28:12 -05:00
|
|
|
ISCAT,
|
2016-06-03 11:45:54 -04:00
|
|
|
MSK144,
|
2016-07-02 08:15:41 -04:00
|
|
|
QRA64,
|
2017-01-03 16:37:38 -05:00
|
|
|
FreqCal,
|
2017-06-17 09:48:45 -04:00
|
|
|
FT8,
|
2019-01-28 10:19:46 -05:00
|
|
|
FT4,
|
2020-07-23 13:51:05 -04:00
|
|
|
FST4,
|
|
|
|
FST4W,
|
2020-10-25 13:58:18 -04:00
|
|
|
Q65,
|
2016-06-03 19:40:45 -04:00
|
|
|
MODES_END_SENTINAL_AND_COUNT // this must be last
|
2015-05-28 19:22:17 -04:00
|
|
|
};
|
2016-04-06 13:11:02 -04:00
|
|
|
Q_ENUM (Mode)
|
2015-05-28 19:22:17 -04:00
|
|
|
|
|
|
|
explicit Modes (QObject * parent = nullptr);
|
|
|
|
|
2016-06-04 10:59:01 -04:00
|
|
|
// translate between enumeration and human readable strings
|
2015-05-28 19:22:17 -04:00
|
|
|
static char const * name (Mode);
|
|
|
|
static Mode value (QString const&);
|
|
|
|
|
|
|
|
// Implement the QAbstractListModel interface
|
|
|
|
int rowCount (QModelIndex const& parent = QModelIndex {}) const override
|
|
|
|
{
|
2016-06-03 19:40:45 -04:00
|
|
|
return parent.isValid () ? 0 : MODES_END_SENTINAL_AND_COUNT; // Number of modes in Mode enumeration class
|
2015-05-28 19:22:17 -04:00
|
|
|
}
|
|
|
|
QVariant data (QModelIndex const&, int role = Qt::DisplayRole) const override;
|
|
|
|
QVariant headerData (int section, Qt::Orientation, int = Qt::DisplayRole) const override;
|
|
|
|
};
|
|
|
|
|
|
|
|
ENUM_QDATASTREAM_OPS_DECL (Modes, Mode);
|
|
|
|
ENUM_CONVERSION_OPS_DECL (Modes, Mode);
|
|
|
|
|
|
|
|
#endif
|