KitchenAlert
- Copyright (C) 2010 Heli Hyvättinen
+ Copyright (C) 2010-2011 Heli Hyvättinen
This file is part of KitchenAlert.
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)));
activateWindow();
- raise();
+
+// removing everything below does not solve the bug #6752!
+
+ raise(); //this may be unnecessary
// The alerting timer is selected
ui->ComingAlertsTableView->selectionModel()->select(QItemSelection(indexOfAlerter,indexOfAlerter),QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows );
ui->SnoozeButton->setEnabled(true);
-
- //Debug message
-
-
-
- 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();
+//qDebug ("Snooze on when alerting");
}
if (model_.isThisTimerAlerting(index) == true)
{
ui->SnoozeButton->setEnabled(true);
+//qDebug() << "Snooze on";
+ }
+ else
+ {
+ ui->SnoozeButton->setDisabled(true);
+//qDebug() << "Snooze off";
}
- else ui->SnoozeButton->setDisabled(true);
}
}
model_.snoozeTimer(row);
}
ui->SnoozeButton->setDisabled(true);
- // alertSound_.stop();
+
}
model_.startTimer(row);
}
- ui->SnoozeButton->setDisabled(true);
- // alertSound_.stop();
+
+
+ if (model_.isThisTimerAlerting(row) == false) //This has to be checked, because 00:00:00 alerts alert *before* the program execution reaches here
+ {
+ ui->SnoozeButton->setDisabled(true);
+ }
+ // qDebug () << "disabled snooze because of restart";
+
}
model_.stopTimer(row);
}
ui->SnoozeButton->setDisabled(true);
-// alertSound_.stop();
+
}
QModelIndex KitchenAlertMainWindow::selectedRow()
SelectSoundDialog dialog;
if ( dialog.exec() == QDialog::Accepted) //if user pressed OK
{
+ QSettings settings ("KitchenAlert","KitchenAlert");
+
if (dialog.isDefaultSoundChecked() == true)
+ {
+
+ settings.setValue("UseDefaultSound",true);
emit defaultSoundEnabled();
- else
- emit soundChanged(dialog.getSoundFileName());
+ }
+ else
+ {
+ QString filename = dialog.getSoundFileName();
+ settings.setValue("UseDefaultSound",false);
+ settings.setValue("soundfile",filename);
+ emit soundChanged(filename);
+ }
+
}
}
void KitchenAlertMainWindow::openAbout()
{
QMessageBox::about(this,tr("About KitchenAlert"),tr("<p>Version %1"
- "<p>Copyright © Heli Hyvättinen 2010"
+ "<p>Copyright © Heli Hyvättinen 2010-2011"
"<p>License: General Public License v3"
"<p>Web page: http://kitchenalert.garage.maemo.org/"
"<p>Bugtracker: https://garage.maemo.org/projects/kitchenalert/").arg(QApplication::applicationVersion()));
case QEvent::WindowActivate:
model_.setUpdateViewOnChanges(true);
- ui->debugLabel->setText("Returned to the application!");
+// ui->debugLabel->setText("Returned to the application!");
break;
case QEvent::WindowDeactivate:
model_.setUpdateViewOnChanges(false);
- ui->debugLabel->setText("");
+// ui->debugLabel->setText("");
break;
default: