Stopped timers now show full time and "stopped"
[kitchenalert] / src / timer.h
index e75d9e4..69ee596 100644 (file)
@@ -1,9 +1,11 @@
 /**************************************************************************
-        KitchenAlert v.0.01
+        KitchenAlert
 
-        Copyright (C) 2010  Heli Hyvättinen
+        Copyright (C) 2010-2011  Heli Hyvättinen
 
-        This program is free software: you can redistribute it and/or modify
+        This file is part of KitchenAlert.
+
+        Kitchen Alert is free software: you can redistribute it and/or modify
         it under the terms of the GNU General Public License as published by
         the Free Software Foundation, either version 3 of the License, or
         (at your option) any later version.
 
 #include <QModelIndex>
 
+#include "alertsound.h"
+
+/*! The timer class of KitchenAlert'
+
+  @author Heli Hyvättinen
+  @date 2011-04-05
+  @version 0.2.1
+
+The timer class of KitchenAlert.
+
+*/
+
 class Timer : public QObject
 {
     Q_OBJECT
 public:
     explicit Timer(QObject *parent = 0);
 
-    int getOriginalTimeInSeconds();
+    /*! Returns the original time in seconds
+        When the alert restarts, it is set to this time.
+    */
+     int getOriginalTimeInSeconds();
+
+    /*! Sets the original time in seconds */
     void setOriginalTimeInSeconds(int seconds);
 
+    /*! Returns the time remaining before the alert in seconds       */
     int getRemainingTimeInSeconds();
 
+    /*! Returns the alert text */
     QString getAlertText();
+
+    /*! Sets the alert text */
     void setAlertText(QString text);
 
+    /*! Returns whether the timer is alerting */
     bool isAlerting();
 
+    /*! Saves the timer to a file
+      @param filename The file to which to save.
+    */
+    bool save(QString filename);
 
-signals:
+    /*! Loads a timer from a file
+      @param filename The file from which to load.
+    */
+    bool load(QString filename);
+
+    /*! Returns wheter the alert is running or not.
+      Alerting timers are considered running. */
+    bool isRunning();
 
+
+signals:
+    /*! Emitted when the remaining time in the timer has changed */
     void remainingTimeChanged();
+
+    /*! Emitted when the timer alerts */
     void alert(QModelIndex indexOfAlerter);
 
 public slots:
+    /*! The internal QTimer is connected to this slot */
     void secondPassed();
+
+    /*! Start the timer */
     void start();
+
+    /*! Stop the timer*/
     void stop();
+
+    /*! Snooze the timer
+        Currently sets the timer to alert again in two minutes.
+    */
     void snooze();
 
+    /*! Switches to use the default sound (and saves it to settings */
+    void enableDefaultSound();
+
+    /*! Changes the sound file used and saves it to settings */
+    void changeAlertSound(QString filename);
+
+
 
 
 private:
@@ -69,8 +125,16 @@ private:
     QTimer _actualTimer;
     bool alerting_;
 
+    QString filenameWithPath_; /*! Name (with full path) of the file where the timer was loaded from. Empty if timer not loaded from file. */
+
     QModelIndex whereAmI();
 
+    AlertSound alertSound_;
+
+
+
+
+
 };
 
 #endif // TIMER_H