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

Diff of /infoscreen/main.cpp

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

revision 501 by torben, Fri Dec 11 08:17:45 2009 UTC revision 502 by torben, Fri Dec 11 09:25:49 2009 UTC
# Line 1  Line 1 
1  #include <QApplication>  #include <QApplication>
2  #include <QtWebKit>  #include <QtWebKit>
3    #include <QDesktopWidget>
4    #include <iostream>
5    
6  class MyWebView : public QWebView  class MyWebView : public QWebView
7  {  {
8  public:  public:
9          MyWebView(QWidget* parent) : QWebView(parent) {          MyWebView(QWidget* parent) : QWebView(parent) {
10                  this->setWindowState( Qt::WindowFullScreen );                  this->setWindowState( Qt::WindowFullScreen );
11                    qApp->setOverrideCursor( QCursor( Qt::BlankCursor) );
12    
13                    
14                    
15            }
16    
17            virtual void show() {
18                    QWebView::show();
19            
20                    this->load( QUrl( generateUrl() ) );
21          }          }
22    
23            QString generateUrl() {
24                    QDesktopWidget* desktop = QApplication::desktop();
25                    QRect rect = desktop->screenGeometry();
26                    
27                    QString width;
28                    width.setNum( rect.width() );
29    
30                    QString height;
31                    height.setNum( rect.height() );
32    
33                                    
34                    QSettings settings("Caddi", "infoscreen");
35                    QString url = settings.value("url").toString();
36                    QString screenid = settings.value("screenid").toString();
37    
38                    url.append("?screen_id=").append(screenid);
39                    url.append("&width=").append(width);
40                    url.append("&height=").append(height);
41    
42    
43                    std::cout << url.toAscii().data() << std::endl;
44    
45                    return url;
46            }
47    
48  };  };
49    
50    
# Line 20  int main(int argc, char** argv) { Line 57  int main(int argc, char** argv) {
57          settings->setAttribute( QWebSettings::PluginsEnabled, true);          settings->setAttribute( QWebSettings::PluginsEnabled, true);
58    
59          MyWebView web(0);          MyWebView web(0);
         web.load(QUrl("http://10.210.210.200/infoscreens/screen.php?screen_id=1&height=480&width=640"));  
60          web.show();          web.show();
61                    
62    

Legend:
Removed from v.501  
changed lines
  Added in v.502

  ViewVC Help
Powered by ViewVC 1.1.20