summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiklas Goby2011-02-22 14:40:04 +0100
committerNiklas Goby2011-02-22 14:40:04 +0100
commit8fbc4f6ca1ac9d9ed680248a04f00a91f917cf43 (patch)
tree80273e70ea61aba1daca22aeb5cb751eac0d9a20
parentSimplified printing of the application path; more cleanup (diff)
downloadfbgui-8fbc4f6ca1ac9d9ed680248a04f00a91f917cf43.tar.gz
fbgui-8fbc4f6ca1ac9d9ed680248a04f00a91f917cf43.tar.xz
fbgui-8fbc4f6ca1ac9d9ed680248a04f00a91f917cf43.zip
changes in the fbbrowser class, added some slots for the jsOject and signals in the jsObject
-rw-r--r--src/.project114
-rw-r--r--src/fbbrowser.cpp63
-rw-r--r--src/fbbrowser.h20
-rw-r--r--src/fbbrowser.ui19
-rw-r--r--src/fbgui.qrc5
-rw-r--r--src/html/errorPage.html32
-rw-r--r--src/jsObject.cpp20
-rw-r--r--src/jsObject.h37
-rwxr-xr-xsrc/testApp.sh27
9 files changed, 116 insertions, 221 deletions
diff --git a/src/.project b/src/.project
deleted file mode 100644
index 1afb784..0000000
--- a/src/.project
+++ /dev/null
@@ -1,114 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>fbbrowser</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
- <triggers>clean,full,incremental,</triggers>
- <arguments>
- <dictionary>
- <key>?name?</key>
- <value></value>
- </dictionary>
- <dictionary>
- <key>org.eclipse.cdt.make.core.append_environment</key>
- <value>true</value>
- </dictionary>
- <dictionary>
- <key>org.eclipse.cdt.make.core.autoBuildTarget</key>
- <value>all</value>
- </dictionary>
- <dictionary>
- <key>org.eclipse.cdt.make.core.buildArguments</key>
- <value></value>
- </dictionary>
- <dictionary>
- <key>org.eclipse.cdt.make.core.buildCommand</key>
- <value>make</value>
- </dictionary>
- <dictionary>
- <key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
- <value>clean</value>
- </dictionary>
- <dictionary>
- <key>org.eclipse.cdt.make.core.contents</key>
- <value>org.eclipse.cdt.make.core.activeConfigSettings</value>
- </dictionary>
- <dictionary>
- <key>org.eclipse.cdt.make.core.enableAutoBuild</key>
- <value>false</value>
- </dictionary>
- <dictionary>
- <key>org.eclipse.cdt.make.core.enableCleanBuild</key>
- <value>true</value>
- </dictionary>
- <dictionary>
- <key>org.eclipse.cdt.make.core.enableFullBuild</key>
- <value>true</value>
- </dictionary>
- <dictionary>
- <key>org.eclipse.cdt.make.core.fullBuildTarget</key>
- <value>all</value>
- </dictionary>
- <dictionary>
- <key>org.eclipse.cdt.make.core.stopOnError</key>
- <value>true</value>
- </dictionary>
- <dictionary>
- <key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
- <value>true</value>
- </dictionary>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>com.trolltech.qtcppproject.QtMakefileGenerator</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
- <triggers>full,incremental,</triggers>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.cdt.core.cnature</nature>
- <nature>org.eclipse.cdt.core.ccnature</nature>
- <nature>com.trolltech.qtcppproject.QtNature</nature>
- <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
- <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
- </natures>
- <filteredResources>
- <filter>
- <id>1296135546369</id>
- <name></name>
- <type>6</type>
- <matcher>
- <id>org.eclipse.ui.ide.multiFilter</id>
- <arguments>1.0-name-matches-false-false-*.o</arguments>
- </matcher>
- </filter>
- <filter>
- <id>1296135546371</id>
- <name></name>
- <type>6</type>
- <matcher>
- <id>org.eclipse.ui.ide.multiFilter</id>
- <arguments>1.0-name-matches-false-false-ui_*.*</arguments>
- </matcher>
- </filter>
- <filter>
- <id>1296135546374</id>
- <name></name>
- <type>6</type>
- <matcher>
- <id>org.eclipse.ui.ide.multiFilter</id>
- <arguments>1.0-name-matches-false-false-qrc_*.*</arguments>
- </matcher>
- </filter>
- </filteredResources>
-</projectDescription>
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 @@
-<ui version="4.0" >
- <class>fbbrowserClass</class>
- <widget class="QWidget" name="fbbrowserClass" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>0</y>
- <width>400</width>
- <height>300</height>
- </rect>
- </property>
- <property name="windowTitle" >
- <string>fbbrowser</string>
- </property>
- </widget>
- <layoutdefault spacing="6" margin="11" />
- <resources/>
- <connections/>
-</ui>
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 @@
-<!DOCTYPE RCC><RCC version="1.0">
- <qresource>
- <file>html/errorPage.html</file>
- </qresource>
- </RCC>
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 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
- "http://www.w3.org/TR/html4/strict.dtd">
-<html>
-<head>
-
-<script type="text/javascript">
-function quitProgramm(){
-webkitTest.signalQuitAll();
-}
-
-</script>
-
-</head>
-<body>
-<h1>ERROR</h1>
-
-<p>
-No Internet Connection or Server is down.
-
-
-Please contact your Administrator.
-</p>
-
-<form name="formular">
- <p>
- <input type="button" name="quitProgramm_Button" value="quit programm"
- onclick="quitProgramm()">
- </p>
-</form>
-
-</body>
-</html>
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