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

Annotation of /infoscreen/main.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 502 - (hide annotations) (download)
Fri Dec 11 09:25:49 2009 UTC (14 years, 5 months ago) by torben
File size: 1283 byte(s)
- Load url and and ID from file
- Read screen settings
- hide cursor


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     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 torben 501 };
49    
50    
51     int main(int argc, char** argv) {
52     QApplication app(argc,argv);
53    
54    
55     QWebSettings* settings = QWebSettings::globalSettings();
56     settings->setAttribute( QWebSettings::JavascriptEnabled, true);
57     settings->setAttribute( QWebSettings::PluginsEnabled, true);
58    
59     MyWebView web(0);
60     web.show();
61    
62    
63     return app.exec();
64     }

  ViewVC Help
Powered by ViewVC 1.1.20