File indexing completed on 2024-05-05 04:48:13

0001 /****************************************************************************************
0002  * Copyright (c) 2009 Nikolaj Hald Nielsen <nhn@kde.org>                                *
0003  * Copyright (c) 2012 Matěj Laitl <matej@laitl.cz>                                      *
0004  *                                                                                      *
0005  * This program is free software; you can redistribute it and/or modify it under        *
0006  * the terms of the GNU General Public License as published by the Free Software        *
0007  * Foundation; either version 2 of the License, or (at your option) any later           *
0008  * version.                                                                             *
0009  *                                                                                      *
0010  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
0011  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
0012  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
0013  *                                                                                      *
0014  * You should have received a copy of the GNU General Public License along with         *
0015  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
0016  ****************************************************************************************/
0017  
0018 #ifndef METAMULTISOURCECAPABILITY_H
0019 #define METAMULTISOURCECAPABILITY_H
0020 
0021 #include "core/capabilities/Capability.h"
0022 
0023 class QUrl;
0024 
0025 namespace Capabilities
0026 {
0027     /**
0028      * A capability for tracks that can have several different source urls, such as
0029      * multiple fallback streams for a radio station. If one source url fails or finishes,
0030      * the track will automatically use the next one. It is also possible to get a list
0031      * of all urls that can be presented to the user so tha she can choose.
0032      *
0033      * @author Nikolaj Hald Nielsen <nhn@kde.org>
0034      */
0035     class AMAROKCORE_EXPORT MultiSourceCapability : public Capability
0036     {
0037         Q_OBJECT
0038 
0039         public:
0040             MultiSourceCapability();
0041             ~MultiSourceCapability() override;
0042 
0043             static Type capabilityInterfaceType() { return MultiSource; }
0044 
0045             /**
0046              * Return list of displayable urls in this MultiSource. Only for display
0047              * purposes, don't attempt to play these urls.
0048              */
0049             virtual QStringList sources() const = 0;
0050 
0051             /**
0052              * Set current source. Does nothing if @param source is out of bounds.
0053              */
0054             virtual void setSource( int source ) = 0;
0055 
0056             /**
0057              * Get index of the current source
0058              */
0059             virtual int current() const = 0;
0060 
0061             /**
0062              * Return the url of the next source without actually advancing to it.
0063              * Returns empty url if the current source is the last one.
0064              */
0065             virtual QUrl nextUrl() const = 0;
0066 
0067         Q_SIGNALS:
0068             void urlChanged( const QUrl &url );
0069     };
0070 }
0071 
0072 #endif