From 951db8ebf3f95ec6252f170bef7d3294b7bd6bc8 Mon Sep 17 00:00:00 2001 From: Niklas Date: Fri, 21 Oct 2011 13:11:40 +0200 Subject: now the two versions of the NetworkDiscovery code should be the same (except for the qDebug...) --- src/ndgui.cpp | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) (limited to 'src/ndgui.cpp') diff --git a/src/ndgui.cpp b/src/ndgui.cpp index 8daef9e..c0a390f 100644 --- a/src/ndgui.cpp +++ b/src/ndgui.cpp @@ -7,6 +7,7 @@ ndgui::ndgui(QMainWindow *parent) : _started = false; _userChoice = false; + _tryAgain = false; createAction(); @@ -93,11 +94,15 @@ void ndgui::startNetworkDiscovery(){ disconnect(_webView,SIGNAL(loadFinished(bool)), this, SLOT(startNetworkDiscovery())); if(!_started) { - _started = true; - qxtLog->debug() << _tag << "Initializing networkDiscovery ..."; - QStringList l; - l << "-d"; - networkDiscovery.initAndRun("209.85.148.105", _userChoice, true, "/tmp/fbgui.log","/var/tmp/qt_c_socket_custom", "/bin/cdhcpcd", &l); + if (!_tryAgain) { + _started = true; + QStringList l; + l << "-d"; + networkDiscovery.initAndRun("209.85.148.105", _userChoice, true, "/var/tmp/logfile","/var/tmp/qt_c_socket_custom", DEFAULT_PATHTODHCPCDEXE, &l); + } else { + _tryAgain = false; + networkDiscovery.tryAgain(); + } } else { qxtLog->debug() << _tag << "NetworkDiscovery already started"; @@ -189,9 +194,11 @@ void ndgui::continueBoot(QString ifName, int userChoice) { QString gateway = networkDiscovery.getGatewayForInterface(ifName); networkDiscovery.ip4_replaceDefaultRoute(ifName,gateway,0); } - //_webView->load(QUrl("qrc:html/continueBoot.html")); - emit initFbgui(); - this->hide(); + if (networkDiscovery.checkConnectivityViaTcp()) { + emit initFbgui(); + } else { + abortBoot("Interface was suddenly made unusable "); + } } @@ -208,8 +215,16 @@ QString ndgui::readLogFile() { /**/ void ndgui::tryAgain() { - qxtLog->debug() << _tag << "try again"; + qxtLog->debug()<< _tag << " try again "; + _tryAgain = true; + _started = false; + _ifNameList.clear(); + _manConfList.clear(); + createAction(); + _webView->load(QUrl("qrc:html/networkdiscovery_userchoice.html")); + _webView->show(); + QTimer::singleShot(2000, this, SLOT(prepareNetworkDiscover())); } -- cgit v1.2.3-55-g7522