From 8fbc4f6ca1ac9d9ed680248a04f00a91f917cf43 Mon Sep 17 00:00:00 2001
From: Niklas Goby
Date: Tue, 22 Feb 2011 14:40:04 +0100
Subject: changes in the fbbrowser class, added some slots for the jsOject and
signals in the jsObject
---
src/.project | 114 ------------------------------------------------
src/fbbrowser.cpp | 63 +++++++++++++++++++++++++-
src/fbbrowser.h | 20 ++++++++-
src/fbbrowser.ui | 19 --------
src/fbgui.qrc | 5 ---
src/html/errorPage.html | 32 --------------
src/jsObject.cpp | 20 ---------
src/jsObject.h | 37 +++++++++++++++-
src/testApp.sh | 27 ------------
9 files changed, 116 insertions(+), 221 deletions(-)
delete mode 100644 src/.project
delete mode 100644 src/fbbrowser.ui
delete mode 100644 src/fbgui.qrc
delete mode 100644 src/html/errorPage.html
delete mode 100755 src/testApp.sh
(limited to 'src')
diff --git a/src/.project b/src/.project
deleted file mode 100644
index 1afb784..0000000
--- a/src/.project
+++ /dev/null
@@ -1,114 +0,0 @@
-
-
- fbbrowser
-
-
-
-
-
- org.eclipse.cdt.managedbuilder.core.genmakebuilder
- clean,full,incremental,
-
-
- ?name?
-
-
-
- org.eclipse.cdt.make.core.append_environment
- true
-
-
- org.eclipse.cdt.make.core.autoBuildTarget
- all
-
-
- org.eclipse.cdt.make.core.buildArguments
-
-
-
- org.eclipse.cdt.make.core.buildCommand
- make
-
-
- org.eclipse.cdt.make.core.cleanBuildTarget
- clean
-
-
- org.eclipse.cdt.make.core.contents
- org.eclipse.cdt.make.core.activeConfigSettings
-
-
- org.eclipse.cdt.make.core.enableAutoBuild
- false
-
-
- org.eclipse.cdt.make.core.enableCleanBuild
- true
-
-
- org.eclipse.cdt.make.core.enableFullBuild
- true
-
-
- org.eclipse.cdt.make.core.fullBuildTarget
- all
-
-
- org.eclipse.cdt.make.core.stopOnError
- true
-
-
- org.eclipse.cdt.make.core.useDefaultBuildCmd
- true
-
-
-
-
- com.trolltech.qtcppproject.QtMakefileGenerator
-
-
-
-
- org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
- full,incremental,
-
-
-
-
-
- org.eclipse.cdt.core.cnature
- org.eclipse.cdt.core.ccnature
- com.trolltech.qtcppproject.QtNature
- org.eclipse.cdt.managedbuilder.core.managedBuildNature
- org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
-
-
-
- 1296135546369
-
- 6
-
- org.eclipse.ui.ide.multiFilter
- 1.0-name-matches-false-false-*.o
-
-
-
- 1296135546371
-
- 6
-
- org.eclipse.ui.ide.multiFilter
- 1.0-name-matches-false-false-ui_*.*
-
-
-
- 1296135546374
-
- 6
-
- org.eclipse.ui.ide.multiFilter
- 1.0-name-matches-false-false-qrc_*.*
-
-
-
-
diff --git a/src/fbbrowser.cpp b/src/fbbrowser.cpp
index 1048d46..6191466 100644
--- a/src/fbbrowser.cpp
+++ b/src/fbbrowser.cpp
@@ -58,8 +58,26 @@ fbbrowser::~fbbrowser()
//
void fbbrowser::addJSObject()
{
- jsObject *jso = new jsObject();
+ jso = new jsObject();
view->page()->mainFrame()->addToJavaScriptWindowObject(QString("jsObject"), jso);
+
+ // connect the signals of the jsObject to the slots of the fbbrowser
+ connectJsSignalsToSlots();
+}
+
+void fbbrowser::connectJsSignalsToSlots()
+{
+ QObject::connect(jso, SIGNAL(closeBrowser()), this, SLOT(quitAll()));
+ QObject::connect(jso, SIGNAL(startDownload()), this, SLOT(startDownload_Slot()));
+ QObject::connect(jso, SIGNAL(getMacAddress()), this, SLOT(getMacAddress_Slot()));
+ QObject::connect(jso, SIGNAL(getIpAddress()), this, SLOT(getIpAddress_Slot()));
+ QObject::connect(jso, SIGNAL(getIntegratedHardwareDevices()), this, SLOT(getIntegratedHardwareDevices_Slot()));
+ QObject::connect(jso, SIGNAL(getUsbDevices()), this, SLOT(getUsbDevices_Slot()));
+ QObject::connect(jso, SIGNAL(getHardDrives()), this, SLOT(getHardDrives_Slot()));
+
+ // for testing reasons
+ QObject::connect(jso, SIGNAL(showTime()), this, SLOT(showTime_Slot()));
+ QObject::connect(jso, SIGNAL(showDate()), this, SLOT(showDate_Slot()));
}
void fbbrowser::writeText(QString text)
@@ -78,6 +96,49 @@ void fbbrowser::quitAll()
emit signalQuitAll();
}
+void fbbrowser::startDownload_Slot()
+{
+
+}
+
+void fbbrowser::getMacAddress_Slot()
+{
+
+}
+
+void fbbrowser::getIpAddress_Slot()
+{
+
+}
+
+void fbbrowser::getIntegratedHardwareDevices_Slot()
+{
+
+}
+
+void fbbrowser::getUsbDevices_Slot()
+{
+
+}
+
+void fbbrowser::getHardDrives_Slot()
+{
+
+}
+
+// for testing reasons
+void fbbrowser::showTime_Slot()
+{
+ QString time = QTime::currentTime().toString("hh:mm:ss");
+ view->page()->mainFrame->evaluateJavaScript(/*TODO:: edit jsFunction name*/ "");
+}
+
+void fbbrowser::showDate_Slot()
+{
+ QString date = QDate::currentDate().toString("dd.MM.yyyy");
+ view->page()->mainFrame->evaluateJavaScript(/*TODO:: edit jsFunction name*/ "");
+}
+
void fbbrowser::getSysInfo()
{
/*
diff --git a/src/fbbrowser.h b/src/fbbrowser.h
index 6cfa588..42d1d3d 100644
--- a/src/fbbrowser.h
+++ b/src/fbbrowser.h
@@ -19,7 +19,6 @@ public:
~fbbrowser();
void printusage();
Q_INVOKABLE void writeText(QString text); //used for writing web content into a file
- Q_INVOKABLE void quitAll();
private:
QUrl baseUrl;
@@ -32,12 +31,31 @@ private:
// Private download function.
void download(const QString & file);
+ //the jsObject. connection to the webpage for emiting signals
+ jsObject * jso;
+ // connects all jsObject signals with fbbrowser slots
+ void connectJsSignalsToSlots();
+
private slots:
void addJSObject();
void getSysInfo();
+ // slots which are emited by the jsObject signals
+
+ void quitAll();
+ void startDownload_Slot();
+ void getMacAddress_Slot();
+ void getIpAddress_Slot();
+ void getIntegratedHardwareDevices_Slot();
+ void getUsbDevices_Slot();
+ void getHardDrives_Slot();
+
+ // for testing reasons
+ void showTime_Slot();
+ void showDate_Slot();
+
signals:
void signalQuitAll();
};
diff --git a/src/fbbrowser.ui b/src/fbbrowser.ui
deleted file mode 100644
index a02b1ab..0000000
--- a/src/fbbrowser.ui
+++ /dev/null
@@ -1,19 +0,0 @@
-
- fbbrowserClass
-
-
-
- 0
- 0
- 400
- 300
-
-
-
- fbbrowser
-
-
-
-
-
-
diff --git a/src/fbgui.qrc b/src/fbgui.qrc
deleted file mode 100644
index da051a4..0000000
--- a/src/fbgui.qrc
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
- html/errorPage.html
-
-
diff --git a/src/html/errorPage.html b/src/html/errorPage.html
deleted file mode 100644
index 271d9fe..0000000
--- a/src/html/errorPage.html
+++ /dev/null
@@ -1,32 +0,0 @@
-
-
-
-
-
-
-
-
-ERROR
-
-
-No Internet Connection or Server is down.
-
-
-Please contact your Administrator.
-
-
-
-
-
-
diff --git a/src/jsObject.cpp b/src/jsObject.cpp
index ee7f670..f41187c 100644
--- a/src/jsObject.cpp
+++ b/src/jsObject.cpp
@@ -15,24 +15,4 @@ jsObject::~jsObject() {
// TODO Auto-generated destructor stub
}
-void jsObject::performAction(jsAction a)
-{
- switch (a)
- {
- case QUIT :
- break;
- case SHOW_TIME :
- break;
- case SHOW_DATE :
- break;
- case SHOW_USB_DEVICES :
- break;
- case SHOW_HARDDRIVES :
- break;
- case SHOW_IP_ADDRESS :
- break;
- case SHOW_MAC_ADDRESS :
- break;
- }
-}
diff --git a/src/jsObject.h b/src/jsObject.h
index a025c5a..db927c1 100644
--- a/src/jsObject.h
+++ b/src/jsObject.h
@@ -3,6 +3,8 @@
*
* Created on: Feb 1, 2011
* Author: niklas
+ * The purpose of the jsObject class is to provide signals which will be emited in the javascript functions.
+ * Those javascript functions are writen in a seperate file: jsFunktions.js
*/
#ifndef JSOBJECT_H_
@@ -33,8 +35,39 @@ public:
//private:
// fbbrowser browser;
-private slots:
- void performAction(jsAction a);
+// no slots needed. class provides only signals
+// private slots:
+// void performAction(jsAction a);
+
+// define all the needed signals.
+// every action gets its own signal. (the former enum is not needed anymore)
+// the signals will be connected in the fbbrowser class with slots of the fbbrowser class
+signals:
+ // should be the last signal to be emited.
+ // Will close the browser and continues the boot sequenze
+ void closeBrowser();
+ // will start the download of all needed files for the following boot sequence
+ void startDownload();
+
+ // starts the slot which is responsible for extracting the MAC address of the machine
+ // the MAC Address will be the parameter of a javascript function which will present it on the webpage
+ void getMacAddress();
+ // starts the slot which is responsible for extracting the IP address of the machine
+ // the IP address will be the parameter of a javascript function which will present it on the webpage
+ void getIpAddress();
+ // starts the slot which is responsible for extracting the integrated hardware devices of the machine
+ // the array of integrated hardware devices will be the parameter of a javascript function which will present // it on the webpage
+ void getIntegratedHardwareDevices();
+ // starts the slot which is responsible for extracting the usb devices of the machine
+ // the array of usb devices will be the parameter of a javascript function which will present it on the webpag
+ void getUsbDevices();
+ // starts the slot which is responsible for extracting the hard drive devices of the machine
+ // the array of hard rive devices will be the parameter of a javascript function which will present it on the // webpag
+ void getHardDrives();
+
+ // for testing
+ void showTime();
+ void showDate();
};
diff --git a/src/testApp.sh b/src/testApp.sh
deleted file mode 100755
index ccd7cd6..0000000
--- a/src/testApp.sh
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/bin/sh
-# This script now needs to have the URL to load as an argument.
-if [ $# = 0 ]; then
- echo "No URL passed, exiting..."
- exit
-fi
-
-script_path="$(cd "${0%/*}" 2>/dev/null; echo "$PWD"/"${0##*/}")"
-
-# to get the path only - not the script name - add
-working_path=`dirname "$script_path"`
-
-# Start QT's virtual framebuffer
-/usr/local/Trolltech/Qt-4.7.1/bin/qvfb -width 800 -height 600 &
-# Wait for it to load (needed?)
-sleep 1
-# Start the fbbrowser app.
-# This requires the fbgui git repository to be in the user's home directory.
-$working_path/fbgui -qws $1
-# Check if fbbrowser is not running, if so kill the qvfb.
-if [ $(ps aux | grep -v grep | grep -c fbgui) -eq 1 ]
-then
- echo "fbgui is still running ..."
-else
- echo "fbgui stopped running, killing qvfb ..."
- killall qvfb
-fi
--
cgit v1.2.3-55-g7522