File: task.h

package info (click to toggle)
kdeutils 4%3A2.2.2-9.2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 8,892 kB
  • ctags: 10,879
  • sloc: cpp: 82,942; sh: 11,754; ansic: 4,638; perl: 1,852; makefile: 706; python: 258
file content (87 lines) | stat: -rw-r--r-- 1,861 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#ifndef ssk_karm_h
#define ssk_karm_h

#include <qstring.h>
#include <qlist.h>
#include <qobject.h>
#include <qlistview.h>
#include <qvector.h>
#include <qpixmap.h>
#include "karm.h"

class QFile;
class QTimer;

/**
	Encapsulates a task.
*/

class Task :public QObject, public QListViewItem
{
Q_OBJECT

private:
	QString _name;
	long _totalTime;
  long _sessionTime;
  QTimer *_timer;
  int _i;
  static QVector<QPixmap> *icons;

public:
	/** constructor */
	Task(const QString& taskame, long minutes, long sessionTime, QListView *parent = 0);
	Task(const QString& taskame, long minutes, long sessionTime, QListViewItem *parent = 0);
  void init(const QString& taskame, long minutes, long sessionTime);

	/**increments the total task time
	* @param minutes to increment by
	*/
	void incrementTime( long minutes );

	/** decrements the total task time
	* @param minutes to decrement by
	*/
	void decrementTime( long minutes );

	/** sets the total time accumulated by the task
	* @param minutes time in minutes
	*/
	void setTotalTime ( long minutes );
	void setSessionTime ( long minutes );

	/** returns the total time accumulated by the task
	* @return total time in minutes
	*/
	long totalTime() const
		{ return _totalTime; };

	long sessionTime() const
		{ return _sessionTime; };

	/** sets the name of the task
	* @param name	a pointer to the name. A deep copy will be made.
	*/
	void setName( const QString& name );

	/** returns the name of this task.
	* @return a pointer to the name.
	*/
	QString name() const
		{ return _name; };

	/** Updates the content of the QListViewItem with respect to _name and _totalTime
	 */
	inline void update() {
    setText(0, _name);
		setText(1, Karm::formatTime(_sessionTime));
		setText(2, Karm::formatTime(_totalTime));
	}
  
  void setRunning(bool on);

protected slots:    
  void updateActiveIcon();
};

#endif