diff options
| author | Iain R. Learmonth <irl@debian.org> | 2015-10-18 18:51:00 +0100 |
|---|---|---|
| committer | Iain R. Learmonth <irl@debian.org> | 2015-10-18 18:51:00 +0100 |
| commit | d63dd8d081a6fcd0715cd13f26df59fb831769d2 (patch) | |
| tree | b9c1f6245147a310aac3762630bad389bbb57335 /FrequencyList.hpp | |
| parent | c720a3d55c5ec832c29cb7ce50b6fb4b70c55b11 (diff) | |
Imported Upstream version 1.5.0upstream/1.5.0
Diffstat (limited to 'FrequencyList.hpp')
| -rw-r--r-- | FrequencyList.hpp | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/FrequencyList.hpp b/FrequencyList.hpp new file mode 100644 index 00000000..c2265923 --- /dev/null +++ b/FrequencyList.hpp @@ -0,0 +1,59 @@ +#ifndef FREQUENCY_LIST_HPP__ +#define FREQUENCY_LIST_HPP__ + +#include "pimpl_h.hpp" + +#include <QSortFilterProxyModel> + +#include "Radio.hpp" + +// +// Class FrequencyList +// +// Encapsulates a collection of frequencies. The implementation is a +// table containing the list of Frequency type elements which is +// editable and a second column which is an immutable double +// representation of the corresponding Frequency item scaled to +// mega-Hertz. +// +// The list is ordered. +// +// Responsibilities +// +// Stores internally a list of unique frequencies. Provides methods +// to add and delete list elements. +// +// Collaborations +// +// Implements the QSortFilterProxyModel interface for a list of spot +// frequencies. +// +class FrequencyList final + : public QSortFilterProxyModel +{ +public: + using Frequency = Radio::Frequency; + using Frequencies = Radio::Frequencies; + + explicit FrequencyList (QObject * parent = nullptr); + explicit FrequencyList (Frequencies, QObject * parent = nullptr); + ~FrequencyList (); + + // Load and store contents + FrequencyList& operator = (Frequencies); + Frequencies frequencies () const; + + // Model API + QModelIndex add (Frequency); + bool remove (Frequency); + bool removeDisjointRows (QModelIndexList); + + // Custom roles. + static int constexpr SortRole = Qt::UserRole; + +private: + class impl; + pimpl<impl> m_; +}; + +#endif |
