summaryrefslogtreecommitdiffstats
path: root/LogReceiver/ndgui.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'LogReceiver/ndgui.cpp')
-rw-r--r--LogReceiver/ndgui.cpp44
1 files changed, 34 insertions, 10 deletions
diff --git a/LogReceiver/ndgui.cpp b/LogReceiver/ndgui.cpp
index cb2a2f9..be01224 100644
--- a/LogReceiver/ndgui.cpp
+++ b/LogReceiver/ndgui.cpp
@@ -3,6 +3,11 @@
ndgui::ndgui(QMainWindow *parent) :
QMainWindow(parent) {
+ _started = false;
+ _userChoice = false;
+
+ createAction();
+
connect(&networkDiscovery, SIGNAL(addInterface(const QString &)), this, SLOT(addInterface( const QString &)));
connect(&networkDiscovery, SIGNAL(changeProgressBarValue(const QString & , const int& )), this, SLOT(updateIfProgressBar(const QString & , const int&)));
connect(&networkDiscovery, SIGNAL(connectionEstablished(QString)), this, SLOT(handleConnectionEstablished(QString)));
@@ -11,34 +16,53 @@ ndgui::ndgui(QMainWindow *parent) :
connect(&networkDiscovery, SIGNAL(allProcessesFinished()), this, SLOT(handleAllProcessesFinished()));
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(
javaScriptWindowObjectCleared()), this, SLOT(attachToDOM()));
- connect(_webView, SIGNAL(loadFinished(bool)), this,
- SLOT(startNetworkDiscovery()));
-
-
-
setCentralWidget(_webView);
- _webView->load(QUrl("qrc:html/networkdiscovery.html"));
- _webView->show();
setWindowTitle(tr("NetD"));
setAttribute(Qt::WA_QuitOnClose, true);
setWindowFlags(Qt::FramelessWindowHint);
+ _webView->load(QUrl("qrc:html/networkdiscovery_userchoice.html"));
+ _webView->show();
+
+ QTimer::singleShot(2000, this, SLOT(prepareNetworkDiscover()));
+
}
ndgui::~ndgui() {
}
+void ndgui::createAction() {
+ _allowUserChoice = new QAction(tr("&quit"), this);
+ _allowUserChoice->setShortcut(QKeySequence(Qt::Key_F5));
+ connect(_allowUserChoice, SIGNAL(triggered()), this, SLOT(setUserChoiceTrue()));
+ this->addAction(_allowUserChoice);
+}
+
+void ndgui::setUserChoiceTrue() {
+ _userChoice = true;
+}
+
+void ndgui::prepareNetworkDiscover() {
+ connect(_webView, SIGNAL(loadFinished(bool)), this,
+ SLOT(startNetworkDiscovery()));
+ this->removeAction(_allowUserChoice);
+
+ _webView->load(QUrl("qrc:html/networkdiscovery.html"));
+ _webView->show();
+}
+
void ndgui::startNetworkDiscovery(){
+
+ disconnect(_webView,SIGNAL(loadFinished(bool)), this, SLOT(startNetworkDiscovery()));
if(!_started) {
_started = true;
- networkDiscovery.initAndRun("209.85.148.105", true,"/var/tmp/qt_c_socket_custom");
+ networkDiscovery.initAndRun("209.85.148.105", _userChoice,"/var/tmp/qt_c_socket_custom");
}
else {
qDebug() << "NetworkDiscovery already started";