diff --git a/plugins/skproto.cpp b/plugins/skproto.cpp index 638e529822cc4dead093daac68c584f713e81c09..9de5c26bfcb9fe2fc0c8166f29a5563e1abd1aa5 100644 --- a/plugins/skproto.cpp +++ b/plugins/skproto.cpp @@ -206,6 +206,23 @@ void SkyliveProtocol::processPackets() } } } + else if(pkt.cmd=="OPENYOUTUBE") + { + QList<QString> paramlist = pkt.params.split(PARAM_SEPARATOR); + if(paramlist.size()==3) + { + //SKMessage mmsg("youtubevideo"); + //QString yt("http://youtube.googleapis.com/v/"); + SKMessage mmsg("openurl"); + QString yt("http://www.youtube.com/embed/"); + yt.append(paramlist[0]); + yt.append("?html5=1&autoplay=1&start="); + yt.append(paramlist[1]); + mmsg.parameters.insert("url", yt); + //mmsg.parameters.insert("volume", paramlist[2]); + sendMessage(mmsg); + } + } else { std::cout << "Unknown command from server" <<std::endl; diff --git a/src/mainwin.cpp b/src/mainwin.cpp index 494917f2fc57ce47e2e6869b2e4f3d8cf8c54019..6895cb785486253e494545fa67d8ea4a73e7e397 100644 --- a/src/mainwin.cpp +++ b/src/mainwin.cpp @@ -57,6 +57,7 @@ MainWin::MainWin(QString &htmlfile) registerHandler((QString)"loginok", (SKHandlerFunction)&MainWin::handle_loginres); registerHandler((QString)"loginfailed", (SKHandlerFunction)&MainWin::handle_loginres); + registerHandler((QString)"openurl", (SKHandlerFunction)&MainWin::handle_openurl); msgsender = SENDER; @@ -106,3 +107,24 @@ void MainWin::handle_loginres(SKMessage &msg) } } +void MainWin::handle_openurl(SKMessage &msg) +{ + if(msg.handle=="openurl") + { + if(msg.parameters.contains("url")) + { + std::cout << "OPEN URL " << msg.parameters["url"].toStdString() << std::endl; + //if(msg.parameters.contains("width") + //if(msg.parameters.contains("height); + WebWin *wv = new WebWin; + QWebPage *newWeb = new QWebPage(wv); + + wv->setPage(newWeb); + wv->setAttribute(Qt::WA_DeleteOnClose, true); + + wv->setUrl(QUrl(msg.parameters["url"])); + wv->show(); + + } + } +} diff --git a/src/mainwin.h b/src/mainwin.h index 0e68489114f9daca74d99ecd039cd4e69d54f955..23a3057ae3681820ecc9e97c7bfac6b0e284f0f2 100644 --- a/src/mainwin.h +++ b/src/mainwin.h @@ -62,6 +62,7 @@ class MainWin : public SkylivexWin void handle_connected(SKMessage &msg); void handle_asklogin(SKMessage &msg); void handle_loginres(SKMessage &msg); + void handle_openurl(SKMessage &msg); }; diff --git a/src/webwin.cpp b/src/webwin.cpp index 06e84e0876977db43f6e2601ac464fe85d7ad402..950bd505d01268c9328ecdfbe72b3cb1e33bf622 100644 --- a/src/webwin.cpp +++ b/src/webwin.cpp @@ -241,7 +241,6 @@ SkylivexWin::SkylivexWin() registerHandler((QString)"notify", (SKHandlerFunction)&SkylivexWin::handle_notify); registerHandler((QString)"publicchatrcv", (SKHandlerFunction)&SkylivexWin::handle_chatreceived); - } SkylivexWin* SkylivexWin::createSkyliveWindow(QString url, QWebPage::WebWindowType type)