2 * Copyright 2001 Stefan Schimanski <1Stein@gmx.de>
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 Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 #ifndef KTIMER_H_INCLUDED
20 #define KTIMER_H_INCLUDED
25 #include "ui_prefwidget.h"
27 #include <QTreeWidgetItem>
30 class KTimerJob : public QObject {
34 KTimerJob( QObject *parent=0);
37 enum States { Stopped, Paused, Started };
39 unsigned delay() const;
40 QString command() const;
42 bool oneInstance() const;
43 unsigned value() const;
46 void setUser( void *user );
48 void load( KConfig *cfg, const QString& grp );
49 void save( KConfig *cfg, const QString& grp );
50 QString formatTime( int seconds ) const;
51 int timeToSeconds( int hours, int minutes, int seconds ) const;
52 void secondsToHMS( int secs, int *hours, int *minutes, int *seconds ) const;
56 void setDelay( unsigned int sec );
57 void setDelay( int sec );
58 void setCommand( const QString &cmd );
59 void setLoop( bool loop );
60 void setOneInstance( bool one );
61 void setValue( unsigned int value );
62 void setValue( int value );
63 void setState( States state );
70 void stateChanged( KTimerJob *job, States state );
71 void delayChanged( KTimerJob *job, unsigned int sec );
72 void commandChanged( KTimerJob *job, const QString &cmd );
73 void loopChanged( KTimerJob *job, bool loop );
74 void oneInstanceChanged( KTimerJob *job, bool one );
75 void valueChanged( KTimerJob *job, unsigned int value );
77 void changed( KTimerJob *job );
78 void fired( KTimerJob *job );
79 void finished( KTimerJob *job, bool error );
80 void error( KTimerJob *job );
87 void processExited(int, QProcess::ExitStatus);
90 struct KTimerJobPrivate *d;
94 class KTimerPref : public QDialog, public Ui::PrefWidget
98 KTimerPref( QWidget *parent=0);
99 virtual ~KTimerPref();
103 void done(int result);
109 void currentChanged( QTreeWidgetItem * , QTreeWidgetItem *);
111 void saveJobs( KConfig *cfg );
112 void loadJobs( KConfig *cfg );
116 void jobChanged( KTimerJob *job );
117 void jobFinished( KTimerJob *job, bool error );
121 struct KTimerPrefPrivate *d;