1 |
#include <QApplication> |
#include <QApplication> |
2 |
#include <QtWebKit> |
#include <QtWebKit> |
3 |
#include <QDesktopWidget> |
#include "MainView.h" |
|
#include <iostream> |
|
4 |
|
|
|
class MyWebView : public QWebView |
|
|
{ |
|
|
public: |
|
|
MyWebView(QWidget* parent) : QWebView(parent) { |
|
|
this->setWindowState( Qt::WindowFullScreen ); |
|
|
qApp->setOverrideCursor( QCursor( Qt::BlankCursor) ); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
virtual void show() { |
|
|
QWebView::show(); |
|
|
|
|
|
this->load( QUrl( generateUrl() ) ); |
|
|
} |
|
|
|
|
|
QString generateUrl() { |
|
|
QDesktopWidget* desktop = QApplication::desktop(); |
|
|
QRect rect = desktop->screenGeometry(); |
|
|
|
|
|
QString width; |
|
|
width.setNum( rect.width() ); |
|
|
|
|
|
QString height; |
|
|
height.setNum( rect.height() ); |
|
|
|
|
|
|
|
|
QSettings settings("Caddi", "infoscreen"); |
|
|
QString url = settings.value("url").toString(); |
|
|
QString screenid = settings.value("screenid").toString(); |
|
|
|
|
|
url.append("?screen_id=").append(screenid); |
|
|
url.append("&width=").append(width); |
|
|
url.append("&height=").append(height); |
|
|
|
|
|
|
|
|
std::cout << url.toAscii().data() << std::endl; |
|
|
|
|
|
return url; |
|
|
} |
|
|
|
|
|
}; |
|
5 |
|
|
6 |
|
|
7 |
int main(int argc, char** argv) { |
int main(int argc, char** argv) { |
8 |
QApplication app(argc,argv); |
QApplication app(argc,argv); |
9 |
|
app.setApplicationName("infoscreen"); |
10 |
|
|
11 |
|
|
12 |
QWebSettings* settings = QWebSettings::globalSettings(); |
QWebSettings* settings = QWebSettings::globalSettings(); |
13 |
settings->setAttribute( QWebSettings::JavascriptEnabled, true); |
settings->setAttribute( QWebSettings::JavascriptEnabled, true); |
14 |
settings->setAttribute( QWebSettings::PluginsEnabled, true); |
settings->setAttribute( QWebSettings::PluginsEnabled, true); |
15 |
|
|
16 |
MyWebView web(0); |
MainView main(0); |
17 |
web.show(); |
main.show(); |
18 |
|
|
19 |
|
|
20 |
return app.exec(); |
return app.exec(); |