From 259a2e0ff8984325b59bc6dd7d9611867557865d Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Thu, 23 Feb 2012 10:03:25 +0100 Subject: improved user choice coding... --- src/fbgui/ndgui.cpp | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) (limited to 'src/fbgui/ndgui.cpp') diff --git a/src/fbgui/ndgui.cpp b/src/fbgui/ndgui.cpp index ad7ff5f..c74ae82 100644 --- a/src/fbgui/ndgui.cpp +++ b/src/fbgui/ndgui.cpp @@ -43,9 +43,6 @@ void ndgui::init() { setWindowTitle(tr("NetD")); _started = false; - _userChoice = false; - - addActions(); _networkDiscovery = new NetworkDiscovery(); _jsi = new JavascriptInterfaceNDGUI(_webView->page()->mainFrame(), _networkDiscovery); @@ -62,8 +59,8 @@ void ndgui::init() { connect(_networkDiscovery, SIGNAL(changeProgressBarValue(const QString & , const int& )), _jsi, SLOT(updateIfProgressBar(const QString & , const int&))); - connect(_networkDiscovery, SIGNAL(allProcessesFinished()), this, - SLOT(handleAllProcessesFinished())); + connect(_networkDiscovery, SIGNAL(allProcessesFinished(bool)), this, + SLOT(handleAllProcessesFinished(bool))); connect(_jsi, SIGNAL(startFbgui(const QString&)), this, SLOT(continueBoot(const QString&))); connect(_networkDiscovery, SIGNAL(continueBootWithoutCheck(QString )), @@ -79,6 +76,9 @@ void ndgui::init() { } else { _webView->load(QUrl("qrc:html/networkdiscovery.html")); } + + addActions(); + showFullScreen(); } @@ -91,7 +91,8 @@ void ndgui::init() { void ndgui::addActions() { _allowUserChoice = new QAction(tr("&userChoice"), this); _allowUserChoice->setShortcut(QKeySequence(Qt::Key_F5)); - connect(_allowUserChoice, SIGNAL(triggered()), this, SLOT(setUserChoiceTrue())); + connect(_allowUserChoice, SIGNAL(triggered()), + this->_networkDiscovery, SLOT(activateUserChoice())); this->addAction(_allowUserChoice); _tryAgain = new QAction(tr("&tryAgain"), this); _tryAgain->setShortcut(QKeySequence(Qt::Key_F9)); @@ -99,16 +100,6 @@ void ndgui::addActions() { this->addAction(_tryAgain); } -/** - * @brief set userChoice true - * - * is the connected to the triggered action pressing the F5 button. - * set the _userChoice member true - */ -void ndgui::setUserChoiceTrue() { - _userChoice = true; -} - /** * @brief start the network discovery * @@ -119,7 +110,7 @@ void ndgui::setUserChoiceTrue() { void ndgui::startNetworkDiscovery() { if (!_started) { _started = true; - _networkDiscovery->initAndRun(_userChoice); + _networkDiscovery->init(); } else { LOG4CXX_DEBUG(ndLogger, "NetworkDiscovery already started"); } @@ -135,12 +126,12 @@ void ndgui::startNetworkDiscovery() { * choose interface dialog (one or more interface names in the list (add with * handleConnectionEstablished)). */ -void ndgui::handleAllProcessesFinished() { +void ndgui::handleAllProcessesFinished(bool userChoice) { LOG4CXX_DEBUG(ndLogger, "all Processes finished"); _allowUserChoice->setEnabled(false); QList ifConnectedList = _networkDiscovery->getIfConnectedList(); if (ifConnectedList.size() > 0) { - if (_userChoice) { + if (userChoice) { _jsi->chooseInterfaceDialog(ifConnectedList); } else { foreach(QString i, ifConnectedList) @@ -194,7 +185,6 @@ void ndgui::tryAgain() { LOG4CXX_DEBUG(ndLogger, " try again "); _networkDiscovery->prepareTryAgain(); delete _allowUserChoice; - delete _tryAgain; delete _networkDiscovery; _ifNameList.clear(); -- cgit v1.2.3-55-g7522