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

Diff of /infoscreen/webview.cpp

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

infoscreen/MyWebView.cpp revision 535 by torben, Fri Jan 8 09:20:37 2010 UTC infoscreen/webview.cpp revision 904 by torben, Fri Jun 25 13:52:07 2010 UTC
# Line 2  Line 2 
2  #include <QDesktopWidget>  #include <QDesktopWidget>
3  #include <stdexcept>  #include <stdexcept>
4    
5  #include "MyWebView.h"  #include "webview.h"
6    
7    
8  MyWebView::MyWebView(QWidget* parent) : QWebView(parent) {                WebView::WebView(QWidget* parent) : QWebView(parent) {
     connect(this, SIGNAL( loadFinished(bool) ), this, SLOT( onChange(bool) ) );  
9    
10      QWebSettings* settings = QWebSettings::globalSettings();      QWebSettings* settings = QWebSettings::globalSettings();
11      settings->setAttribute( QWebSettings::JavascriptEnabled, true);      settings->setAttribute( QWebSettings::JavascriptEnabled, true);
12      settings->setAttribute( QWebSettings::PluginsEnabled, true);      settings->setAttribute( QWebSettings::PluginsEnabled, true);
   
   
   
     QTimer* timer = new QTimer(this);  
     connect(timer, SIGNAL(timeout()), this, SLOT(onTimer()));  
     timer->start(1000);  
   
13  }  }
14    
15  void MyWebView::start(QString url, QString screenid) {  void WebView::start(QString& url, QString& screenid) {
16      try {      try {
17          this->load( QUrl( generateUrl(url, screenid) ) );          this->load( QUrl( generateUrl(url, screenid) ) );
18      } catch (std::exception& e) {      } catch (std::exception& e) {
# Line 29  void MyWebView::start(QString url, QStri Line 21  void MyWebView::start(QString url, QStri
21    
22  }  }
23    
24  void MyWebView::showError(const char* msg) {  void WebView::showError(const char* msg) {
25      QString str("<html><body><center><h1>");      QString str("<html><body><center><h1>");
26      str.append(msg).append("</h1></center></body></html>");      str.append(msg).append("</h1></center></body></html>");
27      this->setHtml( str );      this->setHtml( str );
28  }  }
29    
30  QString MyWebView::generateUrl(QString url, QString screenid) {  QString WebView::generateUrl(QString& url, QString& screenid) {
31      QDesktopWidget* desktop = QApplication::desktop();      QDesktopWidget* desktop = QApplication::desktop();
32      QRect rect = desktop->screenGeometry();      QRect rect = desktop->screenGeometry();
33    
# Line 60  QString MyWebView::generateUrl(QString u Line 52  QString MyWebView::generateUrl(QString u
52      return url;      return url;
53  }  }
54    
 //public slots:  
 void MyWebView::onChange(bool success) {  
     //qDebug() << "html" << this->page()->mainFrame()->toHtml();  
 }  
   
   
 void MyWebView::onTimer() {  
 }  

Legend:
Removed from v.535  
changed lines
  Added in v.904

  ViewVC Help
Powered by ViewVC 1.1.20