From a8087a7c1b83ae7770f2b1c278d0eb5318b7e33e Mon Sep 17 00:00:00 2001 From: Niklas Date: Wed, 28 Sep 2011 17:44:42 +0200 Subject: added a select field to the manual conf gui. also fixed some bugs in the ip4_manualConf function --- LogReceiver/ndgui.cpp | 39 +++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) (limited to 'LogReceiver/ndgui.cpp') diff --git a/LogReceiver/ndgui.cpp b/LogReceiver/ndgui.cpp index e3ddfd4..26e924c 100644 --- a/LogReceiver/ndgui.cpp +++ b/LogReceiver/ndgui.cpp @@ -12,6 +12,7 @@ ndgui::ndgui(QMainWindow *parent) : connect(&networkDiscovery, SIGNAL(continueBoot(QString, int)), this, SLOT(continueBoot(QString, int))); _started = false; + _manualConfInterfaces = "[\"NO INTERFACE\"]"; _webView = new QWebView(this); connect(_webView->page()->mainFrame(), SIGNAL( @@ -74,14 +75,13 @@ void ndgui::continueBoot(QString ifName, int userChoice) { if (!userChoice) { QString text = "continue with interface: " + ifName; qDebug() << text << "no user choice"; - _webView->load(QUrl("qrc:html/continueBoot.html")); } else { QString text = "continue with interface: " + ifName; qDebug() << text << "with user choice"; - _webView->load(QUrl("qrc:html/continueBoot.html")); QString gateway = networkDiscovery.getGatewayForInterface(ifName); networkDiscovery.ip4_replaceDefaultRoute(ifName,gateway,0); } + _webView->load(QUrl("qrc:html/continueBoot.html")); } void ndgui::showLog() { @@ -89,6 +89,35 @@ void ndgui::showLog() { } /*test html gui version*/ + +QVariantList ndgui::getManualConfInterfaces() { + qDebug() << "call getManualConfInterfaces"; + /* + QString jsonArr(""); + if(_manConfList.size() > 0) { + jsonArr = "["; + for(int i = 0; i < _manConfList.size()-1; i++) { + jsonArr += "'" + _manConfList.value(i) + "',"; + } + jsonArr += "'" + _manConfList.last() + "']"; + + } + qDebug() << "value of jsonArr:" << jsonArr; + */ + QVariantList jsonArr; + foreach (QString s, _manConfList) { + QVariant e(s); + jsonArr << e; + } + qDebug() << "value of jsonArr:" << jsonArr; + return jsonArr; +} + +int ndgui::ip4_setManualConfiguration(QVariantMap jsonArr) { + return networkDiscovery.ip4_setManualConfiguration(jsonArr); + +} + /* slots */ @@ -134,6 +163,7 @@ void ndgui::loadJQuery() { // und _webView->page()->mainFrame() zu _parent void ndgui::abortBoot(const QString msg) { + qDebug() << "call abortBoot:" << msg; QString code = QString("abortBootDialog('\%1')").arg(msg); _webView->page()->mainFrame()->evaluateJavaScript(code); } @@ -166,9 +196,10 @@ void ndgui::addInterface(const QString &ifName) { if (ifName == "") return; qDebug() << "call addInterface"; + _manConfList.append(ifName); QString code = QString("addInterface('\%1')").arg(ifName); _webView->page()->mainFrame()->evaluateJavaScript(code); } -void ndgui::notifyCall(){ - qDebug() << "------ called"; +void ndgui::notifyCall(QString msg){ + qDebug() << "------ called:" << msg; } -- cgit v1.2.3-55-g7522