1 /***************************************************************************
2 * Copyright (C) 2008 Rob Scheepmaker <r.scheepmaker@student.utwente.nl> *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . *
18 ***************************************************************************/
20 #ifndef SYSTEMTRAYJOB_H
21 #define SYSTEMTRAYJOB_H
23 #include <QtCore/QHash>
24 #include <QtCore/QObject>
29 class Job
: public QObject
40 Job(QObject
*parent
= 0);
44 * Request and signal destruction of this object
49 * @return the name of the application which started this job.
51 QString
applicationName() const;
54 * @return the name of the icon to be used for this job.
56 QString
applicationIconName() const;
59 * @return the descripion of the activity that is performed.
61 QString
message() const;
64 * @return the errormessage if an error has occured.
66 QString
error() const;
69 * @return the speed at which the jobs is progressing.
71 QString
speed() const;
73 QMap
<QString
, qlonglong
> totalAmounts() const;
75 QMap
<QString
, qlonglong
> processedAmounts() const;
78 * @return a list of pairs containing label names/values in the order they should be displayed.
80 QList
<QPair
<QString
, QString
> > labels() const;
83 * @return the state this job is in.
87 bool isSuspendable() const;
89 bool isKillable() const;
92 * @retun the percentage of the job that has been completed.
94 uint
percentage() const;
100 virtual void suspend();
105 virtual void resume();
114 * Emitted when the job is ready to be shown
116 void ready(SystemTray::Job
*job
);
119 * Emitted when the job changes
121 void changed(SystemTray::Job
*job
);
124 * Emitted when the job is about to be destroyed
126 void destroyed(SystemTray::Job
*job
);
129 void setApplicationName(const QString
&applicationName
);
130 void setApplicationIconName(const QString
&applicationIcon
);
131 void setMessage(const QString
&message
);
132 void setError(const QString
&error
);
133 void setSpeed(const QString
&speed
);
134 void setTotalAmounts(QMap
<QString
, qlonglong
> amount
);
135 void setProcessedAmounts(QMap
<QString
, qlonglong
> amount
);
136 void setState(State state
);
137 void setSuspendable(bool suspendable
);
138 void setKillable(bool killable
);
139 void setPercentage(uint percentage
);
140 void setLabels(QList
<QPair
<QString
, QString
> > labels
);
141 void timerEvent(QTimerEvent
*);
147 void scheduleChangedSignal();