summaryrefslogtreecommitdiffstats
path: root/src/fbgui.cpp
blob: 8f6fc88c2b7af2fca4a826358b7ac919cf9b978c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include "fbgui.h"
#include "DownloadManager.h"
#include "JSObject.h"

#include <iostream>
#include <QUrl>
#include <QMap>
#include <QtWebKit>
#include <QApplication>

QUrl baseURL;
bool debug;

fbgui::fbgui(QApplication *parent)
{
	_parent = parent;
	/* Browser init. */
	QWebView* webView = new QWebView(this);
	webView->load(baseURL);
	/* Connect fbb with app for killing the app from browser. */


	/* Init JavaScript interface */
	JSObject* jso = new JSObject(webView->page()->mainFrame());

	QObject::connect(webView->page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), jso, SLOT(attachToDOM()));
	QObject::connect(jso, SIGNAL(signalQuitAll()), parent, SLOT(quit()));

	/* Init Download Manager */
	DownloadManager* dm = new DownloadManager();
	QObject::connect(jso, SIGNAL(requestFile(QString&)), dm, SLOT(downloadFile(QString&)));
	QObject::connect(dm, SIGNAL(updateProgress(int)), jso, SLOT(updateProgressBar(int)));

	setWindowFlags(Qt::SplashScreen);
	showFullScreen();
	setCentralWidget(webView);

}
void fbgui::quit(){
	//parent.quit();
}