X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2Fselectsounddialog.cpp;h=0a78d3e430d12a12b589a5fa24f9e11190298115;hb=e3d78d642357c3cbd65564b4784088d548b1ba6a;hp=539796e5b64de34661579d03a764a26acb36efb3;hpb=55e83dd6677893a7d2ed9de67c675fd9b45a68bc;p=kitchenalert diff --git a/src/selectsounddialog.cpp b/src/selectsounddialog.cpp index 539796e..0a78d3e 100644 --- a/src/selectsounddialog.cpp +++ b/src/selectsounddialog.cpp @@ -1,7 +1,7 @@ /************************************************************************** KitchenAlert - Copyright (C) 2010 Heli Hyvättinen + Copyright (C) 2010-2011 Heli Hyvättinen This file is part of KitchenAlert. @@ -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())); @@ -49,7 +53,12 @@ SelectSoundDialog::SelectSoundDialog(QWidget *parent) : ui->lineEdit->setDisabled(true); } else ui->CustomSoundRadioButton->setChecked(true); - qDebug() << "UseDefaultSoundfile is " << useDefaultSoundFile; +// 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; + } + +}