summaryrefslogtreecommitdiffstats
path: root/src/ndgui.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ndgui.cpp')
-rw-r--r--src/ndgui.cpp108
1 files changed, 82 insertions, 26 deletions
diff --git a/src/ndgui.cpp b/src/ndgui.cpp
index 149f476..3034051 100644
--- a/src/ndgui.cpp
+++ b/src/ndgui.cpp
@@ -1,3 +1,14 @@
+/**
+ * @class ndgui
+ *
+ * @brief the GUI.
+ *
+ * This class is responsible for creating and displaying the user interface.
+ * It also connects the webView via QWebBridge to javascript functions inside the html files.
+ */
+
+
+
#include "ndgui.h"
QString gServerIp("");
@@ -7,7 +18,9 @@ QString gPathToDhcpExe("");
-/*constructor*/
+/**
+ * constructor
+ */
ndgui::ndgui(QMainWindow *parent) :
QMainWindow(parent) {
init();
@@ -15,7 +28,9 @@ ndgui::ndgui(QMainWindow *parent) :
-/*destructor*/
+/**
+ * destructor
+ */
ndgui::~ndgui() {
delete _debugConsole;
delete _toggleDebugConsole;
@@ -27,7 +42,9 @@ ndgui::~ndgui() {
-/**/
+/**
+ * @brief initialize all variables and prepare everything for a successful run
+ */
void ndgui::init() {
_tag = "[nd:ndgui]";
@@ -82,7 +99,7 @@ void ndgui::init() {
/**
- * This method sets the used Layout.
+ * @brief This method sets the used Layout.
*
* This method sets the used Layout. Possible layout are:
* - browser mode: only the browser is visible
@@ -110,7 +127,7 @@ void ndgui::setupLayout() {
/**
- * This method creates a debug console as a widget.
+ * @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).
@@ -141,7 +158,7 @@ void ndgui::createDebugConsole() {
/**
- * This method toggles the debug console.
+ * @brief This method toggles the debug console.
*
* Toggle the visibility of the debug console if the action _toggleDebugConsole is triggered.
*
@@ -154,8 +171,9 @@ void ndgui::toggleDebugConsole() {
/**
- * creates an action which you can trigger with the F5 Button during the first
- * seconds.
+ * @brief Create actions
+ *
+ * creates an action which you can trigger with the F5 and F9 Button.
*/
void ndgui::createAction() {
_allowUserChoice = new QAction(tr("&userChoice"), this);
@@ -171,6 +189,8 @@ void ndgui::createAction() {
/**
+ * @brief set userChoice true
+ *
* is the connected to the triggered action pressing the F5 button.
* set the _userChoice member true
*/
@@ -181,6 +201,8 @@ void ndgui::setUserChoiceTrue() {
/**
+ * @brief starts a singleshot event.
+ *
* is connected to the singleShot event. Triggering this method means
* that we go on with the main NetworkDiscovery screen.
* connects the loadFinished signal of the _webView with the
@@ -196,6 +218,8 @@ void ndgui::startSingleShot() {
/**
+ * @brief start the network discovery
+ *
* main starting point of the whole procedure.
* disconnect the loadFinished signal with the startNetworkDiscovery
* and starts the networkDiscovery.
@@ -215,6 +239,8 @@ void ndgui::startNetworkDiscovery() {
/**
+ * @brief handle if a interface is able to connect
+ *
* if we have a user choice (_userChoice = true) than networkDiscovery will
* emit connectionEstablished signals.
* Add the interface name to a _ifNameList. This list holds all interfaces
@@ -227,6 +253,8 @@ void ndgui::handleConnectionEstablished(QString ifName) {
/**
+ * @brief determines if we continue the boot sequence or if we show the chooseInterface or abortBoot dialog
+ *
* if we have a user choice (_userChoice = true) than networkDiscovery will
* emit a allProcessesFinished signal if all processes are done.
* This method determines if user will see an abort boot dialog (no interface names in
@@ -266,6 +294,8 @@ void ndgui::handleAllProcessesFinished() {
/**
+ * @brief restart the system
+ *
* this method will restart the system.
* triggered through a button click in the gui.
*/
@@ -282,6 +312,8 @@ void ndgui::restartSystem() {
/**
+ * @brief shut down the system
+ *
* this method will restart the system.
* triggered through a button click in the gui.
*/
@@ -298,6 +330,8 @@ void ndgui::shutDownSystem() {
/**
+ * @brief continue the boot sequence
+ *
* represents the end of the NetworkDiscovery life time.
* will start the fbgui screen. All networkDiscovery signals
* will be ignored after this point.
@@ -317,7 +351,9 @@ void ndgui::continueBoot(QString ifName) {
-/**/
+/**
+ * @brief continue the boot sequence without further checking if the connection is still possible.
+ */
void ndgui::continueBootWithoutCheck(QString ifName) {
qxtLog->debug() << _tag << " continue with interface: " << ifName;
emit initFbgui();
@@ -327,7 +363,7 @@ void ndgui::continueBootWithoutCheck(QString ifName) {
/**
- * read the log file. Log File will be presented inside of a dialog.
+ * @brief read the log file. Log File will be presented inside of a dialog.
*/
QString ndgui::readLogFile() {
qxtLog->debug() << _tag << "show log";
@@ -336,7 +372,9 @@ QString ndgui::readLogFile() {
-/* starts the whole application again.*/
+/**
+ * @brief starts the whole application again.
+ */
void ndgui::tryAgain() {
qxtLog->debug()<< _tag << " try again ";
_networkDiscovery->prepareTryAgain();
@@ -359,7 +397,7 @@ void ndgui::tryAgain() {
/*test html gui version*/
/**
- * fills the drop down box of the manual interface configuration
+ * @brief fills the drop down box of the manual interface configuration
* dialog.
*/
QVariantList ndgui::getManualConfInterfaces() {
@@ -374,7 +412,12 @@ QVariantList ndgui::getManualConfInterfaces() {
}
-/*return a json formated interface configuration*/
+/**
+ * @brief return a json formated interface configuration
+ *
+ * @param ifName
+ * the name of the interface
+ */
QVariantMap ndgui::getInterfaceConf(QString ifName) {
return _networkDiscovery->getInterfaceConfig(ifName);
@@ -383,8 +426,11 @@ QVariantMap ndgui::getInterfaceConf(QString ifName) {
/**
- * takes the entered manual configuration dates and delivers it
+ * @brief takes the entered manual configuration dates and delivers it
* to the networkDiscovery for further actions.
+ *
+ * @param jsonArr
+ * a jsonArr which contains the manual entered interface configuration
*/
int ndgui::ip4_setManualConfiguration(QVariantMap jsonArr) {
return _networkDiscovery->ip4_setManualConfiguration(jsonArr);
@@ -399,7 +445,7 @@ int ndgui::ip4_setManualConfiguration(QVariantMap jsonArr) {
/************************************************/
/**
- * stellt ein ndgui/fbgui Objekt zur verwendung durch die html bereit.
+ * @brief stellt ein ndgui/fbgui Objekt zur verwendung durch die html bereit.
*/
void ndgui::attachToDOM(){
_webView->page()->mainFrame()->addToJavaScriptWindowObject(QString("fbgui"), this);
@@ -408,6 +454,9 @@ void ndgui::attachToDOM(){
+/**
+ * @brief load jQuery and js scripts into the page so that all javascript functions will work.
+ */
void ndgui::loadJQuery() {
QString js;
QString pathToJsDir(":/html");
@@ -437,12 +486,13 @@ void ndgui::loadJQuery() {
-//diese methoden müssen später in die javascriptInterface Klasse eingefügt werden.
-
-// dieser code muss später in die javascriptInterface klasse der fbgui eingefügt werden
-// tausche dazu ndgui zu javascriptinterface
-// und _webView->page()->mainFrame() zu _parent
+/**
+ * @brief show abortBoot dialog
+ *
+ * @param msg
+ * the message, displayed in the dialog.
+ */
void ndgui::abortBoot(const QString msg) {
QString code = QString("abortBootDialog('\%1')").arg(msg);
_webView->page()->mainFrame()->evaluateJavaScript(code);
@@ -451,7 +501,10 @@ void ndgui::abortBoot(const QString msg) {
/**
- * opens ths chooseInterfaceDialog
+ * @brief opens ths chooseInterfaceDialog
+ *
+ * @param msg
+ * the interfaces as json formated string. will be displayed in a select box.
*/
void ndgui::chooseInterfaceDialog(const QString msg) {
QString code = QString("chooseInterfaceDialog(\%1)").arg(msg);
@@ -461,7 +514,10 @@ void ndgui::chooseInterfaceDialog(const QString msg) {
/**
- * updates the over all status
+ * @brief updates the over all status
+ *
+ * @param status
+ * the new status message
*/
void ndgui::updateStatus(const QString &status) {
if (status == "")
@@ -473,7 +529,7 @@ void ndgui::updateStatus(const QString &status) {
/**
- * updates the progress bar for each interface.
+ * @brief updates the progress bar for each interface.
*
* @param ifname
* the name ot the interface to update
@@ -491,7 +547,7 @@ void ndgui::updateIfProgressBar(const QString &ifName, const int& percent) {
/**
- * update the status for each interface
+ * @brief update the status for each interface
*
* @param ifName
* the name ot the interface to update
@@ -509,7 +565,7 @@ void ndgui::updateIfStatus(const QString &ifName, const QString &status) {
/**
- * adds an interface to the DOM tree. Creates its progress bar and it's status label.
+ * @brief adds an interface to the DOM tree. Creates its progress bar and it's status label.
*
* @param ifName
* name of the new interface.
@@ -525,7 +581,7 @@ void ndgui::addInterface(const QString &ifName) {
/**
- * just for debugging.
+ * @brief just for debugging.
*/
void ndgui::notifyCall(QString msg){
qxtLog->debug() << _tag << "------ called:" << msg;