--- infoscreen/MainView.cpp 2010/01/06 23:13:21 529 +++ infoscreen/MainView.cpp 2010/01/07 19:31:07 533 @@ -5,6 +5,7 @@ #include #include +#include #include "MyWebView.h" #include "clientsiderender.h" @@ -19,6 +20,7 @@ { this->resize(400,400); this->setWindowState( Qt::WindowFullScreen ); + this->grabKeyboard(); qApp->setOverrideCursor( QCursor( Qt::BlankCursor) ); @@ -51,6 +53,13 @@ } +void MainView::keyPressEvent ( QKeyEvent* event ) +{ + int key = event->key(); + if (key == ' ' || key == Qt::Key_Return || key == Qt::Key_Enter) { + qApp->quit(); + } +} void MainView::onTimer() { @@ -95,14 +104,15 @@ bool found = false; int tries = 0; - - while (found == false && tries <= screenItems.size()) { //find next with valid display time - tries++; - currentItemIdx = (currentItemIdx+1) % screenItems.size(); - currentItem = screenItems.at(currentItemIdx); - - if (currentItem.start <= now && now <= currentItem.stop ) - found = true; + if (screenItems.size() > 0) { //only try if we have a any screens + while (found == false && tries <= screenItems.size()) { //find next with valid display time + tries++; + currentItemIdx = (currentItemIdx+1) % screenItems.size(); + currentItem = screenItems.at(currentItemIdx); + + if (currentItem.start <= now && now <= currentItem.stop ) + found = true; + } } if (found) {