File indexing completed on 2025-01-05 04:26:56

0001 /****************************************************************************************
0002  * Copyright (c) 2008 Shane King <kde@dontletsstart.com>                                *
0003  *                                                                                      *
0004  * This program is free software; you can redistribute it and/or modify it under        *
0005  * the terms of the GNU General Public License as published by the Free Software        *
0006  * Foundation; either version 2 of the License, or (at your option) any later           *
0007  * version.                                                                             *
0008  *                                                                                      *
0009  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
0010  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
0011  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
0012  *                                                                                      *
0013  * You should have received a copy of the GNU General Public License along with         *
0014  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
0015  ****************************************************************************************/
0016 
0017 #ifndef AMAROK_LASTFM_MULTIPLAYABLECAPABILITY_H
0018 #define AMAROK_LASTFM_MULTIPLAYABLECAPABILITY_H
0019 
0020 #include "core/support/Components.h"
0021 #include "core/support/Debug.h"
0022 #include "core/logger/Logger.h"
0023 #include "MainWindow.h"
0024 #include "LastFmMeta.h"
0025 #include "core/meta/forward_declarations.h"
0026 #include "core/capabilities/MultiPlayableCapability.h"
0027 
0028 #include <KLocalizedString>
0029 
0030 #include <Track.h>
0031 #include <RadioStation.h>
0032 #include <RadioTuner.h>
0033 #include <ws.h>
0034 
0035 class LastFmMultiPlayableCapability : public Capabilities::MultiPlayableCapability
0036 {
0037     Q_OBJECT
0038 
0039     public:
0040         explicit LastFmMultiPlayableCapability( LastFm::Track *track );
0041         ~LastFmMultiPlayableCapability() override;
0042 
0043         // Capabilities::MultiPlayableCapability methods
0044         void fetchFirst() override;
0045         void fetchNext() override;
0046 
0047     private Q_SLOTS:
0048         void slotTrackPlaying( const Meta::TrackPtr &track );
0049         void slotNewTrackAvailable();
0050         void skip();
0051         void error( lastfm::ws::Error e );
0052 
0053     private:
0054         QUrl m_url;
0055         LastFm::TrackPtr m_track;
0056 
0057         lastfm::Track m_currentTrack;
0058         lastfm::RadioTuner *m_tuner;
0059 };
0060 
0061 #endif