--- infoscreen/MyWebView.cpp 2009/12/15 13:53:02 512
+++ infoscreen/MyWebView.cpp 2010/01/07 19:42:12 534
@@ -6,64 +6,64 @@
MyWebView::MyWebView(QWidget* parent) : QWebView(parent) {
- connect(this, SIGNAL( loadFinished(bool) ), this, SLOT( onChange(bool) ) );
+ connect(this, SIGNAL( loadFinished(bool) ), this, SLOT( onChange(bool) ) );
- QWebSettings* settings = QWebSettings::globalSettings();
- settings->setAttribute( QWebSettings::JavascriptEnabled, true);
- settings->setAttribute( QWebSettings::PluginsEnabled, true);
+ QWebSettings* settings = QWebSettings::globalSettings();
+ settings->setAttribute( QWebSettings::JavascriptEnabled, true);
+ settings->setAttribute( QWebSettings::PluginsEnabled, true);
- QTimer* timer = new QTimer(this);
- connect(timer, SIGNAL(timeout()), this, SLOT(onTimer()));
- timer->start(1000);
-
+ QTimer* timer = new QTimer(this);
+ connect(timer, SIGNAL(timeout()), this, SLOT(onTimer()));
+ timer->start(1000);
+
}
void MyWebView::start() {
- try {
- this->load( QUrl( generateUrl() ) );
- } catch (std::exception& e) {
- showError(e.what() );
- }
+ try {
+ this->load( QUrl( generateUrl() ) );
+ } catch (std::exception& e) {
+ showError(e.what() );
+ }
}
void MyWebView::showError(const char* msg) {
- QString str("
");
- str.append(msg).append("
");
- this->setHtml( str );
+ QString str("");
+ str.append(msg).append("
");
+ this->setHtml( str );
}
QString MyWebView::generateUrl() {
- QDesktopWidget* desktop = QApplication::desktop();
- QRect rect = desktop->screenGeometry();
+ QDesktopWidget* desktop = QApplication::desktop();
+ QRect rect = desktop->screenGeometry();
+
+ QString width, height;
+ width.setNum( rect.width() );
+ height.setNum( rect.height() );
- QString width, height;
- width.setNum( rect.width() );
- height.setNum( rect.height() );
-
- QSettings settings("Caddi", "infoscreen");
- qDebug() << "Settings: " << settings.fileName();
+ QSettings settings("Caddi", "infoscreen");
+ qDebug() << "Settings: " << settings.fileName();
- QString url = settings.value("url").toString();
- QString screenid = settings.value("screenid").toString();
+ QString url = settings.value("url").toString();
+ QString screenid = settings.value("screenid").toString();
- if (url.length() == 0) {
- throw std::runtime_error("No url in config file");
- }
+ if (url.length() == 0) {
+ throw std::runtime_error("No url in config file");
+ }
- url.append("?screen_id=").append(screenid);
- url.append("&width=").append(width);
- url.append("&height=").append(height);
+ url.append("?screen_id=").append(screenid);
+ url.append("&width=").append(width);
+ url.append("&height=").append(height);
- qDebug() << "URL:" << url;
+ qDebug() << "URL:" << url;
- return url;
+ return url;
}
//public slots: