matio
22nd November 2009, 14:24
I'm trying to make a media player, the main problem at the moment is that when the user presses the next button it skipps two tracks instead of one. I think this is to do with the signals so I added blockSignals(true), but it still doesn't work:
void MainWindow::nextFile()
{
int index = sources.indexOf(mediaObject->currentSource()) + 1;
if (sources.size() > index) {
mediaObject->stop();
mediaObject->clearQueue();
mediaObject->blockSignals(true);
index = sources.indexOf(mediaObject->currentSource()) + 1;
mediaObject->setCurrentSource(sources.at(index));
mediaObject->blockSignals(false);
mediaObject->play();
setLabelNowPlaying();
}
}
?
void MainWindow::nextFile()
{
int index = sources.indexOf(mediaObject->currentSource()) + 1;
if (sources.size() > index) {
mediaObject->stop();
mediaObject->clearQueue();
mediaObject->blockSignals(true);
index = sources.indexOf(mediaObject->currentSource()) + 1;
mediaObject->setCurrentSource(sources.at(index));
mediaObject->blockSignals(false);
mediaObject->play();
setLabelNowPlaying();
}
}
?