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

Diff of /infoscreen/mainview.cpp

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

revision 870 by torben, Mon Jun 21 13:53:17 2010 UTC revision 881 by torben, Thu Jun 24 07:52:59 2010 UTC
# Line 16  Line 16 
16  #include "videoview.h"  #include "videoview.h"
17    
18  #include "httpwrapper.h"  #include "httpwrapper.h"
19    #include "screenmanager.h"
20    
21    
22    
# Line 32  MainView::MainView(QWidget* parent) Line 33  MainView::MainView(QWidget* parent)
33    
34      if (currentMode == ModeSimpleWeb){      if (currentMode == ModeSimpleWeb){
35          qDebug() << "Starting plain browser mode";          qDebug() << "Starting plain browser mode";
         web->setVisible(true);  
         web->start(url,screenid);  
36      }      }
37    
38      if (currentMode == ModeLocal ) {      if (currentMode == ModeLocal ) {
# Line 68  MainView::MainView(QWidget* parent) Line 67  MainView::MainView(QWidget* parent)
67      layout->setContentsMargins(0,0,0,0);      layout->setContentsMargins(0,0,0,0);
68      setLayout(layout);      setLayout(layout);
69    
70        if (currentMode == ModeSimpleWeb) {
71            web->setVisible(true);
72            web->start(url,screenid);
73        }
74    
75      if (currentMode == ModeXml || currentMode == ModeLocal) {      if (enableScreenManager) {
76          qDebug() << "Starting timer...";          screenManager = new ScreenManager(screenManagerOn, screenManagerOff);
77          timer = new QTimer(this);      } else {
78          connect(timer, SIGNAL(timeout() ), this, SLOT(onTimer() ));          qDebug() << "ScreenManager is disabled";
         timer->start(100);  
79      }      }
80    
81    
82        qDebug() << "Starting timer...";
83        timer = new QTimer(this);
84        connect(timer, SIGNAL(timeout() ), this, SLOT(onTimer() ));
85        timer->start(100);
86  }  }
87    
88  void MainView::loadSettings()  void MainView::loadSettings()
# Line 96  void MainView::loadSettings() Line 104  void MainView::loadSettings()
104          exit(1);          exit(1);
105      }      }
106    
107        enableScreenManager = settings->value("enablescreenmanager").toBool();
108        if (enableScreenManager) {
109            screenManagerOn = settings->value("screenmanager_on").toTime();
110            screenManagerOff = settings->value("screenmanager_off").toTime();
111        }
112    
113        xmlInterval = settings->value("xmlinterval", 30).toInt();
114        xmlInterval = (xmlInterval * 60 * 1000); //convert to milliseconds
115    
116    
117      if (currentMode == ModeSimpleWeb || currentMode == ModeXml) {      if (currentMode == ModeSimpleWeb || currentMode == ModeXml) {
118          url = settings->value("url").toString();          url = settings->value("url").toString();
# Line 133  void MainView::keyPressEvent ( QKeyEvent Line 150  void MainView::keyPressEvent ( QKeyEvent
150    
151  void MainView::onTimer()  void MainView::onTimer()
152  {  {
153      screenManager.timerTick();      if (enableScreenManager == true) {
154            screenManager->timerTick();
155        }
156    
157      if (currentMode == ModeXml) {      if (currentMode == ModeXml) {
158          readXml();          readXml();
159      }      }
160    
161      switchScreens();      if (currentMode == ModeXml || currentMode == ModeLocal) {
162            switchScreens();
163        }
164  }  }
165    
166    
# Line 193  void MainView::readLocalFiles() Line 214  void MainView::readLocalFiles()
214    
215  bool MainView::readXml()  bool MainView::readXml()
216  {  {
217      const int TIMEOUT = 30*60*1000; // 30 minutter      if ( lastXml.isNull() || lastXml.elapsed() > xmlInterval) {
218      if ( lastXml.isNull() || lastXml.elapsed() > TIMEOUT) {          qDebug() << "Reading XML";
219    
220    
221          bool res = xmlHandler.readXml( xmlUrl );          bool res = xmlHandler.readXml( xmlUrl );
# Line 267  void MainView::switchScreens() Line 288  void MainView::switchScreens()
288              }              }
289    
290          } else {          } else {
             qDebug() << "no screen";  
291              errorInfoScreen("Der er ingen information at vise");              errorInfoScreen("Der er ingen information at vise");
292          }          }
293          lastScreenSwitch = QTime::currentTime();          lastScreenSwitch = QTime::currentTime();

Legend:
Removed from v.870  
changed lines
  Added in v.881

  ViewVC Help
Powered by ViewVC 1.1.20