projects
/
kitchenalert
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Bugfixes
[kitchenalert]
/
src
/
alertsound.cpp
diff --git
a/src/alertsound.cpp
b/src/alertsound.cpp
index
8fd54b7
..
b6c1fa3
100644
(file)
--- a/
src/alertsound.cpp
+++ b/
src/alertsound.cpp
@@
-1,7
+1,7
@@
/**************************************************************************
/**************************************************************************
- This file is part of KitchenAlert v.0.09
+ This file is part of KitchenAlert
- Copyright (C) 2010 Heli Hyvättinen
+ Copyright (C) 2010-2011 Heli Hyvättinen
Kitchen Alert is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
Kitchen Alert is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@
-27,15
+27,16
@@
#include <QDebug>
#include <QSettings>
#include <QDebug>
#include <QSettings>
+// Initialize static const
+ const QString AlertSound::defaultsound_ = "/home/opt/KitchenAlert/DoorbellModifiedFinal.mp3";
+
AlertSound::AlertSound(QObject *parent) :
QObject(parent)
{
AlertSound::AlertSound(QObject *parent) :
QObject(parent)
{
- //THIS NEEDS TESTING: DOES IT REALLY CHANGE TUNE WHEN RESTARTING THE APPLICATION?
- defaultsound_ = "/home/opt/KitchenAlert/Doorbell-old-tring-modified-multiplied-low-quality.mp3";
QString filename;
QSettings settings("KitchenAlert","KitchenAlert");
QString filename;
QSettings settings("KitchenAlert","KitchenAlert");
@@
-43,7
+44,7
@@
AlertSound::AlertSound(QObject *parent) :
// settings.clear(); //REMOVE THIS AFTER TESTING!!!!!!
bool useDefaultSound = settings.value("UseDefaultSound",true).toBool();
// settings.clear(); //REMOVE THIS AFTER TESTING!!!!!!
bool useDefaultSound = settings.value("UseDefaultSound",true).toBool();
- qDebug() << "In AlertSound constructor UseDefaultSound is " << useDefaultSound;
+// qDebug() << "In AlertSound constructor UseDefaultSound is " << useDefaultSound;
if (useDefaultSound == true)
{
filename = defaultsound_;
if (useDefaultSound == true)
{
filename = defaultsound_;
@@
-52,7
+53,11
@@
AlertSound::AlertSound(QObject *parent) :
{
filename = settings.value("soundfile",defaultsound_).toString();
}
{
filename = settings.value("soundfile",defaultsound_).toString();
}
- pSound_ = Phonon::createPlayer(Phonon::MusicCategory, Phonon::MediaSource(filename));
+
+
+
+ pSound_ = new QMediaPlayer;
+ pSound_->setMedia(QUrl::fromLocalFile(filename));
}
AlertSound::~AlertSound()
}
AlertSound::~AlertSound()
@@
-66,30
+71,28
@@
AlertSound::~AlertSound()
void AlertSound::play()
{
void AlertSound::play()
{
- pSound_->stop(); //Just testing if stopping the previous alert will prevent the jammming of the sound
- pSound_->play();
- qDebug() << "Sound should be played now";
+ pSound_->play();
+ // qDebug() << "Sound should be played now";
}
void AlertSound::stop()
{
pSound_->stop();
}
void AlertSound::stop()
{
pSound_->stop();
+// qDebug() << pSound_->state();
+// qDebug() << "Sound stopped by AlertSound.";
}
void AlertSound::setSound(QString filename)
{
}
void AlertSound::setSound(QString filename)
{
- QSettings settings("KitchenAlert","KitchenAlert");
- settings.setValue("UseDefaultSound",false);
- settings.setValue("soundfile",filename);
- pSound_->setCurrentSource(filename);
+
+ pSound_->setMedia(QUrl::fromLocalFile(filename));
}
void AlertSound::setDefaultSound()
{
}
void AlertSound::setDefaultSound()
{
- QSettings settings ("KitchenAlert","KitchenAlert");
- settings.setValue("UseDefaultSound",true);
- pSound_->setCurrentSource(defaultsound_);
+
+ pSound_->setMedia(QUrl::fromLocalFile(defaultsound_));
}
}