| 1 |
/**************************************************************************************** |
| 2 |
* Copyright (c) 2009 Nikolaj Hald Nielsen <[email protected]> * |
| 3 |
* Copyright (c) 2012 Matěj Laitl <[email protected]> * |
| 4 |
* * |
| 5 |
* This program is free software; you can redistribute it and/or modify it under * |
| 6 |
* the terms of the GNU General Public License as published by the Free Software * |
| 7 |
* Foundation; either version 2 of the License, or (at your option) any later * |
| 8 |
* version. * |
| 9 |
* * |
| 10 |
* This program is distributed in the hope that it will be useful, but WITHOUT ANY * |
| 11 |
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * |
| 12 |
* PARTICULAR PURPOSE. See the GNU General Public License for more details. * |
| 13 |
* * |
| 14 |
* You should have received a copy of the GNU General Public License along with * |
| 15 |
* this program. If not, see <http://www.gnu.org/licenses/>. * |
| 16 |
****************************************************************************************/ |
| 17 |
|
| 18 |
#ifndef METAMULTISOURCECAPABILITY_H |
| 19 |
#define METAMULTISOURCECAPABILITY_H |
| 20 |
|
| 21 |
#include "core/capabilities/Capability.h" |
| 22 |
|
| 23 |
class QUrl; |
| 24 |
|
| 25 |
namespace Capabilities |
| 26 |
{ |
| 27 |
/** |
| 28 |
* A capability for tracks that can have several different source urls, such as |
| 29 |
* multiple fallback streams for a radio station. If one source url fails or finishes, |
| 30 |
* the track will automatically use the next one. It is also possible to get a list |
| 31 |
* of all urls that can be presented to the user so tha she can choose. |
| 32 |
* |
| 33 |
* @author Nikolaj Hald Nielsen <[email protected]> |
| 34 |
*/ |
| 35 |
class AMAROKCORE_EXPORT MultiSourceCapability : public Capability |
| 36 |
{ |
| 37 |
Q_OBJECT |
| 38 |
|
| 39 |
public: |
| 40 |
MultiSourceCapability(); |
| 41 |
~MultiSourceCapability() override; |
| 42 |
|
| 43 |
static Type capabilityInterfaceType() { return MultiSource; } |
| 44 |
|
| 45 |
/** |
| 46 |
* Return list of displayable urls in this MultiSource. Only for display |
| 47 |
* purposes, don't attempt to play these urls. |
| 48 |
*/ |
| 49 |
virtual QStringList sources() const = 0; |
| 50 |
|
| 51 |
/** |
| 52 |
* Set current source. Does nothing if @param source is out of bounds. |
| 53 |
*/ |
| 54 |
virtual void setSource( int source ) = 0; |
| 55 |
|
| 56 |
/** |
| 57 |
* Get index of the current source |
| 58 |
*/ |
| 59 |
virtual int current() const = 0; |
| 60 |
|
| 61 |
/** |
| 62 |
* Return the url of the next source without actually advancing to it. |
| 63 |
* Returns empty url if the current source is the last one. |
| 64 |
*/ |
| 65 |
virtual QUrl nextUrl() const = 0; |
| 66 |
|
| 67 |
Q_SIGNALS: |
| 68 |
void urlChanged( const QUrl &url ); |
| 69 |
}; |
| 70 |
} |
| 71 |
|
| 72 |
#endif |