summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNiklas2011-11-04 14:26:42 +0100
committerNiklas2011-11-04 14:26:42 +0100
commite86d15fa86b032ded7503adf3768cd5ca999d4ec (patch)
treee213fdb38b3276a85c99eaa044f3603a93b1487a
parentchanged the tryagain (diff)
downloadfbgui-e86d15fa86b032ded7503adf3768cd5ca999d4ec.tar.gz
fbgui-e86d15fa86b032ded7503adf3768cd5ca999d4ec.tar.xz
fbgui-e86d15fa86b032ded7503adf3768cd5ca999d4ec.zip
fixed some bugs: continueBoot , checkConnectivity: first check passed, second check failed. added a new action. it is now possible to triger the tryAgain via F9
-rw-r--r--src/ndgui.cpp83
-rw-r--r--src/ndgui.h6
-rw-r--r--src/networkdiscovery.cpp10
3 files changed, 29 insertions, 70 deletions
diff --git a/src/ndgui.cpp b/src/ndgui.cpp
index c059cf2..f2469f5 100644
--- a/src/ndgui.cpp
+++ b/src/ndgui.cpp
@@ -20,6 +20,7 @@ ndgui::~ndgui() {
delete _debugConsole;
delete _toggleDebugConsole;
delete _allowUserChoice;
+ delete _tryAgain;
delete _webView;
delete _networkDiscovery;
}
@@ -32,7 +33,6 @@ void ndgui::init() {
_started = false;
_userChoice = false;
- _tryAgain = false;
_ifNameList.clear();
_manConfList.clear();
@@ -158,10 +158,14 @@ void ndgui::toggleDebugConsole() {
* seconds.
*/
void ndgui::createAction() {
- _allowUserChoice = new QAction(tr("&quit"), this);
+ _allowUserChoice = new QAction(tr("&userChoice"), this);
_allowUserChoice->setShortcut(QKeySequence(Qt::Key_F5));
connect(_allowUserChoice, SIGNAL(triggered()), this, SLOT(setUserChoiceTrue()));
this->addAction(_allowUserChoice);
+ _tryAgain = new QAction(tr("&tryAgain"), this);
+ _tryAgain->setShortcut(QKeySequence(Qt::Key_F9));
+ connect(_tryAgain, SIGNAL(triggered()), this, SLOT(tryAgain()));
+ this->addAction(_tryAgain);
}
@@ -232,6 +236,7 @@ void ndgui::handleConnectionEstablished(QString ifName) {
*/
void ndgui::handleAllProcessesFinished() {
qxtLog->debug() << _tag << "all Processes finished";
+ _allowUserChoice->setEnabled(false);
if (_ifNameList.size() > 0) {
if (_userChoice) {
QString jsonArr = "[";
@@ -242,15 +247,19 @@ void ndgui::handleAllProcessesFinished() {
chooseInterfaceDialog(jsonArr);
} else {
foreach(QString i, _ifNameList)
- {
- if (_networkDiscovery->checkConnectivity(i)) {
- continueBoot(i);
- break;
- }
+ {
+ if (_networkDiscovery->checkConnectivity(i)) {
+ continueBootWithoutCheck(i);
+ break;
}
+ }
}
} else {
- abortBoot("No usable interfaces found!" + _networkDiscovery->GetErrorStr());
+ qxtLog->debug() << _tag << " No usable interfaces found!: "
+ << _networkDiscovery->GetErrorStr();
+ qxtLog->debug() << _tag << " list is empty";
+ abortBoot("No usable interfaces found!"
+ + _networkDiscovery->GetErrorStr());
}
}
@@ -314,45 +323,6 @@ void ndgui::continueBootWithoutCheck(QString ifName) {
emit initFbgui();
this->close();
}
-//void ndgui::continueBoot(QString ifName) {
-// if (!_userChoice) {
-// foreach(QString i, _ifNameList)
-// {
-// if (_networkDiscovery->checkConnectivity(i)) {
-// QString text = "continue with interface: " + i;
-// qxtLog->debug() << _tag << " " << text << "no user choice";
-// emit
-// initFbgui();
-// this->close();
-// }
-// }
-// abortBoot(
-// "Interface was suddenly made unusable. Please check the log and try again.");
-// } else {
-// int ret = 0;
-// QString text = "continue with interface: " + ifName;
-// qxtLog->debug() << _tag << " " << text << " with user choice";
-// QString gateway = _networkDiscovery->getGatewayForInterface(ifName);
-// if (!gateway.isEmpty()) {
-// qxtLog->debug() << _tag
-// << " gateway is empty. this will produce errors";
-// }
-// ret = _networkDiscovery->ip4_replaceDefaultRoute(ifName, gateway, 0);
-// if (0 != ret) {
-// qxtLog->debug() << _tag
-// << " set default route failed. returned with: " << ret
-// << " : " << strerror(-ret);
-// }
-// if (_networkDiscovery->checkConnectivityViaTcp()) {
-// emit initFbgui();
-// this->close();
-// } else {
-// abortBoot(
-// "Interface was suddenly made unusable. Please check the log and try again.");
-// }
-// }
-//
-//}
@@ -376,30 +346,13 @@ void ndgui::tryAgain() {
delete _toggleDebugConsole;
}
delete _allowUserChoice;
+ delete _tryAgain;
delete _webView;
delete _networkDiscovery;
init();
}
-///**/
-//void ndgui::tryAgain() {
-// qxtLog->debug()<< _tag << " try again ";
-// _tryAgain = true;
-// _started = false;
-// _ifNameList.clear();
-// _manConfList.clear();
-// createAction();
-// if (debugMode > -1) {
-// _webView->load(QUrl("qrc:html/networkdiscovery_userchoice_debug.html"));
-// }
-// else {
-// _webView->load(QUrl("qrc:html/networkdiscovery_userchoice.html"));
-// }
-// _webView->show();
-//
-// QTimer::singleShot(2000, this, SLOT(prepareNetworkDiscover()));
-//}
diff --git a/src/ndgui.h b/src/ndgui.h
index d5f86f8..f6d1061 100644
--- a/src/ndgui.h
+++ b/src/ndgui.h
@@ -67,11 +67,11 @@ private:
bool _started;
- bool _tryAgain;
+ QWebView* _webView;
- QWebView * _webView;
+ QAction* _allowUserChoice;
- QAction * _allowUserChoice;
+ QAction* _tryAgain;
NetworkDiscovery* _networkDiscovery;
diff --git a/src/networkdiscovery.cpp b/src/networkdiscovery.cpp
index 6039bef..4193286 100644
--- a/src/networkdiscovery.cpp
+++ b/src/networkdiscovery.cpp
@@ -455,9 +455,15 @@ bool NetworkDiscovery::checkConnectivity(QString ifName) {
// get gateway address
QString pathToGatewayFile(DEFAULT_INTERFACE_CONF_LOCATION);
pathToGatewayFile += ifName;
- interfaceconfiguration *ifConf = new interfaceconfiguration();
+ interfaceconfiguration* ifConf;
+ if (!_ifcMap.contains(ifName)) {
+ ifConf = new interfaceconfiguration();
+ _ifcMap.insert(ifName, ifConf);
+ }
+ else {
+ ifConf = _ifcMap.value(ifName);
+ }
ifConf->readConfigOutOfFile(pathToGatewayFile);
- _ifcMap.insert(ifName, ifConf);
// replace default route
qxtLog->debug() << _tag << "replace default route";