--- infoscreen/MainView.cpp 2010/01/07 19:42:12 534 +++ infoscreen/MainView.cpp 2010/01/08 09:20:37 535 @@ -6,6 +6,8 @@ #include #include +#include +#include #include "MyWebView.h" #include "clientsiderender.h" @@ -18,6 +20,20 @@ MainView::MainView(QWidget* parent) : QWidget(parent) { + + settings = new QSettings("Caddi", "infoscreen"); + url = settings->value("url").toString(); + bool xmlMode = settings->value("xml").toBool(); + screenid = settings->value("screenid").toString(); + + if (url == "" || screenid == "") { + QMessageBox::warning(this,"infoscreen","Could not find url or screenid in config file " + settings->fileName()); + + exit(1); //Normal qApp->exit() doesn't terminate the init sequence so use std C exit function + } + + + this->resize(400,400); this->setWindowState( Qt::WindowFullScreen ); this->grabKeyboard(); @@ -47,9 +63,21 @@ - QTimer* timer = new QTimer(this); - connect(timer, SIGNAL(timeout() ), this, SLOT(onTimer() )); - timer->start(100); + + if (xmlMode == true) { + xmlUrl = url + "?screen_id=" + screenid; + qDebug() << "Starting XML mode"; + qDebug() << "xmlUrl" << xmlUrl; + + QTimer* timer = new QTimer(this); + connect(timer, SIGNAL(timeout() ), this, SLOT(onTimer() )); + timer->start(100); + } else { + qDebug() << "Starting plain browser mode"; + web->setVisible(true); + web->start(url,screenid); + } + } @@ -76,7 +104,8 @@ const int TIMEOUT = 30*60*1000; // 30 minutter if ( lastXml.isNull() || lastXml.elapsed() > TIMEOUT) { - xmlHandler.readXml( "http://infoscreen.sundhedhorsens.dk/infoscreen/screen_xml.php?screen_id=1" ); + + xmlHandler.readXml( xmlUrl ); lastXml = QTime::currentTime();