Brutally restored choosing alert sound & fixed status column not always updating
authorHeli Hyvättinen <heli.hyvattinen@kymp.net>
Mon, 20 Sep 2010 11:22:28 +0000 (14:22 +0300)
committerHeli Hyvättinen <heli.hyvattinen@kymp.net>
Mon, 20 Sep 2010 11:22:28 +0000 (14:22 +0300)
src/.directory
src/KitchenAlert.pro.user
src/alertsound.cpp
src/currentalertstablemodel.cpp
src/currentalertstablemodel.h
src/kitchenalertmainwindow.cpp
src/kitchenalertmainwindow.h
src/timer.cpp
src/timer.h

index 86d107d..79e0b47 100644 (file)
@@ -1,5 +1,5 @@
 [Dolphin]
 SortOrder=1
 Sorting=2
-Timestamp=2010,8,16,21,16,54
+Timestamp=2010,9,20,14,21,59
 ViewMode=1
index 2078c84..bbc6a8f 100644 (file)
      <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
     </valuemap>
     <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.2" type="QVariantMap">
+     <value key="Packaging Enabled" type="bool">true</value>
      <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"/>
+     <value key="Version Number" type="QString">0.0.1</value>
     </valuemap>
     <value key="ProjectExplorer.BuildConfiguration.BuildStepsCount" type="int">3</value>
     <valuemap key="ProjectExplorer.BuildConfiguration.CleanStep.0" type="QVariantMap">
      <value key="Qt4ProjectManager.MakeStep.MakeCommand" type="QString"></value>
     </valuemap>
     <valuemap key="ProjectExplorer.BuildConfiguration.BuildStep.2" type="QVariantMap">
+     <value key="Packaging Enabled" type="bool">true</value>
      <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"/>
+     <value key="Version Number" type="QString">0.0.1</value>
     </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">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>
+    <valuelist key="Qt4ProjectManager.MaemoRunConfiguration.LastDeployedFiles" type="QVariantList">
+     <value type="QString">/holvi/heli/ohjelmointi/KitchenAlert-build-maemo/kitchenalert_0.0.1_armel.deb</value>
+     <value type="QString">192.168.2.15</value>
+    </valuelist>
+    <valuelist key="Qt4ProjectManager.MaemoRunConfiguration.LastDeployedHosts" type="QVariantList">
+     <value type="QString">192.168.2.15</value>
+     <value type="QString">/holvi/heli/ohjelmointi/KitchenAlert-build-maemo/kitchenalert_0.0.1_armel.deb</value>
+    </valuelist>
+    <valuelist key="Qt4ProjectManager.MaemoRunConfiguration.LastDeployedRemotePaths" type="QVariantList">
+     <value type="QString">/home/developer/kitchenalert_0.0.1_armel.deb</value>
+     <value type="QString">/home/developer/kitchenalert_0.0.1_armel.deb</value>
+    </valuelist>
+    <valuelist key="Qt4ProjectManager.MaemoRunConfiguration.LastDeployedTimes" type="QVariantList">
+     <value type="QDateTime">2010-09-19T21:36:38</value>
+     <value type="QDateTime">2010-09-20T14:15:54</value>
+    </valuelist>
    </valuemap>
    <value key="ProjectExplorer.Target.RunConfigurationCount" type="int">1</value>
   </valuemap>
index 0f83d32..54decb8 100644 (file)
@@ -66,6 +66,8 @@ void AlertSound::stop()
     pSound_->stop();
 }
 
+
+
 void AlertSound::setSound(QString filename)
 {
    QSettings settings("KitchenAlert","KitchenAlert");
index 00c207e..0684c84 100644 (file)
@@ -201,7 +201,7 @@ void CurrentAlertsTableModel::addTimers(QList <Timer *> timers, bool startImmedi
 //preparatory work
     foreach (Timer* timer, timers)
     {
-        connect (timer,SIGNAL(remainingTimeChanged()),this,SLOT(refreshTimeColumn()));
+        connect (timer,SIGNAL(remainingTimeChanged()),this,SLOT(refreshTimeAndStatusColumns()));
 //        qDebug() << "timer connected";
         timer->setParent(this); //The model becomes the timers parent giving the timer access to model
     }
@@ -226,12 +226,12 @@ void CurrentAlertsTableModel::addTimers(QList <Timer *> timers, bool startImmedi
 }
 
 
-void CurrentAlertsTableModel::refreshTimeColumn()
+void CurrentAlertsTableModel::refreshTimeAndStatusColumns()
 {
     if (updateViewOnChanges_ == true) //Only update GUI if active to save battery
     {
-        emit dataChanged(createIndex(0,1),createIndex(rowCount(QModelIndex())-1,1));  //Entire time column refreshed
-//        qDebug() << "Refresh time column";
+        emit dataChanged(createIndex(0,1),createIndex((rowCount(QModelIndex())-1),2));  //Entire time and status columns refreshed
+
 
     }
 
@@ -245,7 +245,7 @@ void CurrentAlertsTableModel::startTimer(QModelIndex index)
     if (ptimer != NULL)
     {
         ptimer->start();
-        refreshTimeColumn();
+        refreshTimeAndStatusColumns();
     }
 }
 
@@ -255,7 +255,7 @@ void CurrentAlertsTableModel::stopTimer(QModelIndex index)
     if (ptimer != NULL)
     {
         ptimer->stop();
-        refreshTimeColumn();
+        refreshTimeAndStatusColumns();
     }
 }
 
@@ -265,7 +265,7 @@ void CurrentAlertsTableModel::snoozeTimer(QModelIndex index)
     if (ptimer != NULL)
     {
         ptimer->snooze();
-        refreshTimeColumn();
+        refreshTimeAndStatusColumns();
     }
 }
 
@@ -293,7 +293,7 @@ void CurrentAlertsTableModel::setUpdateViewOnChanges(bool update)
 {
     updateViewOnChanges_ = update;
     if (update == true)
-        refreshTimeColumn(); //Refresh to catch up with past changes
+        refreshTimeAndStatusColumns(); //Refresh to catch up with past changes
 }
 
 bool CurrentAlertsTableModel::isThisTimerAlerting(QModelIndex index)
index 8bf341a..b4a7b87 100644 (file)
@@ -97,9 +97,11 @@ public slots:
     void addTimers(QList <Timer *> timers, bool startImmediately = true);
 
     /*!
-     Tells the view to refresh all information in the time column.
+     Tells the view to refresh all information in the time and status columns.
+     (The time and status change without user inervention unlike the alert text and thus
+     need to be refreshed.)
       */
-    void refreshTimeColumn ();
+    void refreshTimeAndStatusColumns ();
 
     /*!
       Passes the start command to the timer in the given index.
index e2e79ff..3d4dc22 100644 (file)
@@ -137,6 +137,11 @@ void KitchenAlertMainWindow::newTimerSequence()
 
        connect(timer1,SIGNAL(alert(QModelIndex)),this,SLOT(alert(QModelIndex)));
 
+       //TODO: FIND A WAY TO INFORM THE TIMERS' ALERTSOUND'S OF A CHANGE OF THE SOUND FILE THEY SHOULD USE!!!!
+
+       connect(this,SIGNAL(defaultSoundEnabled()),timer1,SLOT(enableDefaultSound()));
+       connect(this,SIGNAL(soundChanged(QString)),timer1,SLOT(changeAlertSound(QString)));
+
 
 
         model_.addTimers(alltimers); // give timers to the model, they are started automatically by default
@@ -270,9 +275,9 @@ void KitchenAlertMainWindow::openSelectSoundDialog()
    if ( dialog.exec() == QDialog::Accepted) //if user pressed OK
     {
        if (dialog.isDefaultSoundChecked() == true)
-           alertSound_.setDefaultSound();
+           emit defaultSoundEnabled();
        else
-            alertSound_.setSound(dialog.getSoundFileName());
+           emit soundChanged(dialog.getSoundFileName());
     }
 
 }
index 720da7b..382dff6 100644 (file)
@@ -112,6 +112,11 @@ public slots:
     */
     void stop();
 
+signals:
+
+    void defaultSoundEnabled();
+
+    void soundChanged(QString filename);
 
 protected:
     void changeEvent(QEvent *e);
index 177a9a2..6aff3f5 100644 (file)
@@ -108,7 +108,7 @@ void Timer::start()
 void Timer::stop()
 {
     _actualTimer.stop();
-    _remainingTime = 0; //Stopped timer shows 00:00:00 (which unfortunately makes it red...)
+    _remainingTime = 0; //Stopped timer shows 00:00:00
 
     alerting_ = false;
     alertSound_.stop();
@@ -146,3 +146,14 @@ QModelIndex Timer::whereAmI()
 
 }
 
+void Timer::enableDefaultSound()
+{
+alertSound_.setDefaultSound();
+}
+
+void Timer::changeAlertSound(QString filename)
+{
+alertSound_.setSound(filename);
+}
+
+
index 7df8c2d..519039c 100644 (file)
@@ -80,6 +80,10 @@ public slots:
     void stop();
     void snooze();
 
+    void enableDefaultSound();
+    void changeAlertSound(QString filename);
+
+
 
 
 private: