diff options
Diffstat (limited to 'LogReceiver/ndgui.cpp')
| -rw-r--r-- | LogReceiver/ndgui.cpp | 88 |
1 files changed, 17 insertions, 71 deletions
diff --git a/LogReceiver/ndgui.cpp b/LogReceiver/ndgui.cpp index 7514d8a..ccd67da 100644 --- a/LogReceiver/ndgui.cpp +++ b/LogReceiver/ndgui.cpp @@ -7,16 +7,19 @@ ndgui::ndgui(QMainWindow *parent) : connect(&logReceiver, SIGNAL(changeProgressBarValue(const QString & , const int& )), this, SLOT(updateIfProgressBar(const QString & , const int&))); //connect(&logReceiver, SIGNAL(connectionEstablished(interfaceconfiguration*)), this, SLOT(handleConnectionEstablished(interfaceconfiguration*))); //connect(&logReceiver, SIGNAL(abortBoot(QString)), this, SLOT(handleAbortBoot(QString))); - //connect(&logReceiver, SIGNAL(updateStatusLabel(QString,QString)), this, SLOT(handleUpdateStatusLabel(QString, QString))); + connect(&logReceiver, SIGNAL(updateStatusLabel(QString,QString)), this, SLOT(updateIfStatus(const QString &, const QString &))); //connect(&logReceiver, SIGNAL(allProcessesFinished()), this, SLOT(handleAllProcessesFinished())); + connect(&logReceiver, SIGNAL(continueBoot(QString)), this, SLOT(continueBoot(QString))); + _started = false; _webView = new QWebView(this); + connect(_webView->page()->mainFrame(), SIGNAL( + javaScriptWindowObjectCleared()), this, SLOT(attachToDOM())); connect(_webView, SIGNAL(loadFinished(bool)), this, - SLOT(loadFinished(bool))); + SLOT(startNetworkDiscovery())); + - connect(_webView->page()->mainFrame(), SIGNAL( - javaScriptWindowObjectCleared()), this, SLOT(attachToDOM())); setCentralWidget(_webView); _webView->load(QUrl("qrc:html/networkdiscovery.html")); @@ -25,71 +28,19 @@ ndgui::ndgui(QMainWindow *parent) : setAttribute(Qt::WA_QuitOnClose, true); setWindowFlags(Qt::FramelessWindowHint); - logReceiver.initAndRun("/var/tmp/qt_c_socket_custom"); - numberOfInterfaces = 0; - - } ndgui::~ndgui() { } -void ndgui::buildGui() { - - ndStatusLabel = new QLabel(tr("test")); - ndStatusLabel->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - ndStatusLabel->setAlignment(Qt::AlignCenter); - ndStatusLabel->setMinimumSize(100, 20); - - // create interface group box - createInterfaceGroupBox(); - - mainLayout = new QVBoxLayout; - mainLayout->addWidget(ndStatusLabel); - mainLayout->addWidget(interfaceGroupBox); - - setLayout(mainLayout); -} - -void ndgui::createInterfaceGroupBox() { - interfaceGroupBox = new QGroupBox(tr("Interfaces")); - - interfaceGroupBoxLayout = new QVBoxLayout; - /* add interfaces via addInterfacesToGroupBox()*/ - - interfaceGroupBox->setLayout(interfaceGroupBoxLayout); -} - -void ndgui::addNewInterface(QString ifName) { - qDebug() << "receive interface to add:" << ifName; - QHBoxLayout *hBoxLayout = new QHBoxLayout; - QLabel *label = new QLabel(ifName); - QLabel *labelStatus = new QLabel("waiting"); - QProgressBar *pBar = new QProgressBar(this); - pBar->setRange(1, 100); - pBar->setMaximumSize(200, 20); - - statusLabels.insert(ifName, labelStatus); - progressBars.insert(ifName, pBar); - - hBoxLayout->addWidget(label, Qt::AlignLeft); - hBoxLayout->addWidget(labelStatus, Qt::AlignCenter); - hBoxLayout->addWidget(pBar, Qt::AlignRight); - - numberOfInterfaces++; - - interfaceGroupBoxLayout->addLayout(hBoxLayout, 2); -} - -void ndgui::handleProgress(QString ifName, int newValue) { - qDebug() << "<[---]> SLOT handleProgress activated with: " << ifName - << newValue; - QProgressBar * pBar = progressBars.value(ifName); - if (newValue >= pBar->value()) { - pBar->setValue(newValue); - } else { - qDebug() << "Error: new value is smaller than the old value!"; +void ndgui::startNetworkDiscovery(){ + if(!_started) { + _started = true; + logReceiver.initAndRun("/var/tmp/qt_c_socket_custom"); + } + else { + qDebug() << "NetworkDiscovery already started"; } } @@ -102,10 +53,6 @@ void ndgui::handleAbortBoot(QString msg) { showAbortBootDialog(); } -void ndgui::handleUpdateStatusLabel(QString ifName, QString status) { - QLabel* label = statusLabels.value(ifName); - label->setText(status); -} void ndgui::handleAllProcessesFinished() { qDebug() << "all Processes finished"; @@ -166,7 +113,9 @@ void ndgui::shutDownSystem() { void ndgui::continueBoot(QString ifName) { QString text = "continue with interface: " + ifName; - cID->close(); + qDebug() << text; + _webView->load(QUrl("qrc:html/continueBoot.html")); + //cID->close(); } void ndgui::showLog() { @@ -176,9 +125,6 @@ void ndgui::showLog() { /*test html gui version*/ /* slots */ -void ndgui::loadFinished(bool ok) { - qDebug() << "load finished:" << ok; -} /************************************************/ ////////////////////////////////////////////////// |
