summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Bauer2012-02-03 17:25:54 +0100
committerJonathan Bauer2012-02-03 17:25:54 +0100
commit2d492b0641daec1555b42a3f5a3d2cc16fb9ad66 (patch)
tree0c49af4e5cfa5a325beb5ecd4c68f1e4430a8b19
parentUser Private Key, Certificate und Server Certificate gesetzt (diff)
parentminor changes (diff)
downloadfbgui-2d492b0641daec1555b42a3f5a3d2cc16fb9ad66.tar.gz
fbgui-2d492b0641daec1555b42a3f5a3d2cc16fb9ad66.tar.xz
fbgui-2d492b0641daec1555b42a3f5a3d2cc16fb9ad66.zip
merge cleanup branch
-rw-r--r--.gitignore4
-rw-r--r--src/fbgui/CMakeLists.txt4
-rw-r--r--src/fbgui/agui.cpp86
-rw-r--r--src/fbgui/agui.h54
-rw-r--r--src/fbgui/console.cpp60
-rw-r--r--src/fbgui/console.h32
-rw-r--r--src/fbgui/fbgui.cpp239
-rw-r--r--src/fbgui/fbgui.h61
-rw-r--r--src/fbgui/html/js/networkDiscovery.js4
-rw-r--r--src/fbgui/interfaceconfiguration.cpp15
-rw-r--r--src/fbgui/javascriptinterface.cpp13
-rw-r--r--src/fbgui/javascriptinterface.h2
-rw-r--r--src/fbgui/main.cpp572
-rw-r--r--src/fbgui/ndgui.cpp156
-rw-r--r--src/fbgui/ndgui.h28
-rw-r--r--src/fbgui/networkdiscovery.cpp9
-rw-r--r--src/fbgui/networkmanager.cpp50
-rw-r--r--src/fbgui/sysinfo.cpp23
-rw-r--r--src/fbgui/sysinfo.h1
-rwxr-xr-xtestApp.sh5
20 files changed, 617 insertions, 801 deletions
diff --git a/.gitignore b/.gitignore
index 6dab371..8463a08 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,5 +17,7 @@ Debug
/doxygen/html/*
/doxygen/latex/*
/doxygen/man/*
-testApp.sh
/build
+testApp.sh
+testAppGDB.sh
+
diff --git a/src/fbgui/CMakeLists.txt b/src/fbgui/CMakeLists.txt
index 8b19777..e0806b5 100644
--- a/src/fbgui/CMakeLists.txt
+++ b/src/fbgui/CMakeLists.txt
@@ -23,7 +23,9 @@ javascriptinterface.h
ndgui.h
networkdiscovery.h
networkmanager.h
-fbgui.h)
+fbgui.h
+agui.h
+console.h)
file(GLOB FBGUI_UIS *.ui)
file(GLOB FBGUI_RCS *.qrc)
diff --git a/src/fbgui/agui.cpp b/src/fbgui/agui.cpp
new file mode 100644
index 0000000..3f2fd68
--- /dev/null
+++ b/src/fbgui/agui.cpp
@@ -0,0 +1,86 @@
+/*
+ * agui.cpp
+ *
+ * Created on: Jan 31, 2012
+ * Author: joe
+ */
+
+#include "agui.h"
+#include "console.h"
+
+#include <log4cxx/logger.h>
+#include "qlog4cxx.h"
+
+using namespace log4cxx;
+using namespace log4cxx::helpers;
+LoggerPtr aguiCoreLogger(Logger::getLogger("agui.core"));
+
+QString logFilePath("");
+int debugMode = -1;
+
+agui::agui() {
+ setupLayout();
+ createActions();
+
+ setAttribute(Qt::WA_QuitOnClose, true);
+ setWindowFlags(Qt::FramelessWindowHint);
+}
+
+agui::~agui() {
+}
+
+/**
+ * @brief This method sets the used Layout.
+ *
+ * This method sets the used Layout. Possible layout are:
+ * - browser mode: only the browser is visible
+ * - debug mode: the screen is divided into the browser and a debug
+ * out console
+ */
+void agui::setupLayout() {
+ // setup layout of the gui: debug split or browser
+ _webView = new QWebView(this);
+ //_webView->setContextMenuPolicy(Qt::NoContextMenu); // if this does not work try Qt::CustomContextMenu
+ _webView->page()->mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff);
+ if (debugMode > -1) {
+ // split main window in browser & debug console
+ Console* debugConsole = new Console(this);
+ QSplitter* _splitter = new QSplitter(Qt::Vertical, this);
+ _splitter->addWidget(_webView);
+ _splitter->addWidget(debugConsole);
+ setCentralWidget(_splitter);
+ } else {
+ setCentralWidget(_webView);
+ }
+
+}
+
+//-------------------------------------------------------------------------------------------
+/**
+ * This method enables a shortcut for closing the program.
+ * The shortcut itself is not configurable: CTRL + X
+ */
+void agui::createActions() {
+ _quit = new QAction(tr("&quit"), this);
+ _quit->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_X));
+ this->addAction(_quit);
+ connect(_quit, SIGNAL(triggered()), this, SLOT(close()));
+}
+//-------------------------------------------------------------------------------------------
+void agui::magicKey(const char* key){
+ QFile file("/proc/sysrq-trigger");
+ if (file.open(QIODevice::WriteOnly)) {
+ file.write(key);
+ file.close();
+ } else {
+ LOG4CXX_DEBUG(aguiCoreLogger, "Could not open /proc/sysrq-trigger");
+ }
+}
+
+void agui::rebootSystem() {
+ magicKey("b");
+}
+
+void agui::shutdownSystem() {
+ magicKey("o");
+}
diff --git a/src/fbgui/agui.h b/src/fbgui/agui.h
new file mode 100644
index 0000000..0639981
--- /dev/null
+++ b/src/fbgui/agui.h
@@ -0,0 +1,54 @@
+/*
+ * agui.h
+ *
+ * Created on: Jan 31, 2012
+ * Author: joe
+ */
+
+#ifndef AGUI_H_
+#define AGUI_H_
+
+#include <QtGui>
+#include <QtWebKit>
+
+extern QString logFilePath;
+extern int debugMode;
+
+class agui: public QMainWindow
+{
+ Q_OBJECT
+
+public:
+ agui();
+ virtual ~agui();
+
+protected:
+ // QWebView for displaying internet content
+ QWebView* _webView;
+ //-------------------
+ // layout setup:
+ //-------------------
+ // Sets the layout depending on the debug mode:
+ // no debug or debugMode = 0 -> only browser shown.
+ // debugMode = 1 -> split main window in browser and debug console.
+ void setupLayout();
+ // Create all actions for the GUI. (Currently only quit.)
+ void createActions();
+
+ //------------------
+ // action list:
+ //------------------
+ // closes the main window provoking the application to quit.
+ QAction* _quit;
+
+private:
+ void magicKey(const char*);
+
+protected slots:
+ // shut off the system
+ void shutdownSystem();
+ // reboot the system
+ void rebootSystem();
+};
+
+#endif /* AGUI_H_ */
diff --git a/src/fbgui/console.cpp b/src/fbgui/console.cpp
new file mode 100644
index 0000000..b4fcddf
--- /dev/null
+++ b/src/fbgui/console.cpp
@@ -0,0 +1,60 @@
+/*
+ * console.cpp
+ *
+ * Created on: Jan 31, 2012
+ * Author: joe
+ */
+
+#include "console.h"
+
+Console::Console(QMainWindow* parent) :
+ QTextEdit(parent) {
+
+ setWindowFlags(Qt::FramelessWindowHint);
+
+ // fanciness
+ QPalette pal;
+ pal.setColor(QPalette::Base, Qt::black);
+ setPalette(pal);
+ setTextColor(Qt::white);
+
+ // CTRL + D toggles debug window
+ QAction* _toggle = new QAction(tr("&toggleDebug"), parentWidget());
+ _toggle->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_D));
+ parentWidget()->addAction(_toggle);
+ connect(_toggle, SIGNAL(triggered()), this, SLOT(toggle()));
+
+ // watcher to detect file change
+ QFileSystemWatcher* _watcher = new QFileSystemWatcher(this);
+ // read from log file
+ _logFile = new QFile(logFilePath);
+ _logFileIn = new QTextStream(_logFile);
+
+ if (!_logFile->open(QFile::ReadOnly | QFile::Text)) {
+ } else {
+ // watch log file
+ _watcher->addPath(logFilePath);
+ connect(_watcher, SIGNAL(fileChanged(const QString&)), this,
+ SLOT(refresh(const QString&)));
+ }
+}
+
+Console::~Console() {
+ delete _logFile;
+ delete _logFileIn;
+}
+
+void Console::refresh(const QString& fileName) {
+ if (fileName == logFilePath) {
+ while (!_logFileIn->atEnd()) {
+ QString line = _logFileIn->readLine();
+ if (!line.isEmpty())
+ this->append(line);
+ }
+ this->moveCursor(QTextCursor::End);
+ }
+}
+
+void Console::toggle() {
+ (this->isVisible()) ? this->hide() : this->show();
+}
diff --git a/src/fbgui/console.h b/src/fbgui/console.h
new file mode 100644
index 0000000..bc6ec50
--- /dev/null
+++ b/src/fbgui/console.h
@@ -0,0 +1,32 @@
+/*
+ * console.h
+ *
+ * Created on: Jan 31, 2012
+ * Author: joe
+ */
+
+#ifndef CONSOLE_H_
+#define CONSOLE_H_
+
+#include "fbgui.h"
+#include <QtGui>
+
+extern QString logFilePath;
+
+class Console : public QTextEdit
+{
+ Q_OBJECT
+
+public:
+ Console(QMainWindow* parent = 0);
+ virtual ~Console();
+
+private:
+ QFile* _logFile;
+ QTextStream* _logFileIn;
+private slots:
+ void toggle();
+ void refresh(const QString& fileName);
+};
+
+#endif /* CONSOLE_H_ */
diff --git a/src/fbgui/fbgui.cpp b/src/fbgui/fbgui.cpp
index 2adcca3..b4a8a13 100644
--- a/src/fbgui/fbgui.cpp
+++ b/src/fbgui/fbgui.cpp
@@ -11,13 +11,11 @@ using namespace log4cxx;
using namespace log4cxx::helpers;
LoggerPtr coreLogger(Logger::getLogger("fbgui.core"));
-
#include <iostream>
#include <QThread>
#include <QtWebKit>
QThread dmThread;
-QString logFilePath("");
QString ipConfigFilePath("");
QString binPath("");
QUrl baseURL("");
@@ -27,7 +25,8 @@ QString fileToTriggerURL("");
QString serialLocation("");
QString sessionID("");
bool sslSupport;
-int debugMode = -1;
+//int debugMode=-1;
+//QString logFilePath("");
//-------------------------------------------------------------------------------------------
/**
@@ -40,14 +39,13 @@ int debugMode = -1;
* @see JavascriptInterface
* @see DownloadManager
*/
-fbgui::fbgui() {
+fbgui::fbgui() :
+ agui(){
}
-fbgui::~fbgui() {
+fbgui::~fbgui(){
dmThread.quit();
}
-
-
/**
* init function.
*/
@@ -58,17 +56,12 @@ void fbgui::init() {
if(sslSupport)
LOG4CXX_DEBUG(coreLogger, "SSL enabled.");
- _watcher = new QFileSystemWatcher(this);
-
- setupLayout();
- createActions();
-
// initialize javascript interface
JavascriptInterface* jsi = new JavascriptInterface(
_webView->page()->mainFrame());
QObject::connect(jsi, SIGNAL(quitFbgui()), this, SLOT(close()));
QObject::connect(jsi, SIGNAL(shutDownClient()), this,
- SLOT(performShutDown()));
+ SLOT(shutdownSystem()));
QObject::connect(_webView->page()->mainFrame(), SIGNAL(
javaScriptWindowObjectCleared()), jsi, SLOT(attachToDOM()));
@@ -93,118 +86,11 @@ void fbgui::init() {
dm->moveToThread(&dmThread);
dmThread.start();
- // show "waiting for internet" page until triggered.
-// if (debugMode > -1) {
-// _webView->load(QUrl("qrc:/html/preload-debug.html"));
-// } else {
-// _webView->load(QUrl("qrc:/html/preload.html"));
-// }
-
- // watcher is not needed anymore since we guarantee internet connection with the networkDiscovery.
- // start watching for fileToTriggerURL
- //watchForTrigger();
loadURL();
// set properties
setWindowTitle("fbgui");
- setAttribute(Qt::WA_QuitOnClose, true);
- setWindowFlags(Qt::FramelessWindowHint);
showFullScreen();
- this->show();
-}
-//-------------------------------------------------------------------------------------------
-// Layout / actions setup
-//-------------------------------------------------------------------------------------------
-/**
- * This method sets the used Layout.
- *
- * This method sets the used Layout. Possible layout are:
- * - browser mode: only the browser is visible
- * - debug mode: the screen is divided into the browser and a debug
- * out console
- */
-void fbgui::setupLayout() {
- // setup layout of the gui: debug split or browser
- _webView = new QWebView(this);
- if (debugMode == 1) {
- // split main window in browser & debug console
- createDebugConsole();
- _splitter = new QSplitter(Qt::Vertical, this);
- _splitter->addWidget(_webView);
- _splitter->addWidget(_debugConsole);
- setCentralWidget(_splitter);
- } else
- setCentralWidget(_webView);
-}
-//-------------------------------------------------------------------------------------------
-/**
- * This method enables a shortcut for closing the program.
- * The shortcut itself is not configurable: CTRL + X
- */
-void fbgui::createActions() {
- _quit = new QAction(tr("&quit"), this);
- _quit->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_X));
- this->addAction(_quit);
- connect(_quit, SIGNAL(triggered()), this, SLOT(close()));
-}
-//-------------------------------------------------------------------------------------------
-// File system watching
-//-------------------------------------------------------------------------------------------
-/**
- * This method sets a "watchdog" to a special file.
- *
- * This method sets a "watchdog" to a special file. If needed it creates the
- * file which it has to watch over. It than connects a QFileSystemWatcher with
- * this file. If changes happen to this file, the
- * fbgui::checkForTrigger(const QString& dirname) method will be called.
- *
- */
-void fbgui::watchForTrigger() {
- // check if fileToTriggerURL already exists
- QFile file(fileToTriggerURL);
- if (file.exists()) {
- LOG4CXX_DEBUG(coreLogger, "[watcher] " << fileToTriggerURL << " found.");
- // try to load URL
- loadURL();
- } else {
- // create it
- if (file.open(QIODevice::WriteOnly)) {
- LOG4CXX_DEBUG(coreLogger, "Created: " << fileToTriggerURL);
- file.close();
- } else {
- LOG4CXX_DEBUG(coreLogger, "Creation of " << fileToTriggerURL << " failed!");
- LOG4CXX_DEBUG(coreLogger, "Exiting in 5 seconds...");
- QTimer::singleShot(5000, this, SLOT(close()));
- }
- }
- // watch the path to trigger file
- LOG4CXX_DEBUG(coreLogger, "[watcher] Watching " << fileToTriggerURL);
- _watcher->addPath(fileToTriggerURL);
- //_watcher = new QFileSystemWatcher(QStringList(fileToTriggerURL, logFilePath), this);
-QObject::connect(_watcher, SIGNAL(fileChanged(const QString&)), this, SLOT(prepareURLLoad(const QString&)));
-
-}
-//-------------------------------------------------------------------------------------------
-/**
- * This method checks if the trigger was valid.
- *
- * This method checks if the trigger was valid. If yes,
- * we have received an IP Address an can load the main screen.
- * If not, something some error happened.
- *
- * @see fbgui::checkHost()
- * @see fbgui::loadURL()
- */
-void fbgui::prepareURLLoad(const QString& fileName) {
- if (fileName == fileToTriggerURL) {
- LOG4CXX_DEBUG(coreLogger, "[watcher] " << fileToTriggerURL << " changed!");
- // disconnect _watcher, his job is done
- LOG4CXX_DEBUG(coreLogger, "[watcher] disconnected.");
- _watcher->disconnect(this);
- _watcher->deleteLater();
- // try to load URL
- loadURL();
- }
}
//-------------------------------------------------------------------------------------------
// Preparations for URL load
@@ -418,57 +304,6 @@ QByteArray fbgui::generatePOSTData() {
LOG4CXX_DEBUG(coreLogger, "[post] POST data: " << postData);
return postData;
}
-
-//-------------------------------------------------------------------------------------------
-// Shutdown / Reboot of the client
-//-------------------------------------------------------------------------------------------
-// TODO One function for reboot and shutdown, with parameter for the action.
-// for example: doSystemCall(_REBOOT_);
-/**
- * This method performs the shutdown of the client.
- *
- * This method performs the shutdown of the client. It is triggered by the
- * JavascriptInterface::shutDownClient() signal which will be emited in the
- * JavascriptInterface::shutDown() method.
- * This method writes the character 'o' in /proc/sysrq-trigger
- * which will shutdown the computer immediatly.
- * (See linux magic keys)
- *
- * @see JavascriptInterface::shutDownClient()
- * @see JavascriptInterface::shutDown()
- */
-void fbgui::performShutDown() {
- QFile file("/proc/sysrq-trigger");
- if (file.open(QIODevice::WriteOnly)) {
- file.write("o");
- file.close();
- } else {
- LOG4CXX_DEBUG(coreLogger, "Could not open /proc/sysrq-trigger");
- }
-}
-//-------------------------------------------------------------------------------------------
-/**
- * This method performs the reboot of the client.
- *
- * This method performs the reboot of the client. It is triggered by the
- * JavascriptInterface::rebootClient() signal which will be emited in the
- * JavascriptInterface::reboot() method.
- * This method writes the character 'b' in /proc/sysrq-trigger
- * which will shutdown the computer immediatly.
- * (See linux magic keys)
- *
- * @see JavascriptInterface::rebootClient()
- * @see JavascriptInterface::reboot()
- */
-void fbgui::performReboot() {
- QFile file("/proc/sysrq-trigger");
- if (file.open(QIODevice::WriteOnly)) {
- file.write("b");
- file.close();
- } else {
- LOG4CXX_DEBUG(coreLogger, "Could not open /proc/sysrq-trigger");
- }
-}
//-------------------------------------------------------------------------------------------
// Preparing Kernel Switch per kexec (initiating Stage 3)
//-------------------------------------------------------------------------------------------
@@ -563,65 +398,3 @@ void fbgui::runKexec() {
//TODO: Handle failure properly...
}
}
-//-------------------------------------------------------------------------------------------
-// Debug console setup / control
-//-------------------------------------------------------------------------------------------
-/**
- * This method creates a debug console as a widget.
- *
- * It is basicly a QTextEdit widget as provided by QT's Framework.
- * An action to toggle this widget is implemented (CTRL + D).
- *
- * @see fbgui::toggleDebugConsole()
- */
-void fbgui::createDebugConsole() {
- // create the debug console widget
- _debugConsole = new QTextEdit(this);
- _debugConsole->setWindowFlags(Qt::FramelessWindowHint);
- // fanciness
- QPalette pal;
- pal.setColor(QPalette::Base, Qt::black);
- _debugConsole->setPalette(pal);
- _debugConsole->setTextColor(Qt::white);
- // CTRL + D toggles debug window
- _toggleDebugConsole = new QAction(tr("&toggleDebug"), this);
- _toggleDebugConsole->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_D));
- addAction(_toggleDebugConsole);
- connect(_toggleDebugConsole, SIGNAL(triggered()),
- this, SLOT(toggleDebugConsole()));
-
- // read from log file
- _logFile = new QFile(logFilePath);
- _logFileIn = new QTextStream(_logFile);
-
- if (!_logFile->open(QFile::ReadOnly | QFile::Text)) {
- //do error
- }
- _debugConsole->setPlainText(_logFileIn->readAll());
- _debugConsole->moveCursor(QTextCursor::End);
- LOG4CXX_DEBUG(coreLogger, "Log file opened.");
- // watch log file
- _watcher->addPath(logFilePath);
- QObject::connect(_watcher, SIGNAL(fileChanged(const QString&)), this, SLOT(refreshDebugConsole(const QString&)));
-
-}
-//-------------------------------------------------------------------------------------------
-void fbgui::refreshDebugConsole(const QString& fileName) {
- if (fileName == logFilePath) {
- while (!_logFileIn->atEnd()) {
- _debugConsole->append(_logFileIn->readLine());
- }
- _debugConsole->moveCursor(QTextCursor::End);
- }
-}
-//-------------------------------------------------------------------------------------------
-/**
- * This method toggles the debug console.
- *
- * Toggle the visibility of the debug console if the action _toggleDebugConsole is triggered.
- *
- * @see fbgui::createDebugConsole()
- */
-void fbgui::toggleDebugConsole() {
- (_debugConsole->isVisible()) ? _debugConsole->hide() : _debugConsole->show();
-}
diff --git a/src/fbgui/fbgui.h b/src/fbgui/fbgui.h
index 0c8d7d6..5fa4323 100644
--- a/src/fbgui/fbgui.h
+++ b/src/fbgui/fbgui.h
@@ -23,6 +23,8 @@
#include <QtGui>
#include <QtWebKit>
+#include "agui.h"
+
// Internal default settings
#define DEFAULT_URL "http://www.google.com"
#define DEFAULT_DOWNLOAD_DIR "/tmp/fbgui"
@@ -45,9 +47,10 @@ extern QString downloadPath;
extern QUrl baseURL;
extern int debugMode;
extern int updateInterval;
+extern QString interfaceName;
extern bool sslSupport;
-class fbgui: public QMainWindow
+class fbgui : public agui
{
Q_OBJECT
@@ -59,26 +62,6 @@ public slots:
void init();
private:
- //-------------------
- // layout setup:
- //-------------------
- // Sets the layout depending on the debug mode:
- // no debug or debugMode = 0 -> only browser shown.
- // debugMode = 1 -> split main window in browser and debug console.
- void setupLayout();
- // Create all actions for the GUI. (Currently only quit.)
- void createActions();
- // Create a debug console widget as QTextEdit in order to print debug messages
- // directly within the GUI. This was needed since ttys can't really be used
- // for debugging purposes in the preboot environment.
- void createDebugConsole();
-
- //----------------------------------------
- // control the display of components:
- //----------------------------------------
- // watches for the file triggering the loading of the URL.
- // the file can be specified by the corresponding option.
- void watchForTrigger();
bool checkHost() const;
void loadURL();
@@ -87,41 +70,11 @@ private:
QByteArray generatePOSTData();
- //----------------------------------
- // widgets constituing the gui:
- //----------------------------------
- // QWebView for displaying internet content
- QWebView* _webView;
// QNetworkRequest for the Network Request
QNetworkRequest* _qnr;
// List for expected SSL Errors, like selfsigned certificate error
QList<QSslError> _expectedSslErrors;
- // QSplitter to split the main window in two resizable frames.
- QSplitter* _splitter;
- // QTextEdit implementing a minimalistic debug console.
- QTextEdit* _debugConsole;
-
- //------------------
- // action list:
- //------------------
- // closes the main window provoking the application to quit.
- QAction* _quit;
- // triggers toggleDebugConsole()
- QAction* _toggleDebugConsole;
-
- // watcher to detect changes in the observed directory.
- QFileSystemWatcher* _watcher;
- QFile* _logFile;
- QTextStream* _logFileIn;
-
private slots:
- // toggles debug console when action _toggleDebugConsole happens.
- void toggleDebugConsole();
- void refreshDebugConsole(const QString&);
-
- // This function is triggered by fileChanged Signal of _watcher.
- // It deletes _watcher, since we don't need it anymore and tries to load URL.
- void prepareURLLoad(const QString&);
void loadURLDone(bool success);
//SSL Error Handler for SSL Requests
@@ -138,12 +91,6 @@ private slots:
//Sets PrivateKey in QSslConfiguration
void setPrivateKey(const QSslKey &);
-
- // shut off the system
- void performShutDown();
- // reboot the system
- void performReboot();
- // shows "loading system" page
void loadSystem();
// prepares kexec by loading downloaded initramfs, kernel into kexec
void prepareKexec();
diff --git a/src/fbgui/html/js/networkDiscovery.js b/src/fbgui/html/js/networkDiscovery.js
index 10b4f19..d1ffad4 100644
--- a/src/fbgui/html/js/networkDiscovery.js
+++ b/src/fbgui/html/js/networkDiscovery.js
@@ -186,7 +186,7 @@ var abortBootDialog = function (m) {
showLog(text);},
"Restart": function() {fbgui.restartSystem();
$(this).dialog("close"); },
- "Shut Down": function() { fbgui.shutDownSystem();
+ "Shut Down": function() { fbgui.shutdownSystem();
$(this).dialog("close"); },
"Try Again": function() {fbgui.tryAgain();
$(this).dialog("close"); }
@@ -221,7 +221,7 @@ var chooseInterfaceDialog = function (i) {
showLog(text);},
"Restart": function() {fbgui.restartSystem();
$(this).dialog("close"); },
- "Shut Down": function() { fbgui.shutDownSystem();
+ "Shut Down": function() { fbgui.shutdownSystem();
$(this).dialog("close"); },
"Continue": function() {
var ifName = $("#nd_ifName_select :selected").text();
diff --git a/src/fbgui/interfaceconfiguration.cpp b/src/fbgui/interfaceconfiguration.cpp
index 3d09e52..d9d72df 100644
--- a/src/fbgui/interfaceconfiguration.cpp
+++ b/src/fbgui/interfaceconfiguration.cpp
@@ -12,6 +12,13 @@
#include "interfaceconfiguration.h"
+#include <log4cxx/logger.h>
+#include "qlog4cxx.h"
+
+using namespace log4cxx;
+using namespace log4cxx::helpers;
+LoggerPtr ndifLogger(Logger::getLogger("fbgui.nd.ifconf"));
+
interfaceconfiguration::interfaceconfiguration() {
_tag = "[nd:InterfaceConfiguration]";
}
@@ -34,10 +41,10 @@ bool interfaceconfiguration::readConfigOutOfFile(QString pathToConfig) {
QFile file(pathToConfig);
if (file.exists()) {
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
- qDebug() << _tag << "couldn't open file:" << pathToConfig;
+ LOG4CXX_DEBUG(ndifLogger, _tag << "couldn't open file:" << pathToConfig);
return false;
}
- qDebug() << _tag << "read config file";
+ LOG4CXX_DEBUG(ndifLogger, _tag << "read config file");
while (!file.atEnd()) {
QString line(file.readLine());
QStringList splitedLine = line.split("=");
@@ -74,11 +81,11 @@ bool interfaceconfiguration::readConfigOutOfFile(QString pathToConfig) {
} else if (name.compare("DHCPCHADDR") == 0) {
this->dhcpchaddr = values;
} else {
- qDebug() << _tag << "read unknown name" << name << values;
+ LOG4CXX_DEBUG(ndifLogger, _tag << "read unknown name" << name << values);
}
}
} else {
- qDebug() << _tag << "file doesn't exist:" << pathToConfig;
+ LOG4CXX_DEBUG(ndifLogger, _tag << "file doesn't exist:" << pathToConfig);
return false;
}
return true;
diff --git a/src/fbgui/javascriptinterface.cpp b/src/fbgui/javascriptinterface.cpp
index 3afd3f6..8260fab 100644
--- a/src/fbgui/javascriptinterface.cpp
+++ b/src/fbgui/javascriptinterface.cpp
@@ -229,16 +229,3 @@ void JavascriptInterface::callbackOnFinished() {
QString code = QString("\%1").arg(_callbackOnDownloadsFinished);
_parent->evaluateJavaScript(code);
}
-//-------------------------------------------------------------------------------------------------------
-/**
- * This method triggers the URL load *FOR DEBUGGING/TESTING PURPOSES*
-
- */
-void JavascriptInterface::trigger() {
- QFile file(fileToTriggerURL);
- if (file.open(QIODevice::WriteOnly)) {
- file.write("data\n");
- LOG4CXX_DEBUG(jsiLogger, "*trigger watcher*");
- }
- file.close();
-}
diff --git a/src/fbgui/javascriptinterface.h b/src/fbgui/javascriptinterface.h
index 5d45964..b15c134 100644
--- a/src/fbgui/javascriptinterface.h
+++ b/src/fbgui/javascriptinterface.h
@@ -66,8 +66,6 @@ public slots:
void downloadInfo(const QString& filename, const double& filesize);
void notify(const QString& msg);
- // functions to help test functionality
- void trigger();
};
#endif // JAVASCRIPTINTERFACE_H_
diff --git a/src/fbgui/main.cpp b/src/fbgui/main.cpp
index 0a36f32..c83dbdc 100644
--- a/src/fbgui/main.cpp
+++ b/src/fbgui/main.cpp
@@ -20,167 +20,173 @@ using namespace log4cxx::helpers;
LoggerPtr logger(Logger::getLogger("fbgui"));
void printHelp() {
- QTextStream qout(stdout);
- qout << QObject::tr("Usage: ./fbgui [OPTIONS]") << endl;
- qout << QObject::tr("Options:") << endl;
- qout << "-c <path>, --config=<path> " << QObject::tr(
- "Path to configuration file.") << endl;
- qout << "-u <URL>, --url=<URL> " << QObject::tr(
- "Sets the URL to be loaded.") << endl;
- qout << "-d <path>, --download=<path> " << QObject::tr(
- "Specify the download directory.") << endl;
- qout << "-t <path, --trigger=<path> " << QObject::tr(
- "Specify location of the file triggering the URL load.") << endl;
- qout << "-s <path, --serial=<path> " << QObject::tr(
- "Specify location of the file containing the serial number.") << endl;
- qout << "-D <level>, --debug=<level> " << QObject::tr(
- "Activate debug mode. [0,1]") << endl;
- qout << "-h, --help " << QObject::tr(
- "Prints this help.") << endl;
+ QTextStream qout(stdout);
+ qout << QObject::tr("Usage: ./fbgui [OPTIONS]") << endl;
+ qout << QObject::tr("Options:") << endl;
+ qout << "-c <path>, --config=<path> "
+ << QObject::tr("Path to configuration file.") << endl;
+ qout << "-u <URL>, --url=<URL> "
+ << QObject::tr("Sets the URL to be loaded.") << endl;
+ qout << "-d <path>, --download=<path> "
+ << QObject::tr("Specify the download directory.") << endl;
+ qout
+ << "-t <path, --trigger=<path> "
+ << QObject::tr(
+ "Specify location of the file triggering the URL load.")
+ << endl;
+ qout
+ << "-s <path, --serial=<path> "
+ << QObject::tr(
+ "Specify location of the file containing the serial number.")
+ << endl;
qout << "-x, --ssl " << QObject::tr(
"Enables SSL support.") << endl;
- qout.flush();
- exit( EXIT_SUCCESS);
+ qout << "-D <level>, --debug=<level> "
+ << QObject::tr("Activate debug mode. [0,1]") << endl;
+ qout << "-h, --help "
+ << QObject::tr("Prints this help.") << endl;
+ qout.flush();
+ exit(EXIT_SUCCESS);
}
int main(int argc, char *argv[]) {
- // Initialisation of the QApplication:
- // In QT, every application is composed of two separate
- // components: the GUI-Client and the GUI-Server.
- //
- // The third parameter sets the application as the
- // GUI-Server (aswell as the GUI-Client).
-
- QFileInfo loggingConfInfo = QFileInfo(QDir::home(), ".fbgui.logging.conf");
- QString loggingConfigFilePath;
- if (loggingConfInfo.exists())
- loggingConfigFilePath = loggingConfInfo.absoluteFilePath();
- else {
- loggingConfInfo = QFileInfo(QString("/etc/fbgui.logging.conf"));
- if (loggingConfInfo.exists())
- loggingConfigFilePath = loggingConfInfo.absoluteFilePath();
- else
- loggingConfigFilePath = "";
- }
-
- if (loggingConfigFilePath.length() > 0) {
- // BasicConfigurator replaced with PropertyConfigurator.
- PropertyConfigurator::configure(loggingConfigFilePath.toStdString());
- } else {
- BasicConfigurator::configure();
- }
- QApplication app(argc, argv, QApplication::GuiServer);
- app.setOrganizationName("team_projekt_2011");
- app.setApplicationName("prebootGUI");
- binPath = QApplication::applicationDirPath();
-
- QTranslator translator;
- translator.load(":" + QLocale::system().name());
- app.installTranslator(&translator);
-
- // parse command line arguments using getopt
- QMap<QString, QString> clOpts;
- int longIndex = 0;
+ // Initialisation of the QApplication:
+ // In QT, every application is composed of two separate
+ // components: the GUI-Client and the GUI-Server.
+ //
+ // The third parameter sets the application as the
+ // GUI-Server (aswell as the GUI-Client).
+
+ QApplication app(argc, argv, QApplication::GuiServer);
+ app.setOrganizationName("team_projekt_2011");
+ app.setApplicationName("prebootGUI");
+ binPath = QApplication::applicationDirPath();
+
+
+
+ QTranslator translator;
+ translator.load(":" + QLocale::system().name());
+ app.installTranslator(&translator);
+
+
+ // LOG4CXX Logger Init
+ QFileInfo loggingConfInfo = QFileInfo(QDir::home(), ".fbgui.logging.conf");
+ QString loggingConfigFilePath;
+ if (loggingConfInfo.exists())
+ loggingConfigFilePath = loggingConfInfo.absoluteFilePath();
+ else {
+ loggingConfInfo = QFileInfo(QString("/etc/fbgui.logging.conf"));
+ if (loggingConfInfo.exists())
+ loggingConfigFilePath = loggingConfInfo.absoluteFilePath();
+ else
+ loggingConfigFilePath = "";
+ }
+
+ if (loggingConfigFilePath.length() > 0) {
+ // BasicConfigurator replaced with PropertyConfigurator.
+ PropertyConfigurator::configure(loggingConfigFilePath.toStdString());
+ } else {
+ BasicConfigurator::configure();
+ }
+
+
+ // parse command line arguments using getopt
+ QMap<QString, QString> clOpts;
+ int longIndex = 0;
static const char *optString = "c:u:d:s:t:D:hl:nS:p:e:x";
- static const struct option longOpts[] = { { "config", required_argument,
- NULL, 'c' }, { "url", required_argument, NULL, 'u' }, { "download",
- required_argument, NULL, 'd' }, { "serial", required_argument, NULL,
- 's' }, { "trigger", required_argument, NULL, 't' }, { "debug",
- required_argument, NULL, 'D' }, { "help", no_argument, NULL, 'h' }, {
- "log", required_argument, NULL, 'l' },
- { "nd", no_argument, NULL, 'n' }, { "server", required_argument, NULL,
- 'S' }, { "autoup", no_argument, NULL, 'a' }, {
- "socketserverpath", required_argument, NULL, 'p' }, {
+ static const struct option longOpts[] = { { "config", required_argument,
+ NULL, 'c' }, { "url", required_argument, NULL, 'u' }, { "download",
+ required_argument, NULL, 'd' }, { "serial", required_argument, NULL,
+ 's' }, { "trigger", required_argument, NULL, 't' }, { "debug",
+ required_argument, NULL, 'D' }, { "help", no_argument, NULL, 'h' },
+ { "log", required_argument, NULL, 'l' }, { "nd", no_argument, NULL,
+ 'n' }, { "server", required_argument, NULL, 'S' }, {
+ "autoup", no_argument, NULL, 'a' }, { "socketserverpath",
+ required_argument, NULL, 'p' }, { "pathtoexe",
"pathtoexe", required_argument, NULL, 'e' }, { "ssl", no_argument, NULL, 'x' } };
- int opt = getopt_long(argc, argv, optString, longOpts, &longIndex);
- while (opt != -1) {
- switch (opt) {
- case 'c':
- clOpts.insert("configFile", optarg);
- break;
- case 'l':
- clOpts.insert("logFile", optarg);
- break;
- case 'u':
- clOpts.insert("url", optarg);
- break;
- case 'd':
- clOpts.insert("downloadDir", optarg);
- break;
- case 's':
- clOpts.insert("serialLocation", optarg);
- break;
- case 't':
- clOpts.insert("trigger", optarg);
- break;
- case 'D':
- clOpts.insert("debug", optarg);
- break;
- case 'h':
- clOpts.insert("help", "help");
- break;
- case 'n':
- clOpts.insert("nd", "nd");
- break;
- case 'S':
- clOpts.insert("server", optarg);
- break;
- case 'a':
- clOpts.insert("autoup", "autoup");
- break;
- case 'p':
- clOpts.insert("socketserverpath", optarg);
- break;
- case 'e':
- clOpts.insert("pathtoexe", optarg);
- break;
+ int opt = getopt_long(argc, argv, optString, longOpts, &longIndex);
+ while (opt != -1) {
+ switch (opt) {
+ case 'c':
+ clOpts.insert("configFile", optarg);
+ break;
+ case 'l':
+ clOpts.insert("logFile", optarg);
+ break;
+ case 'u':
+ clOpts.insert("url", optarg);
+ break;
+ case 'd':
+ clOpts.insert("downloadDir", optarg);
+ break;
+ case 's':
+ clOpts.insert("serialLocation", optarg);
+ break;
+ case 't':
+ clOpts.insert("trigger", optarg);
+ break;
+ case 'D':
+ clOpts.insert("debug", optarg);
+ break;
+ case 'h':
+ clOpts.insert("help", "help");
+ break;
+ case 'n':
+ clOpts.insert("nd", "nd");
+ break;
+ case 'S':
+ clOpts.insert("server", optarg);
+ break;
+ case 'a':
+ clOpts.insert("autoup", "autoup");
+ break;
+ case 'p':
+ clOpts.insert("socketserverpath", optarg);
+ break;
+ case 'e':
+ clOpts.insert("pathtoexe", optarg);
+ break;
case 'x':
clOpts.insert("ssl", "ssl");
break;
- }
- opt = getopt_long(argc, argv, optString, longOpts, &longIndex);
- }
-
- if (clOpts.contains("help"))
- printHelp();
-
- if (clOpts.contains("debug")) {
- debugMode = clOpts.value("debug").toInt();
- // start basic debug output on terminal
- // qxtLog->disableLoggerEngine("DEFAULT");
- // qxtLog->enableLogLevels(QxtLogger::DebugLevel);
- // qxtLog->addLoggerEngine("std_logger", new LoggerEngine_std);
- // qxtLog->initLoggerEngine("std_logger");
- // qxtLog->setMinimumLevel("std_logger", QxtLogger::DebugLevel);
- } else
- debugMode = -1;
-
- // look for config file either in:
- // - the path found in the configuration file
- // - the user's home directory (as .fbgui.conf)
- // - /etc/fbgui.conf
-
- QString configFilePath;
- QFileInfo confInfo;
- if (clOpts.contains("configFile"))
- configFilePath = clOpts.value("configFile");
- else {
- confInfo = QFileInfo(QDir::home(), ".fbgui.conf");
- if (confInfo.exists())
- configFilePath = confInfo.absoluteFilePath();
- else {
- confInfo = QFileInfo(QString("/etc/fbgui.conf"));
- if (confInfo.exists())
- configFilePath = QString("/etc/fbgui.conf");
- else
- configFilePath = DEFAULT_CONFIG_PATH;
- }
- }
-
- // read the config file
- QSettings confFileSettings(configFilePath, QSettings::IniFormat);
- confFileSettings.setIniCodec("UTF-8");
+ }
+ opt = getopt_long(argc, argv, optString, longOpts, &longIndex);
+ }
+
+ if (clOpts.contains("help"))
+ printHelp();
+
+ if (clOpts.contains("debug")) {
+ debugMode = clOpts.value("debug").toInt();
+ } else
+ debugMode = -1;
+
+ // look for config file either in:
+ // - the path found in the configuration file
+ // - the user's home directory (as .fbgui.conf)
+ // - /etc/fbgui.conf
+
+ QString configFilePath;
+ QFileInfo confInfo;
+ if (clOpts.contains("configFile"))
+ configFilePath = clOpts.value("configFile");
+ else {
+ confInfo = QFileInfo(QDir::home(), ".fbgui.conf");
+ if (confInfo.exists())
+ configFilePath = confInfo.absoluteFilePath();
+ else {
+ confInfo = QFileInfo(QString("/etc/fbgui.conf"));
+ if (confInfo.exists())
+ configFilePath = QString("/etc/fbgui.conf");
+ else
+ configFilePath = DEFAULT_CONFIG_PATH;
+ }
+ }
+
+ // read the config file
+ QSettings confFileSettings(configFilePath, QSettings::IniFormat);
+ confFileSettings.setIniCodec("UTF-8");
// set SSL support
if (clOpts.contains("ssl"))
@@ -190,149 +196,143 @@ int main(int argc, char *argv[]) {
else
sslSupport = DEFAULT_SSL_SUPPORT;
- // set base URL to be loaded
- if (clOpts.contains("url"))
- baseURL = QUrl(clOpts.value("url"));
+ // set base URL to be loaded
+ if (clOpts.contains("url"))
+ baseURL = QUrl(clOpts.value("url"));
else if (confFileSettings.contains("default/pbs_url")){
- baseURL = confFileSettings.value("default/pbs_url").toUrl();
+ baseURL = confFileSettings.value("default/pbs_url").toUrl();
}
- else
- baseURL = DEFAULT_URL;
+ else
+ baseURL = DEFAULT_URL;
if(sslSupport)
baseURL.setScheme("https");
- // set directory for downloads
- if (clOpts.contains("downloadDir"))
- downloadPath = clOpts.value("downloadDir");
- else if (confFileSettings.contains("default/download_directory"))
- downloadPath
- = confFileSettings.value("default/download_directory").toString();
- else
- downloadPath = DEFAULT_DOWNLOAD_DIR;
-
- // set update interval for download progress functions of download manager.
- if (confFileSettings.contains("default/update_interval"))
- updateInterval
- = confFileSettings.value("default/update_interval").toInt();
- else
- updateInterval = DEFAULT_UPDATE_INTERVAL;
-
- // set which file to watch to trigger loading of URL
- if (clOpts.contains("trigger"))
- fileToTriggerURL = clOpts.value("trigger");
- else if (confFileSettings.contains("default/file_trigger"))
- fileToTriggerURL
- = confFileSettings.value("default/file_trigger").toString();
- else
- fileToTriggerURL = DEFAULT_FILE_TRIGGER;
-
- // set serial location
- if (clOpts.contains("serialLocation"))
- serialLocation = clOpts.value("serialLocation");
- else if (confFileSettings.contains("default/serial_location"))
- serialLocation
- = confFileSettings.value("default/serial_location").toString();
- else
- serialLocation = QString("/serial"); // tests
-
- // save ip config location (file generated by uchpc)
- if (confFileSettings.contains("default/ip_config"))
- ipConfigFilePath = confFileSettings.value("default/ip_config").toString();
-
- // save path to log file
- if (clOpts.contains("logFile"))
- logFilePath = clOpts.value("logFile");
- else if (confFileSettings.contains("default/log_file"))
- logFilePath = confFileSettings.value("default/log_file").toString();
- else
- logFilePath = DEFAULT_LOG_FILE_PATH;
-
- //
- if (clOpts.contains("server"))
- gServerIp = clOpts.value("server");
- else if (confFileSettings.contains("default/server"))
- gServerIp = confFileSettings.value("default/server").toString();
- else
- gServerIp = "209.85.148.105"; //that is a google server. change this to a proper default address
-
- //
- if (clOpts.contains("autoup"))
- gAutoUp = true;
- else if (confFileSettings.contains("default/autoup"))
- gAutoUp = confFileSettings.value("default/autoup").toBool();
- else
- gAutoUp = false;
-
- //
- if (clOpts.contains("socketserverpath"))
- gSocketServerPath = clOpts.value("socketserverpath");
- else if (confFileSettings.contains("default/socketserverpath"))
- gSocketServerPath
- = confFileSettings.value("default/socketserverpath").toString();
- else
- gSocketServerPath = DEFAULT_QTSOCKETADDRESS;
-
- //
- if (clOpts.contains("pathtoexe"))
- gPathToDhcpExe = clOpts.value("pathtoexe");
- else if (confFileSettings.contains("default/pathtoexe"))
- gPathToDhcpExe = confFileSettings.value("default/pathtoexe").toString();
- else
- gPathToDhcpExe = DEFAULT_PATHTODHCPCDEXE;
-
- // write always a log file
- // // activate file logger if debug mode activated.
- // if (debugMode > -1) {
- // start debug logging to file.
- // qxtLog->addLoggerEngine("file_logger", new LoggerEngine_file(logFilePath));
- // qxtLog->setMinimumLevel("file_logger", QxtLogger::DebugLevel);
- // }
-
- // print config
- LOG4CXX_DEBUG(logger, "************* CONFIG INFO *************");
- LOG4CXX_DEBUG(logger, "configFilePath: " << configFilePath);
- LOG4CXX_DEBUG(logger, "logFilePath: " << logFilePath);
- LOG4CXX_DEBUG(logger, "ipConfigFilePath: " << ipConfigFilePath);
- LOG4CXX_DEBUG(logger, "baseURL: " << baseURL.toString());
- LOG4CXX_DEBUG(logger, "downloadDir : " << downloadPath);
- LOG4CXX_DEBUG(logger, "trigger: " << fileToTriggerURL);
- LOG4CXX_DEBUG(logger, "serialLocation: " << serialLocation);
+ // set directory for downloads
+ if (clOpts.contains("downloadDir"))
+ downloadPath = clOpts.value("downloadDir");
+ else if (confFileSettings.contains("default/download_directory"))
+ downloadPath =
+ confFileSettings.value("default/download_directory").toString();
+ else
+ downloadPath = DEFAULT_DOWNLOAD_DIR;
+
+ // set update interval for download progress functions of download manager.
+ if (confFileSettings.contains("default/update_interval"))
+ updateInterval =
+ confFileSettings.value("default/update_interval").toInt();
+ else
+ updateInterval = DEFAULT_UPDATE_INTERVAL;
+
+ // set which file to watch to trigger loading of URL
+ if (clOpts.contains("trigger"))
+ fileToTriggerURL = clOpts.value("trigger");
+ else if (confFileSettings.contains("default/file_trigger"))
+ fileToTriggerURL =
+ confFileSettings.value("default/file_trigger").toString();
+ else
+ fileToTriggerURL = DEFAULT_FILE_TRIGGER;
+
+ // set serial location
+ if (clOpts.contains("serialLocation"))
+ serialLocation = clOpts.value("serialLocation");
+ else if (confFileSettings.contains("default/serial_location"))
+ serialLocation =
+ confFileSettings.value("default/serial_location").toString();
+ else
+ serialLocation = QString("/serial"); // tests
+
+ // save ip config location (file generated by uchpc)
+ if (confFileSettings.contains("default/ip_config"))
+ ipConfigFilePath =
+ confFileSettings.value("default/ip_config").toString();
+
+ // save path to log file
+ if (clOpts.contains("logFile"))
+ logFilePath = clOpts.value("logFile");
+ else if (confFileSettings.contains("default/log_file"))
+ logFilePath = confFileSettings.value("default/log_file").toString();
+ else
+ logFilePath = DEFAULT_LOG_FILE_PATH;
+
+ //
+ if (clOpts.contains("server"))
+ gServerIp = clOpts.value("server");
+ else if (confFileSettings.contains("default/server"))
+ gServerIp = confFileSettings.value("default/server").toString();
+ else
+ gServerIp = "209.85.148.105"; //that is a google server. change this to a proper default address
+
+ //
+ if (clOpts.contains("autoup"))
+ gAutoUp = true;
+ else if (confFileSettings.contains("default/autoup"))
+ gAutoUp = confFileSettings.value("default/autoup").toBool();
+ else
+ gAutoUp = false;
+
+ //
+ if (clOpts.contains("socketserverpath"))
+ gSocketServerPath = clOpts.value("socketserverpath");
+ else if (confFileSettings.contains("default/socketserverpath"))
+ gSocketServerPath =
+ confFileSettings.value("default/socketserverpath").toString();
+ else
+ gSocketServerPath = DEFAULT_QTSOCKETADDRESS;
+
+ //
+ if (clOpts.contains("pathtoexe"))
+ gPathToDhcpExe = clOpts.value("pathtoexe");
+ else if (confFileSettings.contains("default/pathtoexe"))
+ gPathToDhcpExe = confFileSettings.value("default/pathtoexe").toString();
+ else
+ gPathToDhcpExe = DEFAULT_PATHTODHCPCDEXE;
+
+ // print config
+ LOG4CXX_DEBUG(logger, "************* CONFIG INFO *************");
+ LOG4CXX_DEBUG(logger, "configFilePath: " << configFilePath);
+ LOG4CXX_DEBUG(logger, "logFilePath: " << logFilePath);
+ LOG4CXX_DEBUG(logger, "ipConfigFilePath: " << ipConfigFilePath);
+ LOG4CXX_DEBUG(logger, "baseURL: " << baseURL.toString());
+ LOG4CXX_DEBUG(logger, "downloadDir : " << downloadPath);
+ LOG4CXX_DEBUG(logger, "trigger: " << fileToTriggerURL);
+ LOG4CXX_DEBUG(logger, "serialLocation: " << serialLocation);
LOG4CXX_DEBUG(logger, "ssl: " << sslSupport);
- if (clOpts.contains("nd") || confFileSettings.contains("default/nd")) {
- LOG4CXX_DEBUG(logger, "*******************************************");
- LOG4CXX_DEBUG(logger, "Network Discovery activated:");
- LOG4CXX_DEBUG(logger, "server: " << gServerIp);
- LOG4CXX_DEBUG(logger, "autoup: " << gAutoUp);
- LOG4CXX_DEBUG(logger, "socketserverpath: " << gSocketServerPath);
- LOG4CXX_DEBUG(logger, "pathtoexe: " << gPathToDhcpExe);
- } else {
- LOG4CXX_DEBUG(logger, "Network Discovery deactivated.");
- }
- LOG4CXX_DEBUG(logger, "*******************************************");
-
- // set invisible cursor
- //QWSServer::instance()->setCursorVisible(false);
-
- // set default keyboard / mouse drivers. TODO: fix this, doesn't work...
- //QWSServer::instance()->setDefaultKeyboard("TTY:/dev/tty0");
- //QWSServer::instance()->setDefaultMouse("IntelliMouse:/dev/mice");
-
-
- fbgui gui;
- ndgui ngui;
-
- if (clOpts.contains("nd") || confFileSettings.contains("default/nd")) {
- LOG4CXX_DEBUG(logger, "Initializing ndgui...");
- QObject::connect(&ngui, SIGNAL(initFbgui()), &gui, SLOT(init()));
- ngui.init();
- ngui.show();
- } else {
- gui.init();
- gui.show();
- }
-
- return app.exec();
+ if (clOpts.contains("nd") || confFileSettings.contains("default/nd")) {
+ LOG4CXX_DEBUG(logger, "*******************************************");
+ LOG4CXX_DEBUG(logger, "Network Discovery activated:");
+ LOG4CXX_DEBUG(logger, "server: " << gServerIp);
+ LOG4CXX_DEBUG(logger, "autoup: " << gAutoUp);
+ LOG4CXX_DEBUG(logger, "socketserverpath: " << gSocketServerPath);
+ LOG4CXX_DEBUG(logger, "pathtoexe: " << gPathToDhcpExe);
+ } else {
+ LOG4CXX_DEBUG(logger, "Network Discovery deactivated.");
+ }
+ LOG4CXX_DEBUG(logger, "*******************************************");
+
+ //if (QSslSocket::supportsSsl())
+ // LOG4CXX_DEBUG(logger, "SUPPORT SSL!");
+
+ // set invisible cursor
+ //QWSServer::instance()->setCursorVisible(false);
+
+ // set default keyboard / mouse drivers. TODO: fix this, doesn't work...
+ //QWSServer::instance()->setDefaultKeyboard("TTY:/dev/tty0");
+ //QWSServer::instance()->setDefaultMouse("IntelliMouse:/dev/mice");
+
+ fbgui gui;
+ ndgui ngui;
+
+ if (clOpts.contains("nd") || confFileSettings.contains("default/nd")) {
+ QObject::connect(&ngui, SIGNAL(initFbgui()), &gui, SLOT(init()));
+ ngui.init();
+ ngui.show();
+ } else {
+ gui.init();
+ gui.show();
+ }
+
+ return app.exec();
}
diff --git a/src/fbgui/ndgui.cpp b/src/fbgui/ndgui.cpp
index 4e0b3f6..a95d884 100644
--- a/src/fbgui/ndgui.cpp
+++ b/src/fbgui/ndgui.cpp
@@ -11,7 +11,6 @@
#include "ndgui.h"
-
#include <log4cxx/logger.h>
#include "qlog4cxx.h"
@@ -24,14 +23,14 @@ QString gServerIp("");
bool gAutoUp = true;
QString gSocketServerPath("");
QString gPathToDhcpExe("");
-
+QString interfaceName("");
/**
* constructor
*/
-ndgui::ndgui(QMainWindow *parent) :
- QMainWindow(parent) {
+ndgui::ndgui() :
+ agui() {
}
@@ -41,11 +40,8 @@ ndgui::ndgui(QMainWindow *parent) :
*/
ndgui::~ndgui() {
- delete _debugConsole;
- delete _toggleDebugConsole;
delete _allowUserChoice;
delete _tryAgain;
- delete _webView;
delete _networkDiscovery;
}
@@ -57,13 +53,14 @@ ndgui::~ndgui() {
*/
void ndgui::init() {
+ LOG4CXX_DEBUG(ndLogger, "Initializing ndgui...");
+
_started = false;
_userChoice = false;
_ifNameList.clear();
_manConfList.clear();
- setupLayout();
- createAction();
+ addActions();
_networkDiscovery = new NetworkDiscovery();
connect(_networkDiscovery, SIGNAL(addInterface(const QString &)), this,
@@ -90,101 +87,24 @@ void ndgui::init() {
javaScriptWindowObjectCleared()), this, SLOT(attachToDOM()));
connect(_webView, SIGNAL(loadFinished(bool)), this, SLOT(startSingleShot()));
- setWindowTitle(tr("NetD"));
- setAttribute(Qt::WA_QuitOnClose, true);
- setWindowFlags(Qt::FramelessWindowHint);
- showFullScreen();
if (debugMode > -1) {
_webView->load(QUrl("qrc:html/networkdiscovery_debug.html"));
} else {
_webView->load(QUrl("qrc:html/networkdiscovery.html"));
-
}
- _webView->show();
-}
-
-
-
-/**
- * @brief This method sets the used Layout.
- *
- * This method sets the used Layout. Possible layout are:
- * - browser mode: only the browser is visible
- * - debug mode: the screen is divided into the browser and a debug
- * out console
- */
-void ndgui::setupLayout() {
- // setup layout of the gui: debug split or browser
- _webView = new QWebView(this);
- _webView->setContextMenuPolicy(Qt::NoContextMenu); // if this does not work try Qt::CustomContextMenu
-
- if (debugMode == 1) {
- // split main window in browser & debug console
- createDebugConsole();
- _splitter = new QSplitter(Qt::Vertical, this);
- _splitter->addWidget(_webView);
- _splitter->addWidget(_debugConsole);
- setCentralWidget(_splitter);
- } else {
- _webView->page()->mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff);
- setCentralWidget(_webView);
- }
-}
-
-
-
-/**
- * @brief This method creates a debug console as a widget.
- *
- * It is basicly a QTextEdit widget as provided by QT's Framework.
- * An action to toggle this widget is implemented (CTRL + D).
- *
- * @see fbgui::toggleDebugConsole()
- */
-void ndgui::createDebugConsole() {
- // create the debug console widget
- _debugConsole = new QTextEdit(this);
- _debugConsole->setWindowFlags(Qt::FramelessWindowHint);
- // fanciness
- QPalette pal;
- pal.setColor(QPalette::Base, Qt::black);
- _debugConsole->setPalette(pal);
- _debugConsole->setTextColor(Qt::white);
- // enable custom logger engine
-// qxtLog->addLoggerEngine("fb_logger", new LoggerEngine_fb(_debugConsole));
- //qxtLog->initLoggerEngine("fb_logger");
-// qxtLog->setMinimumLevel("fb_logger", QxtLogger::DebugLevel);
- // CTRL + D toggles debug window
- _toggleDebugConsole = new QAction(tr("&toggleDebug"), this);
- _toggleDebugConsole->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_D));
- addAction(_toggleDebugConsole);
- connect(_toggleDebugConsole, SIGNAL(triggered()), this, SLOT(
- toggleDebugConsole()));
-}
-
-
-
-/**
- * @brief This method toggles the debug console.
- *
- * Toggle the visibility of the debug console if the action _toggleDebugConsole is triggered.
- *
- * @see fbgui::createDebugConsole()
- */
-void ndgui::toggleDebugConsole() {
- (_debugConsole->isVisible()) ? _debugConsole->hide() : _debugConsole->show();
+ setWindowTitle(tr("NetD"));
+ showFullScreen();
}
-
/**
- * @brief Create actions
+ * @brief Add actions
*
- * creates an action which you can trigger with the F5 and F9 Button.
+ * Add actions which you can trigger with the F5 and F9 Button.
*/
-void ndgui::createAction() {
+void ndgui::addActions() {
_allowUserChoice = new QAction(tr("&userChoice"), this);
_allowUserChoice->setShortcut(QKeySequence(Qt::Key_F5));
connect(_allowUserChoice, SIGNAL(triggered()), this, SLOT(setUserChoiceTrue()));
@@ -195,8 +115,6 @@ void ndgui::createAction() {
this->addAction(_tryAgain);
}
-
-
/**
* @brief set userChoice true
*
@@ -259,8 +177,6 @@ void ndgui::handleConnectionEstablished(QString ifName) {
_ifNameList.append(ifName);
}
-
-
/**
* @brief determines if we continue the boot sequence or if we show the chooseInterface or abortBoot dialog
*
@@ -300,43 +216,6 @@ void ndgui::handleAllProcessesFinished() {
}
-
-/**
- * @brief restart the system
- *
- * this method will restart the system.
- * triggered through a button click in the gui.
- */
-void ndgui::restartSystem() {
- QFile file("/proc/sysrq-trigger");
- if (file.open(QIODevice::WriteOnly)) {
- file.write("b");
- file.close();
- } else {
- LOG4CXX_DEBUG(ndLogger, "Could not open /proc/sysrq-trigger");
- }
-}
-
-
-
-/**
- * @brief shut down the system
- *
- * this method will restart the system.
- * triggered through a button click in the gui.
- */
-void ndgui::shutDownSystem() {
- QFile file("/proc/sysrq-trigger");
- if (file.open(QIODevice::WriteOnly)) {
- file.write("o");
- file.close();
- } else {
- LOG4CXX_DEBUG(ndLogger, "Could not open /proc/sysrq-trigger");
- }
-}
-
-
-
/**
* @brief continue the boot sequence
*
@@ -348,6 +227,7 @@ void ndgui::shutDownSystem() {
void ndgui::continueBoot(QString ifName) {
if (_networkDiscovery->checkConnectivity(ifName)) {
LOG4CXX_DEBUG(ndLogger, " continue with interface: " << ifName);
+ interfaceName = ifName;
emit initFbgui();
this->close();
} else {
@@ -358,18 +238,17 @@ void ndgui::continueBoot(QString ifName) {
}
-
/**
* @brief continue the boot sequence without further checking if the connection is still possible.
*/
void ndgui::continueBootWithoutCheck(QString ifName) {
LOG4CXX_DEBUG(ndLogger, " continue with interface: " << ifName);
+ interfaceName = ifName;
emit initFbgui();
this->close();
}
-
/**
* @brief read the log file. Log File will be presented inside of a dialog.
*/
@@ -379,21 +258,15 @@ QString ndgui::readLogFile() {
}
-
/**
* @brief starts the whole application again.
*/
void ndgui::tryAgain() {
LOG4CXX_DEBUG(ndLogger, " try again ");
_networkDiscovery->prepareTryAgain();
- if(debugMode > -1) {
- delete _splitter;
- delete _debugConsole;
- delete _toggleDebugConsole;
- }
delete _allowUserChoice;
delete _tryAgain;
- delete _webView;
+ //delete _webView;
delete _networkDiscovery;
init();
@@ -401,7 +274,6 @@ void ndgui::tryAgain() {
}
-
/*test html gui version*/
/**
diff --git a/src/fbgui/ndgui.h b/src/fbgui/ndgui.h
index 1cb285c..2e214df 100644
--- a/src/fbgui/ndgui.h
+++ b/src/fbgui/ndgui.h
@@ -21,6 +21,7 @@
#include <QVariant>
#include "fbgui.h"
+#include "agui.h"
#include "networkdiscovery.h"
@@ -29,12 +30,12 @@ extern bool gAutoUp;
extern QString gSocketServerPath;
extern QString gPathToDhcpExe;
-class ndgui: public QMainWindow
+class ndgui: public agui
{
Q_OBJECT
public:
- ndgui(QMainWindow *parent = 0);
+ ndgui();
~ndgui();
Q_INVOKABLE QVariantList getManualConfInterfaces();
Q_INVOKABLE int ip4_setManualConfiguration(QVariantMap result);
@@ -49,8 +50,6 @@ public slots:
void chooseInterfaceDialog(QString msg);
void handleAllProcessesFinished();
- void restartSystem();
- void shutDownSystem();
void continueBoot(QString ifName);
void continueBootWithoutCheck(QString ifName);
void tryAgain();
@@ -76,16 +75,14 @@ private slots:
private:
- QString _tag;
+ void addActions();
- void createAction();
+ QString _tag;
bool _userChoice;
bool _started;
- QWebView* _webView;
-
QAction* _allowUserChoice;
QAction* _tryAgain;
@@ -97,21 +94,6 @@ private:
QList<QString> _manConfList;
QString _manualConfInterfaces;
-
- // QSplitter to split the main window in two resizable frames.
- QSplitter* _splitter;
- // QTextEdit implementing a minimalistic debug console.
- QTextEdit* _debugConsole;
-
- // triggers toggleDebugConsole()
- QAction* _toggleDebugConsole;
-
-
- void setupLayout();
- void createDebugConsole();
- void toggleDebugConsole();
-
-
};
#endif // NDGUI_H
diff --git a/src/fbgui/networkdiscovery.cpp b/src/fbgui/networkdiscovery.cpp
index 49aa148..ccefb8a 100644
--- a/src/fbgui/networkdiscovery.cpp
+++ b/src/fbgui/networkdiscovery.cpp
@@ -544,7 +544,7 @@ bool NetworkDiscovery::checkConnectivityViaTcp(QString server) {
/**
* same function as handleNewInput() but with a client as parameter.
*
- * @param cleint
+ * @param client
* a client
*/
void NetworkDiscovery::handleNewInput(QLocalSocket * client) {
@@ -553,7 +553,7 @@ void NetworkDiscovery::handleNewInput(QLocalSocket * client) {
QString data(client->readLine());
data = data.trimmed();
- LOG4CXX_DEBUG(ndcLogger, data);
+ if (!data.isEmpty()) LOG4CXX_DEBUG(ndcLogger, data);
QStringList lines = data.split("\n");
for (int i = 0; i < lines.length(); i++) {
@@ -621,6 +621,7 @@ void NetworkDiscovery::handleNewInputLine(QLocalSocket * client, QString logMsg)
_ifNameToClient.insert(interface, client);
}
+
// st states
// #define LOG_EMERG 0 /* system is unusable */
@@ -856,8 +857,8 @@ void NetworkDiscovery::prepareTryAgain() {
}
*/
// reset everything
- delete _networkManager;
- delete _server;
+ //delete _networkManager;
+ //delete _server;
foreach(QProcess* p, _clientProcessToIfNameMap.keys())
{
delete p;
diff --git a/src/fbgui/networkmanager.cpp b/src/fbgui/networkmanager.cpp
index ce2186a..8a3e529 100644
--- a/src/fbgui/networkmanager.cpp
+++ b/src/fbgui/networkmanager.cpp
@@ -10,6 +10,13 @@
#include "networkmanager.h"
+#include <log4cxx/logger.h>
+#include "qlog4cxx.h"
+
+using namespace log4cxx;
+using namespace log4cxx::helpers;
+LoggerPtr ndnmLogger(Logger::getLogger("fbgui.nd.nm"));
+
NetworkManager::NetworkManager()
{
// TODO Auto-generated constructor stub
@@ -59,11 +66,12 @@ NetworkManager::replaceDefaultRoute(QString ifname, QString gateway, int mss,
QByteArray ba_gw = gateway.toAscii();
char * gwaddr = ba_gw.data();
- qDebug() << "---doRoute() gwaddr" << gwaddr;
+ LOG4CXX_DEBUG(ndnmLogger, "---doRoute() gwaddr" << gwaddr);
+ //qDebug() << "---doRoute() gwaddr" << gwaddr;
if (!(gw = nl_addr_parse(gwaddr, af)))
{
- qDebug() << "Invalid router address given:" << gwaddr;
+ LOG4CXX_DEBUG(ndnmLogger, "Invalid router address given:" << gwaddr);
return -1;
}
@@ -72,7 +80,7 @@ NetworkManager::replaceDefaultRoute(QString ifname, QString gateway, int mss,
if ((cache = rtnl_link_alloc_cache(rtsock)) == NULL)
{
- qDebug() << "error with link cache alloc \n";
+ LOG4CXX_DEBUG(ndnmLogger, "error with link cache alloc \n");
}
iface_idx = rtnl_link_name2i(cache, ifn);
@@ -88,7 +96,7 @@ NetworkManager::replaceDefaultRoute(QString ifname, QString gateway, int mss,
}
retval = rtnl_route_add(rtsock, route, NLM_F_REPLACE);
- qDebug() << "return value:" << retval << ":" << strerror(-retval);
+ LOG4CXX_DEBUG(ndnmLogger, "return value:" << retval << ":" << strerror(-retval));
rtnl_route_put(route);
nl_addr_put(gw);
@@ -268,7 +276,7 @@ NetworkManager::bringInterfaceUpDown(QString ifname, bool up)
if (!(request = rtnl_link_alloc()))
{
- qDebug() << "error. couldn't allocate a rtnl link";
+ LOG4CXX_DEBUG(ndnmLogger, "error. couldn't allocate a rtnl link");
return -1;
}
@@ -286,20 +294,20 @@ NetworkManager::bringInterfaceUpDown(QString ifname, bool up)
if ((cache = rtnl_link_alloc_cache(rtsock)) == NULL)
{
- qDebug() << "error with link cache alloc ";
+ LOG4CXX_DEBUG(ndnmLogger, "error with link cache alloc ");
}
old = rtnl_link_get_by_name(cache, ifn);
if (old)
{
- qDebug() << "change link";
+ LOG4CXX_DEBUG(ndnmLogger, "change link");
retval = rtnl_link_change(rtsock, old, request, 0);
}
else
{
- qDebug() << "change failed";
+ LOG4CXX_DEBUG(ndnmLogger, "change failed");
retval = -1;
- qDebug() << "return value:" << retval << ":" << strerror(-retval);
+ LOG4CXX_DEBUG(ndnmLogger, "return value:" << retval << ":" << strerror(-retval));
}
rtnl_link_put(old);
@@ -383,7 +391,7 @@ NetworkManager::ip4_configureInterface(QString ifname, QString ipAddress,
if ((cache = rtnl_link_alloc_cache(rtsock)) == NULL)
{
- qDebug() << "error with link cache alloc";
+ LOG4CXX_DEBUG(ndnmLogger, "error with link cache alloc");
return -1;
}
@@ -391,7 +399,7 @@ NetworkManager::ip4_configureInterface(QString ifname, QString ipAddress,
if (!(addr = rtnl_addr_alloc()))
{
- qDebug() << "error with addr alloc";
+ LOG4CXX_DEBUG(ndnmLogger, "error with addr alloc");
return -1;
}
@@ -400,11 +408,11 @@ NetworkManager::ip4_configureInterface(QString ifname, QString ipAddress,
nl_addr_put(local);
if (err != 0)
{
- qDebug() << "error with set local addr";
+ LOG4CXX_DEBUG(ndnmLogger, "error with set local addr");
}
prefixLength = ip4_netmaskToPrefix(ipAddress, netmask);
- qDebug() << "prefix length:" << prefixLength;
+ LOG4CXX_DEBUG(ndnmLogger, "prefix length:" << prefixLength);
rtnl_addr_set_prefixlen(addr, prefixLength);
local = nl_addr_parse(bcaddr, af);
@@ -412,7 +420,7 @@ NetworkManager::ip4_configureInterface(QString ifname, QString ipAddress,
nl_addr_put(local);
if (err != 0)
{
- qDebug() << "error with set broadcast addr";
+ LOG4CXX_DEBUG(ndnmLogger, "error with set broadcast addr");
}
rtnl_addr_set_ifindex(addr, iface_idx);
@@ -420,7 +428,7 @@ NetworkManager::ip4_configureInterface(QString ifname, QString ipAddress,
retval = sync_address(ifn, iface_idx, af, addr);
if (retval < 0)
{
- qDebug() << "error in sync_address";
+ LOG4CXX_DEBUG(ndnmLogger, "error in sync_address");
}
rtnl_addr_put(addr);
@@ -446,7 +454,7 @@ NetworkManager::ip4_netmaskToPrefix(QString ipAddr, QString netmask)
if (netmask == "")
{
- qDebug() << "error: netmask is empty";
+ LOG4CXX_DEBUG(ndnmLogger, "error: netmask is empty");
return retval;
}
nae.setIp(QHostAddress(ipAddr));
@@ -469,7 +477,7 @@ NetworkManager::ip6_addAddress(struct ip6_addr* ip6Addr, const char *iface)
if ((cache = rtnl_link_alloc_cache(rtsock)) == NULL)
{
- qDebug() << "error with link cache alloc";
+ LOG4CXX_DEBUG(ndnmLogger, "error with link cache alloc");
return -1;
}
@@ -638,7 +646,7 @@ nlh = nl_handle_alloc();
{
//nm_log_err (log_domain, "(%s): error %d returned from rtnl_addr_delete(): %s",
// iface, err, nl_geterror ());
- qDebug() << "error with delete addr";
+ LOG4CXX_DEBUG(ndnmLogger, "error with delete addr");
}
}
@@ -671,7 +679,7 @@ if (buf_valid == 0)
{
//nm_log_dbg (log_domain, "(%s): adding address '%s/%d'",
//iface, buf, nl_addr_get_prefixlen (nladdr));
- qDebug() << "buf valid adding addr";
+ LOG4CXX_DEBUG(ndnmLogger, "buf valid adding addr");
}
err = rtnl_addr_add(nlh, addr, 0);
@@ -680,7 +688,7 @@ if (err < 0)
//nm_log_err (log_domain,
// "(%s): error %d returned from rtnl_addr_add():\n%s",
// iface, err, nl_geterror ());
- qDebug() << "error with add addr" << strerror(-err);
+ LOG4CXX_DEBUG(ndnmLogger, "error with add addr" << strerror(-err));
}
rtnl_addr_put(addr);
@@ -710,7 +718,7 @@ NetworkManager::writeResolvConf(QString path, QString ifname,
QFile file(path + "resolv.conf");
if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
{
- qDebug() << "error couldn't open file:" << path;
+ LOG4CXX_DEBUG(ndnmLogger, "error couldn't open file:" << path);
return -1;
}
QTextStream out(&file);
diff --git a/src/fbgui/sysinfo.cpp b/src/fbgui/sysinfo.cpp
index d1ac44f..807413b 100644
--- a/src/fbgui/sysinfo.cpp
+++ b/src/fbgui/sysinfo.cpp
@@ -41,16 +41,27 @@ SysInfo::~SysInfo() {
* @see JavascriptInterface::getSysInfo(const QString& info)
*/
const QString SysInfo::getInfo(const QString& infoName) {
- LOG4CXX_DEBUG(siLogger, "requested " << infoName);
if (infoName == QString("mbserial"))
return getMainboardSerial();
else if (infoName == QString("usb"))
return getUsbVendorIdProductIdSerialNumber();
+ else if (infoName == QString("mac"))
+ return getMACAddress();
/* unknown code */
LOG4CXX_DEBUG(siLogger, "unknown requested");
return "info_error";
}
+const QString SysInfo::getMACAddress() {
+ // Returns MAC address of eth0 for now
+ LOG4CXX_DEBUG(siLogger, "Requesting MAC of: " << interfaceName << " ...");
+ QNetworkInterface qni = QNetworkInterface::interfaceFromName(interfaceName);
+ if (!qni.isValid()) {
+ LOG4CXX_DEBUG(siLogger, "No valid interface with name: " << interfaceName);
+ return "no_interface";
+ }
+ return qni.hardwareAddress();
+}
// -----------------------------------------------------------------------------------------------
// Mainboard / USB Infos using libsysfs
// -----------------------------------------------------------------------------------------------
@@ -70,6 +81,7 @@ const QString SysInfo::getInfo(const QString& infoName) {
* @see SysInfo::getInfo(const QString& infoName)
*/
const QString SysInfo::getMainboardSerial() {
+ LOG4CXX_DEBUG(siLogger, "Requesting Mainboard Serial...");
QString out = "";
struct sysfs_class_device *class_device = sysfs_open_class_device("dmi",
"id");
@@ -82,6 +94,8 @@ const QString SysInfo::getMainboardSerial() {
QVariantMap a;
if(QString(attr->name) == QString("board_serial")) {
out = QString(attr->value);
+ if (out.endsWith("\n"))
+ out.chop(1);
}
}
LOG4CXX_DEBUG(siLogger, "Mainboard Serial: " + out);
@@ -200,11 +214,4 @@ const QString SysInfo::getUsbVendorIdProductIdSerialNumber() {
}
libusb_free_device_list(devs, 1); //free the list, unref the devices in it
libusb_exit(ctx); //close the session
-
-
- /*
- QByteArray json = serializer.serialize(list);
- LOG4CXX_DEBUG(siLogger, tag + "json object: " + json);
- return json;
- */
}
diff --git a/src/fbgui/sysinfo.h b/src/fbgui/sysinfo.h
index a4c5a48..08717ac 100644
--- a/src/fbgui/sysinfo.h
+++ b/src/fbgui/sysinfo.h
@@ -41,6 +41,7 @@ public:
private:
// private system information readers
+ const QString getMACAddress();
const QString getMainboardSerial();
const QString getUsbVendorIdProductIdSerialNumber();
diff --git a/testApp.sh b/testApp.sh
index f33ab17..4fcfe25 100755
--- a/testApp.sh
+++ b/testApp.sh
@@ -11,10 +11,9 @@
# -s <path>, --serial=<path> sets path to serial number file
#
# Note: all path are expected to be absolute.
-
# Adapt these to your own system.
QT_VERSION=Qt-4.8.0
-PATH_TO_FBGUI_BUILD=/home/michael/workspace/fbgui
+PATH_TO_FBGUI_BUILD=~/fbgui/build
# check if network discovery is activated and if running as root
for ARG in $*
@@ -46,8 +45,6 @@ display_id=$(grep -n $(whoami) /etc/passwd| head -n 1|awk -F : '{print $1}')
# quick sleep to wait for qvfb loading
sleep 0.2
# Start fbgui connecting to QVFb with display_id from above.
-
$PATH_TO_FBGUI_BUILD/src/fbgui/fbgui -display QVFb:$display_id $@ -e $PATH_TO_FBGUI_BUILD/src/customdhcpcd/cdhcpcd
-
# kill qvfb since fbgui stopped
killall qvfb