From 23bc13f690a08cb049adf5145f115f45cbb9950f Mon Sep 17 00:00:00 2001 From: Niklas Date: Mon, 22 Aug 2011 16:00:24 +0200 Subject: added a additional status label and some signals --- workspace/LogReceiver/ndgui.cpp | 59 +++++++++++++++++++++++------------------ 1 file changed, 33 insertions(+), 26 deletions(-) (limited to 'workspace/LogReceiver/ndgui.cpp') diff --git a/workspace/LogReceiver/ndgui.cpp b/workspace/LogReceiver/ndgui.cpp index 0e743ed..78aa280 100644 --- a/workspace/LogReceiver/ndgui.cpp +++ b/workspace/LogReceiver/ndgui.cpp @@ -5,13 +5,17 @@ ndgui::ndgui(QWidget *parent) { ui.setupUi(this); - connect(&logReceiver, SIGNAL(addNewInterface(QString, int)), this, SLOT(addNewInterface(QString, int))); - connect(&logReceiver, SIGNAL(changeProgressBarValue(int , int )), this, SLOT(handleProgress(int, int))); + connect(&logReceiver, SIGNAL(addNewInterface(QString)), this, SLOT(addNewInterface(QString))); + connect(&logReceiver, SIGNAL(changeProgressBarValue(QString , int )), this, SLOT(handleProgress(QString, int))); connect(&logReceiver, SIGNAL(connectionEstablished(QString)), this, SLOT(handleConnectionEstablished(QString))); + connect(&logReceiver, SIGNAL(abortBoot(QString)), this, SLOT(handleAbortBoot(QString))); + connect(&logReceiver, SIGNAL(updateStatusLabel(QString,QString)), this, SLOT(handleUpdateStatusLabel(QString, QString))); + connect(&logReceiver, SIGNAL(allProcessesFinished()), this, SLOT(handleAllProcessesFinished())); buildGui(); logReceiver.initAndRun("/var/tmp/qt_c_socket_custom"); + numberOfInterfaces = 0; setWindowTitle(tr("NetD")); @@ -51,42 +55,30 @@ void ndgui::createInterfaceGroupBox(){ interfaceGroupBox->setLayout(interfaceGroupBoxLayout); } -void ndgui::addNewInterface(QString ifName, int index) { +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); - progressBars.insert(index, pBar); + 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::addInterfacesToGroupBox(QList &interfaces) { - foreach(QNetworkInterface nI, interfaces){ - int index = indexToIfaceNameMap.value(nI.humanReadableName()); - QHBoxLayout *hBoxLayout = new QHBoxLayout; - QLabel *label = new QLabel(nI.humanReadableName()); - QProgressBar *pBar = new QProgressBar(this); - pBar->setRange(1,100); - pBar->setMaximumSize(200,20); - - progressBars.insert(index,pBar); - - hBoxLayout->addWidget(label, Qt::AlignLeft); - hBoxLayout->addWidget(pBar, Qt::AlignRight); - - interfaceGroupBoxLayout->addLayout(hBoxLayout,2); - } -} -*/ -void ndgui::handleProgress(int iFaceIndex, int newValue) { - qDebug() << "<[---]> SLOT handleProgress activated with: " << iFaceIndex << newValue; - QProgressBar * pBar = progressBars.value(iFaceIndex); + +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); } @@ -96,5 +88,20 @@ void ndgui::handleProgress(int iFaceIndex, int newValue) { } void ndgui::handleConnectionEstablished(QString ifName) { + finalUsableInterfaces.append(ifName); +} + +void ndgui::handleAbortBoot(QString msg) { + qDebug() << "abort boot. reason:" << msg; +} + +void ndgui::handleUpdateStatusLabel(QString ifName, QString status) { + QLabel* label = statusLabels.value(ifName); + label->setText(status); +} + +void ndgui::handleAllProcessesFinished() { + qDebug() << "all Processes finished"; + mainLayout-> } -- cgit v1.2.3-55-g7522