File indexing completed on 2025-02-23 04:27:31
0001 /**************************************************************************************** 0002 * Copyright (c) 2008 Jeff Mitchell <mitchell@kde.org> * 0003 * Copyright (c) 2007-2008 Leo Franchi <lfranchi@gmail.com> * 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 AMAROK_SONGKICK_ENGINE 0019 #define AMAROK_SONGKICK_ENGINE 0020 0021 #include "ContextObserver.h" 0022 #include "context/DataEngine.h" 0023 #include "core/meta/forward_declarations.h" 0024 0025 #include <kio/job.h> 0026 0027 /** 0028 This class provides Songkick data for use in Context applets. 0029 It provides concert/tour information. 0030 */ 0031 0032 using namespace Context; 0033 0034 class SongkickEngine : public DataEngine, public ContextObserver, Meta::Observer 0035 { 0036 Q_OBJECT 0037 0038 public: 0039 SongkickEngine( QObject* parent, const QList<QVariant>& args ); 0040 0041 QStringList sources() const; 0042 0043 //reimplemented from ContextObserver 0044 virtual void message( const ContextState& state ); 0045 0046 //reimplemented from Meta::Observer 0047 using Observer::metadataChanged; 0048 void metadataChanged( Meta::TrackPtr track ); 0049 0050 protected: 0051 bool sourceRequestEvent( const QString& name ); 0052 0053 private Q_SLOTS: 0054 void datesResult( KJob* ); 0055 void ontourResult( KJob* ); 0056 0057 private: 0058 void update(); 0059 0060 KJob* m_datesJob; 0061 KJob* m_ontourJob; 0062 0063 QStringList m_sources; 0064 0065 Meta::TrackPtr m_currentTrack; 0066 0067 bool m_ontour; 0068 bool m_dates; 0069 0070 }; 0071 0072 AMAROK_EXPORT_DATAENGINE( songkick, SongkickEngine ) 0073 0074 #endif