Managed IMAGE command from server

parent a088835d
......@@ -236,6 +236,20 @@ void SkyliveProtocol::processPackets()
QList<QString> paramlist = pkt.params.split(PARAM_SEPARATOR);
mmsg.parameters.insert("when", paramlist[0]);
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
{
......
......@@ -157,14 +157,18 @@ void MainWin::handle_openurl(SKMessage &msg)
{
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);
std::cout << "OPEN URL " << msg.parameters["url"].toStdString() << std::endl;
WebWin *wv = new WebWin;
QWebPage *newWeb = new QWebPage(wv);
wv->setPage(newWeb);
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->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