PDA

View Full Version : couldnt create slave



prophet0
19th December 2011, 18:50
im doing a simple application that plays a video from an sql database from my computer..

HEADER



#include <QMainWindow>
#include <QtCore>
#include <QtGui>

#include <phonon/MediaObject>
#include <phonon/AudioOutput>
#include <phonon/VideoWidget>

#include <QtSql>

namespace Ui {
class SQLtest;
}

class SQLtest : public QMainWindow
{
Q_OBJECT

public:
explicit SQLtest(QWidget *parent = 0);
QSqlDatabase *db;
~SQLtest();

public slots:
void _DoParse();

private:
Ui::SQLtest *ui;
Phonon::MediaObject *mediaObject;
Phonon::AudioOutput *aio_audioOutput;
Phonon::VideoWidget *wid_videowidget;
};

#endif // SQLTEST_H



CPP FILE



#include "sqltest.h"
#include "ui_sqltest.h"

SQLtest::SQLtest(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::SQLtest)
{
ui->setupUi(this);

QSqlDatabase db = QSqlDatabase::addDatabase("QMYSQL", "maindb");
db.setHostName("localhost");
db.setDatabaseName("data");
db.setUserName("root");
db.setPassword("MYPASS");

QTimer::singleShot(0, this, SLOT(_DoParse()));


mediaObject = new Phonon::MediaObject(this);
metaInformationResolver = new Phonon::MediaObject(this);
wid_videowidget = new Phonon::VideoWidget(this);
aio_audioOutput = new Phonon::AudioOutput(Phonon::VideoCategory, this);

// Make our Connections
Phonon::createPath(mediaObject, wid_videowidget); // to link the mediaobject withvideo widget
Phonon::createPath(mediaObject, aio_audioOutput); // to link the mediaobject with audo output
// Add our display settings
wid_videowidget->setGeometry(0, 0, 760, 360);
wid_videowidget->setAspectRatio(Phonon::VideoWidget::AspectRatioWid get);
wid_videowidget->setScaleMode(Phonon::VideoWidget::FitInView);
aio_audioOutput->setVolume(50);

}

void SQLtest::_DoParse()
{
QSqlDatabase db = QSqlDatabase::database("maindb");
QSqlQuery query(db);

if(db.open()){

query.exec("SELECT `Movie` FROM `strings` WHERE Movie IS NOT NULL LIMIT 0 , 30");

while (query.next()){
QString movie = query.value(0).toString();

QString vidpath = QApplication::applicationDirPath();
vidpath = "/home/dev/ttm/moives/" + movie;
mediaObject->enqueue(Phonon::MediaSource(vidpath));

mediaObject->play();

// QMessageBox::critical(this,
// "String for Movie",
// movie,
// QMessageBox::Ok);

}


}else if(!db.open()){
QMessageBox::critical(this,
"DB NOT OPEN",
"NOT Open",
QMessageBox::Ok);
}
}

SQLtest::~SQLtest()
{
delete ui;
}




error i get when first file is done playing



SQLtest(15297): couldn't create slave: "Unable to create io-slave:
klauncher said: Unknown protocol ''.
"