summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/fbgui/javascriptinterface.cpp4
-rw-r--r--src/fbgui/ndgui.cpp33
-rw-r--r--src/fbgui/ndgui.h14
-rw-r--r--src/fbgui/networkdiscovery.cpp8
-rw-r--r--src/fbgui/networkdiscovery.h58
5 files changed, 40 insertions, 77 deletions
diff --git a/src/fbgui/javascriptinterface.cpp b/src/fbgui/javascriptinterface.cpp
index 72d0844..8022797 100644
--- a/src/fbgui/javascriptinterface.cpp
+++ b/src/fbgui/javascriptinterface.cpp
@@ -129,7 +129,3 @@ LOG4CXX_DEBUG(jsiLogger, "Notifying: " << msg);
QString code = QString("notify('\%1')").arg(msg);
_targetFrame->evaluateJavaScript(code);
}
-
-//-------------------------------------------------------------------------------------------------------
-// Network Discovery Communication
-//-------------------------------------------------------------------------------------------------------
diff --git a/src/fbgui/ndgui.cpp b/src/fbgui/ndgui.cpp
index 0d99a22..447b396 100644
--- a/src/fbgui/ndgui.cpp
+++ b/src/fbgui/ndgui.cpp
@@ -24,7 +24,6 @@ LoggerPtr ndLogger(Logger::getLogger("fbgui.nd"));
*/
ndgui::ndgui() :
agui() {
-
}
/**
@@ -52,23 +51,21 @@ void ndgui::init() {
_jsi = new JavascriptInterfaceNDGUI(_webView->page()->mainFrame(), _networkDiscovery);
+ connect(_networkDiscovery, SIGNAL(abortBoot(QString)), _jsi,
+ SLOT(abortBoot(const QString)));
+ connect(_networkDiscovery, SIGNAL(updateStatus(QString)), _jsi,
+ SLOT(updateStatus(const QString&)));
connect(_networkDiscovery, SIGNAL(addInterface(const QString &)), _jsi,
SLOT(addInterface( const QString &)));
+ connect(_networkDiscovery, SIGNAL(updateIfStatus(QString,QString)), _jsi,
+ SLOT(updateIfStatus(const QString &, const QString &)));
connect(_networkDiscovery,
SIGNAL(changeProgressBarValue(const QString & , const int& )),
_jsi, SLOT(updateIfProgressBar(const QString & , const int&)));
connect(_networkDiscovery, SIGNAL(connectionEstablished(QString)), this,
SLOT(handleConnectionEstablished(QString)));
- connect(_networkDiscovery, SIGNAL(abortBoot(QString)), _jsi,
- SLOT(abortBoot(const QString)));
- connect(_networkDiscovery, SIGNAL(updateIfStatus(QString,QString)), _jsi,
- SLOT(updateIfStatus(const QString &, const QString &)));
- connect(_networkDiscovery, SIGNAL(updateStatus(QString)), _jsi,
- SLOT(updateStatus(const QString&)));
connect(_networkDiscovery, SIGNAL(allProcessesFinished()), this,
SLOT(handleAllProcessesFinished()));
- connect(_networkDiscovery, SIGNAL(continueBoot(QString)), this,
- SLOT(continueBoot(QString)));
connect(_jsi, SIGNAL(startFbgui(const QString&)), this,
SLOT(continueBoot(const QString&)));
connect(_networkDiscovery, SIGNAL(continueBootWithoutCheck(QString )),
@@ -122,7 +119,6 @@ void ndgui::setUserChoiceTrue() {
* and starts the networkDiscovery.
*/
void ndgui::startNetworkDiscovery() {
- //disconnect(_webView, SIGNAL(loadFinished(bool)), this, SLOT(startSingleShot()));
if (!_started) {
_started = true;
_networkDiscovery->initAndRun(_userChoice);
@@ -204,21 +200,6 @@ void ndgui::continueBootWithoutCheck(QString ifName) {
this->close();
}
-/* slots */
-/**
- * @brief adds an interface to the DOM tree. Creates its progress bar and it's status label.
- *
- * @param ifName
- * name of the new interface.
- */
-//void ndgui::addInterface(const QString &ifName) {
-// if (ifName == "")
-// return;
-// _manConfList.append(ifName);
-// QString code = QString("addInterface('\%1')").arg(ifName);
-// _webView->page()->mainFrame()->evaluateJavaScript(code);
-//}
-
/**
* @brief crashes everything :)
*/
@@ -227,11 +208,9 @@ void ndgui::tryAgain() {
_networkDiscovery->prepareTryAgain();
delete _allowUserChoice;
delete _tryAgain;
- //delete _webView;
delete _networkDiscovery;
_ifNameList.clear();
- _manConfList.clear();
init();
}
diff --git a/src/fbgui/ndgui.h b/src/fbgui/ndgui.h
index 05e2665..8a02a99 100644
--- a/src/fbgui/ndgui.h
+++ b/src/fbgui/ndgui.h
@@ -34,15 +34,14 @@ public:
public slots:
void startNetworkDiscovery();
+
void handleConnectionEstablished(QString ifName);
void handleAllProcessesFinished();
- void continueBootWithoutCheck(QString ifName);
- void tryAgain();
- /* to delete once the new jsi is tested ... */
-// void addInterface(const QString &ifName);
+ void continueBootWithoutCheck(QString ifName);
void continueBoot(const QString& ifName);
+ void tryAgain();
signals:
void initFbgui();
@@ -59,11 +58,10 @@ private:
QAction* _allowUserChoice;
QAction* _tryAgain;
- bool _userChoice;bool _started;
+ bool _userChoice;
+ bool _started;
- QList<QString> _ifNameList; // maps interfaceName to its gateway
- QList<QString> _manConfList;
- QString _manualConfInterfaces;
+ QList<QString> _ifNameList;
};
#endif // NDGUI_H
diff --git a/src/fbgui/networkdiscovery.cpp b/src/fbgui/networkdiscovery.cpp
index 4e08e80..865d76b 100644
--- a/src/fbgui/networkdiscovery.cpp
+++ b/src/fbgui/networkdiscovery.cpp
@@ -529,11 +529,9 @@ int NetworkDiscovery::ip4_setManualConfiguration(QVariantMap result) {
}
return 0;
- }LOG4CXX_DEBUG(
- ndcLogger,
- "emit signal continueBootWithoutCheck(" << result["ifname"].toString() << ")");
- emit
- continueBootWithoutCheck(result["ifname"].toString());
+ }
+ LOG4CXX_DEBUG(ndcLogger, "emit signal continueBootWithoutCheck(" << result["ifname"].toString() << ")");
+ emit continueBootWithoutCheck(result["ifname"].toString());
return 0;
}
diff --git a/src/fbgui/networkdiscovery.h b/src/fbgui/networkdiscovery.h
index f98566f..51dc8a7 100644
--- a/src/fbgui/networkdiscovery.h
+++ b/src/fbgui/networkdiscovery.h
@@ -40,25 +40,22 @@ public:
~NetworkDiscovery();
void initAndRun(bool userChoice, QStringList* args = NULL);
- int ip4_replaceDefaultRoute(QString ifName, QString gateway, int mss);
+ bool checkConnectivity(QString ifName);
+ bool checkConnectivityViaTcp();
int ip4_setManualConfiguration(QVariantMap result);
+
void tryAgain();
void prepareTryAgain();
- bool checkConnectivity(QString ifName);
- bool checkConnectivityViaTcp();
// Public member access
QList<QString> getIfUpList();
InterfaceConfiguration* getInterfaceConfig(QString ifName);
QString GetErrorStr();
- QString getGatewayForInterface(QString ifName);
-
-
public slots:
-
+ void readyForRun();
void checkForIsRunning();
void handleNewConnection();
@@ -70,58 +67,53 @@ public slots:
void handleProcessStarted();
void handleProcessFinished(int exitCode, QProcess::ExitStatus exitStatus);
- void readyForRun();
-
signals:
+ void updateStatus(QString status);
+
void addInterface(const QString &ifName);
+ void updateIfStatus(QString ifName, QString status);
void changeProgressBarValue(const QString & ifName, const int $newValue);
void connectionEstablished(QString ifName);
- void abortBoot(QString msg);
- void updateIfStatus(QString ifName, QString status);
- void updateStatus(QString status);
+
void allProcessesFinished();
- void continueBoot(QString ifName);
void continueBootWithoutCheck(QString ifName);
- void setManualConfInterfaces(QString jsonArr);
- //void readyForRun();
+ void abortBoot(QString msg);
private:
-
void mainWork();
- void killDHCPCD();
-
- void handleNewInput(QLocalSocket * client);
+ void getListOfNetworkInterfaces();
+ void getListOfNetworkInterfacesWithAutoUp();
+ bool checkBlackList(QString i);
+ bool checkConnectivityViaTcp(QString server);
void runDHCPCD(QList<QString> &interfaces);
void runDHCPCD(QString interface);
+ void killDHCPCD();
- bool checkCarrierState(QString interface);
- bool checkConnectivityViaTcp(QString server);
-
- bool checkBlackList(QString i);
-
- void getListOfNetworkInterfaces();
- void getListOfNetworkInterfacesWithAutoUp();
+ void handleNewInput(QLocalSocket * client);
QLocalServer *_server;
- QMap<QLocalSocket*, QLocalSocket*> _clients;
QLocalSocket *_client;
+ QMap<QLocalSocket*, QLocalSocket*> _clients;
QMap<QString, QLocalSocket*> _ifNameToClient;
QMap<QProcess*, QString> _clientProcessToIfNameMap;
- QStringList _dhcpcdArguments;
- int _numberOfProcesses;
- NetworkManager* _networkManager;
+ //QList<Q_PID> _pidsList;
+
bool _userChoice;
bool _blocked;
+ QTimer*_timer;
QList<QString> _ifUpList;
QList<QString> _ifDownList;
int _ifUpCountdown;
- QTimer*_timer;
- QList<Q_PID> _pidsList;
- QString _errorStr;
+ int _numberOfProcesses;
+ QStringList _dhcpcdArguments;
+
+ NetworkManager* _networkManager;
QMap<QString, InterfaceConfiguration*> _ifcMap;
+
+ QString _errorStr;
};
#endif // NetworkDiscovery_H