summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Bauer2012-02-01 15:31:48 +0100
committerJonathan Bauer2012-02-01 15:31:48 +0100
commit1fe9c90f77990e740c205a5113340583146536e8 (patch)
tree834545bffba0be9fe8895fdf3bc90f91f285b120
parentnew abstract class agui for common gui functions, new console class for debug... (diff)
downloadfbgui-1fe9c90f77990e740c205a5113340583146536e8.tar.gz
fbgui-1fe9c90f77990e740c205a5113340583146536e8.tar.xz
fbgui-1fe9c90f77990e740c205a5113340583146536e8.zip
adapted existing classes to reflect changes
-rw-r--r--.gitignore2
-rw-r--r--src/fbgui/CMakeLists.txt4
-rw-r--r--src/fbgui/fbgui.cpp236
-rw-r--r--src/fbgui/fbgui.h60
-rw-r--r--src/fbgui/html/js/networkDiscovery.js4
-rw-r--r--src/fbgui/main.cpp15
-rw-r--r--src/fbgui/ndgui.cpp153
-rw-r--r--src/fbgui/ndgui.h29
-rw-r--r--src/fbgui/networkdiscovery.cpp6
-rwxr-xr-xtestApp.sh1
10 files changed, 46 insertions, 464 deletions
diff --git a/.gitignore b/.gitignore
index cf2591d..8463a08 100644
--- a/.gitignore
+++ b/.gitignore
@@ -19,3 +19,5 @@ Debug
/doxygen/man/*
/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/fbgui.cpp b/src/fbgui/fbgui.cpp
index c7cbce6..ee74452 100644
--- a/src/fbgui/fbgui.cpp
+++ b/src/fbgui/fbgui.cpp
@@ -16,7 +16,6 @@ LoggerPtr coreLogger(Logger::getLogger("fbgui.core"));
#include <QtWebKit>
QThread dmThread;
-QString logFilePath("");
QString ipConfigFilePath("");
QString binPath("");
QUrl baseURL("");
@@ -25,7 +24,8 @@ int updateInterval = -1;
QString fileToTriggerURL("");
QString serialLocation("");
QString sessionID("");
-int debugMode = -1;
+//int debugMode = -1;
+//QString logFilePath("");
//-------------------------------------------------------------------------------------------
/**
@@ -38,9 +38,10 @@ int debugMode = -1;
* @see JavascriptInterface
* @see DownloadManager
*/
-fbgui::fbgui() {
+fbgui::fbgui() :
+ agui(){
}
-fbgui::~fbgui() {
+fbgui::~fbgui(){
dmThread.quit();
}
@@ -51,13 +52,6 @@ void fbgui::init() {
// start fbgui
LOG4CXX_DEBUG(coreLogger, "Initializing fbgui...");
- // init watcher
- _watcher = new QFileSystemWatcher(this);
-
- // setup layout and actions
- setupLayout();
- createActions();
-
// initialize javascript interface
JavascriptInterface* jsi = new JavascriptInterface(
_webView->page()->mainFrame());
@@ -88,118 +82,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
@@ -310,57 +197,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)
//-------------------------------------------------------------------------------------------
@@ -455,65 +291,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)) {
- LOG4CXX_DEBUG(coreLogger, "Could not open log file: " << logFilePath);
- }
- else {
- _debugConsole->setPlainText(_logFileIn->readAll());
- _debugConsole->moveCursor(QTextCursor::End);
- // 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 4891194..2feafa1 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,7 +47,7 @@ extern QUrl baseURL;
extern int debugMode;
extern int updateInterval;
-class fbgui: public QMainWindow
+class fbgui : public agui
{
Q_OBJECT
@@ -57,68 +59,12 @@ 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();
QByteArray generatePOSTData();
- //----------------------------------
- // widgets constituing the gui:
- //----------------------------------
- // QWebView for displaying internet content
- QWebView* _webView;
- // 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);
-
- // 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/main.cpp b/src/fbgui/main.cpp
index 051ce65..e14e683 100644
--- a/src/fbgui/main.cpp
+++ b/src/fbgui/main.cpp
@@ -10,8 +10,10 @@
#include <log4cxx/propertyconfigurator.h>
#include "qlog4cxx.h"
+#include "agui.h"
#include "fbgui.h"
#include "ndgui.h"
+#include "console.h"
#include "../common/fbgui.h"
@@ -48,6 +50,7 @@ void printHelp() {
}
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.
@@ -268,14 +271,6 @@ int main(int argc, char *argv[]) {
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);
@@ -294,7 +289,8 @@ int main(int argc, char *argv[]) {
LOG4CXX_DEBUG(logger, "pathtoexe: " << gPathToDhcpExe);
} else {
LOG4CXX_DEBUG(logger, "Network Discovery deactivated.");
- }LOG4CXX_DEBUG(logger, "*******************************************");
+ }
+ LOG4CXX_DEBUG(logger, "*******************************************");
// set invisible cursor
//QWSServer::instance()->setCursorVisible(false);
@@ -307,7 +303,6 @@ int main(int argc, char *argv[]) {
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();
diff --git a/src/fbgui/ndgui.cpp b/src/fbgui/ndgui.cpp
index 4e0b3f6..34a3f2d 100644
--- a/src/fbgui/ndgui.cpp
+++ b/src/fbgui/ndgui.cpp
@@ -30,8 +30,8 @@ QString gPathToDhcpExe("");
/**
* constructor
*/
-ndgui::ndgui(QMainWindow *parent) :
- QMainWindow(parent) {
+ndgui::ndgui() :
+ agui() {
}
@@ -41,11 +41,11 @@ ndgui::ndgui(QMainWindow *parent) :
*/
ndgui::~ndgui() {
- delete _debugConsole;
- delete _toggleDebugConsole;
+ //delete _debugConsole;
+ //delete _toggleDebugConsole;
delete _allowUserChoice;
delete _tryAgain;
- delete _webView;
+ //delete _webView;
delete _networkDiscovery;
}
@@ -57,13 +57,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 +91,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 +119,6 @@ void ndgui::createAction() {
this->addAction(_tryAgain);
}
-
-
/**
* @brief set userChoice true
*
@@ -300,43 +222,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
*
@@ -358,7 +243,6 @@ void ndgui::continueBoot(QString ifName) {
}
-
/**
* @brief continue the boot sequence without further checking if the connection is still possible.
*/
@@ -369,7 +253,6 @@ void ndgui::continueBootWithoutCheck(QString ifName) {
}
-
/**
* @brief read the log file. Log File will be presented inside of a dialog.
*/
@@ -379,7 +262,6 @@ QString ndgui::readLogFile() {
}
-
/**
* @brief starts the whole application again.
*/
@@ -387,13 +269,13 @@ void ndgui::tryAgain() {
LOG4CXX_DEBUG(ndLogger, " try again ");
_networkDiscovery->prepareTryAgain();
if(debugMode > -1) {
- delete _splitter;
- delete _debugConsole;
- delete _toggleDebugConsole;
+ //delete _splitter;
+ //delete _debugConsole;
+ //delete _toggleDebugConsole;
}
delete _allowUserChoice;
delete _tryAgain;
- delete _webView;
+ //delete _webView;
delete _networkDiscovery;
init();
@@ -401,7 +283,6 @@ void ndgui::tryAgain() {
}
-
/*test html gui version*/
/**
diff --git a/src/fbgui/ndgui.h b/src/fbgui/ndgui.h
index 18fe5c7..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();
@@ -73,20 +72,17 @@ signals:
private slots:
void setUserChoiceTrue();
- void toggleDebugConsole();
private:
- QString _tag;
+ void addActions();
- void createAction();
+ QString _tag;
bool _userChoice;
bool _started;
- QWebView* _webView;
-
QAction* _allowUserChoice;
QAction* _tryAgain;
@@ -98,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();
-
-
-
};
#endif // NDGUI_H
diff --git a/src/fbgui/networkdiscovery.cpp b/src/fbgui/networkdiscovery.cpp
index 0198086..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) {
@@ -857,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/testApp.sh b/testApp.sh
index d9a02b3..8a4843a 100755
--- a/testApp.sh
+++ b/testApp.sh
@@ -14,6 +14,7 @@
#
# Adapt these to your own system.
QT_VERSION=Qt-4.7.2
+#PATH_TO_FBGUI_BUILD=/home/joe/fbgui/build
PATH_TO_FBGUI_BUILD=/home/joe/workspace/fbgui
# check if network discovery is activated and if running as root