StelAudioMgr.cpp   StelAudioMgr.cpp 
skipping to change at line 58 skipping to change at line 58
QMediaPlayer* sound = new QMediaPlayer(); QMediaPlayer* sound = new QMediaPlayer();
QString path = QFileInfo(filename).absoluteFilePath(); QString path = QFileInfo(filename).absoluteFilePath();
sound->setMedia(QMediaContent(QUrl::fromLocalFile(path))); sound->setMedia(QMediaContent(QUrl::fromLocalFile(path)));
audioObjects[id] = sound; audioObjects[id] = sound;
} }
void StelAudioMgr::playSound(const QString& id) void StelAudioMgr::playSound(const QString& id)
{ {
if (audioObjects.contains(id)) if (audioObjects.contains(id))
{ {
if (audioObjects[id]!=NULL) if (audioObjects[id]!=Q_NULLPTR)
{ {
// if already playing, stop and play from the start // if already playing, stop and play from the start
if (audioObjects[id]->state()==QMediaPlayer::Playing State) if (audioObjects[id]->state()==QMediaPlayer::Playing State)
audioObjects[id]->stop(); audioObjects[id]->stop();
// otherwise just play it // otherwise just play it
audioObjects[id]->play(); audioObjects[id]->play();
} }
else else
qDebug() << "StelAudioMgr: Cannot play sound, " << i d << "not correctly loaded."; qDebug() << "StelAudioMgr: Cannot play sound, " << i d << "not correctly loaded.";
} }
else else
qDebug() << "StelAudioMgr: Cannot play sound, " << id << "no t loaded."; qDebug() << "StelAudioMgr: Cannot play sound, " << id << "no t loaded.";
} }
void StelAudioMgr::pauseSound(const QString& id) void StelAudioMgr::pauseSound(const QString& id)
{ {
if (audioObjects.contains(id)) if (audioObjects.contains(id))
{ {
if (audioObjects[id]!=NULL) if (audioObjects[id]!=Q_NULLPTR)
audioObjects[id]->pause(); audioObjects[id]->pause();
else else
qDebug() << "StelAudioMgr: Cannot pause sound, " << id << "not correctly loaded."; qDebug() << "StelAudioMgr: Cannot pause sound, " << id << "not correctly loaded.";
} }
else else
qDebug() << "StelAudioMgr: Cannot pause sound, " << id << "n ot loaded."; qDebug() << "StelAudioMgr: Cannot pause sound, " << id << "n ot loaded.";
} }
void StelAudioMgr::stopSound(const QString& id) void StelAudioMgr::stopSound(const QString& id)
{ {
if (audioObjects.contains(id)) if (audioObjects.contains(id))
{ {
if (audioObjects[id]!=NULL) if (audioObjects[id]!=Q_NULLPTR)
audioObjects[id]->stop(); audioObjects[id]->stop();
else else
qDebug() << "StelAudioMgr: Cannot stop sound, " << i d << "not correctly loaded."; qDebug() << "StelAudioMgr: Cannot stop sound, " << i d << "not correctly loaded.";
} }
else else
qDebug() << "StelAudioMgr: Cannot stop sound, " << id << "no t loaded."; qDebug() << "StelAudioMgr: Cannot stop sound, " << id << "no t loaded.";
} }
void StelAudioMgr::dropSound(const QString& id) void StelAudioMgr::dropSound(const QString& id)
{ {
if (!audioObjects.contains(id)) if (!audioObjects.contains(id))
{ {
qDebug() << "StelAudioMgr: Cannot drop sound, " << id << "no t loaded."; qDebug() << "StelAudioMgr: Cannot drop sound, " << id << "no t loaded.";
return; return;
} }
if (audioObjects[id]!=NULL) if (audioObjects[id]!=Q_NULLPTR)
{ {
audioObjects[id]->stop(); audioObjects[id]->stop();
delete audioObjects[id]; delete audioObjects[id];
audioObjects.remove(id); audioObjects.remove(id);
} }
} }
qint64 StelAudioMgr::position(const QString& id) qint64 StelAudioMgr::position(const QString& id)
{ {
if (!audioObjects.contains(id)) if (!audioObjects.contains(id))
{ {
qDebug() << "StelAudioMgr: Cannot report position for sound, " << id << "not loaded."; qDebug() << "StelAudioMgr: Cannot report position for sound, " << id << "not loaded.";
return(-1); return(-1);
} }
if (audioObjects[id]!=NULL) if (audioObjects[id]!=Q_NULLPTR)
{ {
return audioObjects[id]->position(); return audioObjects[id]->position();
} }
return (-1); return (-1);
} }
qint64 StelAudioMgr::duration(const QString& id) qint64 StelAudioMgr::duration(const QString& id)
{ {
if (!audioObjects.contains(id)) if (!audioObjects.contains(id))
{ {
qDebug() << "StelAudioMgr: Cannot report duration for sound, " << id << "not loaded."; qDebug() << "StelAudioMgr: Cannot report duration for sound, " << id << "not loaded.";
return(-1); return(-1);
} }
if (audioObjects[id]!=NULL) if (audioObjects[id]!=Q_NULLPTR)
{ {
return audioObjects[id]->duration(); return audioObjects[id]->duration();
} }
return (-1); return (-1);
} }
#else #else
void StelAudioMgr::loadSound(const QString& filename, const QString& id) void StelAudioMgr::loadSound(const QString& filename, const QString& id)
{ {
qWarning() << "This build of Stellarium does not support sound - can not load audio" << QDir::toNativeSeparators(filename) << id; qWarning() << "This build of Stellarium does not support sound - can not load audio" << QDir::toNativeSeparators(filename) << id;
 End of changes. 6 change blocks. 
6 lines changed or deleted 6 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/