Fix PlaySound with correct QUrl
It was missing to use fromLocalFile BUG: 452591
This commit is contained in:
parent
2dc5d53ec4
commit
da84914b7d
1 changed files with 11 additions and 9 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue