Fresh start from released sources + some work done
authorHeli Hyvättinen <heli.hyvattinen@kymp.net>
Wed, 8 Sep 2010 17:04:21 +0000 (20:04 +0300)
committerHeli Hyvättinen <heli.hyvattinen@kymp.net>
Wed, 8 Sep 2010 17:04:21 +0000 (20:04 +0300)
New since released:
Fixed bug 6346
Quick-fixed bug 6381 (changing alert sound works only partially because of this)
00:00:00 now alerts
Multiline for alert text + associated layout change for the view

18 files changed:
src/KitchenAlert.pro
src/KitchenAlert.pro.user
src/alertsound.cpp
src/createtimersequencedialog.cpp
src/createtimersequencedialog.h
src/currentalertstablemodel.cpp
src/currentalertstablemodel.h
src/kitchenalert.png [new file with mode: 0644]
src/kitchenalert.qrc
src/kitchenalertmainwindow.cpp
src/kitchenalertmainwindow.h
src/kitchenalertmainwindow.ui
src/main.cpp
src/selectsounddialog.cpp
src/selectsounddialog.h
src/selectsounddialog.ui
src/timer.cpp
src/timer.h

index 2fc4ff7..cdd89fc 100644 (file)
@@ -17,26 +17,19 @@ SOURCES += main.cpp\
     timer.cpp \
     currentalertstablemodel.cpp \
     alertsound.cpp \
-    selectsounddialog.cpp \
-    savedtimers.cpp
+    selectsounddialog.cpp
 
 HEADERS  += kitchenalertmainwindow.h \
     createtimersequencedialog.h \
     timer.h \
     currentalertstablemodel.h \
     alertsound.h \
-    selectsounddialog.h \
-    savedtimers.h
+    selectsounddialog.h
 
 FORMS    += kitchenalertmainwindow.ui \
     createtimersequencedialog.ui \
     selectsounddialog.ui \
-    kitchenalertmainwindow.ui \
-    choosetimersequencedialog.ui
-
-CONFIG += mobility
-MOBILITY =
-
+    kitchenalertmainwindow.ui
 
 
 symbian {
index 975b471..2078c84 100644 (file)
@@ -2,12 +2,12 @@
 <qtcreator>
  <data>
   <variable>ProjectExplorer.Project.ActiveTarget</variable>
-  <value type="int">2</value>
+  <value type="int">1</value>
  </data>
  <data>
   <variable>ProjectExplorer.Project.EditorSettings</variable>
   <valuemap type="QVariantMap">
-   <value key="EditorConfiguration.Codec" type="QByteArray">System</value>
+   <value key="EditorConfiguration.Codec" type="QByteArray">UTF-8</value>
   </valuemap>
  </data>
  <data>
   <valuemap type="QVariantMap">
    <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Desktop</value>
    <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Target.DesktopTarget</value>
-   <value key="ProjectExplorer.Target.ActiveBuildConfiguration" type="int">1</value>
+   <value key="ProjectExplorer.Target.ActiveBuildConfiguration" type="int">0</value>
    <value key="ProjectExplorer.Target.ActiveRunConfiguration" type="int">0</value>
    <valuemap key="ProjectExplorer.Target.BuildConfiguration.0" type="QVariantMap">
     <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.0" type="QVariantMap">
-     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
+     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">qmake</value>
      <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">QtProjectManager.QMakeBuildStep</value>
      <valuelist key="QtProjectManager.QMakeBuildStep.QMakeArguments" type="QVariantList"/>
     </valuemap>
     <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.1" type="QVariantMap">
-     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
+     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Make</value>
      <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
      <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">false</value>
      <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList"/>
@@ -32,7 +32,7 @@
     </valuemap>
     <value key="ProjectExplorer.BuildConfiguration.BuildStepsCount" type="int">2</value>
     <valuemap key="ProjectExplorer.BuildConfiguration.CleanStep.0" type="QVariantMap">
-     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
+     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Make</value>
      <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
      <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">true</value>
      <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList">
    </valuemap>
    <valuemap key="ProjectExplorer.Target.BuildConfiguration.1" type="QVariantMap">
     <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.0" type="QVariantMap">
-     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
+     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">qmake</value>
      <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">QtProjectManager.QMakeBuildStep</value>
      <valuelist key="QtProjectManager.QMakeBuildStep.QMakeArguments" type="QVariantList"/>
     </valuemap>
     <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.1" type="QVariantMap">
-     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
+     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Make</value>
      <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
      <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">false</value>
      <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList"/>
     </valuemap>
     <value key="ProjectExplorer.BuildConfiguration.BuildStepsCount" type="int">2</value>
     <valuemap key="ProjectExplorer.BuildConfiguration.CleanStep.0" type="QVariantMap">
-     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
+     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Make</value>
      <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
      <value key="Qt4ProjectManager.MakeStep.Clean" type="bool">true</value>
-     <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList"/>
+     <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList">
+      <value type="QString">clean</value>
+     </valuelist>
      <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
     </valuemap>
     <value key="ProjectExplorer.BuildConfiguration.CleanStepsCount" type="int">1</value>
  <data>
   <variable>ProjectExplorer.Project.Target.1</variable>
   <valuemap type="QVariantMap">
-   <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Qt Simulator</value>
-   <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Target.QtSimulatorTarget</value>
-   <value key="ProjectExplorer.Target.ActiveBuildConfiguration" type="int">1</value>
+   <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Maemo</value>
+   <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Target.MaemoDeviceTarget</value>
+   <value key="ProjectExplorer.Target.ActiveBuildConfiguration" type="int">0</value>
    <value key="ProjectExplorer.Target.ActiveRunConfiguration" type="int">0</value>
    <valuemap key="ProjectExplorer.Target.BuildConfiguration.0" type="QVariantMap">
     <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.0" type="QVariantMap">
      <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList"/>
      <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
     </valuemap>
-    <value key="ProjectExplorer.BuildConfiguration.BuildStepsCount" type="int">2</value>
+    <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.2" type="QVariantMap">
+     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
+     <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MaemoPackageCreationStep</value>
+     <valuelist key="Qt4ProjectManager.BuildStep.MaemoPackage.LocalFiles" type="QVariantList"/>
+     <value key="Qt4ProjectManager.BuildStep.MaemoPackage.Modified" type="bool">false</value>
+     <value key="Qt4ProjectManager.BuildStep.MaemoPackage.RemoteExe" type="QString">/usr/local/bin/KitchenAlert</value>
+     <valuelist key="Qt4ProjectManager.BuildStep.MaemoPackage.RemoteFiles" type="QVariantList"/>
+    </valuemap>
+    <value key="ProjectExplorer.BuildConfiguration.BuildStepsCount" type="int">3</value>
     <valuemap key="ProjectExplorer.BuildConfiguration.CleanStep.0" type="QVariantMap">
      <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Make</value>
      <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Debug</value>
     <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
     <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">2</value>
-    <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">/holvi/heli/ohjelmointi/KitchenAlert-build-simulator</value>
-    <value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">2</value>
-    <value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">0</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">/holvi/heli/ohjelmointi/KitchenAlert-build-maemo</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">8</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">9</value>
     <value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value>
    </valuemap>
    <valuemap key="ProjectExplorer.Target.BuildConfiguration.1" type="QVariantMap">
      <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList"/>
      <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
     </valuemap>
-    <value key="ProjectExplorer.BuildConfiguration.BuildStepsCount" type="int">2</value>
+    <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.2" type="QVariantMap">
+     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
+     <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MaemoPackageCreationStep</value>
+     <valuelist key="Qt4ProjectManager.BuildStep.MaemoPackage.LocalFiles" type="QVariantList"/>
+     <value key="Qt4ProjectManager.BuildStep.MaemoPackage.Modified" type="bool">true</value>
+     <value key="Qt4ProjectManager.BuildStep.MaemoPackage.RemoteExe" type="QString"></value>
+     <valuelist key="Qt4ProjectManager.BuildStep.MaemoPackage.RemoteFiles" type="QVariantList"/>
+    </valuemap>
+    <value key="ProjectExplorer.BuildConfiguration.BuildStepsCount" type="int">3</value>
     <valuemap key="ProjectExplorer.BuildConfiguration.CleanStep.0" type="QVariantMap">
      <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Make</value>
      <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Release</value>
     <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
     <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">0</value>
-    <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">/holvi/heli/ohjelmointi/KitchenAlert-build-simulator</value>
-    <value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">2</value>
-    <value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">0</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">/holvi/heli/ohjelmointi/KitchenAlert-build-maemo</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">8</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">9</value>
     <value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value>
    </valuemap>
    <value key="ProjectExplorer.Target.BuildConfigurationCount" type="int">2</value>
    <valuemap key="ProjectExplorer.Target.RunConfiguration.0" type="QVariantMap">
-    <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">KitchenAlert</value>
-    <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4RunConfiguration</value>
-    <value key="Qt4ProjectManager.Qt4RunConfiguration.BaseEnvironmentBase" type="int">2</value>
-    <valuelist key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments" type="QVariantList"/>
-    <value key="Qt4ProjectManager.Qt4RunConfiguration.ProFile" type="QString">KitchenAlert.pro</value>
-    <value key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix" type="bool">false</value>
-    <value key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal" type="bool">false</value>
-    <valuelist key="Qt4ProjectManager.Qt4RunConfiguration.UserEnvironmentChanges" type="QVariantList"/>
-    <value key="Qt4ProjectManager.Qt4RunConfiguration.UserSetName" type="bool">false</value>
-    <value key="Qt4ProjectManager.Qt4RunConfiguration.UserSetWorkingDirectory" type="bool">false</value>
-    <value key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory" type="QString"></value>
+    <value key=".ProFile" type="QString">KitchenAlert.pro</value>
+    <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">New Maemo Run Configuration</value>
+    <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MaemoRunConfiguration</value>
+    <valuelist key="Qt4ProjectManager.MaemoRunConfiguration.Arguments" type="QVariantList"/>
+    <valuemap key="Qt4ProjectManager.MaemoRunConfiguration.DebuggingHelpersLastDeployed" type="QVariantMap"/>
+    <value key="Qt4ProjectManager.MaemoRunConfiguration.DeviceId" type="qulonglong">17</value>
+    <valuemap key="Qt4ProjectManager.MaemoRunConfiguration.LastDeployed" type="QVariantMap">
+     <value key="192.168.2.15" type="QDateTime">2010-09-08T15:52:20</value>
+    </valuemap>
    </valuemap>
    <value key="ProjectExplorer.Target.RunConfigurationCount" type="int">1</value>
   </valuemap>
  <data>
   <variable>ProjectExplorer.Project.Target.2</variable>
   <valuemap type="QVariantMap">
-   <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Maemo</value>
-   <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Target.MaemoDeviceTarget</value>
+   <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Qt Simulator</value>
+   <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Target.QtSimulatorTarget</value>
    <value key="ProjectExplorer.Target.ActiveBuildConfiguration" type="int">0</value>
    <value key="ProjectExplorer.Target.ActiveRunConfiguration" type="int">0</value>
    <valuemap key="ProjectExplorer.Target.BuildConfiguration.0" type="QVariantMap">
      <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList"/>
      <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
     </valuemap>
-    <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.2" type="QVariantMap">
-     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
-     <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MaemoPackageCreationStep</value>
-     <valuelist key="Qt4ProjectManager.BuildStep.MaemoPackage.LocalFiles" type="QVariantList"/>
-     <value key="Qt4ProjectManager.BuildStep.MaemoPackage.Modified" type="bool">false</value>
-     <value key="Qt4ProjectManager.BuildStep.MaemoPackage.RemoteExe" type="QString">/usr/local/bin/KitchenAlert</value>
-     <valuelist key="Qt4ProjectManager.BuildStep.MaemoPackage.RemoteFiles" type="QVariantList"/>
-    </valuemap>
-    <value key="ProjectExplorer.BuildConfiguration.BuildStepsCount" type="int">3</value>
+    <value key="ProjectExplorer.BuildConfiguration.BuildStepsCount" type="int">2</value>
     <valuemap key="ProjectExplorer.BuildConfiguration.CleanStep.0" type="QVariantMap">
      <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Make</value>
      <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Debug</value>
     <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
     <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">2</value>
-    <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">/holvi/heli/ohjelmointi/KitchenAlert-build-maemo</value>
-    <value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">8</value>
-    <value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">9</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">/holvi/heli/ohjelmointi/KitchenAlert-build-simulator</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">2</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">0</value>
     <value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value>
    </valuemap>
    <valuemap key="ProjectExplorer.Target.BuildConfiguration.1" type="QVariantMap">
      <valuelist key="Qt4ProjectManager.MakeStep.MakeArguments" type="QVariantList"/>
      <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
     </valuemap>
-    <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.2" type="QVariantMap">
-     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString"></value>
-     <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MaemoPackageCreationStep</value>
-     <valuelist key="Qt4ProjectManager.BuildStep.MaemoPackage.LocalFiles" type="QVariantList"/>
-     <value key="Qt4ProjectManager.BuildStep.MaemoPackage.Modified" type="bool">true</value>
-     <value key="Qt4ProjectManager.BuildStep.MaemoPackage.RemoteExe" type="QString"></value>
-     <valuelist key="Qt4ProjectManager.BuildStep.MaemoPackage.RemoteFiles" type="QVariantList"/>
-    </valuemap>
-    <value key="ProjectExplorer.BuildConfiguration.BuildStepsCount" type="int">3</value>
+    <value key="ProjectExplorer.BuildConfiguration.BuildStepsCount" type="int">2</value>
     <valuemap key="ProjectExplorer.BuildConfiguration.CleanStep.0" type="QVariantMap">
      <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Make</value>
      <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MakeStep</value>
     <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">Release</value>
     <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4BuildConfiguration</value>
     <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildConfiguration" type="int">0</value>
-    <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">/holvi/heli/ohjelmointi/KitchenAlert-build-maemo</value>
-    <value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">8</value>
-    <value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">9</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.BuildDirectory" type="QString">/holvi/heli/ohjelmointi/KitchenAlert-build-simulator</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.QtVersionId" type="int">2</value>
+    <value key="Qt4ProjectManager.Qt4BuildConfiguration.ToolChain" type="int">0</value>
     <value key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild" type="bool">true</value>
    </valuemap>
    <value key="ProjectExplorer.Target.BuildConfigurationCount" type="int">2</value>
    <valuemap key="ProjectExplorer.Target.RunConfiguration.0" type="QVariantMap">
-    <value key=".ProFile" type="QString">KitchenAlert.pro</value>
-    <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">New Maemo Run Configuration</value>
-    <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.MaemoRunConfiguration</value>
-    <valuelist key="Qt4ProjectManager.MaemoRunConfiguration.Arguments" type="QVariantList"/>
-    <valuemap key="Qt4ProjectManager.MaemoRunConfiguration.DebuggingHelpersLastDeployed" type="QVariantMap"/>
-    <value key="Qt4ProjectManager.MaemoRunConfiguration.DeviceId" type="qulonglong">17</value>
-    <valuemap key="Qt4ProjectManager.MaemoRunConfiguration.LastDeployed" type="QVariantMap">
-     <value key="192.168.2.15" type="QDateTime">2010-08-16T21:04:14</value>
-    </valuemap>
+    <value key="ProjectExplorer.ProjectConfiguration.DisplayName" type="QString">KitchenAlert</value>
+    <value key="ProjectExplorer.ProjectConfiguration.Id" type="QString">Qt4ProjectManager.Qt4RunConfiguration</value>
+    <value key="Qt4ProjectManager.Qt4RunConfiguration.BaseEnvironmentBase" type="int">2</value>
+    <valuelist key="Qt4ProjectManager.Qt4RunConfiguration.CommandLineArguments" type="QVariantList"/>
+    <value key="Qt4ProjectManager.Qt4RunConfiguration.ProFile" type="QString">KitchenAlert.pro</value>
+    <value key="Qt4ProjectManager.Qt4RunConfiguration.UseDyldImageSuffix" type="bool">false</value>
+    <value key="Qt4ProjectManager.Qt4RunConfiguration.UseTerminal" type="bool">false</value>
+    <valuelist key="Qt4ProjectManager.Qt4RunConfiguration.UserEnvironmentChanges" type="QVariantList"/>
+    <value key="Qt4ProjectManager.Qt4RunConfiguration.UserSetName" type="bool">false</value>
+    <value key="Qt4ProjectManager.Qt4RunConfiguration.UserSetWorkingDirectory" type="bool">false</value>
+    <value key="Qt4ProjectManager.Qt4RunConfiguration.UserWorkingDirectory" type="QString"></value>
    </valuemap>
    <value key="ProjectExplorer.Target.RunConfigurationCount" type="int">1</value>
   </valuemap>
index b11f538..0f83d32 100644 (file)
@@ -26,8 +26,6 @@
 
 #include <QDebug>
 #include <QSettings>
-#include <QList>
-
 
 
 
@@ -53,32 +51,11 @@ AlertSound::AlertSound(QObject *parent) :
         filename = settings.value("soundfile",defaultsound_).toString();
     }
     pSound_ = Phonon::createPlayer(Phonon::MusicCategory, Phonon::MediaSource(filename));
-
-
-    //TESTCODE!!!
-
-    QList<Phonon::AudioOutputDevice> audioOutputDevices =
-                 Phonon::BackendCapabilities::availableAudioOutputDevices();
-
-    foreach (Phonon::AudioOutputDevice device, audioOutputDevices)
-    {
-    qDebug() << device.name() << device.description();
-    }
 }
 
 void AlertSound::play()
 {
-
-    //TESTCODE
-
-    Phonon::AudioOutput *audioOutput = new Phonon::AudioOutput(Phonon::MusicCategory, this);
-
-    Phonon::Path path = Phonon::createPath(pSound_, audioOutput);
-
-    audioOutput->setVolumeDecibel(0);
-
-    //TESTCODE ENDS
-
+    pSound_->stop(); //Just testing if stopping the previous alert will prevent the jammming of the sound
     pSound_->play();
     qDebug() << "Sound should be played now";
 }
index b7c360f..d7b696c 100644 (file)
@@ -32,7 +32,6 @@ CreateTimerSequenceDialog::CreateTimerSequenceDialog(QWidget *parent) :
     ui(new Ui::CreateTimerSequenceDialog)
 {
     ui->setupUi(this);
- //   ui->timer1AlertText->setMaxLength(40); //needed only with fixed cell height
 }
 
 CreateTimerSequenceDialog::~CreateTimerSequenceDialog()
index d53ac38..4765387 100644 (file)
@@ -39,8 +39,8 @@ namespace Ui {
 /*! Class for the dialog for creating timers'
 
   @author Heli Hyvättinen
-  @date 2010-08-12
-  @version 0.1.1
+  @date 2010-07-20
+  @version 0.1
 
 Class for the dialog for creating timers
 
index 755a109..00c207e 100644 (file)
@@ -140,7 +140,7 @@ QVariant CurrentAlertsTableModel::data(const QModelIndex &index, int role) const
 
 //                    qDebug () << timeAsText;
 
-                   return timeAsText;
+                    return timeAsText;
 
 
                 case statusColumnNumber_:
@@ -165,24 +165,24 @@ QVariant CurrentAlertsTableModel::data(const QModelIndex &index, int role) const
 
 
 
-      case Qt::BackgroundRole :
+//      case Qt::BackgroundRole :
 
-            //For some reason, these have no effect at all!!! They are asked by the view though.
+//            //For some reason, these have no effect at all!!! They are asked by the view though.
 
-            //No need to care for the column number, all have the same color
+//            //No need to care for the column number, all have the same color
 
 //            qDebug() << "BackgroundRole asked";
 
-            if (currentTimers_.at(index.row())->isAlerting())
-            {
+//            if (currentTimers_.at(index.row())->isAlerting())
+//            {
 //                qDebug() << "black background";
-                return QBrush (QColor(Qt::black));
-            }
-            else
-            {
+//                return QBrush (QColor(Qt::black));
+//            }
+//            else
+//            {
 //                qDebug() << "red background";
-                return QBrush (QColor(Qt::red));
-            }
+//                return QBrush (QColor(Qt::red));
+//            }
         default:
             return QVariant();
 
@@ -195,8 +195,10 @@ QVariant CurrentAlertsTableModel::data(const QModelIndex &index, int role) const
 
 
 
-void CurrentAlertsTableModel::addTimers(QList <Timer *> timers)
+void CurrentAlertsTableModel::addTimers(QList <Timer *> timers, bool startImmediately)
 {
+
+//preparatory work
     foreach (Timer* timer, timers)
     {
         connect (timer,SIGNAL(remainingTimeChanged()),this,SLOT(refreshTimeColumn()));
@@ -204,13 +206,23 @@ void CurrentAlertsTableModel::addTimers(QList <Timer *> timers)
         timer->setParent(this); //The model becomes the timers parent giving the timer access to model
     }
 
-    int nextRow = rowCount(QModelIndex()); //As row numbering starts from zero, number of the rows is the row number of the row after current ones
-    int lastRow = nextRow + timers.length()-1;
-    beginInsertRows(QModelIndex(),nextRow,lastRow);
+
+//Add the timers
+
+    beginResetModel();
     currentTimers_.append(timers);
-    endInsertRows();
-//    qDebug() << "Timers should be appended";
-//    reset();
+    endResetModel();
+
+    //start the timers if requested
+
+    if (startImmediately)
+    {
+        foreach (Timer* timer, timers)
+        {
+            timer->start();
+        }
+    }
+
 }
 
 
@@ -281,7 +293,7 @@ void CurrentAlertsTableModel::setUpdateViewOnChanges(bool update)
 {
     updateViewOnChanges_ = update;
     if (update == true)
-        reset(); //Refresh view to catch up with past changes
+        refreshTimeColumn(); //Refresh to catch up with past changes
 }
 
 bool CurrentAlertsTableModel::isThisTimerAlerting(QModelIndex index)
@@ -296,20 +308,3 @@ bool CurrentAlertsTableModel::isThisTimerAlerting(QModelIndex index)
     }
     return false;
 }
-
-void CurrentAlertsTableModel::removeTimer(QModelIndex index)
-{
-    if (index.isValid())
-    {
-        int row = index.row();
-        beginRemoveRows(QModelIndex(),row,row);
-        Timer* p_timer = currentTimers_.takeAt(row);
-        endRemoveRows();
-        delete p_timer;
-    }
-}
-
-bool CurrentAlertsTableModel::saveTimer(QModelIndex index, QString filename)
-{
-    return currentTimers_.at(index.row())->save(filename);
-}
index 52f3f5c..8bf341a 100644 (file)
@@ -35,7 +35,7 @@
 /*! Class that contains the model that holds the timers'
 
   @author Heli Hyvättinen
-  @date 2010-08-08
+  @date 2010-09-08
   @version 0.1.1
 
 Class that contains the model that holds the timers
@@ -49,48 +49,93 @@ class CurrentAlertsTableModel : public QAbstractTableModel
 public:
     explicit CurrentAlertsTableModel(QObject *parent = 0);
 
+    /*!
+    Returns the number of rows in the model.
+    Used by the view.
+    */
     int rowCount(const QModelIndex &parent) const;
 
+    /*!
+      Returns the (fixed) number of columns in the model.
+      Used by the view.
+    */
     int columnCount(const QModelIndex &parent) const;
 
+    /*!
+    Returns the queried contents of the cell
+    Used by the view.
+    */
     QVariant data(const QModelIndex &index, int role) const;
 
+    /*!
+      Returns the queried header data.
+      As no headers are wanted, it always returns an empty QVariant.
+      Used by the view.
+      */
     QVariant headerData(int section, Qt::Orientation orientation, int role) const;
 
+    /*!
+      Returns the index in the model of the given timer
+      */
     QModelIndex giveIndexForTimer(Timer * ptimer);
 
+    /*!
+      Returns whether the timer in the given position is currently alerting.
+      @param index Any cell from the row of the alert is good here.
+      */
     bool isThisTimerAlerting(QModelIndex index);
 
-    bool saveTimer(QModelIndex index,QString filename);
-
 signals:
 
 public slots:
 
-    void addTimers(QList <Timer *> timers);
+    /*!
+       Adds the timers to the model
+    @param timers List of timers to be added
+    @param startImmediately If true, the timers will be started after adding to the model.
+    */
+    void addTimers(QList <Timer *> timers, bool startImmediately = true);
 
+    /*!
+     Tells the view to refresh all information in the time column.
+      */
     void refreshTimeColumn ();
 
+    /*!
+      Passes the start command to the timer in the given index.
+      @param index Any cell from the row of the alert is good here.
+      */
     void startTimer(QModelIndex index);
+
+    /*!
+      Passes the snooze command to the timer in the given index.
+      @param index Any cell from the row of the alert is good here.
+      */
     void snoozeTimer(QModelIndex index);
-    void stopTimer(QModelIndex index);
 
 
-    void setUpdateViewOnChanges(bool update);
+    /*!
+      Passes the stop command to the timer in the given index.
+      @param index Any cell from the row of the alert is good here.
+      */
+    void stopTimer(QModelIndex index);
 
-    void removeTimer(QModelIndex index);
+/*!
+Sets whether the view should be kept up to date.
+*/
+    void setUpdateViewOnChanges(bool update);
 
 private:
-    QList <Timer * > currentTimers_;
+    QList <Timer * > currentTimers_; /*! Holds the timers */
 
-    static const int numberOfColumns_ = 3;
-    static const int alertTextColumnNumber_ = 0;
-    static const int timeRemainingColumnNumber_ = 1;
-    static const int statusColumnNumber_ = 2;
+    static const int numberOfColumns_ = 3; /*! The fixed number of columns in the model */
+    static const int alertTextColumnNumber_ = 0; /*! Tells which column contains the alert text */
+    static const int timeRemainingColumnNumber_ = 1; /*! Tells which column contains the time remaining until alert */
+    static const int statusColumnNumber_ = 2; /*! Tells which column contains status information, such as that the timer is alerting  */
 
 
 
-    bool updateViewOnChanges_;
+    bool updateViewOnChanges_; /*! Keeps track on whether the view should be kept up to date. */
 
 };
 
diff --git a/src/kitchenalert.png b/src/kitchenalert.png
new file mode 100644 (file)
index 0000000..1605413
Binary files /dev/null and b/src/kitchenalert.png differ
index a3f703b..16bb470 100644 (file)
@@ -1,5 +1,5 @@
 <RCC>
     <qresource prefix="/">
-        <file>icon64.png</file>
+        <file>kitchenalert.png</file>
     </qresource>
 </RCC>
index 18c4e2f..e2e79ff 100644 (file)
@@ -42,9 +42,7 @@
 #include <QAction>
 #include <QMenuBar>
 #include <QMessageBox>
-#include <QFileDialog>
-#include <QFile>
-#include <QIcon>
+#include <QSettings>
 
 
 
@@ -54,12 +52,14 @@ KitchenAlertMainWindow::KitchenAlertMainWindow(QWidget *parent) :
     {
     ui->setupUi(this);
 
-    setWindowIcon(QIcon(":/icon64.png"));
+    setWindowIcon(QIcon(":/kitchenalert.png"));
 
-  //load sticky alerts to the model here...
 
 
 
+  connect(ui->CreateNewScheduleButton, SIGNAL (pressed()), this, SLOT (newTimerSequence()));
+
+
   //alerts' tableview setup
 
 
@@ -67,42 +67,27 @@ KitchenAlertMainWindow::KitchenAlertMainWindow(QWidget *parent) :
   ui->ComingAlertsTableView->setSelectionMode(QAbstractItemView::SingleSelection);
   ui->ComingAlertsTableView->setSelectionBehavior(QAbstractItemView::SelectRows);
 
+  ui->ComingAlertsTableView->horizontalHeader()->hide();
+//  ui->ComingAlertsTableView->verticalHeader()->setVisible(true);
 
-  //Commented out for testing their potebtial effect for slowdown:
-
-  //  ui->ComingAlertsTableView->horizontalHeader()->setResizeMode(QHeaderView::Fixed);
-//  ui->ComingAlertsTableView->horizontalHeader()->resizeSection(0,460);
-//  ui->ComingAlertsTableView->horizontalHeader()->resizeSection(1,140);
-//  ui->ComingAlertsTableView->horizontalHeader()->resizeSection(2,100);
-
-//  ui->ComingAlertsTableView->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents);
-
-
-
-
-//  ui->ComingAlertsTableView->verticalHeader()->setDefaultSectionSize(40); //Needed with fixed cell height only
-
-
-
+  ui->ComingAlertsTableView->horizontalHeader()->setResizeMode(QHeaderView::Fixed);
+  ui->ComingAlertsTableView->horizontalHeader()->resizeSection(0,535);
+  ui->ComingAlertsTableView->horizontalHeader()->resizeSection(1,140);
+  ui->ComingAlertsTableView->horizontalHeader()->resizeSection(2,100);
 
-  ui->ComingAlertsTableView->horizontalHeader()->hide();
-  ui->ComingAlertsTableView->setWordWrap(true);
+  ui->ComingAlertsTableView->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents);
 
 
-  //Buttons used when a timer is selected are disabled by default and enabled upon selection
+  //Buttons used to reacting an alarm are hidden by default
 
   disableSelectionDependentButtons();
 
+
   connect(ui->ComingAlertsTableView->selectionModel(),SIGNAL(selectionChanged(QItemSelection,QItemSelection)),this,SLOT(timerSelected(QItemSelection,QItemSelection)));
 
-  //connect buttons to respective functions
-  connect(ui->CreateNewScheduleButton, SIGNAL (pressed()), this, SLOT (newTimerSequence()));
   connect(ui->DoneButton,SIGNAL(clicked()),this,SLOT(stop()));
   connect(ui->RestartButton,SIGNAL(clicked()),this,SLOT(restart()));
   connect(ui->SnoozeButton,SIGNAL(clicked()),this, SLOT(snooze()));
-  connect(ui->RemoveButton,SIGNAL(clicked()),this,SLOT(remove()));
-  connect(ui->SaveButton,SIGNAL(clicked()),this,SLOT(saveTimer()));
-  connect(ui->loadButton,SIGNAL(clicked()),this,SLOT(loadTimer()));
 
   // menu setup
 
@@ -143,38 +128,29 @@ void KitchenAlertMainWindow::newTimerSequence()
     if (createdialog.exec() == QDialog::Accepted) //if user pressed OK
     {
 
-        //get user input from the dialog
-
-
-       QList<Timer *>  alltimers = createdialog.getTimers();
 
-       // take first timer (currently the only one!)
+       QList<Timer *>  alltimers = createdialog.getTimers();  //get user input from the dialog
 
+       Timer* timer1 = alltimers.at(0); // take first timer (currently the only one!)
 
-       Timer* timer1 = alltimers.at(0);
-
-
-       //connect alert
 
 
        connect(timer1,SIGNAL(alert(QModelIndex)),this,SLOT(alert(QModelIndex)));
 
 
-       //Disable buttons, as selection is cleared when view is refreshed to show the new timer
-
-       disableSelectionDependentButtons();
 
+        model_.addTimers(alltimers); // give timers to the model, they are started automatically by default
 
-       // give timers to the model
+ //       ui->ComingAlertsTableView->resizeColumnsToContents();
 
-       model_.addTimers(alltimers);
 
+        //Disable buttons, as selection is cleared when view is refreshed to show the new timer
+        //But only if the timer has not already alerted and thus been selected
 
-       //start the timer when it's safely in the model (consider moving this to the model's addTimers function)
+        if (!selectedRow().isValid())
+            disableSelectionDependentButtons();
 
 
-       timer1->start();
-
 
     }
     // if cancelled, do nothing
@@ -197,7 +173,7 @@ void KitchenAlertMainWindow::alert(QModelIndex indexOfAlerter)
 
     // The alerting timer is selected
     ui->ComingAlertsTableView->selectionModel()->select(QItemSelection(indexOfAlerter,indexOfAlerter),QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows );
-//    qDebug() << "Should be selected now";
+    qDebug() << "Should be selected now";
 
 
     //Snooze button is enabled
@@ -205,22 +181,27 @@ void KitchenAlertMainWindow::alert(QModelIndex indexOfAlerter)
 
     ui->SnoozeButton->setEnabled(true);
 
-    //The alert sound is played (consider moving this operation inside timer, as now stopping one alert will silence all alerting alerts)
+    //Debug message
+
 
-    alertSound_.play();
+
+    ui->debugLabel->setText(tr("Alert received from row %1").arg(indexOfAlerter.row()));
+    qDebug() << "Wrote the debug message";
+
+    //The alert sound is played
+   //TESTING TO MOVE THIS OPERATION TO THE TIMER ITSELF
+//    alertSound_.play();
 
 }
 
 
-void KitchenAlertMainWindow::timerSelected(QItemSelection selected,QItemSelection deselected)
+void KitchenAlertMainWindow::timerSelected(QItemSelection selected,QItemSelection)
 {
     ui->DoneButton->setEnabled(true);
     ui->RestartButton->setEnabled(true);
-    ui->RemoveButton->setEnabled(true);
-    ui->SaveButton->setEnabled(true);
 
 
-    //enabled only when alerting
+    //snooze button enabled only when alerting
     QModelIndexList indexes = selected.indexes();
 
     //the selection model only allows selecting one row at the time & we only need to know the row, so we can just take the first one
@@ -244,7 +225,7 @@ void KitchenAlertMainWindow::snooze()
         model_.snoozeTimer(row);
     }
     ui->SnoozeButton->setDisabled(true);
-    alertSound_.stop();
+  //  alertSound_.stop();
 
 }
 
@@ -257,7 +238,7 @@ void KitchenAlertMainWindow::restart()
         model_.startTimer(row);
     }
     ui->SnoozeButton->setDisabled(true);
-    alertSound_.stop();
+ //   alertSound_.stop();
 
 }
 
@@ -269,8 +250,7 @@ void KitchenAlertMainWindow::stop()
         model_.stopTimer(row);
     }
     ui->SnoozeButton->setDisabled(true);
-    alertSound_.stop();
-    qDebug() << "Stopped.";
+//    alertSound_.stop();
 }
 
 QModelIndex KitchenAlertMainWindow::selectedRow()
@@ -285,17 +265,16 @@ QModelIndex KitchenAlertMainWindow::selectedRow()
 
 void KitchenAlertMainWindow::openSelectSoundDialog()
 {
+    //THIS CEASED TO WORK WHEN SOUND WAS MOVED TO TIMERS THEMSELVES
     SelectSoundDialog dialog;
    if ( dialog.exec() == QDialog::Accepted) //if user pressed OK
     {
        if (dialog.isDefaultSoundChecked() == true)
            alertSound_.setDefaultSound();
        else
-        alertSound_.setSound(dialog.getSoundFileName());
-
-   //opening a dialog clears the selection so the selection dependen buttons must be disabled
+            alertSound_.setSound(dialog.getSoundFileName());
     }
-    disableSelectionDependentButtons();
+
 }
 
 void KitchenAlertMainWindow::openAbout()
@@ -303,18 +282,23 @@ void KitchenAlertMainWindow::openAbout()
     QMessageBox::about(this,tr("About KitchenAlert"),tr("<p>Version %1"
                                                         "<p>Copyright &copy; Heli Hyv&auml;ttinen 2010"
                                                          "<p>License: General Public License v3"
-                                                         "<p>Bugtracker and project page: https://garage.maemo.org/projects/kitchenalert/").arg(QApplication::applicationVersion()));
+                                                         "<p>Web page: http://kitchenalert.garage.maemo.org/"
+                                                         "<p>Bugtracker: https://garage.maemo.org/projects/kitchenalert/").arg(QApplication::applicationVersion()));
 }
 
 bool KitchenAlertMainWindow::event(QEvent *event)
 {
     QMainWindow::event(event);
 
+
+
     switch (event->type())
     {
         case QEvent::WindowActivate:
 
             model_.setUpdateViewOnChanges(true);
+
+
               break;
 
        case QEvent::WindowDeactivate:
@@ -323,6 +307,8 @@ bool KitchenAlertMainWindow::event(QEvent *event)
 
        default:
             break;
+
+
     }
 }
 
@@ -331,133 +317,31 @@ void KitchenAlertMainWindow::disableSelectionDependentButtons()
     ui->DoneButton->setDisabled(true);
     ui->SnoozeButton->setDisabled(true);
     ui->RestartButton->setDisabled(true);
-    ui->RemoveButton->setDisabled(true);
-    ui->SaveButton->setDisabled(true);
-}
 
-void KitchenAlertMainWindow::remove()
-{
-   QModelIndex row = selectedRow();
-   if (row.isValid())
-   {
-    model_.removeTimer(row);
-    alertSound_.stop();
-    ui->ComingAlertsTableView->clearSelection();
-    disableSelectionDependentButtons();
-   }
 }
 
-void KitchenAlertMainWindow::saveTimer()
+void KitchenAlertMainWindow::initializeAlertSound()
 {
+    QSettings settings;
 
-    QModelIndex row = selectedRow();
-
-    if (row.isValid() == false) //If there was no row selected invalid row was returned
-        return;
-
-
-    //file name is asked. As the filename will be appended, there's no point in confirming owerwrite here
-    QString filename = QFileDialog::getSaveFileName(this, "", "", "*.kitchenalert",NULL,QFileDialog::DontConfirmOverwrite);
+    bool useDefaultSound = settings.value("UseDefaultSound",true).toBool();
+    QString filename = settings.value("soundfile","").toString();
 
-    disableSelectionDependentButtons();
-
-    qDebug() << filename;
-
-    if (filename.isEmpty()) //user cancelled the dialog (or gave an empty name)
+    if (useDefaultSound == true)
     {
-        return;
+        openSelectSoundDialog();
     }
-
-    if (!filename.endsWith(".kitchenalert"))
+    else if (filename.isEmpty())
     {
-        filename.append(".kitchenalert");
-
+        openSelectSoundDialog();
     }
 
-    qDebug() << "filename appended to " << filename;
-
+   QString currentFilename = settings.value("soundfile","").toString();
 
-    //MANUAL CONFIRMATION OF OWERWRITE
-
-    if ( QFile::exists(filename))
-    {
-         //ASK FOR CONFIRMATION
-
-        QString overwriteQuestion ("File ");
-        overwriteQuestion.append(filename);
-        overwriteQuestion.append(" already exists. Do you want to overwrite it?");
-        if (QMessageBox::question(this,"Confirm overwrite?", overwriteQuestion,QMessageBox::Yes | QMessageBox::No,QMessageBox::No) != QMessageBox::Yes)
-        {
-            return;
-        }
-    }
-
-
-
-
-
-    QString errorMessage(tr("Cannot write to file "));
-    errorMessage.append(filename);
-
-    if (!model_.saveTimer(row,filename)) //Save the file, if not successful give an error message
-    {
-        QMessageBox::critical(this,tr("Save timer failed!"), errorMessage);
-    }
-
-
-}
-
-void KitchenAlertMainWindow::loadTimer()
-{
-    QString filename = QFileDialog::getOpenFileName(this,"","",tr("KitchenAlert timer files (*.kitchenalert)"));
-    if (!filename.isEmpty())
-    {
-
-//        if (!filename.endsWith(".kitchenalert"))      //not needed, the dialog won't let the user to select files not ending with ".kitchenalert"
-//        {
-//            filename.append(".kitchenalert");
-//        }
-
-        QString errorTitle(tr("Failed to load file "));
-        errorTitle.append(filename);
-
-        Timer * p_timer = new Timer();
-        if (!p_timer->load(filename))
-        {
-            QMessageBox::critical(this,errorTitle,tr("Unable to open file or not a valid KitchenAlert timer file."));
-            delete p_timer;
-            return;
-        }
-
-        initializeTimer(p_timer);
-    }
-}
-
-
-void KitchenAlertMainWindow::initializeTimer(Timer *p_timer)
-{
-
-//connect alert
-
-
-connect(p_timer,SIGNAL(alert(QModelIndex)),this,SLOT(alert(QModelIndex)));
-
-
-//Disable buttons, as selection is cleared when view is refreshed to show the new timer
-
-disableSelectionDependentButtons();
-
-
-// give timers to the model (model wants list of timers now..)
-
-QList<Timer *> timerList;
-
-timerList.append(p_timer);
-model_.addTimers(timerList);
-
-
-//start the timer when it's safely in the model (consider moving this to the model's addTimers function)
+   if (currentFilename.isEmpty())
+   {
+        ui->debugLabel->setText("<FONT color=red>No alert sound file set. Alert sound will not be played!</FONT>");
 
+   }
 
-p_timer->start();
 }
index 30711ea..720da7b 100644 (file)
@@ -40,7 +40,7 @@ namespace Ui {
 /*! The main window class of KitchenAlert'
 
   @author Heli Hyvättinen
-  @date 2010-08-08
+  @date 2010-09-08
   @version 0.1.1
 
 Operates the UI.
@@ -60,41 +60,90 @@ public:
 
 
 public slots:
-    void newTimerSequence();
-    void openSelectSoundDialog();
+   /*!
+   Opens a dialog for creating a new timer
+   Connects the new timer's alert and adds it to the model, starting the timer
+    */
+        void newTimerSequence();
+
+   /*!
+   Opens a dialog for choosing the alert sound
+   Gives the sound filename to AlertSound
+    */
+   void openSelectSoundDialog();
+
+    /*!
+   Shows the application's about box
+   */
     void openAbout();
 
+/*! Sounds the alert sound and selects the alarming timer
+  Also bring the application to top and activates it
+  Used by connecting it to the timer's alert signal
+  @param indexOfAlerted The index of the alerting timer in the model.
 
+  */
     void alert(QModelIndex indexOfAlerted);
-    void timerSelected(QItemSelection selected,QItemSelection deselected);
+
+/*!
+    Reacts to selecting of timer in the view.
+    Needs to be connected to the corresponding signal.
+    Sets enabling of buttons as necessary.
+    Does not receive information of clearing the selection (because no signal is sent).
+    Disabling selection dependent buttons must be done manually by everything that clears the selection.
+    It cannot be cleared by the user with the selection policy used.
+
+    @param selected Selection that contains all selected cells (all cells of the row selected).
+*/
+    void timerSelected(QItemSelection selected,QItemSelection);
+
+    /*! Snoozes the timer that is currently selected.
+      Needs to be connected to the associated button.
+    */
     void snooze();
+
+    /*! Restarts the timer selected.
+      Needs to be connected to the associated button.
+    */
     void restart();
-    void stop();
-    void remove();
-    void saveTimer();
-    void loadTimer();
 
+    /*! Stops the timer selected.
+      Needs to be connected to the associated button.
+    */
+    void stop();
 
 
 protected:
     void changeEvent(QEvent *e);
+
+    /*!
+    Reimplemented to catch WindowActivate and WindowDeactivate events.
+    Stops refreshing the view when the window is deactivated and resumes it when reactivated.
+    */
     bool event(QEvent *event);
 
+    /*!
+    Disables all buttons that should only be enabled when a timer is selected.
+    */
     void disableSelectionDependentButtons();
 
 private:
 
     Ui::KitchenAlertMainWindow *ui;
 
-    QList <Timer *> currentTimers_;
-
-    CurrentAlertsTableModel model_;
+    CurrentAlertsTableModel model_; /*! The model that stores the alerts */
 
+    /*!
+    Returns a QMoldelIndex pointing to a cell in the row that is currently selected.
+    */
     QModelIndex selectedRow();
 
-    AlertSound alertSound_;
+    AlertSound alertSound_; /*! Takes care of alert sound */ //This has been moved to the timers themselves
 
-    void initializeTimer(Timer * p_timer);
+    /*!
+    Not used. Would allow getting rid of the default sound if used.
+    */
+    void initializeAlertSound();
 
 
 };
index 3303d88..23cf09e 100644 (file)
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>736</width>
-    <height>403</height>
+    <width>785</width>
+    <height>413</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -31,8 +31,8 @@
       <rect>
        <x>0</x>
        <y>0</y>
-       <width>1445</width>
-       <height>585</height>
+       <width>1447</width>
+       <height>587</height>
       </rect>
      </property>
      <widget class="QWidget" name="verticalLayoutWidget">
@@ -40,8 +40,8 @@
        <rect>
         <x>350</x>
         <y>0</y>
-        <width>721</width>
-        <height>391</height>
+        <width>791</width>
+        <height>411</height>
        </rect>
       </property>
       <layout class="QVBoxLayout" name="verticalLayout">
         <widget class="QTableView" name="ComingAlertsTableView"/>
        </item>
        <item>
+        <widget class="QLabel" name="debugLabel">
+         <property name="text">
+          <string/>
+         </property>
+        </widget>
+       </item>
+       <item>
         <layout class="QHBoxLayout" name="horizontalLayout_2">
          <item>
           <widget class="QPushButton" name="SnoozeButton">
           </widget>
          </item>
          <item>
-          <widget class="QPushButton" name="RemoveButton">
-           <property name="text">
-            <string>Remove</string>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QPushButton" name="SaveButton">
-           <property name="text">
-            <string>Save</string>
-           </property>
-          </widget>
-         </item>
-         <item>
-          <widget class="QPushButton" name="loadButton">
-           <property name="text">
-            <string>Load</string>
-           </property>
-          </widget>
-         </item>
-         <item>
           <spacer name="horizontalSpacer_2">
            <property name="orientation">
             <enum>Qt::Horizontal</enum>
index 7a30501..ff33e51 100644 (file)
@@ -28,9 +28,9 @@
 int main(int argc, char *argv[])
 {
     QApplication a(argc, argv);
-    a.setApplicationName("KitchenAlert"); //a name required by phonon
-    a.setApplicationVersion("0.2");
-
+    a.setApplicationName("KitchenAlert"); //a name is required by phonon
+    a.setApplicationVersion("0.1.1");
+    a.setOrganizationName("KitchenAlert");
     KitchenAlertMainWindow w;
 #if defined(Q_WS_S60)
     w.showMaximized();
index 210fb90..539796e 100644 (file)
@@ -29,7 +29,6 @@
 #include <QFileDialog>
 #include <QSettings>
 #include <QDebug>
-#include <Phonon>
 
 SelectSoundDialog::SelectSoundDialog(QWidget *parent) :
     QDialog(parent),
@@ -51,11 +50,6 @@ SelectSoundDialog::SelectSoundDialog(QWidget *parent) :
     }
     else ui->CustomSoundRadioButton->setChecked(true);
     qDebug() << "UseDefaultSoundfile is " << useDefaultSoundFile;
-
-    connect(ui->testButton,SIGNAL(clicked()),this,SLOT(testSound()));
-    pSound_ = Phonon::createPlayer(Phonon::NoCategory, Phonon::MediaSource(ui->lineEdit->displayText()));
-
-
 }
 
 SelectSoundDialog::~SelectSoundDialog()
@@ -83,9 +77,3 @@ bool SelectSoundDialog::isDefaultSoundChecked()
 {
     return ui->DefaultSoundRadioButton->isChecked();
 }
-
-void SelectSoundDialog::testSound( )
-{
-    pSound_->setCurrentSource(ui->lineEdit->displayText());
-    pSound_->play();
-}
index 24bbc9c..818d3e5 100644 (file)
@@ -28,7 +28,6 @@
 #define SELECTSOUNDDIALOG_H
 
 #include <QDialog>
-#include <Phonon>
 
 namespace Ui {
     class SelectSoundDialog;
@@ -56,12 +55,9 @@ public:
 
 public slots:
     void browse();
-    void testSound();
 
 private:
     Ui::SelectSoundDialog *ui;
-    Phonon::MediaObject* pSound_;
-
 };
 
 #endif // SELECTSOUNDDIALOG_H
index 6a34a08..0104637 100644 (file)
@@ -101,13 +101,6 @@ p, li { white-space: pre-wrap; }
        </spacer>
       </item>
       <item>
-       <widget class="QPushButton" name="testButton">
-        <property name="text">
-         <string>Test sound</string>
-        </property>
-       </widget>
-      </item>
-      <item>
        <widget class="QPushButton" name="OKButton">
         <property name="text">
          <string>Done</string>
index 1b3eed6..177a9a2 100644 (file)
@@ -27,9 +27,6 @@
 #include "timer.h"
 #include "currentalertstablemodel.h"
 #include <qdebug.h>
-#include <QFile>
-#include <QXmlStreamWriter>
-#include <QXmlStreamReader>
 
 Timer::Timer(QObject *parent) :
     QObject(parent)
@@ -43,7 +40,6 @@ Timer::Timer(QObject *parent) :
 }
 
 
-
 int Timer::getOriginalTimeInSeconds()
 {
     return _originalTime;
@@ -77,8 +73,9 @@ void Timer::secondPassed()
     if (_remainingTime == 0)
     {
         alerting_ = true;
+        alertSound_.play();
         emit alert(whereAmI());
-        qDebug() << "alerted";
+//        qDebug() << "alerting";
     }
 
     emit remainingTimeChanged(); //after alerting in case of alert so that status gets updated immediately
@@ -89,24 +86,32 @@ void Timer::start()
     _remainingTime = _originalTime;
     _actualTimer.start();
 
-    alerting_ = false;
 
-    if (_originalTime == 0) //has to be checked here, since 00:00:00 alert will already be negative when checked next time
-    //THIS ALERTS EVERY SECOND TIME THE TIMER IS STARTED! //This bug disappeared without explanation...
+
+    if (_originalTime == 0) //a 00:00:00 alert has to  be checked here, since it's already negative when checked for the next time
     {
-        alerting_ = true;
+        alerting_  = true;
+        alertSound_.play();
         emit alert(whereAmI());
-        qDebug () << "Alerted for 00:00:00 alert";
+        qDebug () << "Alerting 00:00:00 from row: " << whereAmI().row();
     }
+
+    else
+    {
+        alerting_ = false;
+        alertSound_.stop();
+    }
+
 }
 
 
 void Timer::stop()
 {
     _actualTimer.stop();
-    _remainingTime = 0; //Stopped timer shows 00:00:00
+    _remainingTime = 0; //Stopped timer shows 00:00:00 (which unfortunately makes it red...)
 
     alerting_ = false;
+    alertSound_.stop();
 }
 
 void Timer::snooze()
@@ -114,6 +119,7 @@ void Timer::snooze()
     _remainingTime = 120;
 
     alerting_ = false;
+    alertSound_.stop();
 }
 
 
@@ -140,54 +146,3 @@ QModelIndex Timer::whereAmI()
 
 }
 
-bool Timer::save(QString filename)
-{
-    QFile file(filename);
-
-    if (!file.open(QFile::WriteOnly | QFile::Text))
-    {
-       return false;
-    }
-
-    QXmlStreamWriter xmlWriter(&file);
-    xmlWriter.setAutoFormatting(true);
-    xmlWriter.writeStartDocument();
-    xmlWriter.writeStartElement("kitchenalert");
-    xmlWriter.writeStartElement("timer");
-    xmlWriter.writeAttribute("alert_text",_alertText);
-    xmlWriter.writeAttribute("time_in_seconds", QString().setNum(_originalTime));
-    xmlWriter.writeEndDocument(); //this should close all open elements
-
-    return true;
-}
-
-bool Timer::load(QString filename)
-{
-    QFile file (filename);
-    if (!file.open(QFile::ReadOnly | QFile::Text))
-    {
-        return false;
-    }
-
-    QXmlStreamReader reader;
-    reader.setDevice(&file);
-
-    reader.readNextStartElement();
-
-    if (reader.name() != "kitchenalert")
-        return false;
-
-    reader.readNextStartElement();
-    if (reader.name() != "timer")
-        return false;
-
-
-    _alertText = reader.attributes().value("alert_text").toString();
-    _originalTime = reader.attributes().value("time_in_seconds").toString().toInt();
-    return true;
-
-
-
-
-}
-
index 81b64cd..7df8c2d 100644 (file)
 
 #include <QModelIndex>
 
-
+#include "alertsound.h"
 
 /*! The timer class of KitchenAlert'
 
   @author Heli Hyvättinen
-  @date 2010-08-12
+  @date 2010-09-08
   @version 0.1.1
 
 The timer class of KitchenAlert.
@@ -52,18 +52,21 @@ class Timer : public QObject
 public:
     explicit Timer(QObject *parent = 0);
 
+    /*! Returns the original time in seconds
+        When the alert restarts, it is set to this time.
+    */
+     int getOriginalTimeInSeconds();
 
-    int getOriginalTimeInSeconds();
+    /*! Sets the original time in seconds */
     void setOriginalTimeInSeconds(int seconds);
 
+    /*! Returns the time remaining before the alert in seconds       */
     int getRemainingTimeInSeconds();
 
     QString getAlertText();
     void setAlertText(QString text);
 
     bool isAlerting();
-    bool save(QString filename);
-    bool load(QString filename);
 
 
 signals:
@@ -79,7 +82,6 @@ public slots:
 
 
 
-
 private:
     int _originalTime; //seconds!
     int _remainingTime; //seconds!
@@ -89,6 +91,8 @@ private:
 
     QModelIndex whereAmI();
 
+    AlertSound alertSound_;
+
 };
 
 #endif // TIMER_H