summaryrefslogtreecommitdiffstats
path: root/LogReceiver/ndgui.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'LogReceiver/ndgui.cpp')
-rw-r--r--LogReceiver/ndgui.cpp25
1 files changed, 16 insertions, 9 deletions
diff --git a/LogReceiver/ndgui.cpp b/LogReceiver/ndgui.cpp
index 624bbde..e3ddfd4 100644
--- a/LogReceiver/ndgui.cpp
+++ b/LogReceiver/ndgui.cpp
@@ -5,11 +5,11 @@ ndgui::ndgui(QMainWindow *parent) :
connect(&networkDiscovery, SIGNAL(addInterface(const QString &)), this, SLOT(addInterface( const QString &)));
connect(&networkDiscovery, SIGNAL(changeProgressBarValue(const QString & , const int& )), this, SLOT(updateIfProgressBar(const QString & , const int&)));
- //connect(&networkDiscovery, SIGNAL(connectionEstablished(interfaceconfiguration*)), this, SLOT(handleConnectionEstablished(interfaceconfiguration*)));
+ connect(&networkDiscovery, SIGNAL(connectionEstablished(QString)), this, SLOT(handleConnectionEstablished(QString)));
connect(&networkDiscovery, SIGNAL(abortBoot(QString)), this, SLOT(abortBoot(const QString)));
connect(&networkDiscovery, SIGNAL(updateStatusLabel(QString,QString)), this, SLOT(updateIfStatus(const QString &, const QString &)));
- //connect(&networkDiscovery, SIGNAL(allProcessesFinished()), this, SLOT(handleAllProcessesFinished()));
- connect(&networkDiscovery, SIGNAL(continueBoot(QString, bool)), this, SLOT(continueBoot(QString, bool)));
+ connect(&networkDiscovery, SIGNAL(allProcessesFinished()), this, SLOT(handleAllProcessesFinished()));
+ connect(&networkDiscovery, SIGNAL(continueBoot(QString, int)), this, SLOT(continueBoot(QString, int)));
_started = false;
@@ -44,14 +44,19 @@ void ndgui::startNetworkDiscovery(){
}
}
-void ndgui::handleConnectionEstablished(interfaceconfiguration *ifConf) {
- finalUsableIntefacesMap.insert(ifConf->getInterface(), ifConf);
+void ndgui::handleConnectionEstablished(QString ifName) {
+ _ifNameList.append(ifName);
}
void ndgui::handleAllProcessesFinished() {
qDebug() << "all Processes finished";
- if(finalUsableIntefacesMap.size() > 0) {
- // chooseInterfaceDialog();
+ if(_ifNameList.size() > 0) {
+ QString jsonArr = "[";
+ for(int i = 0; i < _ifNameList.size()-1; i++) {
+ jsonArr += "\"" + _ifNameList.value(i) + "\",";
+ }
+ jsonArr += "\"" + _ifNameList.last() + "\"]";
+ chooseInterfaceDialog(jsonArr);
} else {
abortBoot("No usable interfaces found!");
}
@@ -65,7 +70,7 @@ void ndgui::shutDownSystem() {
}
-void ndgui::continueBoot(QString ifName, bool userChoice) {
+void ndgui::continueBoot(QString ifName, int userChoice) {
if (!userChoice) {
QString text = "continue with interface: " + ifName;
qDebug() << text << "no user choice";
@@ -74,6 +79,8 @@ void ndgui::continueBoot(QString ifName, bool userChoice) {
QString text = "continue with interface: " + ifName;
qDebug() << text << "with user choice";
_webView->load(QUrl("qrc:html/continueBoot.html"));
+ QString gateway = networkDiscovery.getGatewayForInterface(ifName);
+ networkDiscovery.ip4_replaceDefaultRoute(ifName,gateway,0);
}
}
@@ -132,7 +139,7 @@ void ndgui::abortBoot(const QString msg) {
}
void ndgui::chooseInterfaceDialog(const QString msg) {
- QString code = QString("chooseInterfaceDialog('\%1')").arg(msg);
+ QString code = QString("chooseInterfaceDialog(\%1)").arg(msg);
_webView->page()->mainFrame()->evaluateJavaScript(code);
}