summaryrefslogtreecommitdiffstats
path: root/LogReceiver/ndgui.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'LogReceiver/ndgui.cpp')
-rw-r--r--LogReceiver/ndgui.cpp80
1 files changed, 25 insertions, 55 deletions
diff --git a/LogReceiver/ndgui.cpp b/LogReceiver/ndgui.cpp
index ccd67da..0394926 100644
--- a/LogReceiver/ndgui.cpp
+++ b/LogReceiver/ndgui.cpp
@@ -6,10 +6,10 @@ ndgui::ndgui(QMainWindow *parent) :
connect(&logReceiver, SIGNAL(addInterface(const QString &)), this, SLOT(addInterface( const QString &)));
connect(&logReceiver, SIGNAL(changeProgressBarValue(const QString & , const int& )), this, SLOT(updateIfProgressBar(const QString & , const int&)));
//connect(&logReceiver, SIGNAL(connectionEstablished(interfaceconfiguration*)), this, SLOT(handleConnectionEstablished(interfaceconfiguration*)));
- //connect(&logReceiver, SIGNAL(abortBoot(QString)), this, SLOT(handleAbortBoot(QString)));
+ connect(&logReceiver, SIGNAL(abortBoot(QString)), this, SLOT(abortBoot(const QString)));
connect(&logReceiver, SIGNAL(updateStatusLabel(QString,QString)), this, SLOT(updateIfStatus(const QString &, const QString &)));
//connect(&logReceiver, SIGNAL(allProcessesFinished()), this, SLOT(handleAllProcessesFinished()));
- connect(&logReceiver, SIGNAL(continueBoot(QString)), this, SLOT(continueBoot(QString)));
+ connect(&logReceiver, SIGNAL(continueBoot(QString, bool)), this, SLOT(continueBoot(QString, bool)));
_started = false;
@@ -48,74 +48,33 @@ void ndgui::handleConnectionEstablished(interfaceconfiguration *ifConf) {
finalUsableIntefacesMap.insert(ifConf->getInterface(), ifConf);
}
-void ndgui::handleAbortBoot(QString msg) {
- qDebug() << "abort boot. reason:" << msg;
- showAbortBootDialog();
-}
-
-
void ndgui::handleAllProcessesFinished() {
qDebug() << "all Processes finished";
-
- if (finalUsableIntefacesMap.size() > 0) {
- showChooseInterfaceDialog();
+ if(finalUsableIntefacesMap.size() > 0) {
+ // chooseInterfaceDialog();
} else {
- showAbortBootDialog();
+ abortBoot("No usable interfaces found!");
}
}
-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() {
- QStringList list(finalUsableIntefacesMap.keys());
- cID = new ChooseInterfaceDialog(list, 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();
+void ndgui::continueBoot(QString ifName, bool userChoice) {
+ if (!userChoice) {
+ QString text = "continue with interface: " + ifName;
+ qDebug() << text << "no user choice";
+ _webView->load(QUrl("qrc:html/continueBoot.html"));
} else {
- qDebug() << "unknown sender" << QObject::sender();
+ QString text = "continue with interface: " + ifName;
+ qDebug() << text << "with user choice";
+ _webView->load(QUrl("qrc:html/continueBoot.html"));
}
-
-}
-
-void ndgui::continueBoot(QString ifName) {
- QString text = "continue with interface: " + ifName;
- qDebug() << text;
- _webView->load(QUrl("qrc:html/continueBoot.html"));
- //cID->close();
}
void ndgui::showLog() {
@@ -166,6 +125,17 @@ void ndgui::loadJQuery() {
// 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
+
+void ndgui::abortBoot(const QString msg) {
+ QString code = QString("abortBootDialog('\%1')").arg(msg);
+ _webView->page()->mainFrame()->evaluateJavaScript(code);
+}
+
+void ndgui::chooseInterfaceDialog(const QString msg) {
+ QString code = QString("chooseInterfaceDialog('\%1')").arg(msg);
+ _webView->page()->mainFrame()->evaluateJavaScript(code);
+}
+
void ndgui::updateStatus(const QString &status) {
if (status == "")
return;