diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/JSObject.cpp | 7 | ||||
| -rw-r--r-- | src/JSObject.h | 12 | ||||
| -rw-r--r-- | src/fbgui.cpp | 10 | ||||
| -rw-r--r-- | src/fbgui.h | 6 | ||||
| -rw-r--r-- | src/main.cpp | 9 | ||||
| -rw-r--r-- | src/sysInfo.h | 2 |
6 files changed, 17 insertions, 29 deletions
diff --git a/src/JSObject.cpp b/src/JSObject.cpp index 708e825..11f91c6 100644 --- a/src/JSObject.cpp +++ b/src/JSObject.cpp @@ -4,11 +4,10 @@ * Created on: Feb 1, 2011 * Author: niklas */ - +#include "fbgui.h" #include "JSObject.h" #include "sysInfo.h" -extern bool debug; //------------------------------------------------------------------------------------------------------- JSObject::JSObject(QWebFrame *parent) { @@ -19,9 +18,9 @@ JSObject::JSObject(QWebFrame *parent) { JSObject::~JSObject() {} //------------------------------------------------------------------------------------------------------- /* TEST */ -QString JSObject::getInfo(QString info) +QString JSObject::getSysInfo(QString info) { - static sysInfo si; + sysInfo si; if (debug) qDebug() << "Requested info: " << info; if (debug) qDebug() << "sysInfo output: " << si.getInfo(info); if (info == QString("time")){ diff --git a/src/JSObject.h b/src/JSObject.h index ecbc4f2..499d4b6 100644 --- a/src/JSObject.h +++ b/src/JSObject.h @@ -11,16 +11,12 @@ #define JSOBJECT_H_ #include "fbgui.h" -#include "sysInfo.h" -class JSObject : public QObject -{ +class JSObject : public QObject{ Q_OBJECT - private: QWebFrame* _parent; - sysInfo sim; public: JSObject(QWebFrame* parent); @@ -30,16 +26,12 @@ signals: void requestFile(QString& filename); void signalQuitAll(); - public slots: - void attachToDOM(); - QString getInfo(QString info); + QString getSysInfo(QString info); void startDownload(QString filename); void updateProgressBar(int i); void quitAll(); - - }; #endif /* JSOBJECT_H_ */ diff --git a/src/fbgui.cpp b/src/fbgui.cpp index 0a6780d..821c05f 100644 --- a/src/fbgui.cpp +++ b/src/fbgui.cpp @@ -8,22 +8,15 @@ #include <QtWebKit> #include <QApplication> -QUrl baseURL; -QDir downloadDirectory; -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. */ - QObject::connect(jso, SIGNAL(signalQuitAll()), this, SLOT(quit())); /* Init JavaScript interface */ JSObject* jso = new JSObject(webView->page()->mainFrame()); - + QObject::connect(jso, SIGNAL(signalQuitAll()), this, SLOT(close())); QObject::connect(webView->page()->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), jso, SLOT(attachToDOM())); @@ -39,3 +32,4 @@ fbgui::fbgui(QApplication *parent) } void fbgui::quit(){ this->close(); +} diff --git a/src/fbgui.h b/src/fbgui.h index 5a6f014..fdd4477 100644 --- a/src/fbgui.h +++ b/src/fbgui.h @@ -7,6 +7,10 @@ #define DEFAULT_URL "http://www.google.com" +extern QUrl baseURL; +extern QDir downloadDirectory; +extern bool debug; + class fbgui : public QMainWindow { Q_OBJECT @@ -16,8 +20,6 @@ public: public slots: void quit(); -private: - QApplication* _parent; }; #endif // FBGUI_H diff --git a/src/main.cpp b/src/main.cpp index bf16712..4e6627b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -6,9 +6,10 @@ #include <iostream> #include "fbgui.h" -extern bool debug; -extern QDir downloadDirectory; -extern QUrl baseURL; + +QUrl baseURL(DEFAULT_URL); +QDir downloadDirectory("./downloads/"); +bool debug = false; void printHelp() { @@ -83,7 +84,7 @@ int main(int argc, char *argv[]) confFileSettings.setIniCodec("UTF-8"); if (clo.contains("url")) - baseURL = clo.value("url").toUrl(); + baseURL = QUrl(clo.value("url")); else if (confFileSettings.contains("default/url")) baseURL = confFileSettings.value("default/url").toUrl(); else diff --git a/src/sysInfo.h b/src/sysInfo.h index 43aa8ed..ced1d56 100644 --- a/src/sysInfo.h +++ b/src/sysInfo.h @@ -12,6 +12,6 @@ class sysInfo { private: QString getTime(); QString getMACAddress(); -} +}; #endif // SYSTEMINFO_H |
