LeechCraft 0.6.70-14794-g33744ae6ce
Modular cross-platform feature rich live environment.
Loading...
Searching...
No Matches
iradiostationprovider.h
Go to the documentation of this file.
1/**********************************************************************
2 * LeechCraft - modular cross-platform feature rich internet client.
3 * Copyright (C) 2006-2014 Georg Rudoy
4 *
5 * Distributed under the Boost Software License, Version 1.0.
6 * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7 **********************************************************************/
8
9#pragma once
10
11#include <memory>
12#include <functional>
13#include <variant>
14#include <QMap>
15#include <QMetaType>
16#include <QtPlugin>
17
18class QModelIndex;
19class QAbstractItemModel;
20
21namespace Media
22{
23 class IRadioStation;
24 typedef std::shared_ptr<IRadioStation> IRadioStation_ptr;
25
26 using ActionFunctor_f = std::variant<std::function<void (QModelIndex)>, std::function<void ()>>;
27
33 {
37
46
55
59
72
81
87
94
101 };
102
108 {
113 ItemType = Qt::UserRole + 1,
114
120
127
143
147
151 };
152
161 class Q_DECL_EXPORT IRadioStationProvider
162 {
163 public:
165
179 virtual IRadioStation_ptr GetRadioStation (const QModelIndex& item, const QString& query) = 0;
180
197
200 virtual void RefreshItems (const QList<QModelIndex>&) = 0;
201 };
202}
203
205
206Q_DECLARE_INTERFACE (Media::IRadioStationProvider, "org.LeechCraft.Media.IRadioStationProvider/1.0")
Interface for plugins providing radio stations.
virtual void RefreshItems(const QList< QModelIndex > &)=0
Refreshes the list of radio items.
virtual IRadioStation_ptr GetRadioStation(const QModelIndex &item, const QString &query)=0
Returns a radio station for the given item and query.
virtual QList< QAbstractItemModel * > GetRadioListItems() const =0
Returns the list of stations provided by this plugin.
RadioItemRole
Custom user roles for the items in the model.
@ RadioID
The internal ID of the radio.
@ TracksInfos
The tracks list.
@ PluginID
The ID of the plugin for this radio item.
@ ActionFunctor
The callable functor for RadioAction.
@ ItemType
The type of this radio station.
@ MaxRadioRole
Maximum role.
std::variant< std::function< void(QModelIndex)>, std::function< void()> > ActionFunctor_f
std::shared_ptr< IRadioStation > IRadioStation_ptr
A pointer to a shared instance of a IRadioStation.
RadioType
Describes the type of a radio station.
@ RadioAction
An action.
@ TracksRoot
A root for a list of SingleTrack or TracksList items.
@ TracksList
A predefined list of single tracks, not a stream.
@ None
No type (item doesn't correspond to a radio station).
@ SimilarArtists
Radio of artists similar to a given one.
@ GlobalTag
Radio of a global tag like metalcore.
@ CustomAddableStreams
A radio station that contains user-addable streams.
@ Predefined
A predefined radio station like an Icecast stream.
@ SingleTrack
A single song.
Q_DECLARE_METATYPE(QVariantList *)