PageRenderTime 125ms CodeModel.GetById 31ms app.highlight 32ms RepoModel.GetById 38ms app.codeStats 1ms

/src/libtomahawk/infosystem/infoplugins/generic/hypemPlugin.h

http://github.com/tomahawk-player/tomahawk
C++ Header | 95 lines | 56 code | 22 blank | 17 comment | 0 complexity | a9bcf030c5f6c32e387179bea18fb2d5 MD5 | raw file
 1/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
 2 *
 3 *   Copyright 2010-2011, Hugo Lindstr??m <hugolm84@gmail.com>
 4 *
 5 *   Tomahawk is free software: you can redistribute it and/or modify
 6 *   it under the terms of the GNU General Public License as published by
 7 *   the Free Software Foundation, either version 3 of the License, or
 8 *   (at your option) any later version.
 9 *
10 *   Tomahawk is distributed in the hope that it will be useful,
11 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
12 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 *   GNU General Public License for more details.
14 *
15 *   You should have received a copy of the GNU General Public License
16 *   along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#ifndef hypemPlugin_H
20#define hypemPlugin_H
21
22#include "infosystem/infosystem.h"
23#include "infosystem/infosystemworker.h"
24#include <QNetworkReply>
25#include <QObject>
26
27class QNetworkReply;
28
29namespace Tomahawk
30{
31
32namespace InfoSystem
33{
34
35class hypemPlugin : public InfoPlugin
36{
37    Q_OBJECT
38
39public:
40    hypemPlugin();
41    virtual ~hypemPlugin();
42
43    enum ChartType {
44        None =      0x00,
45        Track =     0x01,
46        Album =     0x02,
47        Artist =    0x04
48
49    };
50 void setChartType( ChartType type ) { m_chartType = type; }
51 ChartType chartType() const { return m_chartType; }
52
53public slots:
54    void chartReturned();
55    void chartTypes();
56
57protected slots:
58    virtual void getInfo( Tomahawk::InfoSystem::InfoRequestData requestData );
59    virtual void notInCacheSlot( Tomahawk::InfoSystem::InfoStringHash criteria, Tomahawk::InfoSystem::InfoRequestData requestData );
60    virtual void pushInfo( const QString caller, const Tomahawk::InfoSystem::InfoType type, const QVariant input )
61    {
62        Q_UNUSED( caller )
63        Q_UNUSED( type)
64        Q_UNUSED( input )
65    }
66
67
68private:
69    void fetchChart( Tomahawk::InfoSystem::InfoRequestData requestData );
70    void fetchChartCapabilities( Tomahawk::InfoSystem::InfoRequestData requestData );
71    void dataError( Tomahawk::InfoSystem::InfoRequestData requestData );
72
73    QVariantList m_chartResources;
74    QList<InfoStringHash> m_charts;
75
76
77    ChartType m_chartType;
78    QVariantMap m_allChartsMap;
79    QVariantList m_types;
80    QVariantList m_popularTypes;
81    QVariantList m_trackTypes;
82    QVariantList m_byTagTypes;
83
84
85    uint m_chartsFetchJobs;
86    QList< InfoRequestData > m_cachedRequests;
87
88    QHash< QString, QString > m_cachedCountries;
89};
90
91}
92
93}
94
95#endif // hypemPlugin_H