Sayonara Player
SomaFMStationModel.h
1 /* SomaFMStationModel.h */
2 
3 /* Copyright (C) 2011-2017 Lucio Carreras
4  *
5  * This file is part of sayonara player
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11 
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16 
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 
22 /* SomaFMStationModel.h */
23 
24 #ifndef SomaFMStationModel_H
25 #define SomaFMStationModel_H
26 
27 #include "GUI/Helper/SearchableWidget/AbstractSearchModel.h"
28 #include "Helper/Pimpl.h"
29 
30 #include <QMap>
31 #include <QList>
32 #include <QMimeData>
33 
34 class SomaFMStation;
37 {
38  Q_OBJECT
39 
40 public:
41  explicit SomaFMStationModel(QObject *parent = nullptr);
43 
44 private:
45  PIMPL(SomaFMStationModel)
46 
47  enum class Status : char
48  {
49  Waiting,
50  Error,
51  OK
52  };
53 
54  // QAbstractItemModel interface
55 public:
56  int rowCount(const QModelIndex& parent=QModelIndex()) const override;
57  int columnCount(const QModelIndex& parent=QModelIndex()) const override;
58  QVariant data(const QModelIndex& index, int role=Qt::DisplayRole) const override;
59  QMimeData* mimeData(const QModelIndexList &indexes) const override;
60  Qt::ItemFlags flags(const QModelIndex &index) const override;
61 
62 
63  // AbstractSearchModelInterface interface
64 public:
65  QModelIndex getFirstRowIndexOf(const QString& substr) override;
66  QModelIndex getNextRowIndexOf(const QString& substr, int cur_row, const QModelIndex& parent) override;
67  QModelIndex getPrevRowIndexOf(const QString& substr, int cur_row, const QModelIndex& parent) override;
68  QMap<QChar, QString> getExtraTriggers() override;
69 
70  void set_stations(const QList<SomaFMStation>& stations);
71  void replace_station(const SomaFMStation& station);
72  bool has_stations() const;
73  void set_waiting();
74 };
75 
76 #endif // SomaFMStationModel_H
Definition: AbstractSearchModel.h:55
Definition: SomaFMStation.h:35
Definition: org_mpris_media_player2_adaptor.h:21
Definition: org_mpris_media_player2_adaptor.h:20
Definition: SomaFMStationModel.h:35