KDEGames

kgameclock.h
1 /*
2  This file is part of the KDE games library
3  Copyright (C) 2007 Mauricio Piacentini ([email protected])
4  Portions reused from KGameLCDClock
5  Copyright (C) 2001,2002,2003 Nicolas Hadacek ([email protected])
6 
7  This library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Library General Public
9  License version 2 as published by the Free Software Foundation.
10 
11  This library is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  Library General Public License for more details.
15 
16  You should have received a copy of the GNU Library General Public License
17  along with this library; see the file COPYING.LIB. If not, write to
18  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19  Boston, MA 02110-1301, USA.
20 */
21 
22 #ifndef __KGAMECLOCK_H
23 #define __KGAMECLOCK_H
24 
25 #include <QObject>
26 #include <libkdegames_export.h>
27 
28 class KGameClockPrivate;
29 
35 class KDEGAMES_EXPORT KGameClock : public QObject
36 {
37  Q_OBJECT
38 public:
39  enum ClockType { HourMinSec = 0, MinSecOnly };
40 
44  explicit KGameClock(QObject *parent = nullptr, ClockType clocktype = HourMinSec);
45 
46  virtual ~KGameClock();
47 
51  uint seconds() const;
52 
56  QString timeString() const;
57 
61  void setTime(uint seconds);
62 
66  void setTime(const QString &s);
67 
71  void showTime();
72 
73 Q_SIGNALS:
74  void timeChanged(const QString &);
75 
76 public Q_SLOTS:
80  virtual void restart();
81 
85  virtual void pause();
86 
90  virtual void resume();
91 
92 protected Q_SLOTS:
93  virtual void timeoutClock();
94 
95 private:
96  friend class KGameClockPrivate;
97  KGameClockPrivate *const d;
98 
100 };
101 
102 #endif
Q_DISABLE_COPY(Class)
Class representing a game clock, wraps after 24 hours.
Definition: kgameclock.h:35
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Nov 30 2020 22:37:54 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.