void FreeSound::slotUpdateCurrentSound()
{
+ if (!sound_autoplay->isChecked()) slotPlaySound(false);
m_currentPreview.clear();
m_currentUrl.clear();
QListWidgetItem *item = search_results->currentItem();
}
m_currentPreview = item->data(previewRole).toString();
m_currentUrl = item->data(downloadRole).toString();
+ if (sound_autoplay->isChecked()) slotPlaySound(true);
button_preview->setEnabled(!m_currentPreview.isEmpty());
sound_box->setEnabled(true);
sound_name->setText(item->text());
}
-void FreeSound::slotPlaySound()
+void FreeSound::slotPlaySound(bool play)
{
if (m_currentPreview.isEmpty()) return;
- if (m_previewProcess && m_previewProcess->state() != QProcess::NotRunning) {
+ if (!play || (m_previewProcess && m_previewProcess->state() != QProcess::NotRunning)) {
m_previewProcess->close();
- return;
+ if (!play) return;
}
m_previewProcess->start("ffplay", QStringList() << m_currentPreview << "-nodisp");
}