From: Heli Hyvättinen Date: Sat, 30 Apr 2011 13:00:49 +0000 (+0300) Subject: Bugfixes X-Git-Tag: v0.4.0~17^2 X-Git-Url: https://vcs.maemo.org/git/?p=kitchenalert;a=commitdiff_plain;h=1b7058d42a0dd918569cc049ec174da5dd6b65fe Bugfixes saving a timer no longer clears the selection "new timer" -button now reacts to "clicking" (pressing and releasing) insteads of just pressing for consistency with other buttons --- diff --git a/src/KitchenAlert.pro.user b/src/KitchenAlert.pro.user index bbc6a8f..d2626ad 100644 --- a/src/KitchenAlert.pro.user +++ b/src/KitchenAlert.pro.user @@ -13,81 +13,129 @@ ProjectExplorer.Project.Target.0 - Desktop - Qt4ProjectManager.Target.DesktopTarget + Qt Simulator + Qt Simulator + Qt4ProjectManager.Target.QtSimulatorTarget 0 + 0 0 - - qmake - QtProjectManager.QMakeBuildStep - + + + qmake + qmake + QtProjectManager.QMakeBuildStep + + false + + + Make + Make + Qt4ProjectManager.MakeStep + false + + + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build - - Make - Qt4ProjectManager.MakeStep - false - - + + + Make + Make + Qt4ProjectManager.MakeStep + true + + clean + + + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean - 2 - - Make - Qt4ProjectManager.MakeStep - true - - clean - - - - 1 + 2 false + Debug Debug Qt4ProjectManager.Qt4BuildConfiguration 2 - /holvi/heli/ohjelmointi/KitchenAlert-build-desktop - 4 + /home/heli/Build Directories for Qt Projects/KitchenAlert-build-simulator + 2 0 true - - qmake - QtProjectManager.QMakeBuildStep - + + + qmake + qmake + QtProjectManager.QMakeBuildStep + + false + + + Make + Make + Qt4ProjectManager.MakeStep + false + + + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build - - Make - Qt4ProjectManager.MakeStep - false - - + + + Make + Make + Qt4ProjectManager.MakeStep + true + + clean + + + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean - 2 - - Make - Qt4ProjectManager.MakeStep - true - - clean - - - - 1 + 2 false + Release Release Qt4ProjectManager.Qt4BuildConfiguration 0 - /holvi/heli/ohjelmointi/KitchenAlert-build-desktop - 4 + /home/heli/Build Directories for Qt Projects/KitchenAlert-build-simulator + 2 0 true 2 + + + 0 + Deploy + Deploy + ProjectExplorer.BuildSteps.Deploy + + 1 + No deployment + No deployment + ProjectExplorer.DefaultDeployConfiguration + + 1 - KitchenAlert + KitchenAlert + Qt4ProjectManager.Qt4RunConfiguration 2 @@ -95,9 +143,11 @@ false false - false false + 3768 + true + false 1 @@ -105,223 +155,179 @@ ProjectExplorer.Project.Target.1 + Maemo Maemo Qt4ProjectManager.Target.MaemoDeviceTarget 0 + 0 0 - - qmake - QtProjectManager.QMakeBuildStep - + + + qmake + qmake + QtProjectManager.QMakeBuildStep + + false + + + Make + Make + Qt4ProjectManager.MakeStep + false + + + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build - - Make - Qt4ProjectManager.MakeStep - false - - + + + Make + Make + Qt4ProjectManager.MakeStep + true + + clean + + + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean - - true - - Qt4ProjectManager.MaemoPackageCreationStep - - false - /usr/local/bin/KitchenAlert - - 0.0.1 - - 3 - - Make - Qt4ProjectManager.MakeStep - true - - clean - - - - 1 + 2 false + Debug Debug Qt4ProjectManager.Qt4BuildConfiguration 2 - /holvi/heli/ohjelmointi/KitchenAlert-build-maemo - 8 + /home/heli/Build Directories for Qt Projects/KitchenAlert-build-maemo + 3 9 true - - qmake - QtProjectManager.QMakeBuildStep - - - - Make - Qt4ProjectManager.MakeStep - false - - - - - true - - Qt4ProjectManager.MaemoPackageCreationStep - - true - - - 0.0.1 + + + qmake + qmake + QtProjectManager.QMakeBuildStep + + false + + + Make + Make + Qt4ProjectManager.MakeStep + false + + + + 2 + Build + Build + ProjectExplorer.BuildSteps.Build - 3 - - Make - Qt4ProjectManager.MakeStep - true - - clean - - + + + Make + Make + Qt4ProjectManager.MakeStep + true + + clean + + + + 1 + Clean + Clean + ProjectExplorer.BuildSteps.Clean - 1 + 2 false + Release Release Qt4ProjectManager.Qt4BuildConfiguration 0 - /holvi/heli/ohjelmointi/KitchenAlert-build-maemo - 8 + /home/heli/Build Directories for Qt Projects/KitchenAlert-build-maemo + 3 9 true 2 + + + + true + + + Qt4ProjectManager.MaemoPackageCreationStep + + + + + Qt4ProjectManager.MaemoDeployStep + true + 1 + + /home/heli/Build Directories for Qt Projects/KitchenAlert-build-maemo/kitchenalert_0.0.1_armel.deb + + + 192.168.2.15 + + + + + + 2011-04-05T19:27:15 + + + 2 + Deploy + Deploy + ProjectExplorer.BuildSteps.Deploy + + 1 + Deploy to Maemo device + Deploy to Maemo device + ProjectExplorer.DefaultDeployConfiguration + + 1 - KitchenAlert.pro + KitchenAlert New Maemo Run Configuration Qt4ProjectManager.MaemoRunConfiguration - 17 - - /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 + + KitchenAlert.pro + + false + + 3768 + true + false 1 - ProjectExplorer.Project.Target.2 - - Qt Simulator - Qt4ProjectManager.Target.QtSimulatorTarget - 0 - 0 - - - qmake - QtProjectManager.QMakeBuildStep - - - - Make - Qt4ProjectManager.MakeStep - false - - - - 2 - - Make - Qt4ProjectManager.MakeStep - true - - clean - - - - 1 - false - - Debug - Qt4ProjectManager.Qt4BuildConfiguration - 2 - /holvi/heli/ohjelmointi/KitchenAlert-build-simulator - 2 - 0 - true - - - - qmake - QtProjectManager.QMakeBuildStep - - - - Make - Qt4ProjectManager.MakeStep - false - - - - 2 - - Make - Qt4ProjectManager.MakeStep - true - - clean - - - - 1 - false - - Release - Qt4ProjectManager.Qt4BuildConfiguration - 0 - /holvi/heli/ohjelmointi/KitchenAlert-build-simulator - 2 - 0 - true - - 2 - - KitchenAlert - Qt4ProjectManager.Qt4RunConfiguration - 2 - - KitchenAlert.pro - false - false - - false - false - - - 1 - + ProjectExplorer.Project.TargetCount + 2 - ProjectExplorer.Project.TargetCount - 3 + ProjectExplorer.Project.Updater.EnvironmentId + {f9d47005-7c3c-4c91-accd-62aa22a16497} ProjectExplorer.Project.Updater.FileVersion - 4 + 8 diff --git a/src/alertsound.cpp b/src/alertsound.cpp index f27eb50..b6c1fa3 100644 --- a/src/alertsound.cpp +++ b/src/alertsound.cpp @@ -27,7 +27,8 @@ #include #include - +// Initialize static const + const QString AlertSound::defaultsound_ = "/home/opt/KitchenAlert/DoorbellModifiedFinal.mp3"; @@ -35,7 +36,7 @@ AlertSound::AlertSound(QObject *parent) : QObject(parent) { - defaultsound_ = "/home/opt/KitchenAlert/DoorbellModifiedFinal.mp3"; + QString filename; QSettings settings("KitchenAlert","KitchenAlert"); diff --git a/src/alertsound.h b/src/alertsound.h index 6e7dec2..d7f22ec 100755 --- a/src/alertsound.h +++ b/src/alertsound.h @@ -35,8 +35,8 @@ /*! Class for playing the alert sound' @author Heli Hyvättinen - @date 2011-03-29 - @version 0.2.1 + @date 2011-04-26 + @version 0.3.0 Class for playing (and stopping) the alert sound. @@ -50,6 +50,8 @@ public: virtual ~AlertSound(); + static const QString defaultsound_ ; /*! the name (with full path) of the default sound file */ + signals: public slots: @@ -69,10 +71,12 @@ private: - QMediaPlayer *pSound_; - QString defaultsound_; + QMediaPlayer *pSound_; /*! The media player used to play the sound */ + }; + + #endif // ALERTSOUND_H diff --git a/src/kitchenalert.pro b/src/kitchenalert.pro new file mode 100644 index 0000000..ce9192d --- /dev/null +++ b/src/kitchenalert.pro @@ -0,0 +1,57 @@ +#------------------------------------------------- +# +# Project created by QtCreator 2010-05-25T15:17:43 +# +#------------------------------------------------- + +QT += core gui + + + +TARGET = KitchenAlert +TEMPLATE = app + + +SOURCES += main.cpp\ + kitchenalertmainwindow.cpp \ + createtimersequencedialog.cpp \ + timer.cpp \ + currentalertstablemodel.cpp \ + alertsound.cpp \ + selectsounddialog.cpp + +HEADERS += kitchenalertmainwindow.h \ + createtimersequencedialog.h \ + timer.h \ + currentalertstablemodel.h \ + alertsound.h \ + selectsounddialog.h + +FORMS += kitchenalertmainwindow.ui \ + createtimersequencedialog.ui \ + selectsounddialog.ui \ + kitchenalertmainwindow.ui + + +symbian { + TARGET.UID3 = 0xe1020059 + # TARGET.CAPABILITY += + TARGET.EPOCSTACKSIZE = 0x14000 + TARGET.EPOCHEAPSIZE = 0x020000 0x800000 +} + +RESOURCES += \ + kitchenalert.qrc + +CONFIG += mobility +MOBILITY += multimedia + + +unix:!symbian { + maemo5 { + target.path = /opt/usr/bin + } else { + target.path = /usr/local/bin + } + INSTALLS += target +} diff --git a/src/kitchenalertmainwindow.cpp b/src/kitchenalertmainwindow.cpp index b1bd95c..33ae87a 100644 --- a/src/kitchenalertmainwindow.cpp +++ b/src/kitchenalertmainwindow.cpp @@ -51,19 +51,15 @@ KitchenAlertMainWindow::KitchenAlertMainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::KitchenAlertMainWindow) { - ui->setupUi(this); - setWindowIcon(QIcon(":/kitchenalert.png")); + defaultSaveDirectory_ = "/home/user/MyDocs/KitchenAlert/"; + ui->setupUi(this); - - - connect(ui->CreateNewScheduleButton, SIGNAL (pressed()), this, SLOT (newTimerSequence())); - + setWindowIcon(QIcon(":/kitchenalert.png")); //alerts' tableview setup - ui->ComingAlertsTableView->setModel(&model_); ui->ComingAlertsTableView->setSelectionMode(QAbstractItemView::SingleSelection); ui->ComingAlertsTableView->setSelectionBehavior(QAbstractItemView::SelectRows); @@ -79,19 +75,20 @@ KitchenAlertMainWindow::KitchenAlertMainWindow(QWidget *parent) : ui->ComingAlertsTableView->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents); - //Buttons used to reacting an alarm are hidden by default + //Buttons used to reacting to an alarm are hidden by default disableSelectionDependentButtons(); connect(ui->ComingAlertsTableView->selectionModel(),SIGNAL(selectionChanged(QItemSelection,QItemSelection)),this,SLOT(timerSelected(QItemSelection,QItemSelection))); - + connect(ui->CreateNewScheduleButton, SIGNAL (clicked()), this, SLOT (newTimerSequence())); connect(ui->DoneButton,SIGNAL(clicked()),this,SLOT(stop())); 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->OpenButton,SIGNAL(clicked()),this,SLOT(loadTimer())); + // menu setup QAction * p_SelectSoundAction = new QAction(tr("Select alert sound"),this); @@ -206,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); //snooze button enabled only when alerting @@ -349,6 +347,8 @@ void KitchenAlertMainWindow::disableSelectionDependentButtons() ui->SnoozeButton->setDisabled(true); ui->RestartButton->setDisabled(true); ui->RemoveButton->setDisabled(true); + ui->SaveButton->setDisabled(true); + } @@ -403,11 +403,11 @@ void KitchenAlertMainWindow::saveTimer() //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); + QString filename = QFileDialog::getSaveFileName(this, "", defaultSaveDirectory_, "*.kitchenalert",NULL,QFileDialog::DontConfirmOverwrite); + - disableSelectionDependentButtons(); - qDebug() << filename; +// qDebug() << filename; if (filename.isEmpty()) //user cancelled the dialog (or gave an empty name) { @@ -420,7 +420,7 @@ void KitchenAlertMainWindow::saveTimer() } - qDebug() << "filename appended to " << filename; + // qDebug() << "filename appended to " << filename; //MANUAL CONFIRMATION OF OWERWRITE @@ -454,7 +454,7 @@ void KitchenAlertMainWindow::saveTimer() void KitchenAlertMainWindow::loadTimer() { - QString filename = QFileDialog::getOpenFileName(this,"","",tr("KitchenAlert timer files (*.kitchenalert)")); + QString filename = QFileDialog::getOpenFileName(this,"",defaultSaveDirectory_,tr("KitchenAlert timer files (*.kitchenalert)")); if (!filename.isEmpty()) { diff --git a/src/kitchenalertmainwindow.h b/src/kitchenalertmainwindow.h index c8b4e44..1ec3974 100644 --- a/src/kitchenalertmainwindow.h +++ b/src/kitchenalertmainwindow.h @@ -40,8 +40,8 @@ namespace Ui { /*! The main window class of KitchenAlert' @author Heli Hyvättinen - @date 2011-04-05 - @version 0.2.1 + @date 2011-04-26 + @version 0.3.0 Operates the UI. @@ -52,8 +52,6 @@ class KitchenAlertMainWindow : public QMainWindow Q_OBJECT - - public: explicit KitchenAlertMainWindow(QWidget *parent = 0); ~KitchenAlertMainWindow(); @@ -152,6 +150,8 @@ private: CurrentAlertsTableModel model_; /*! The model that stores the alerts */ + QString defaultSaveDirectory_; + /*! Returns a QMoldelIndex pointing to the cell in the column 0 of the row that is currently selected. */ diff --git a/src/kitchenalertmainwindow.ui b/src/kitchenalertmainwindow.ui index b8ddeac..44ea136 100644 --- a/src/kitchenalertmainwindow.ui +++ b/src/kitchenalertmainwindow.ui @@ -83,19 +83,6 @@ - - - Qt::Horizontal - - - - 40 - 20 - - - - - New timer @@ -123,19 +110,6 @@ - - - - Qt::Horizontal - - - - 40 - 20 - - - - diff --git a/src/main.cpp b/src/main.cpp index e162590..1e0b10f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,7 +1,7 @@ /************************************************************************** KitchenAlert - Copyright (C) 2010 Heli Hyvättinen + Copyright (C) 2010-11 Heli Hyvättinen This file is part of KitchenAlert. diff --git a/src/selectsounddialog.cpp b/src/selectsounddialog.cpp index b23f961..0a78d3e 100644 --- a/src/selectsounddialog.cpp +++ b/src/selectsounddialog.cpp @@ -26,14 +26,18 @@ #include "selectsounddialog.h" #include "ui_selectsounddialog.h" +#include "alertsound.h" #include #include #include + + SelectSoundDialog::SelectSoundDialog(QWidget *parent) : QDialog(parent), ui(new Ui::SelectSoundDialog) { + ui->setupUi(this); connect(ui->browseButton,SIGNAL(clicked()),this,SLOT(browse())); @@ -50,6 +54,11 @@ SelectSoundDialog::SelectSoundDialog(QWidget *parent) : } else ui->CustomSoundRadioButton->setChecked(true); // qDebug() << "UseDefaultSoundfile is " << useDefaultSoundFile; + + + + isTesting_ = false; + connect(ui->TestButton,SIGNAL(clicked()),this,SLOT(testSound())); } SelectSoundDialog::~SelectSoundDialog() @@ -77,3 +86,33 @@ bool SelectSoundDialog::isDefaultSoundChecked() { return ui->DefaultSoundRadioButton->isChecked(); } + +void SelectSoundDialog::testSound() +{ + if (isTesting_ == false) + { + if (ui->CustomSoundRadioButton->isChecked() == false) + { + player.setMedia(QUrl::fromLocalFile(AlertSound::defaultsound_)); + } + + else + { + player.setMedia(QUrl::fromLocalFile(ui->lineEdit->displayText())); + } + + player.play(); + + ui->TestButton->setText(tr("Stop test")); + + isTesting_ = true; + } + + else + { + player.stop(); + ui->TestButton->setText(tr("Test sound")); + isTesting_ = false; + } + +} diff --git a/src/selectsounddialog.h b/src/selectsounddialog.h index f6b13eb..5ed0842 100644 --- a/src/selectsounddialog.h +++ b/src/selectsounddialog.h @@ -28,6 +28,7 @@ #define SELECTSOUNDDIALOG_H #include +#include namespace Ui { class SelectSoundDialog; @@ -36,8 +37,8 @@ namespace Ui { /*! The class for sound selection dialog of KitchenAlert' @author Heli Hyvättinen - @date 2011-03-29 - @version 0.2.1 + @date 2011-04-27 + @version 0.3.0 The class for sound selection dialog in KitchenAlert. @@ -50,14 +51,22 @@ class SelectSoundDialog : public QDialog public: explicit SelectSoundDialog(QWidget *parent = 0); ~SelectSoundDialog(); + QString getSoundFileName(); + /*! returns the filename for custom sound the user has chosen in the dialog */ + bool isDefaultSoundChecked(); + /*! Returns whether "use default sound" was checked by the user in the dialog */ public slots: void browse(); + void testSound(); private: Ui::SelectSoundDialog *ui; + + QMediaPlayer player; + bool isTesting_; }; #endif // SELECTSOUNDDIALOG_H diff --git a/src/selectsounddialog.ui b/src/selectsounddialog.ui index 0104637..ec64a23 100644 --- a/src/selectsounddialog.ui +++ b/src/selectsounddialog.ui @@ -58,9 +58,9 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> <html><head><meta name="qrichtext" content="1" /><style type="text/css"> p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans Serif'; font-size:16pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:12pt; font-weight:600;">Warning:</span><span style=" font-size:12pt;"> choosing a sound file inside the &quot;N900&quot; folder will prevent mounting it outside the device when KitchenAlert is running and the sound from playing if the folder has been mounted out before starting KitchenAlert.</span></p> -<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:12pt;"></p></body></html> +</style></head><body style=" font-family:'Ubuntu'; font-size:16pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-family:'Sans Serif'; font-size:12pt; font-weight:600;">Warning:</span><span style=" font-family:'Sans Serif'; font-size:12pt;"> choosing a sound file inside the &quot;N900&quot; folder will prevent mounting it outside the device when KitchenAlert is running and the sound from playing if the folder has been mounted out before starting KitchenAlert.</span></p> +<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:12pt;"></p></body></html> @@ -86,6 +86,43 @@ p, li { white-space: pre-wrap; } + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Test sound + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + +