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

Annotation of /infoscreen/main.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 505 - (hide annotations) (download)
Fri Dec 11 15:24:10 2009 UTC (14 years, 5 months ago) by torben
File size: 1349 byte(s)
Also dump the used config file

1 torben 501 #include <QApplication>
2     #include <QtWebKit>
3 torben 502 #include <QDesktopWidget>
4     #include <iostream>
5 torben 501
6     class MyWebView : public QWebView
7     {
8     public:
9     MyWebView(QWidget* parent) : QWebView(parent) {
10     this->setWindowState( Qt::WindowFullScreen );
11 torben 502 qApp->setOverrideCursor( QCursor( Qt::BlankCursor) );
12    
13    
14    
15 torben 501 }
16 torben 502
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 torben 501
27 torben 502 QString width;
28     width.setNum( rect.width() );
29    
30     QString height;
31     height.setNum( rect.height() );
32    
33    
34     QSettings settings("Caddi", "infoscreen");
35 torben 505 std::cout << settings.fileName().toAscii().data() << std::endl;
36 torben 502 QString url = settings.value("url").toString();
37     QString screenid = settings.value("screenid").toString();
38    
39     url.append("?screen_id=").append(screenid);
40     url.append("&width=").append(width);
41     url.append("&height=").append(height);
42    
43    
44     std::cout << url.toAscii().data() << std::endl;
45    
46     return url;
47     }
48    
49 torben 501 };
50    
51    
52     int main(int argc, char** argv) {
53     QApplication app(argc,argv);
54    
55    
56     QWebSettings* settings = QWebSettings::globalSettings();
57     settings->setAttribute( QWebSettings::JavascriptEnabled, true);
58     settings->setAttribute( QWebSettings::PluginsEnabled, true);
59    
60     MyWebView web(0);
61     web.show();
62    
63    
64     return app.exec();
65     }

  ViewVC Help
Powered by ViewVC 1.1.20