OSDN Git Service

gwenview: fix rotated test for the case of dsd_1838.nef
[kde/kde-extraapps.git] / ktimer / ktimer.h
1 /*
2  * Copyright 2001 Stefan Schimanski <1Stein@gmx.de>
3  *
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.
8  *
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.
13  *
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.
17  */
18
19 #ifndef KTIMER_H_INCLUDED
20 #define KTIMER_H_INCLUDED
21
22 #include <QDialog>
23 #include <QWidget>
24 #include <QProcess>
25 #include "ui_prefwidget.h"
26
27 #include <QTreeWidgetItem>
28 class KConfig;
29
30 class KTimerJob : public QObject {
31  Q_OBJECT
32
33  public:
34     KTimerJob( QObject *parent=0);
35     virtual ~KTimerJob();
36
37     enum States { Stopped, Paused, Started };
38
39     unsigned delay() const;
40     QString command() const;
41     bool loop() const;
42     bool oneInstance() const;
43     unsigned value() const;
44     States state() const;
45     void *user();
46     void setUser( void *user );
47
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;
53
54
55  public slots:
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 );
64
65     void pause();
66     void stop();
67     void start();
68
69  signals:
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 );
76
77     void changed( KTimerJob *job );
78     void fired( KTimerJob *job );
79     void finished( KTimerJob *job, bool error );
80     void error( KTimerJob *job );
81
82  protected slots:
83     virtual void fire();
84
85  private slots:
86     void timeout();
87     void processExited(int, QProcess::ExitStatus);
88
89  private:
90     struct KTimerJobPrivate *d;
91 };
92
93
94 class KTimerPref : public QDialog, public Ui::PrefWidget
95 {
96     Q_OBJECT
97  public:
98     KTimerPref( QWidget *parent=0);
99     virtual ~KTimerPref();
100
101  public slots:
102     void exit();
103     void done(int result);
104
105  protected slots:
106     void add();
107     void remove();
108     void help();
109     void currentChanged( QTreeWidgetItem * , QTreeWidgetItem *);
110
111     void saveJobs( KConfig *cfg );
112     void loadJobs( KConfig *cfg );
113     void saveAllJobs();
114
115  private slots:
116     void jobChanged( KTimerJob *job );
117     void jobFinished( KTimerJob *job, bool error );
118     void delayChanged();
119
120  private:
121     struct KTimerPrefPrivate *d;
122 };
123
124 #endif