Clementine-audio-player-Mac.../src/playlistitem.h

78 lines
2.1 KiB
C
Raw Normal View History

/* This file is part of Clementine.
Clementine is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Clementine is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
*/
2009-12-24 20:16:07 +01:00
#ifndef PLAYLISTITEM_H
#define PLAYLISTITEM_H
#include <QStandardItem>
#include <QUrl>
class QSettings;
2009-12-26 23:15:57 +01:00
class Song;
2009-12-24 20:16:07 +01:00
class PlaylistItem {
public:
PlaylistItem() {}
virtual ~PlaylistItem() {}
static PlaylistItem* NewFromType(const QString& type);
enum Type {
Type_Song,
2009-12-26 22:35:45 +01:00
Type_Radio,
2009-12-24 20:16:07 +01:00
};
2009-12-29 17:12:08 +01:00
enum Option {
Default = 0x00,
SpecialPlayBehaviour = 0x01,
ContainsMultipleTracks = 0x02,
PauseDisabled = 0x04,
LastFMControls = 0x08,
};
Q_DECLARE_FLAGS(Options, Option);
2009-12-24 20:16:07 +01:00
virtual Type type() const = 0;
QString type_string() const;
2009-12-29 17:12:08 +01:00
virtual Options options() const { return Default; }
2009-12-24 20:16:07 +01:00
virtual void Save(QSettings& settings) const = 0;
virtual void Restore(const QSettings& settings) = 0;
2010-01-16 17:12:47 +01:00
virtual void Reload() {}
2009-12-24 20:16:07 +01:00
2009-12-29 20:22:02 +01:00
virtual Song Metadata() const = 0;
2009-12-24 20:16:07 +01:00
2009-12-26 22:35:45 +01:00
// If the item needs to do anything special before it can play (eg. start
// streaming the radio stream), then it should implement StartLoading() and
// return true. If it returns false then the URL from Url() will be passed
// directly to xine instead.
2009-12-29 17:12:08 +01:00
virtual void StartLoading() {}
2009-12-24 20:16:07 +01:00
virtual QUrl Url() = 0;
2009-12-26 23:15:57 +01:00
// If the item is a radio station that can play another song after one has
// finished then it should do so and return true
2009-12-29 17:12:08 +01:00
virtual void LoadNext() {}
2009-12-26 23:15:57 +01:00
virtual void SetTemporaryMetadata(const Song& metadata) {Q_UNUSED(metadata)}
virtual void ClearTemporaryMetadata() {}
2009-12-24 20:16:07 +01:00
};
2009-12-29 17:12:08 +01:00
Q_DECLARE_OPERATORS_FOR_FLAGS(PlaylistItem::Options);
2009-12-24 20:16:07 +01:00
#endif // PLAYLISTITEM_H