--- infoscreen/MainView.cpp 2010/01/08 09:20:37 535 +++ infoscreen/MainView.cpp 2010/01/08 21:53:23 537 @@ -18,7 +18,7 @@ MainView::MainView(QWidget* parent) - : QWidget(parent) + : QWidget(parent), timer(0) { settings = new QSettings("Caddi", "infoscreen"); @@ -69,7 +69,7 @@ qDebug() << "Starting XML mode"; qDebug() << "xmlUrl" << xmlUrl; - QTimer* timer = new QTimer(this); + timer = new QTimer(this); connect(timer, SIGNAL(timeout() ), this, SLOT(onTimer() )); timer->start(100); } else { @@ -77,15 +77,19 @@ web->setVisible(true); web->start(url,screenid); } +} - +void MainView::closeEvent ( QCloseEvent * event ) +{ + Q_UNUSED(event); + exit(0); //force application shutdown } void MainView::keyPressEvent ( QKeyEvent* event ) { int key = event->key(); if (key == ' ' || key == Qt::Key_Return || key == Qt::Key_Enter) { - qApp->quit(); + close(); } } @@ -105,7 +109,8 @@ if ( lastXml.isNull() || lastXml.elapsed() > TIMEOUT) { - xmlHandler.readXml( xmlUrl ); + bool res = xmlHandler.readXml( xmlUrl ); + if (res == false) lastXml = QTime::currentTime(); @@ -123,6 +128,9 @@ void MainView::switchScreens() { + if (video->isVisible() && video->isPlaying() ) { + return; //wait until current clip has finished + } if (lastScreenSwitch.isNull() || lastScreenSwitch.elapsed() > (currentItem.runtime*1000)) { @@ -152,17 +160,34 @@ picture->loadFromUrl( currentItem.url ); } + if (currentItem.module == "info_web") { + ensureVisible(web); + web->load(currentItem.url); + } + if (currentItem.module == "info_video") { + ensureVisible(video); + video->loadUrl(currentItem.url); + } } else { qDebug() << "no screen"; - hideAll(); + noInfoScreen(); } lastScreenSwitch = QTime::currentTime(); } } +void MainView::noInfoScreen() +{ + ensureVisible(web); + web->setHtml("\ + \ +

Der er ingen information at vise

\ + "); +} + void MainView::ensureVisible(QWidget* widget) { if (! widget->isVisible()) {