• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdenetwork API Reference
  • KDE Home
  • Contact Us
 

kget

  • sources
  • kde-4.12
  • kdenetwork
  • kget
  • plasma
  • applet
  • common
kgetapplet.h
Go to the documentation of this file.
1 /***************************************************************************
2  * *
3  * This program is free software; you can redistribute it and/or modify *
4  * it under the terms of the GNU General Public License as published by *
5  * the Free Software Foundation; either version 2 of the License, or *
6  * (at your option) any later version. *
7  *
8  * Copyright (C) 2008 by Lukas Appelhans <l.appelhans@gmx.de>
9  * *
10  * This program 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 this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
19  ***************************************************************************/
20 #ifndef KGETAPPLET_H
21 #define KGETAPPLET_H
22 
23 #include <plasma/popupapplet.h>
24 #include <plasma/dataengine.h>
25 #include "transfer_interface.h"
26 
27 #include <KIO/Job>
28 
29 class QEvent;
30 class QDropEvent;
31 class QGraphicsLinearLayout;
32 class ErrorWidget;
33 
34 namespace Plasma
35 {
36  class Theme;
37  class IconWidget;
38  class Meter;
39 }
40 
41 class ProxyWidget : public QGraphicsWidget
42 {
43  Q_OBJECT
44  public:
45  ProxyWidget(QGraphicsWidget * parent);
46  ~ProxyWidget();
47 
48  void paint(QPainter * p, const QStyleOptionGraphicsItem * option, QWidget * widget);
49 
50  void setDataWidget(QGraphicsWidget *widget);
51 
52  QGraphicsWidget * dataWidget();
53 
54  private slots:
55  void themeChanged();
56 
57  private:
58  QGraphicsLinearLayout * m_layout;
59  QGraphicsWidget * m_dataWidget;
60  int m_textWidth;
61  int m_textHeight;
62  static const int MARGIN;
63  static const int TOP_MARGIN;
64  static const int LEFT_MARGIN;
65  static const int SPACING;
66 };
67 
68 class KGetApplet : public Plasma::PopupApplet
69 {
70  Q_OBJECT
71 public:
72  KGetApplet(QObject *parent, const QVariantList &args);
73  ~KGetApplet();
74 
75  void init();
76  void setDataWidget(QGraphicsWidget * widget);
77 
78 public slots:
79  void dataUpdated(const QString &name, const Plasma::DataEngine::Data &data);
80 
81 private slots:
82  virtual void slotKgetStarted();
83  void slotUpdateTransfer(int transferChange);
84 
85 signals:
86  void transfersAdded(const QList<OrgKdeKgetTransferInterface*> &transfers);
87  void transfersRemoved(const QList<OrgKdeKgetTransferInterface*> &transfers);
88  void update();
89 
90 private:
91  void updateGlobalProgress();
92  void transferAdded(const QVariantMap &transfer);
93  void transferRemoved(const QVariantMap &transfer);
94 
95 protected:
96  virtual bool sceneEventFilter(QGraphicsItem * watched, QEvent * event);
97  virtual void dropEvent(QGraphicsSceneDragDropEvent * event);
98  virtual void dropEvent(QDropEvent * event);
99  virtual void constraintsEvent(Plasma::Constraints constraints);
100 
101  struct Data
102  {
103  KIO::filesize_t size;
104  KIO::filesize_t downloadedSize;
105  };
106 
107  ProxyWidget *m_proxyWidget;
108  ErrorWidget *m_errorWidget;
109  QGraphicsWidget *m_dataWidget;
110  Plasma::Meter *m_globalProgress;
111  Plasma::IconWidget *m_icon;
112  Plasma::DataEngine *m_engine;
113  KIO::filesize_t m_totalSize;
114  KIO::filesize_t m_downloadedSize;
115  QHash<OrgKdeKgetTransferInterface*, Data> m_transfers;
116  static const QString KGET_DBUS_SERVICE;
117  static const QString KGET_DBUS_PATH;
118 };
119 
120 #endif
KGetApplet::transfersAdded
void transfersAdded(const QList< OrgKdeKgetTransferInterface * > &transfers)
KGetApplet::m_dataWidget
QGraphicsWidget * m_dataWidget
Definition: kgetapplet.h:109
KGetApplet::m_icon
Plasma::IconWidget * m_icon
Definition: kgetapplet.h:111
ProxyWidget::paint
void paint(QPainter *p, const QStyleOptionGraphicsItem *option, QWidget *widget)
Definition: kgetapplet.cpp:68
ProxyWidget::ProxyWidget
ProxyWidget(QGraphicsWidget *parent)
Definition: kgetapplet.cpp:50
QWidget
QObject
ProxyWidget::dataWidget
QGraphicsWidget * dataWidget()
Definition: kgetapplet.cpp:113
KGetApplet::m_globalProgress
Plasma::Meter * m_globalProgress
Definition: kgetapplet.h:110
KGetApplet::dropEvent
virtual void dropEvent(QGraphicsSceneDragDropEvent *event)
Definition: kgetapplet.cpp:347
KGetApplet::KGET_DBUS_PATH
static const QString KGET_DBUS_PATH
Definition: kgetapplet.h:117
ErrorWidget
Definition: kgetappletutils.h:50
ProxyWidget::~ProxyWidget
~ProxyWidget()
Definition: kgetapplet.cpp:64
KGetApplet::Data::size
KIO::filesize_t size
Definition: kgetapplet.h:103
KGetApplet::m_engine
Plasma::DataEngine * m_engine
Definition: kgetapplet.h:112
ProxyWidget
Definition: kgetapplet.h:41
KGetApplet::init
void init()
Definition: kgetapplet.cpp:139
KGetApplet::transfersRemoved
void transfersRemoved(const QList< OrgKdeKgetTransferInterface * > &transfers)
KGetApplet::m_transfers
QHash< OrgKdeKgetTransferInterface *, Data > m_transfers
Definition: kgetapplet.h:115
KGetApplet::KGET_DBUS_SERVICE
static const QString KGET_DBUS_SERVICE
Definition: kgetapplet.h:116
KGetApplet::constraintsEvent
virtual void constraintsEvent(Plasma::Constraints constraints)
Definition: kgetapplet.cpp:292
KGetApplet::update
void update()
KGetApplet::sceneEventFilter
virtual bool sceneEventFilter(QGraphicsItem *watched, QEvent *event)
Definition: kgetapplet.cpp:329
KGetApplet::KGetApplet
KGetApplet(QObject *parent, const QVariantList &args)
Definition: kgetapplet.cpp:118
KGetApplet::Data::downloadedSize
KIO::filesize_t downloadedSize
Definition: kgetapplet.h:104
KGetApplet
Definition: kgetapplet.h:68
ProxyWidget::setDataWidget
void setDataWidget(QGraphicsWidget *widget)
Definition: kgetapplet.cpp:105
KGetApplet::dataUpdated
void dataUpdated(const QString &name, const Plasma::DataEngine::Data &data)
Definition: kgetapplet.cpp:161
KGetApplet::~KGetApplet
~KGetApplet()
Definition: kgetapplet.cpp:135
KGetApplet::setDataWidget
void setDataWidget(QGraphicsWidget *widget)
Definition: kgetapplet.cpp:285
KGetApplet::m_proxyWidget
ProxyWidget * m_proxyWidget
Definition: kgetapplet.h:107
KGetApplet::m_errorWidget
ErrorWidget * m_errorWidget
Definition: kgetapplet.h:108
KGetApplet::Data
Definition: kgetapplet.h:101
QGraphicsWidget
KGetApplet::m_totalSize
KIO::filesize_t m_totalSize
Definition: kgetapplet.h:113
KGetApplet::m_downloadedSize
KIO::filesize_t m_downloadedSize
Definition: kgetapplet.h:114
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:53:17 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kget

Skip menu "kget"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdenetwork API Reference

Skip menu "kdenetwork API Reference"
  • kget
  • kopete
  •   kopete
  •   libkopete
  • krdc
  • krfb

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal