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 |
|
|
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 |
|
|