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)));
// The program is brought to front and activated when alerted
- raise();
+
activateWindow();
+// 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 päälle hälytyksessä");
}
if (model_.isThisTimerAlerting(index) == true)
{
ui->SnoozeButton->setEnabled(true);
+qDebug() << "Snooze päälle";
+ }
+ else
+ {
+ ui->SnoozeButton->setDisabled(true);
+qDebug() << "Snooze pois päältä";
}
- else ui->SnoozeButton->setDisabled(true);
}
}
model_.startTimer(row);
}
+
+
ui->SnoozeButton->setDisabled(true);
+ qDebug () << "disabled snooze because of restart";
// alertSound_.stop();
}
bool KitchenAlertMainWindow::event(QEvent *event)
{
- QMainWindow::event(event);
-
switch (event->type())
{
- case QEvent::ApplicationActivate:
+ case QEvent::WindowActivate:
model_.setUpdateViewOnChanges(true);
- ui->debugLabel->setText("Returned to the application!");
-
-
- break;
+// ui->debugLabel->setText("Returned to the application!");
+ break;
- case QEvent::ApplicationDeactivate:
+ case QEvent::WindowDeactivate:
model_.setUpdateViewOnChanges(false);
- ui->debugLabel->setText("");
+// ui->debugLabel->setText("");
break;
default:
break;
-
}
+
+ return QMainWindow::event(event); // Send the event to the base class implementation (also when handling the event in this function): necessary for the program to work!
}
void KitchenAlertMainWindow::disableSelectionDependentButtons()