PageRenderTime 93ms CodeModel.GetById 51ms app.highlight 5ms RepoModel.GetById 36ms app.codeStats 0ms

/src/libtomahawk/playlist/XspfUpdater.h

http://github.com/tomahawk-player/tomahawk
C Header | 79 lines | 42 code | 20 blank | 17 comment | 0 complexity | e37e1563dd56ca5a9645365bf2385356 MD5 | raw file
 1/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
 2 *
 3 *   Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
 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 XSPFUPDATER_H
20#define XSPFUPDATER_H
21
22#include "PlaylistUpdaterInterface.h"
23#include "DllMacro.h"
24
25class QTimer;
26class QCheckBox;
27
28namespace Tomahawk
29{
30
31
32class DLLEXPORT XspfUpdater : public PlaylistUpdaterInterface
33{
34    Q_OBJECT
35public:
36    XspfUpdater( const playlist_ptr& pl, int interval /* ms */, bool autoUpdate, const QString& xspfUrl );
37
38    virtual ~XspfUpdater();
39
40    virtual QString type() const { return "xspf"; }
41
42    virtual QWidget* configurationWidget() const;
43
44    bool autoUpdate() const { return m_autoUpdate; }
45
46    void setInterval( int intervalMsecs ) ;
47    int intervalMsecs() const { return m_timer->interval(); }
48
49    bool canSubscribe() const { return true; }
50    bool subscribed() const { return m_autoUpdate; }
51    void setSubscribed( bool subscribed );
52
53public slots:
54    void updateNow();
55    void setAutoUpdate( bool autoUpdate );
56
57private slots:
58    void playlistLoaded( const QList<Tomahawk::query_ptr> & );
59
60private:
61    QTimer* m_timer;
62    bool m_autoUpdate;
63    QString m_url;
64
65    QCheckBox* m_toggleCheckbox;
66};
67
68class DLLEXPORT XspfUpdaterFactory : public PlaylistUpdaterFactory
69{
70public:
71    XspfUpdaterFactory() {}
72
73    virtual QString type() const { return "xspf"; }
74    virtual PlaylistUpdaterInterface* create( const playlist_ptr& pl, const QVariantHash& settings );
75};
76
77}
78
79#endif // XSPFUPDATER_H