Commit 27da388c authored by Ömer Fadıl Usta's avatar Ömer Fadıl Usta 😊 Committed by Aleix Pol Gonzalez
Browse files

Fix PlaySound with correct QUrl

It was missing to use fromLocalFile

BUG: 452591


(cherry picked from commit da84914b)
parent 038ccc8e
Pipeline #166454 passed with stage
in 3 minutes and 45 seconds
......@@ -74,16 +74,18 @@ void FindThisDeviceConfig::save()
void FindThisDeviceConfig::playSound()
{
const QString soundFile = m_ui->soundFileRequester->text();
QUrl soundURL = QUrl(soundFile);
QMediaPlayer* player = new QMediaPlayer;
player->setAudioRole(QAudio::Role(QAudio::NotificationRole));
player->setMedia(soundURL);
player->setVolume(100);
player->play();
connect(player, &QMediaPlayer::stateChanged, player, &QObject::deleteLater);
const QUrl soundURL = m_ui->soundFileRequester->url();
if (soundURL.isEmpty()) {
qCWarning(KDECONNECT_PLUGIN_FINDTHISDEVICE) << "Not playing sound, no valid ring tone specified.";
} else {
QMediaPlayer* player = new QMediaPlayer;
player->setAudioRole(QAudio::Role(QAudio::NotificationRole));
player->setMedia(soundURL);
player->setVolume(100);
player->play();
connect(player, &QMediaPlayer::stateChanged, player, &QObject::deleteLater);
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment