File indexing completed on 2025-01-05 04:25:44

0001 /****************************************************************************************
0002  * Copyright (c) 2007 Leo Franchi <lfranchi@gmail.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 SONGKICK_APPLET_H
0018 #define SONGKICK_APPLET_H
0019 
0020 #include "context/Applet.h"
0021 #include "context/DataEngine.h"
0022 #include "context/Svg.h"
0023 
0024 #include <plasma/widgets/iconwidget.h>
0025 
0026 
0027 class QGraphicsSimpleTextItem;
0028 class QGraphicsProxyWidget;
0029 class QTextBrowser;
0030 
0031 class SongkickApplet : public Context::Applet
0032 {
0033     Q_OBJECT
0034 
0035 public:
0036     SongkickApplet( QObject* parent, const QVariantList& args );
0037     ~SongkickApplet();
0038 
0039     bool hasHeightForWidth() const;
0040 
0041     void constraintsEvent( Plasma::Constraints constraints = Plasma::AllConstraints );
0042 
0043     void paintInterface( QPainter *painter, const QStyleOptionGraphicsItem* option, const QRect& contentsRect );
0044 
0045     virtual QSizeF sizeHint( Qt::SizeHint which, const QSizeF & constraint) const;
0046 
0047 public Q_SLOTS:
0048     virtual void init();
0049     void connectSource( const QString& source );
0050     void dataUpdated( const QString& name, const Plasma::DataEngine::Data& data );
0051 
0052 private Q_SLOTS:
0053     void paletteChanged( const QPalette & palette );
0054 
0055 private:
0056     void calculateHeight();
0057 
0058     QString m_titleText;
0059     QGraphicsSimpleTextItem* m_titleLabel;
0060     Plasma::IconWidget* m_reloadIcon;
0061 
0062     // holds main body
0063     QGraphicsProxyWidget *m_songkickProxy;
0064     QTextBrowser* m_songkick;
0065 };
0066 
0067 AMAROK_EXPORT_APPLET( songkick, SongkickApplet )
0068 
0069 #endif