Remove unused roles

This commit is contained in:
Jonas Kvinge 2019-03-09 17:49:12 +01:00
parent 380f2509ac
commit e10a50fdc1
1 changed files with 0 additions and 61 deletions

View File

@ -46,73 +46,12 @@ class InternetServices : public QObject {
explicit InternetServices(QObject *parent = nullptr); explicit InternetServices(QObject *parent = nullptr);
~InternetServices(); ~InternetServices();
enum Role {
// Services can use this role to distinguish between different types of items that they add.
// The root item's type is automatically set to Type_Service,
// but apart from that Services are free to define their own values for this field (starting from TypeCount).
Role_Type = Qt::UserRole + 1000,
// If this is not set the item is not playable (ie. it can't be dragged to the playlist).
// Otherwise it describes how this item is converted to playlist items.
// See the PlayBehaviour enum for more details.
Role_PlayBehaviour,
// The URL of the media for this item. This is required if the PlayBehaviour is set to PlayBehaviour_UseSongLoader.
Role_Url,
// The metadata used in the item that is added to the playlist if the PlayBehaviour is set to PlayBehaviour_SingleItem. Ignored otherwise.
Role_SongMetadata,
// If this is set to true then the model will call the service's LazyPopulate method when this item is expanded.
// Use this if your item's children have to be downloaded or fetched remotely.
Role_CanLazyLoad,
// This is automatically set on the root item for a service. It contains a pointer to an InternetService.
// Services should not set this field themselves.
Role_Service,
// Setting this to true means that the item can be changed by user action (e.g. changing remote playlists)
Role_CanBeModified,
RoleCount,
Role_IsDivider = CollectionModel::Role_IsDivider,
};
enum Type {
Type_Service = 1,
Type_Track,
Type_UserPlaylist,
TypeCount
};
enum PlayBehaviour {
// The item can't be played. This is the default.
PlayBehaviour_None = 0,
// This item's URL is passed through the normal song loader.
// This supports loading remote playlists, remote files and local files.
// This is probably the most sensible behaviour to use if you're just returning normal radio stations.
PlayBehaviour_UseSongLoader,
// This item's URL, Title and Artist are used in the playlist. No special behaviour occurs
// The URL is just passed straight to gstreamer when the user starts playing.
PlayBehaviour_SingleItem,
// This item's children have PlayBehaviour_SingleItem set.
// This is used when dragging a playlist item for instance, to have all the playlit's items info loaded in the mime data.
PlayBehaviour_MultipleItems,
// This item might not represent a song - the service's ItemDoubleClicked() slot will get called instead to do some custom action.
PlayBehaviour_DoubleClickAction,
};
InternetService *ServiceBySource(const Song::Source &source); InternetService *ServiceBySource(const Song::Source &source);
template <typename T> template <typename T>
T *Service() { T *Service() {
return static_cast<T*>(this->ServiceBySource(T::kSource)); return static_cast<T*>(this->ServiceBySource(T::kSource));
} }
// Add and remove services. Ownership is not transferred and the service is not reparented.
// If the service is deleted it will be automatically removed from the model.
void AddService(InternetService *service); void AddService(InternetService *service);
void RemoveService(InternetService *service); void RemoveService(InternetService *service);
void ReloadSettings(); void ReloadSettings();