From 82aa92021583cbeefe6c0a29181680f3ca1e4242 Mon Sep 17 00:00:00 2001 From: Niklas Date: Wed, 24 Aug 2011 13:58:14 +0200 Subject: 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). --- workspace/LogReceiver/ndgui.cpp | 79 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 78 insertions(+), 1 deletion(-) (limited to 'workspace/LogReceiver/ndgui.cpp') 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(QObject::sender())>0) + { + qDebug() << "received Signal restart abd"; + aBD->closeDialog(); + } + else if(qobject_cast(QObject::sender())>0) + { + qDebug() << "received Signal restart cid"; + cID->close(); + } + else + { + qDebug() << "unknown sender" << QObject::sender(); + } + + +} + +void ndgui::shutDownSystem() +{ + if(qobject_cast(QObject::sender())>0) + { + + aBD->closeDialog(); + } + else if(qobject_cast(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"; } -- cgit v1.2.3-55-g7522