Sayonara Player
Loading...
Searching...
No Matches
SomaFMStationModel.h
1/* SomaFMStationModel.h */
2
3/* Copyright (C) 2011-2024 Michael Lugmair (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/Utils/SearchableWidget/SearchableModel.h"
28#include "Utils/Pimpl.h"
29
30#include <QMimeData>
31#include <QAbstractTableModel>
32
33namespace SomaFM
34{
35 class Station;
38 {
39 Q_OBJECT
40 PIMPL(StationModel)
41
42 public:
43 explicit StationModel(QObject* parent = nullptr);
44 ~StationModel() override;
45
46 private:
47 enum class Status :
48 char
49 {
50 Waiting,
51 Error,
52 OK
53 };
54
55 public:
56 [[nodiscard]] int rowCount(const QModelIndex& parent = QModelIndex()) const override;
57 [[nodiscard]] int columnCount(const QModelIndex& parent = QModelIndex()) const override;
58 [[nodiscard]] QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
59 [[nodiscard]] QMimeData* mimeData(const QModelIndexList& indexes) const override;
60 [[nodiscard]] Qt::ItemFlags flags(const QModelIndex& index) const override;
61
62 void setStations(const QList<SomaFM::Station>& stations);
63 void replaceStation(const SomaFM::Station& station);
64 [[nodiscard]] bool hasStations() const;
65 void setWaiting();
66
67 protected:
68 [[nodiscard]] int itemCount() const override;
69 [[nodiscard]] QString searchableString(int index, const QString& prefix) const override;
70 };
71}
72
73#endif // SomaFMStationModel_H
Definition EngineUtils.h:33
Definition SearchableModel.h:57
Definition SomaFMStationModel.h:38
Definition SomaFMStation.h:41
Definition Station.h:34