summaryrefslogtreecommitdiffstats
path: root/workspace/LogReceiver/ndgui.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'workspace/LogReceiver/ndgui.cpp')
-rw-r--r--workspace/LogReceiver/ndgui.cpp29
1 files changed, 26 insertions, 3 deletions
diff --git a/workspace/LogReceiver/ndgui.cpp b/workspace/LogReceiver/ndgui.cpp
index 0d4c505..e838a8c 100644
--- a/workspace/LogReceiver/ndgui.cpp
+++ b/workspace/LogReceiver/ndgui.cpp
@@ -5,8 +5,12 @@ ndgui::ndgui(QWidget *parent)
{
ui.setupUi(this);
- buildGui();
- addInterfacesToGroupBox(list);
+ connect(&logReceiver, SIGNAL(addNewInterface(QString, int)), this, SLOT(addNewInterface(QString, int)));
+ connect(&logReceiver, SIGNAL(changeProgressBarValue(int , int )), this, SLOT(handleProgress(int, int)));
+
+ buildGui();
+
+ logReceiver.initAndRun();
setWindowTitle(tr("NetD"));
@@ -19,6 +23,8 @@ ndgui::~ndgui()
void ndgui::buildGui() {
+
+
ndStatusLabel = new QLabel(tr("test"));
ndStatusLabel->setSizePolicy(QSizePolicy::Expanding,
QSizePolicy::Expanding);
@@ -28,6 +34,8 @@ void ndgui::buildGui() {
// create interface group box
createInterfaceGroupBox();
+
+
mainLayout = new QVBoxLayout;
mainLayout->addWidget(ndStatusLabel);
mainLayout->addWidget(interfaceGroupBox);
@@ -44,6 +52,21 @@ void ndgui::createInterfaceGroupBox(){
interfaceGroupBox->setLayout(interfaceGroupBoxLayout);
}
+void ndgui::addNewInterface(QString ifName, int index) {
+ QHBoxLayout *hBoxLayout = new QHBoxLayout;
+ QLabel *label = new QLabel(ifName);
+ 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::addInterfacesToGroupBox(QList<QNetworkInterface> &interfaces) {
foreach(QNetworkInterface nI, interfaces){
int index = indexToIfaceNameMap.value(nI.humanReadableName());
@@ -61,7 +84,7 @@ void ndgui::addInterfacesToGroupBox(QList<QNetworkInterface> &interfaces) {
interfaceGroupBoxLayout->addLayout(hBoxLayout,2);
}
}
-
+*/
void ndgui::handleProgress(int iFaceIndex, int newValue) {
QProgressBar * pBar = progressBars.value(iFaceIndex);
if(newValue >= pBar->value()) {