{
this->starter = starter;
core.mediaObject()->setTickInterval(1000);
sources.clear();
connect(core.mediaObject(), SIGNAL(stateChanged(Phonon::State, Phonon::State)),
this, SLOT(stateChanged(Phonon::State, Phonon::State)));
QStringList list
= QFileDialog::getOpenFileNames(0,
"Phonon Test",
".",tr
("audios (*.mp3 *.wma *.ogg *.wave *.midi)"));
for (int i = 0; i < list.size(); i++){
Phonon::MediaSource source(list.at(i));
sources.insert(i,source);
}
core.mediaObject()->setCurrentSource(sources.at(0));
core.play();
}
void Tester::stateChanged(Phonon::State newstate, Phonon::State oldstate)
{
if (newstate == Phonon::ErrorState) {
core.mediaObject()->errorString(),
if (core.mediaObject()->errorType() == Phonon::FatalError) {
starter->exit();
} else {
core.mediaObject()->stop();
}
}
}
Tester::Tester(QApplication *starter = 0)
{
this->starter = starter;
core.mediaObject()->setTickInterval(1000);
sources.clear();
connect(core.mediaObject(), SIGNAL(stateChanged(Phonon::State, Phonon::State)),
this, SLOT(stateChanged(Phonon::State, Phonon::State)));
QStringList list = QFileDialog::getOpenFileNames(0,"Phonon Test",".",tr("audios (*.mp3 *.wma *.ogg *.wave *.midi)"));
for (int i = 0; i < list.size(); i++){
Phonon::MediaSource source(list.at(i));
sources.insert(i,source);
}
core.mediaObject()->setCurrentSource(sources.at(0));
core.play();
}
void Tester::stateChanged(Phonon::State newstate, Phonon::State oldstate)
{
if (newstate == Phonon::ErrorState) {
QMessageBox::warning(0, "Phonon Mediaplayer",
core.mediaObject()->errorString(),
QMessageBox::Close);
if (core.mediaObject()->errorType() == Phonon::FatalError) {
starter->exit();
} else {
core.mediaObject()->stop();
}
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks