PageRenderTime 83ms CodeModel.GetById 41ms app.highlight 6ms RepoModel.GetById 34ms app.codeStats 0ms

/src/libtomahawk/context/ContextPage.h

http://github.com/tomahawk-player/tomahawk
C++ Header | 94 lines | 53 code | 23 blank | 18 comment | 0 complexity | 2c9b6f63eb20ede0c68cdf195f3441f9 MD5 | raw file
 1/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
 2 *
 3 *   Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
 4 *   Copyright 2010-2011, Jeff Mitchell <jeff@tomahawk-player.org>
 5 *
 6 *   Tomahawk is free software: you can redistribute it and/or modify
 7 *   it under the terms of the GNU General Public License as published by
 8 *   the Free Software Foundation, either version 3 of the License, or
 9 *   (at your option) any later version.
10 *
11 *   Tomahawk is distributed in the hope that it will be useful,
12 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
13 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 *   GNU General Public License for more details.
15 *
16 *   You should have received a copy of the GNU General Public License
17 *   along with Tomahawk. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef CONTEXTPAGE_H
21#define CONTEXTPAGE_H
22
23#include <QGraphicsProxyWidget>
24#include <QGraphicsWebView>
25#include <QStyleOptionGraphicsItem>
26
27#include "Typedefs.h"
28#include "utils/TomahawkUtils.h"
29
30#include "DllMacro.h"
31#include <signal.h>
32
33class PlaylistInterface;
34
35namespace Tomahawk
36{
37
38class DLLEXPORT ContextPage : public QObject
39{
40    Q_OBJECT
41
42public:
43    ContextPage() {}
44    virtual ~ContextPage() {}
45
46    virtual QGraphicsWidget* widget() = 0;
47    virtual Tomahawk::playlistinterface_ptr playlistInterface() const = 0;
48
49    virtual QString title() const = 0;
50    virtual QString description() const = 0;
51    virtual QPixmap pixmap() const { return QPixmap( RESPATH "icons/tomahawk-icon-128x128.png" ); }
52
53    virtual bool jumpToCurrentTrack() = 0;
54
55public slots:
56    virtual void setArtist( const Tomahawk::artist_ptr& artist ) { Q_UNUSED( artist ); }
57    virtual void setAlbum( const Tomahawk::album_ptr& album ) { Q_UNUSED( album ); }
58    virtual void setQuery( const Tomahawk::query_ptr& query ) { Q_UNUSED( query ); }
59
60signals:
61    void nameChanged( const QString& );
62    void descriptionChanged( const QString& );
63    void pixmapChanged( const QPixmap& );
64    void destroyed( QWidget* widget );
65};
66
67
68class DLLEXPORT ContextProxyPage : public QGraphicsWidget
69{
70    Q_OBJECT
71
72public:
73    ContextProxyPage() : QGraphicsWidget()
74    {}
75
76    Tomahawk::ContextPage* page() const { return m_page; }
77    void setPage( Tomahawk::ContextPage* page );
78
79    virtual bool eventFilter( QObject* watched, QEvent* event );
80
81signals:
82    void focused();
83
84protected:
85    virtual void paint( QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget );
86    virtual bool sceneEvent( QEvent* event );
87
88private:
89    Tomahawk::ContextPage* m_page;
90};
91
92}; // ns
93
94#endif //CONTEXTPAGE_H