summaryrefslogtreecommitdiffstats
path: root/workspace/LogReceiver/ndgui.cpp
diff options
context:
space:
mode:
authorNiklas2011-08-24 13:58:14 +0200
committerNiklas2011-08-24 13:58:14 +0200
commit82aa92021583cbeefe6c0a29181680f3ca1e4242 (patch)
tree567a26262e61a858433d7f5feb524a96509afa74 /workspace/LogReceiver/ndgui.cpp
parentadded a additional status label and some signals (diff)
downloadfbgui-82aa92021583cbeefe6c0a29181680f3ca1e4242.tar.gz
fbgui-82aa92021583cbeefe6c0a29181680f3ca1e4242.tar.xz
fbgui-82aa92021583cbeefe6c0a29181680f3ca1e4242.zip
added to dialogs. one for the critical error case (abot boot dialog), one for the succesful case (choose interface dialog). also added a new function for testing the connectivity via tcpsocket (or http request).
Diffstat (limited to 'workspace/LogReceiver/ndgui.cpp')
-rw-r--r--workspace/LogReceiver/ndgui.cpp79
1 files changed, 78 insertions, 1 deletions
diff --git a/workspace/LogReceiver/ndgui.cpp b/workspace/LogReceiver/ndgui.cpp
index 78aa280..a839aef 100644
--- a/workspace/LogReceiver/ndgui.cpp
+++ b/workspace/LogReceiver/ndgui.cpp
@@ -1,4 +1,6 @@
#include "ndgui.h"
+#include "chooseinterfacedialog.h"
+#include "abortbootdialog.h"
ndgui::ndgui(QWidget *parent)
: QWidget(parent)
@@ -93,6 +95,7 @@ void ndgui::handleConnectionEstablished(QString ifName) {
void ndgui::handleAbortBoot(QString msg) {
qDebug() << "abort boot. reason:" << msg;
+ showAbortBootDialog();
}
void ndgui::handleUpdateStatusLabel(QString ifName, QString status) {
@@ -103,5 +106,79 @@ void ndgui::handleUpdateStatusLabel(QString ifName, QString status) {
void ndgui::handleAllProcessesFinished() {
qDebug() << "all Processes finished";
- mainLayout->
+ if (finalUsableInterfaces.size() > 0) {
+ showChooseInterfaceDialog();
+ } else {
+ showAbortBootDialog();
+ }
+}
+
+void ndgui::showAbortBootDialog() {
+ aBD = new AbortBootDialog(this);
+ connect(aBD, SIGNAL(showLogSignal()), this, SLOT(showLog()));
+ connect(aBD, SIGNAL(restartSignal()), this, SLOT(restartSystem()));
+ connect(aBD, SIGNAL(shutDownSignal()), this, SLOT(shutDownSystem()));
+ aBD->setModal(true);
+ aBD->show();
+}
+
+void ndgui::showChooseInterfaceDialog() {
+ cID = new ChooseInterfaceDialog(finalUsableInterfaces, this);
+ connect(cID, SIGNAL(continueSignal(QString)), this,
+ SLOT(continueBoot(QString)));
+ connect(cID, SIGNAL(restartSignal()), this, SLOT(restartSystem()));
+ connect(cID, SIGNAL(shutDownSignal()), this, SLOT(shutDownSystem()));
+ cID->setModal(true);
+ cID->show();
+}
+
+void ndgui::restartSystem()
+{
+
+ if(qobject_cast<AbortBootDialog*>(QObject::sender())>0)
+ {
+ qDebug() << "received Signal restart abd";
+ aBD->closeDialog();
+ }
+ else if(qobject_cast<ChooseInterfaceDialog*>(QObject::sender())>0)
+ {
+ qDebug() << "received Signal restart cid";
+ cID->close();
+ }
+ else
+ {
+ qDebug() << "unknown sender" << QObject::sender();
+ }
+
+
+}
+
+void ndgui::shutDownSystem()
+{
+ if(qobject_cast<AbortBootDialog*>(QObject::sender())>0)
+ {
+
+ aBD->closeDialog();
+ }
+ else if(qobject_cast<ChooseInterfaceDialog*>(QObject::sender())>0)
+ {
+
+ cID->close();
+ }
+ else
+ {
+ qDebug() << "unknown sender" << QObject::sender();
+ }
+
+}
+
+void ndgui::continueBoot(QString ifName)
+{
+ QString text = "continue with interface: " + ifName;
+ cID->close();
+}
+
+void ndgui::showLog()
+{
+ qDebug() << "show log";
}