Managed IMAGE command from server

parent a088835d
...@@ -236,6 +236,20 @@ void SkyliveProtocol::processPackets() ...@@ -236,6 +236,20 @@ void SkyliveProtocol::processPackets()
QList<QString> paramlist = pkt.params.split(PARAM_SEPARATOR); QList<QString> paramlist = pkt.params.split(PARAM_SEPARATOR);
mmsg.parameters.insert("when", paramlist[0]); mmsg.parameters.insert("when", paramlist[0]);
sendMessage(mmsg); sendMessage(mmsg);
}
else if(pkt.cmd=="IMAGE")
{
QList<QString> paramlist = pkt.params.split(PARAM_SEPARATOR);
if(paramlist.size()==3)
{
SKMessage mmsg("openurl");
mmsg.parameters.insert("url", QByteArray::fromPercentEncoding(paramlist[0].toLocal8Bit()));
mmsg.parameters.insert("width", paramlist[1]);
mmsg.parameters.insert("height", paramlist[2]);
sendMessage(mmsg);
}
} }
else else
{ {
......
...@@ -158,13 +158,17 @@ void MainWin::handle_openurl(SKMessage &msg) ...@@ -158,13 +158,17 @@ void MainWin::handle_openurl(SKMessage &msg)
if(msg.parameters.contains("url")) if(msg.parameters.contains("url"))
{ {
std::cout << "OPEN URL " << msg.parameters["url"].toStdString() << std::endl; std::cout << "OPEN URL " << msg.parameters["url"].toStdString() << std::endl;
//if(msg.parameters.contains("width")
//if(msg.parameters.contains("height);
WebWin *wv = new WebWin; WebWin *wv = new WebWin;
QWebPage *newWeb = new QWebPage(wv); QWebPage *newWeb = new QWebPage(wv);
wv->setPage(newWeb); wv->setPage(newWeb);
wv->setAttribute(Qt::WA_DeleteOnClose, true); wv->setAttribute(Qt::WA_DeleteOnClose, true);
if(msg.parameters.contains("width") && msg.parameters.contains("height"))
wv->resize(msg.parameters["width"].toInt(), msg.parameters["height"].toInt());
else if(msg.parameters.contains("width"))
wv->resize(msg.parameters["width"].toInt(), wv->height());
else if(msg.parameters.contains("height"))
wv->resize(wv->width(), msg.parameters["height"].toInt());
wv->setUrl(QUrl(msg.parameters["url"])); wv->setUrl(QUrl(msg.parameters["url"]));
wv->show(); wv->show();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment