summaryrefslogtreecommitdiffstats
path: root/src/ndgui.cpp
diff options
context:
space:
mode:
authorNiklas2011-10-21 13:11:40 +0200
committerNiklas2011-10-21 13:11:40 +0200
commit951db8ebf3f95ec6252f170bef7d3294b7bd6bc8 (patch)
tree5ee65f0cc4bf16470f32121b819ff1db96182b33 /src/ndgui.cpp
parentput the NetworkDiscovery code into the src folder of the fbgui. made some tes... (diff)
downloadfbgui-951db8ebf3f95ec6252f170bef7d3294b7bd6bc8.tar.gz
fbgui-951db8ebf3f95ec6252f170bef7d3294b7bd6bc8.tar.xz
fbgui-951db8ebf3f95ec6252f170bef7d3294b7bd6bc8.zip
now the two versions of the NetworkDiscovery code should be the same (except for the qDebug...)
Diffstat (limited to 'src/ndgui.cpp')
-rw-r--r--src/ndgui.cpp33
1 files changed, 24 insertions, 9 deletions
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()));
}