Exemplo n.º 1
0
Player::Player(QWidget *parent) :Html5ApplicationViewer(parent) {
    QObject::connect(webView()->page()->mainFrame(),
            SIGNAL(javaScriptWindowObjectCleared()), SLOT(addToJavaScript()));
    api.sync();
    playStatus = false;
    if (HIWORD(BASS_GetVersion())!=BASSVERSION) {
            return;
    }

    if (!BASS_Init(-1,44100,0,NULL,NULL)) {
            return;
    }
    BASS_SetConfig(BASS_CONFIG_NET_PLAYLIST,1); // enable playlist processing
    BASS_SetConfig(BASS_CONFIG_NET_PREBUF,0); // minimize automatic pre-buffering, so we can do it (and display it) instead
    playList.insert("1", "http://mp3.polskieradio.pl:8900/;stream");
    playList.insert("2", "http://stream3.polskieradio.pl:8902/;stream");
    playList.insert("3", "http://stream3.polskieradio.pl:8904/;stream");
    playList.insert("4", "http://mp3.polskieradio.pl:8906/;stream");
    playList.insert("antyradio", "http://ant-waw.cdn.eurozet.pl:8602/;stream");
    acr.loadSettings();
    QObject::connect(&acr, SIGNAL(songFound(QJsonObject)),
                     this, SLOT(songFound(QJsonObject)));
    QObject::connect(&api, SIGNAL(updateReady(QList<Radiostation>)),
                     this, SLOT(songFound(QList<Radiostation>)));
}
Exemplo n.º 2
0
MyWebView::MyWebView(QDeclarativeItem *parent) :
    QDeclarativeItem(parent)
{
    // Important, otherwise the paint method is never called
    setFlag(QGraphicsItem::ItemHasNoContents, true);
    webView_ = new QGraphicsWebView (this);
    webView_->setAcceptTouchEvents(true);
    webView_->setAcceptHoverEvents(false);

    MyWebPage* page = new MyWebPage(webView_);
    webView_->setPage( page );
    connect(webView_->page()->mainFrame(),
            SIGNAL(javaScriptWindowObjectCleared()), SLOT(addToJavaScript()));

//    webView_->setPreferredWidth();
//    webView_->load(QLatin1String("html/index.html"));

}