/[projects]/infoscreen/mainview.cpp
ViewVC logotype

Diff of /infoscreen/mainview.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 884 by torben, Thu Jun 24 09:44:57 2010 UTC revision 1210 by torben, Mon Jan 3 20:56:54 2011 UTC
# Line 1  Line 1 
1  #include "MainView.h"  #include "mainview.h"
2  #include <QApplication>  #include <QApplication>
3  #include <QPushButton>  #include <QPushButton>
4  #include <QLabel>  #include <QLabel>
# Line 43  MainView::MainView(QWidget* parent) Line 43  MainView::MainView(QWidget* parent)
43          readLocalFiles();          readLocalFiles();
44      }      }
45    
46      this->resize(400,400);      this->resize(640,480);
47      this->setWindowState( Qt::WindowFullScreen );      this->setWindowState( Qt::WindowFullScreen );
48      this->grabKeyboard();      this->grabKeyboard();
49    
# Line 68  MainView::MainView(QWidget* parent) Line 68  MainView::MainView(QWidget* parent)
68      layout->setContentsMargins(0,0,0,0);      layout->setContentsMargins(0,0,0,0);
69      setLayout(layout);      setLayout(layout);
70    
71      clockOverlay = new ClockOverlay(this);      if (showClock == true) {
72      clockOverlay->move(10,10);          clockOverlay = new ClockOverlay(this);
73      clockOverlay->resize(100,50);          clockOverlay->move(10,10);
74            clockOverlay->resize(150,75);
75        }
76    
77            
78    
# Line 117  void MainView::loadSettings() Line 119  void MainView::loadSettings()
119          screenManagerOff = settings->value("screenmanager_off").toTime();          screenManagerOff = settings->value("screenmanager_off").toTime();
120      }      }
121    
122        showClock = settings->value("showclock").toBool();
123    
124      xmlInterval = settings->value("xmlinterval", 30).toInt();      xmlInterval = settings->value("xmlinterval", 30).toInt();
125      xmlInterval = (xmlInterval * 60 * 1000); //convert to milliseconds      xmlInterval = (xmlInterval * 60 * 1000); //convert to milliseconds
126    
# Line 153  void MainView::keyPressEvent ( QKeyEvent Line 157  void MainView::keyPressEvent ( QKeyEvent
157      if (key == ' ' || key == Qt::Key_Return || key == Qt::Key_Enter) {      if (key == ' ' || key == Qt::Key_Return || key == Qt::Key_Enter) {
158          close();          close();
159      }      }
160    
161        if (key == 'f' || key == 'F') {
162            Qt::WindowStates current = this->windowState();
163            if (current == Qt::WindowFullScreen) {
164                this->setWindowState(Qt::WindowActive);
165            } else {
166                this->setWindowState(Qt::WindowFullScreen);
167            }
168        }
169    
170  }    }  
171    
172  void MainView::onTimer()  void MainView::onTimer()
# Line 168  void MainView::onTimer() Line 182  void MainView::onTimer()
182      if (currentMode == ModeXml || currentMode == ModeLocal) {      if (currentMode == ModeXml || currentMode == ModeLocal) {
183          switchScreens();          switchScreens();
184      }      }
185      clockOverlay->timerTick();      if (showClock == true) {
186            clockOverlay->timerTick();
187        }
188  }  }
189    
190    
# Line 249  void MainView::switchScreens() Line 265  void MainView::switchScreens()
265      }      }
266    
267      if (lastScreenSwitch.isNull() || lastScreenSwitch.elapsed() > (currentItem.runtime*1000)) {      if (lastScreenSwitch.isNull() || lastScreenSwitch.elapsed() > (currentItem.runtime*1000)) {
   
268          QTime now = QTime::currentTime();          QTime now = QTime::currentTime();
269          if (lastScreenSwitch.isNull())          if (lastScreenSwitch.isNull())
270              currentItemIdx = -1;              currentItemIdx = -1;
# Line 297  void MainView::switchScreens() Line 312  void MainView::switchScreens()
312    
313          } else {          } else {
314              errorInfoScreen("Der er ingen information at vise");              errorInfoScreen("Der er ingen information at vise");
315                currentItem = ScreenItem();
316                currentItem.runtime = 60; //switch screens again in 1 minute
317          }          }
318          lastScreenSwitch = QTime::currentTime();          lastScreenSwitch = QTime::currentTime();
319    
# Line 305  void MainView::switchScreens() Line 322  void MainView::switchScreens()
322    
323  void MainView::errorInfoScreen(QString msg)  void MainView::errorInfoScreen(QString msg)
324  {  {
325          ensureVisible(web);      ensureVisible(web);
326          web->setHtml("<html>\      QString html("<html><body text='#505050' bgcolor='#000000'>");
327                  <body text='#505050' bgcolor='#000000'>\      html.append("<table width='100%' height='100%'><tr><td align='center' valign='middel'><h1>")
328          <table width='100%' height='100%'><tr><td align='center' valign='middel'><h1>" + msg+ "</h1></td></tr></table>\          .append(msg)
329                  </body></html>");          .append("</h1></td></tr></table></body></html>");
330        web->setHtml(html);
331  }  }
332    
333  void MainView::ensureVisible(QWidget* widget)  void MainView::ensureVisible(QWidget* widget)

Legend:
Removed from v.884  
changed lines
  Added in v.1210

  ViewVC Help
Powered by ViewVC 1.1.20