#include "fbgui.h" #include "DownloadManager.h" #include "javascriptInterface.h" #include #include #include #include #include // Note: Absolute paths. QString binPath(QApplication::applicationDirPath()); QString downloadPath(binPath + "/downloads"); QUrl baseURL(DEFAULT_URL); bool debug = false; fbgui::fbgui(QApplication *parent) { setAttribute(Qt::WA_QuitOnClose, true); qDebug() << "Application dir path: " << QApplication::applicationDirPath(); /* Browser init. */ QWebView* webView = new QWebView(this); webView->load(baseURL); /* Init JavaScript interface */ javascriptInterface* jsi = new javascriptInterface(webView->page()->mainFrame()); // this still looks bad.. QObject::connect(jsi, SIGNAL(signalQuitAll()), this, SLOT(close())); QObject::connect(webView->page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), jsi, SLOT(attachToDOM())); /* Init Download Manager */ DownloadManager* dm = new DownloadManager(); QObject::connect(jsi, SIGNAL(requestFile(QString&)), dm, SLOT(downloadFile(QString&))); QObject::connect(dm, SIGNAL(updateProgress(int)), jsi, SLOT(updateProgressBar(int))); setWindowFlags(Qt::SplashScreen); showFullScreen(); setCentralWidget(webView); } void fbgui::quit(){ qDebug() << "fbgui::quit() call"; }