From: Heli Hyvättinen Date: Mon, 20 Sep 2010 11:22:28 +0000 (+0300) Subject: Brutally restored choosing alert sound & fixed status column not always updating X-Git-Tag: v0.4.0~34 X-Git-Url: https://vcs.maemo.org/git/?p=kitchenalert;a=commitdiff_plain;h=b7d2d79d4dcacfd804addcb9de13a7144747c66f Brutally restored choosing alert sound & fixed status column not always updating --- diff --git a/src/.directory b/src/.directory index 86d107d..79e0b47 100644 --- a/src/.directory +++ b/src/.directory @@ -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 diff --git a/src/KitchenAlert.pro.user b/src/KitchenAlert.pro.user index 2078c84..bbc6a8f 100644 --- a/src/KitchenAlert.pro.user +++ b/src/KitchenAlert.pro.user @@ -123,12 +123,14 @@ + true Qt4ProjectManager.MaemoPackageCreationStep false /usr/local/bin/KitchenAlert + 0.0.1 3 @@ -165,12 +167,14 @@ + true Qt4ProjectManager.MaemoPackageCreationStep true + 0.0.1 3 @@ -199,11 +203,23 @@ New Maemo Run Configuration Qt4ProjectManager.MaemoRunConfiguration - 17 - - 2010-09-08T15:52:20 - + + /holvi/heli/ohjelmointi/KitchenAlert-build-maemo/kitchenalert_0.0.1_armel.deb + 192.168.2.15 + + + 192.168.2.15 + /holvi/heli/ohjelmointi/KitchenAlert-build-maemo/kitchenalert_0.0.1_armel.deb + + + /home/developer/kitchenalert_0.0.1_armel.deb + /home/developer/kitchenalert_0.0.1_armel.deb + + + 2010-09-19T21:36:38 + 2010-09-20T14:15:54 + 1 diff --git a/src/alertsound.cpp b/src/alertsound.cpp index 0f83d32..54decb8 100644 --- a/src/alertsound.cpp +++ b/src/alertsound.cpp @@ -66,6 +66,8 @@ void AlertSound::stop() pSound_->stop(); } + + void AlertSound::setSound(QString filename) { QSettings settings("KitchenAlert","KitchenAlert"); diff --git a/src/currentalertstablemodel.cpp b/src/currentalertstablemodel.cpp index 00c207e..0684c84 100644 --- a/src/currentalertstablemodel.cpp +++ b/src/currentalertstablemodel.cpp @@ -201,7 +201,7 @@ void CurrentAlertsTableModel::addTimers(QList 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 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) diff --git a/src/currentalertstablemodel.h b/src/currentalertstablemodel.h index 8bf341a..b4a7b87 100644 --- a/src/currentalertstablemodel.h +++ b/src/currentalertstablemodel.h @@ -97,9 +97,11 @@ public slots: void addTimers(QList 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. diff --git a/src/kitchenalertmainwindow.cpp b/src/kitchenalertmainwindow.cpp index e2e79ff..3d4dc22 100644 --- a/src/kitchenalertmainwindow.cpp +++ b/src/kitchenalertmainwindow.cpp @@ -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()); } } diff --git a/src/kitchenalertmainwindow.h b/src/kitchenalertmainwindow.h index 720da7b..382dff6 100644 --- a/src/kitchenalertmainwindow.h +++ b/src/kitchenalertmainwindow.h @@ -112,6 +112,11 @@ public slots: */ void stop(); +signals: + + void defaultSoundEnabled(); + + void soundChanged(QString filename); protected: void changeEvent(QEvent *e); diff --git a/src/timer.cpp b/src/timer.cpp index 177a9a2..6aff3f5 100644 --- a/src/timer.cpp +++ b/src/timer.cpp @@ -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); +} + + diff --git a/src/timer.h b/src/timer.h index 7df8c2d..519039c 100644 --- a/src/timer.h +++ b/src/timer.h @@ -80,6 +80,10 @@ public slots: void stop(); void snooze(); + void enableDefaultSound(); + void changeAlertSound(QString filename); + + private: