• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeutils API Reference
  • KDE Home
  • Contact Us
 

ktimer

  • sources
  • kde-4.14
  • kdeutils
  • ktimer
ktimer.h
Go to the documentation of this file.
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 class 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
KTimerPref::KTimerPref
KTimerPref(QWidget *parent=0)
Definition: ktimer.cpp:98
KTimerJob::loopChanged
void loopChanged(KTimerJob *job, bool loop)
QWidget
KTimerJob::value
unsigned value() const
Definition: ktimer.cpp:534
KTimerJob::command
QString command() const
Definition: ktimer.cpp:486
KTimerJob
Definition: ktimer.h:30
KTimerJob::delayChanged
void delayChanged(KTimerJob *job, unsigned int sec)
KTimerJob::secondsToHMS
void secondsToHMS(int secs, int *hours, int *minutes, int *seconds) const
Definition: ktimer.cpp:420
KTimerJob::start
void start()
Definition: ktimer.cpp:457
KTimerJob::fire
virtual void fire()
Definition: ktimer.cpp:604
KTimerJob::fired
void fired(KTimerJob *job)
KTimerJob::Paused
Definition: ktimer.h:37
KTimerJob::setState
void setState(States state)
Definition: ktimer.cpp:556
KTimerJob::setUser
void setUser(void *user)
Definition: ktimer.cpp:435
KTimerJob::stateChanged
void stateChanged(KTimerJob *job, States state)
KTimerJob::stop
void stop()
Definition: ktimer.cpp:452
KTimerJob::finished
void finished(KTimerJob *job, bool error)
KTimerPref::help
void help()
Definition: ktimer.cpp:177
KTimerJob::Stopped
Definition: ktimer.h:37
KTimerJob::timeToSeconds
int timeToSeconds(int hours, int minutes, int seconds) const
Definition: ktimer.cpp:413
KTimerJob::setValue
void setValue(unsigned int value)
KTimerJob::setOneInstance
void setOneInstance(bool one)
Definition: ktimer.cpp:524
QObject
KTimerPref::add
void add()
Definition: ktimer.cpp:144
KTimerJob::KTimerJob
KTimerJob(QObject *parent=0)
Definition: ktimer.cpp:358
KTimerJob::changed
void changed(KTimerJob *job)
KTimerPref::done
void done(int result)
Definition: ktimer.cpp:291
KTimerJob::user
void * user()
Definition: ktimer.cpp:429
KTimerPref
Definition: ktimer.h:94
KTimerPref::exit
void exit()
Definition: ktimer.cpp:286
KTimerJob::States
States
Definition: ktimer.h:37
KTimerJob::formatTime
QString formatTime(int seconds) const
Definition: ktimer.cpp:404
QDialog::result
int result() const
QString
KTimerJob::valueChanged
void valueChanged(KTimerJob *job, unsigned int value)
KTimerJob::load
void load(KConfig *cfg, const QString &grp)
Definition: ktimer.cpp:392
KTimerPref::saveAllJobs
void saveAllJobs()
Definition: ktimer.cpp:139
KTimerJob::commandChanged
void commandChanged(KTimerJob *job, const QString &cmd)
KTimerJob::pause
void pause()
Definition: ktimer.cpp:447
QTreeWidgetItem
KTimerJob::Started
Definition: ktimer.h:37
KTimerJob::setDelay
void setDelay(unsigned int sec)
KTimerJob::oneInstanceChanged
void oneInstanceChanged(KTimerJob *job, bool one)
KTimerJob::setCommand
void setCommand(const QString &cmd)
Definition: ktimer.cpp:492
QDialog
KTimerPref::saveJobs
void saveJobs(KConfig *cfg)
Definition: ktimer.cpp:296
KTimerPref::currentChanged
void currentChanged(QTreeWidgetItem *, QTreeWidgetItem *)
Definition: ktimer.cpp:183
KTimerJob::setLoop
void setLoop(bool loop)
Definition: ktimer.cpp:508
KTimerJob::~KTimerJob
virtual ~KTimerJob()
Definition: ktimer.cpp:375
KTimerPref::~KTimerPref
virtual ~KTimerPref()
Definition: ktimer.cpp:134
KTimerJob::state
States state() const
Definition: ktimer.cpp:550
KTimerJob::delay
unsigned delay() const
Definition: ktimer.cpp:441
QObject::parent
QObject * parent() const
KTimerPref::loadJobs
void loadJobs(KConfig *cfg)
Definition: ktimer.cpp:313
KTimerJob::loop
bool loop() const
Definition: ktimer.cpp:502
KTimerJob::oneInstance
bool oneInstance() const
Definition: ktimer.cpp:518
KTimerJob::error
void error(KTimerJob *job)
KTimerJob::save
void save(KConfig *cfg, const QString &grp)
Definition: ktimer.cpp:381
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:42:05 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

ktimer

Skip menu "ktimer"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdeutils API Reference

Skip menu "kdeutils API Reference"
  • ark
  • filelight
  • kcalc
  • kcharselect
  • kdf
  • kfloppy
  • kgpg
  • ktimer
  • kwallet
  • sweeper

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal