Applets
job.h
Go to the documentation of this file.00001 /*************************************************************************** 00002 * Copyright (C) 2008 Rob Scheepmaker <r.scheepmaker@student.utwente.nl> * 00003 * * 00004 * This program is free software; you can redistribute it and/or modify * 00005 * it under the terms of the GNU General Public License as published by * 00006 * the Free Software Foundation; either version 2 of the License, or * 00007 * (at your option) any later version. * 00008 * * 00009 * This program is distributed in the hope that it will be useful, * 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00012 * GNU General Public License for more details. * 00013 * * 00014 * You should have received a copy of the GNU General Public License * 00015 * along with this program; if not, write to the * 00016 * Free Software Foundation, Inc., * 00017 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * 00018 ***************************************************************************/ 00019 00020 #ifndef SYSTEMTRAYJOB_H 00021 #define SYSTEMTRAYJOB_H 00022 00023 #include <QtCore/QHash> 00024 #include <QtCore/QObject> 00025 00026 namespace SystemTray 00027 { 00028 00029 class Job : public QObject 00030 { 00031 Q_OBJECT 00032 00033 public: 00034 enum State { 00035 Running = 0, 00036 Suspended = 1, 00037 Stopped = 2 00038 }; 00039 00040 Job(QObject *parent = 0); 00041 virtual ~Job(); 00042 00046 void destroy(); 00047 00051 QString applicationName() const; 00052 00056 QString applicationIconName() const; 00057 00061 QString message() const; 00062 00066 QString error() const; 00067 00071 QString speed() const; 00072 00073 QMap<QString, qlonglong> totalAmounts() const; 00074 00075 QMap<QString, qlonglong> processedAmounts() const; 00076 00080 QList<QPair<QString, QString> > labels() const; 00081 00085 State state() const; 00086 00087 bool isSuspendable() const; 00088 00089 bool isKillable() const; 00090 00094 uint percentage() const; 00095 00096 public slots: 00100 virtual void suspend(); 00101 00105 virtual void resume(); 00106 00110 virtual void stop(); 00111 00112 signals: 00116 void ready(SystemTray::Job *job); 00117 00121 void changed(SystemTray::Job *job); 00122 00126 void destroyed(SystemTray::Job *job); 00127 00128 protected: 00129 void setApplicationName(const QString &applicationName); 00130 void setApplicationIconName(const QString &applicationIcon); 00131 void setMessage(const QString &message); 00132 void setError(const QString &error); 00133 void setSpeed(const QString &speed); 00134 void setTotalAmounts(QMap<QString, qlonglong> amount); 00135 void setProcessedAmounts(QMap<QString, qlonglong> amount); 00136 void setState(State state); 00137 void setSuspendable(bool suspendable); 00138 void setKillable(bool killable); 00139 void setPercentage(uint percentage); 00140 void setLabels(QList<QPair<QString, QString> > labels); 00141 void timerEvent(QTimerEvent *); 00142 00143 private slots: 00144 void show(); 00145 00146 private: 00147 void scheduleChangedSignal(); 00148 00149 class Private; 00150 Private* const d; 00151 }; 00152 00153 } 00154 #endif