Added sound to the alert
authorHeli Hyvättinen <heli@pantteri.(none)>
Sat, 26 Jun 2010 06:54:35 +0000 (09:54 +0300)
committerHeli Hyvättinen <heli@pantteri.(none)>
Sat, 26 Jun 2010 06:54:35 +0000 (09:54 +0300)
17 files changed:
src/KitchenAlert.pro
src/alertsound.cpp [new file with mode: 0644]
src/alertsound.h [new file with mode: 0644]
src/choosetimersequencedialog.cpp
src/choosetimersequencedialog.h
src/createtimersequencedialog.cpp
src/createtimersequencedialog.h
src/currentalertstablemodel.cpp
src/currentalertstablemodel.h
src/kitchenalertmainwindow.cpp
src/kitchenalertmainwindow.h
src/licence template
src/main.cpp
src/timer.cpp
src/timer.h
src/timerschedule.cpp [new file with mode: 0644]
src/timerschedule.h [new file with mode: 0644]

index deb1cb2..60442ae 100644 (file)
@@ -5,6 +5,7 @@
 #-------------------------------------------------
 
 QT       += core gui
+QT      += phonon
 
 TARGET = KitchenAlert
 TEMPLATE = app
@@ -15,20 +16,24 @@ SOURCES += main.cpp\
     choosetimersequencedialog.cpp \
     createtimersequencedialog.cpp \
     timer.cpp \
-    currentalertstablemodel.cpp
+    currentalertstablemodel.cpp \
+    alertsound.cpp
 
 HEADERS  += kitchenalertmainwindow.h \
     choosetimersequencedialog.h \
     createtimersequencedialog.h \
     timer.h \
-    currentalertstablemodel.h
+    currentalertstablemodel.h \
+    alertsound.h
 
 FORMS    += kitchenalertmainwindow.ui \
     choosetimersequencedialog.ui \
     createtimersequencedialog.ui
 
 CONFIG += mobility
-MOBILITY = 
+MOBILITY =
+
+
 
 symbian {
     TARGET.UID3 = 0xe1020059
@@ -36,3 +41,5 @@ symbian {
     TARGET.EPOCSTACKSIZE = 0x14000
     TARGET.EPOCHEAPSIZE = 0x020000 0x800000
 }
+
+RESOURCES +=
diff --git a/src/alertsound.cpp b/src/alertsound.cpp
new file mode 100644 (file)
index 0000000..fc8e6d3
--- /dev/null
@@ -0,0 +1,50 @@
+/**************************************************************************
+        This file is part of KitchenAlert v.0.09
+
+        Copyright (C) 2010  Heli Hyvättinen
+
+        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.
+
+        This program is distributed in the hope that it will be useful,
+        but WITHOUT ANY WARRANTY; without even the implied warranty of
+        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+        GNU General Public License for more details.
+
+        You should have received a copy of the GNU General Public License
+        along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+**************************************************************************/
+
+
+
+
+
+#include "alertsound.h"
+
+#include <QDebug>
+
+
+
+AlertSound::AlertSound(QObject *parent) :
+    QObject(parent)
+{
+
+
+    pSound_ = Phonon::createPlayer(Phonon::MusicCategory, Phonon::MediaSource("/home/user/MyDocs/KitchenAlertTestSound1.wav"));
+}
+
+void AlertSound::play()
+{
+
+    pSound_->play();
+    qDebug() << "Sound should be played now";
+}
+
+void AlertSound::stop()
+{
+
+    pSound_->stop();
+}
diff --git a/src/alertsound.h b/src/alertsound.h
new file mode 100644 (file)
index 0000000..d754087
--- /dev/null
@@ -0,0 +1,72 @@
+/**************************************************************************
+        KitchenAlert
+
+        Copyright (C) 2010  Heli Hyvättinen
+
+        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.
+
+        This program is distributed in the hope that it will be useful,
+        but WITHOUT ANY WARRANTY; without even the implied warranty of
+        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+        GNU General Public License for more details.
+
+        You should have received a copy of the GNU General Public License
+        along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+**************************************************************************/
+
+
+
+
+
+#ifndef ALERTSOUND_H
+#define ALERTSOUND_H
+
+#include <QObject>
+
+
+
+ #include <Phonon>
+
+
+
+/*! Class for playing the alert sound'
+
+  @author Heli Hyvättinen
+  @date 2010-06-26
+  @version 0.09
+
+Class for playing (and stopping) the alert sound.
+
+*/
+
+class AlertSound : public QObject
+{
+    Q_OBJECT
+public:
+    explicit AlertSound(QObject *parent = 0);
+
+signals:
+
+public slots:
+    /*! Plays the sound */
+    void play();
+
+    /*! Stops the sound from playing */
+    void stop();
+
+private:
+
+
+
+    Phonon::MediaObject *pSound_;
+
+
+};
+
+#endif // ALERTSOUND_H
index 814a87c..7c7810f 100644 (file)
@@ -1,9 +1,11 @@
 /**************************************************************************
-        KitchenAlert v.0.01
+        KitchenAlert
 
         Copyright (C) 2010  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.
index d4f87eb..3af0152 100644 (file)
@@ -1,9 +1,11 @@
 /**************************************************************************
-        KitchenAlert v.0.01
+        KitchenAlert
 
         Copyright (C) 2010  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.
@@ -21,7 +23,6 @@
 
 
 
-
 #ifndef CHOOSETIMERSEQUENCEDIALOG_H
 #define CHOOSETIMERSEQUENCEDIALOG_H
 
@@ -32,6 +33,17 @@ namespace Ui {
     class ChooseTimerSequenceDialog;
 }
 
+/*! Class for the dialog for choosing timers'
+
+  @author Heli Hyvättinen
+  @date 2010-06-26
+  @version 0.09
+
+Does nothing but show the dialog now, useless.
+
+*/
+
+
 class ChooseTimerSequenceDialog : public QDialog
 {
     Q_OBJECT
index 98ba30c..d7b696c 100644 (file)
@@ -1,9 +1,11 @@
 /**************************************************************************
-        KitchenAlert v.0.01
+        KitchenAlert
 
         Copyright (C) 2010  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.
index a84dbd6..3e93f36 100644 (file)
@@ -1,9 +1,11 @@
 /**************************************************************************
-        KitchenAlert v.0.01
+        KitchenAlert
 
         Copyright (C) 2010  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.
@@ -33,6 +35,18 @@ namespace Ui {
     class CreateTimerSequenceDialog;
 }
 
+
+/*! Class for the dialog for creating timers'
+
+  @author Heli Hyvättinen
+  @date 2010-06-26
+  @version 0.09
+
+Class for the dialog for creating timers
+
+*/
+
+
 class CreateTimerSequenceDialog : public QDialog
 {
     Q_OBJECT
index 6587e01..b856739 100644 (file)
@@ -1,9 +1,11 @@
 /**************************************************************************
-        KitchenAlert v.0.019
+        KitchenAlert
 
         Copyright (C) 2010  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.
index 75c8a75..32cadc3 100644 (file)
@@ -1,9 +1,11 @@
 /**************************************************************************
-        KitchenAlert v.0.019
+        KitchenAlert
 
         Copyright (C) 2010  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 <QAbstractTableModel>
 #include "timer.h"
 
+
+/*! Class that contains the model that holds the timers'
+
+  @author Heli Hyvättinen
+  @date 2010-06-26
+  @version 0.09
+
+Class that contains the model that holds the timers
+
+*/
+
+
 class CurrentAlertsTableModel : public QAbstractTableModel
 {
     Q_OBJECT
index 4b00556..36b1142 100644 (file)
@@ -1,10 +1,12 @@
 /**************************************************************************
 
-        KitchenAlert v.0.01
+        KitchenAlert
 
         Copyright (C) 2010  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 "createtimersequencedialog.h"
 
 
+
 #include <QDebug>
 #include <QMessageBox>
-#include <QMediaPlayer>
+
+
 
 KitchenAlertMainWindow::KitchenAlertMainWindow(QWidget *parent) :
     QMainWindow(parent),
@@ -167,9 +171,11 @@ void KitchenAlertMainWindow::alert(QModelIndex indexOfAlerter)
     //The alert sound is played
 
 
-        //TODO
 
 
+        //TODO
+
+    alertSound_.play();
 
 }
 
@@ -186,6 +192,7 @@ void KitchenAlertMainWindow::snooze()
 
     model_.snoozeTimer(selectedRow());
     ui->SnoozeButton->setDisabled(true);
+    alertSound_.stop();
 
 }
 
@@ -193,14 +200,16 @@ void KitchenAlertMainWindow::restart()
 {
 
     model_.startTimer(selectedRow());
-      ui->SnoozeButton->setDisabled(true);
+    ui->SnoozeButton->setDisabled(true);
+    alertSound_.stop();
 
 }
 
 void KitchenAlertMainWindow::stop()
 {
     model_.stopTimer(selectedRow());
-      ui->SnoozeButton->setDisabled(true);
+    ui->SnoozeButton->setDisabled(true);
+    alertSound_.stop();
 }
 
 QModelIndex KitchenAlertMainWindow::selectedRow()
index 882d720..393875b 100644 (file)
@@ -1,9 +1,11 @@
 /**************************************************************************
-        KitchenAlert v.0.01
+        KitchenAlert
 
         Copyright (C) 2010  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 "timer.h"
 #include "currentalertstablemodel.h"
 #include <QItemSelection>
+#include "alertsound.h"
 
 
 namespace Ui {
     class KitchenAlertMainWindow;
 }
 
+
+/*! The main window class of KitchenAlert'
+
+  @author Heli Hyvättinen
+  @date 2010-06-26
+  @version 0.09
+
+Operates the UI.
+
+*/
+
 class KitchenAlertMainWindow : public QMainWindow
 {
     Q_OBJECT 
@@ -67,6 +81,8 @@ private:
     CurrentAlertsTableModel model_;
 
     QModelIndex selectedRow();
+
+    AlertSound alertSound_;
 };
 
 #endif // KITCHENALERTMAINWINDOW_H
index bc10c42..7e56f68 100644 (file)
@@ -1,9 +1,11 @@
 /**************************************************************************
-        KitchenAlert v.0.019
+        KitchenAlert
 
         Copyright (C) 2010  Heli Hyvättinen
+        
+        This file is part of KitchenAlert.
 
-        This program is free software: you can redistribute it and/or modify
+        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.
index 9f83c01..5e157c4 100644 (file)
@@ -1,9 +1,11 @@
 /**************************************************************************
-        KitchenAlert v.0.01
+        KitchenAlert
 
         Copyright (C) 2010  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.
index 8fac364..9c5e75d 100644 (file)
@@ -1,9 +1,11 @@
 /**************************************************************************
-        KitchenAlert v.0.01
+        KitchenAlert
 
         Copyright (C) 2010  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.
index e75d9e4..26c6f6a 100644 (file)
@@ -1,9 +1,11 @@
 /**************************************************************************
-        KitchenAlert v.0.01
+        KitchenAlert
 
         Copyright (C) 2010  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>
 
+
+
+/*! The timer class of KitchenAlert'
+
+  @author Heli Hyvättinen
+  @date 2010-06-26
+  @version 0.09
+
+The timer class of KitchenAlert.
+
+*/
+
 class Timer : public QObject
 {
     Q_OBJECT
diff --git a/src/timerschedule.cpp b/src/timerschedule.cpp
new file mode 100644 (file)
index 0000000..ccf564e
--- /dev/null
@@ -0,0 +1,30 @@
+/**************************************************************************
+        KitchenAlert v.0.01
+
+        Copyright (C) 2010  Heli Hyvättinen
+
+        This program 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.
+
+        This program is distributed in the hope that it will be useful,
+        but WITHOUT ANY WARRANTY; without even the implied warranty of
+        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+        GNU General Public License for more details.
+
+        You should have received a copy of the GNU General Public License
+        along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+**************************************************************************/
+
+
+
+
+
+#include "timerschedule.h"
+
+TimerSchedule::TimerSchedule(QObject *parent) :
+    QObject(parent)
+{
+}
diff --git a/src/timerschedule.h b/src/timerschedule.h
new file mode 100644 (file)
index 0000000..86d0ec4
--- /dev/null
@@ -0,0 +1,42 @@
+/**************************************************************************
+        KitchenAlert v.0.01
+
+        Copyright (C) 2010  Heli Hyvättinen
+
+        This program 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.
+
+        This program is distributed in the hope that it will be useful,
+        but WITHOUT ANY WARRANTY; without even the implied warranty of
+        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+        GNU General Public License for more details.
+
+        You should have received a copy of the GNU General Public License
+        along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+**************************************************************************/
+
+
+
+
+
+#ifndef TIMERSCHEDULE_H
+#define TIMERSCHEDULE_H
+
+#include <QObject>
+
+class TimerSchedule : public QObject
+{
+    Q_OBJECT
+public:
+    explicit TimerSchedule(QObject *parent = 0);
+
+signals:
+
+public slots:
+
+};
+
+#endif // TIMERSCHEDULE_H