diff options
| author | Niklas | 2011-08-01 12:31:12 +0200 |
|---|---|---|
| committer | Niklas | 2011-08-01 12:31:12 +0200 |
| commit | 2a04cb4147eb9c583fae8d0b3120a74eaf1af68a (patch) | |
| tree | 90329cb02eb9435e6f1410cf251677eaf089197c /workspace/LogReceiver/ndgui.cpp | |
| parent | better version of the logwriter.c and started to devide gui and logic (diff) | |
| download | fbgui-2a04cb4147eb9c583fae8d0b3120a74eaf1af68a.tar.gz fbgui-2a04cb4147eb9c583fae8d0b3120a74eaf1af68a.tar.xz fbgui-2a04cb4147eb9c583fae8d0b3120a74eaf1af68a.zip | |
seperation of logic and gui completed.
Diffstat (limited to 'workspace/LogReceiver/ndgui.cpp')
| -rw-r--r-- | workspace/LogReceiver/ndgui.cpp | 29 |
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()) { |
