1// 2// This file is part of the aMule Project. 3// 4// Copyright (c) 2010-2011 Werner Mahr (Vollstrecker) <amule@vollstreckernet.de> 5// 6// Any parts of this program contributed by third-party developers are copyrighted 7// by their respective authors. 8// 9// This program is free software; you can redistribute it and/or modify 10// it under the terms of the GNU General Public License as published by 11// the Free Software Foundation; either version 3 of the License, or 12// (at your option) any later version. 13// 14// This program is distributed in the hope that it will be useful, 15// but WITHOUT ANY WARRANTY; without even the implied warranty of 16// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17// GNU General Public License for more details. 18// 19// You should have received a copy of the GNU General Public License 20// along with this program; if not, write to the Free Software 21// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 22// 23 24#ifndef plasmamule_applet_h 25#define plasmamule_applet_h 26 27#include <plasma/applet.h> 28#include <plasma/dataengine.h> 29 30#include <QGraphicsSceneDragDropEvent> 31 32 33class PlasmaMuleApplet : public Plasma::Applet 34{ 35 Q_OBJECT 36 public: 37 PlasmaMuleApplet(QObject *parent, const QVariantList &args); 38 ~PlasmaMuleApplet(); 39 40 void paintInterface(QPainter *painter, const QStyleOptionGraphicsItem *option, const QRect& contentsRect); 41 void init(); 42 43 public Q_SLOTS: 44 void onSourceAdded(const QString&); 45 void onSourceRemoved(const QString&); 46 void dataUpdated(const QString&, const Plasma::DataEngine::Data&); 47 48 protected: 49 void dragEnterEvent(QGraphicsSceneDragDropEvent *event); 50 void dropEvent(QGraphicsSceneDragDropEvent *event); 51 void contextMenuEvent(QGraphicsSceneContextMenuEvent *event); 52 53 private: 54 void connectToEngine(); 55 56 QString calcSize (qlonglong); 57 QStringList m_catDirs, m_catNames; 58 int m_ed2k_state, m_ed2k_server_port, m_kad_status, m_clients_in_up_queue, m_shared_files_count, m_uptime, m_debugChannel; 59 QString m_ed2k_id_high_low, m_ed2k_server_name, m_ed2k_server_ip, m_nickname, m_version; 60 double m_down_speed, m_up_speed; 61 qlonglong m_total_bytes_downloaded, m_total_bytes_uploaded, m_session_bytes_downloaded, m_session_bytes_uploaded; 62 bool m_os_active, m_config_found; 63 Plasma::Svg m_svg; 64 Plasma::DataEngine* m_aMuleEngine; 65 66 signals: 67 void engine_add_link(QString, int); 68}; 69 70#endif 71