From a28224400b03dc7e6efadc7277470a58a10ace3c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Heli=20Hyv=C3=A4ttinen?= Date: Wed, 18 Aug 2010 19:19:15 +0300 Subject: [PATCH] Updated the web page --- src/.directory | 5 ++ src/KitchenAlert.pro | 9 ++- src/KitchenAlert.pro.user | 116 ++++++++++++++++++------------------- src/kitchenalertmainwindow.cpp | 125 +++++++++++++++++++++++++++++++++++++++- www/index.html | 19 +++--- 5 files changed, 199 insertions(+), 75 deletions(-) create mode 100644 src/.directory diff --git a/src/.directory b/src/.directory new file mode 100644 index 0000000..86d107d --- /dev/null +++ b/src/.directory @@ -0,0 +1,5 @@ +[Dolphin] +SortOrder=1 +Sorting=2 +Timestamp=2010,8,16,21,16,54 +ViewMode=1 diff --git a/src/KitchenAlert.pro b/src/KitchenAlert.pro index 8691efe..2fc4ff7 100644 --- a/src/KitchenAlert.pro +++ b/src/KitchenAlert.pro @@ -17,19 +17,22 @@ SOURCES += main.cpp\ timer.cpp \ currentalertstablemodel.cpp \ alertsound.cpp \ - selectsounddialog.cpp + selectsounddialog.cpp \ + savedtimers.cpp HEADERS += kitchenalertmainwindow.h \ createtimersequencedialog.h \ timer.h \ currentalertstablemodel.h \ alertsound.h \ - selectsounddialog.h + selectsounddialog.h \ + savedtimers.h FORMS += kitchenalertmainwindow.ui \ createtimersequencedialog.ui \ selectsounddialog.ui \ - kitchenalertmainwindow.ui + kitchenalertmainwindow.ui \ + choosetimersequencedialog.ui CONFIG += mobility MOBILITY = diff --git a/src/KitchenAlert.pro.user b/src/KitchenAlert.pro.user index 337e0f2..975b471 100644 --- a/src/KitchenAlert.pro.user +++ b/src/KitchenAlert.pro.user @@ -2,7 +2,7 @@ ProjectExplorer.Project.ActiveTarget - 1 + 2 ProjectExplorer.Project.EditorSettings @@ -103,8 +103,8 @@ ProjectExplorer.Project.Target.1 - Maemo - Qt4ProjectManager.Target.MaemoDeviceTarget + Qt Simulator + Qt4ProjectManager.Target.QtSimulatorTarget 1 0 @@ -120,15 +120,7 @@ - - - Qt4ProjectManager.MaemoPackageCreationStep - - false - /home/opt/kitchenalert/kitchenalert - - - 3 + 2 Make Qt4ProjectManager.MakeStep @@ -144,9 +136,9 @@ Debug Qt4ProjectManager.Qt4BuildConfiguration 2 - /holvi/heli/ohjelmointi/KitchenAlert-build-maemo - 3 - 9 + /holvi/heli/ohjelmointi/KitchenAlert-build-simulator + 2 + 0 true @@ -162,15 +154,7 @@ - - - Qt4ProjectManager.MaemoPackageCreationStep - - false - /home/opt/kitchenalert/kitchenalert - - - 3 + 2 Make Qt4ProjectManager.MakeStep @@ -186,22 +170,24 @@ Release Qt4ProjectManager.Qt4BuildConfiguration 0 - /holvi/heli/ohjelmointi/KitchenAlert-build-maemo - 3 - 9 + /holvi/heli/ohjelmointi/KitchenAlert-build-simulator + 2 + 0 true 2 - KitchenAlert.pro - New Maemo Run Configuration - Qt4ProjectManager.MaemoRunConfiguration - - - 17 - - 2010-08-12T23:08:10 - + KitchenAlert + Qt4ProjectManager.Qt4RunConfiguration + 2 + + KitchenAlert.pro + false + false + + false + false + 1 @@ -209,9 +195,9 @@ ProjectExplorer.Project.Target.2 - Qt Simulator - Qt4ProjectManager.Target.QtSimulatorTarget - 1 + Maemo + Qt4ProjectManager.Target.MaemoDeviceTarget + 0 0 @@ -226,7 +212,15 @@ - 2 + + + Qt4ProjectManager.MaemoPackageCreationStep + + false + /usr/local/bin/KitchenAlert + + + 3 Make Qt4ProjectManager.MakeStep @@ -242,9 +236,9 @@ Debug Qt4ProjectManager.Qt4BuildConfiguration 2 - /holvi/heli/ohjelmointi/KitchenAlert-build-simulator - 2 - 0 + /holvi/heli/ohjelmointi/KitchenAlert-build-maemo + 8 + 9 true @@ -260,7 +254,15 @@ - 2 + + + Qt4ProjectManager.MaemoPackageCreationStep + + true + + + + 3 Make Qt4ProjectManager.MakeStep @@ -276,24 +278,22 @@ Release Qt4ProjectManager.Qt4BuildConfiguration 0 - /holvi/heli/ohjelmointi/KitchenAlert-build-simulator - 2 - 0 + /holvi/heli/ohjelmointi/KitchenAlert-build-maemo + 8 + 9 true 2 - KitchenAlert - Qt4ProjectManager.Qt4RunConfiguration - 2 - - KitchenAlert.pro - false - false - - false - false - + KitchenAlert.pro + New Maemo Run Configuration + Qt4ProjectManager.MaemoRunConfiguration + + + 17 + + 2010-08-16T21:04:14 + 1 diff --git a/src/kitchenalertmainwindow.cpp b/src/kitchenalertmainwindow.cpp index 49add3b..ff4c78a 100644 --- a/src/kitchenalertmainwindow.cpp +++ b/src/kitchenalertmainwindow.cpp @@ -42,6 +42,8 @@ #include #include #include +#include +#include @@ -63,8 +65,8 @@ KitchenAlertMainWindow::KitchenAlertMainWindow(QWidget *parent) : ui->ComingAlertsTableView->horizontalHeader()->resizeSection(1,140); ui->ComingAlertsTableView->horizontalHeader()->resizeSection(2,100); - ui->ComingAlertsTableView->verticalHeader()->setResizeMode(QHeaderView::Fixed); - ui->ComingAlertsTableView->verticalHeader()->setDefaultSectionSize(40); + ui->ComingAlertsTableView->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents); +// ui->ComingAlertsTableView->verticalHeader()->setDefaultSectionSize(40); //Needed with fixed cell heght only @@ -85,6 +87,8 @@ KitchenAlertMainWindow::KitchenAlertMainWindow(QWidget *parent) : 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 @@ -199,6 +203,7 @@ void KitchenAlertMainWindow::timerSelected(QItemSelection selected,QItemSelectio ui->DoneButton->setEnabled(true); ui->RestartButton->setEnabled(true); ui->RemoveButton->setEnabled(true); + ui->SaveButton->setEnabled(true); //enabled only when alerting @@ -313,6 +318,7 @@ void KitchenAlertMainWindow::disableSelectionDependentButtons() ui->SnoozeButton->setDisabled(true); ui->RestartButton->setDisabled(true); ui->RemoveButton->setDisabled(true); + ui->SaveButton->setDisabled(true); } void KitchenAlertMainWindow::remove() @@ -326,3 +332,118 @@ void KitchenAlertMainWindow::remove() disableSelectionDependentButtons(); } } + +void KitchenAlertMainWindow::saveTimer() +{ + + 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); + + disableSelectionDependentButtons(); + + qDebug() << filename; + + if (filename.isEmpty()) //user cancelled the dialog (or gave an empty name) + { + return; + } + + if (!filename.endsWith(".kitchenalert")) + { + filename.append(".kitchenalert"); + + } + + qDebug() << "filename appended to " << filename; + + + //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 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) + + +p_timer->start(); +} diff --git a/www/index.html b/www/index.html index 6aa8ff5..e1f5dff 100644 --- a/www/index.html +++ b/www/index.html @@ -1,11 +1,8 @@ - - - KitchenAlert - + KitchenAlert @@ -28,7 +25,7 @@ version (0.1) is available.
KitchenAlert obeys the volume setting of the device. It is highly recommended to test whether you can hear the alert from where you will be keeping your phone before actually using it to alert you of -something.
+something. Even more so if using the default sound, which is not really as loud or clear as it should be.

@@ -39,7 +36,7 @@ something.

Features

Multiple -timers can be run simultaneously.
+timers can be run simultaneously. (Running several timers for several hours may drain your battery, though.)

The alarm sound @@ -64,13 +61,11 @@ Fish and Wildlife Service.

You can install -KitchenAlert on your N900 from the extras-devel or extras-testing -repositories. However, as +KitchenAlert on your N900 from the extras-devel +repository.  However, as usual for  -these repositories, it's not necessarily safe, as the application is -not -fully tested. Remember to close the repository after installing to -avoid unwanted updating of your applications to development versions.
+this repositories, it's not necessarily safe:
keep  in mind the above cautions on volume settings and battery drain. Remember to close the repository after installing to +avoid unwanted updating of your applications to development versions.

Bug reports and feature request are welcome on the application's carage project page.

-- 1.7.9.5