qipdialogbox.cpp
99 lines
| 2.9 KiB
| text/x-c
|
CppLexer
/ common_PLE / qipdialogbox.cpp
r0 | #include "qipdialogbox.h" | |||
#include <QSpinBox> | ||||
#include <QHBoxLayout> | ||||
#include <QVBoxLayout> | ||||
#include <QLabel> | ||||
#include <QString> | ||||
#include <QLocale> | ||||
QIPDialogBox::QIPDialogBox(QWidget *parent) : | ||||
QWidget(parent) | ||||
{ | ||||
//labelGRESBIP = new QLabel(tr("IP not set")); | ||||
QHBoxLayout *addressLayout = new QHBoxLayout; | ||||
QVBoxLayout *mainLayout = new QVBoxLayout; | ||||
addressPart1 = new QSpinBox; | ||||
addressPart2 = new QSpinBox; | ||||
addressPart3 = new QSpinBox; | ||||
addressPart4 = new QSpinBox; | ||||
addressPart1->setRange(0, 255); | ||||
addressPart1->setValue(129); | ||||
addressPart1->setButtonSymbols(QAbstractSpinBox::NoButtons); | ||||
addressPart2->setRange(0, 255); | ||||
addressPart2->setValue(104); | ||||
addressPart2->setButtonSymbols(QAbstractSpinBox::NoButtons); | ||||
addressPart3->setRange(0, 255); | ||||
addressPart3->setValue(27); | ||||
addressPart3->setButtonSymbols(QAbstractSpinBox::NoButtons); | ||||
addressPart4->setRange(0, 255); | ||||
addressPart4->setValue(113); | ||||
addressPart4->setButtonSymbols(QAbstractSpinBox::NoButtons); | ||||
valueChanged(); | ||||
connect(addressPart1, SIGNAL(valueChanged(int)), this, SLOT(valueChanged())); | ||||
connect(addressPart2, SIGNAL(valueChanged(int)), this, SLOT(valueChanged())); | ||||
connect(addressPart3, SIGNAL(valueChanged(int)), this, SLOT(valueChanged())); | ||||
connect(addressPart4, SIGNAL(valueChanged(int)), this, SLOT(valueChanged())); | ||||
addressLayout->addWidget(addressPart1); | ||||
addressLayout->addWidget(addressPart2); | ||||
addressLayout->addWidget(addressPart3); | ||||
addressLayout->addWidget(addressPart4); | ||||
mainLayout->addLayout(addressLayout); | ||||
//mainLayout->addWidget(labelGRESBIP); | ||||
setLayout(mainLayout); | ||||
} | ||||
void QIPDialogBox::valueChanged() // SLOT | ||||
{ | ||||
gresbIP = addressPart1->cleanText(); | ||||
gresbIP.append("."); | ||||
gresbIP.append(addressPart2->cleanText()); | ||||
gresbIP.append("."); | ||||
gresbIP.append(addressPart3->cleanText()); | ||||
gresbIP.append("."); | ||||
gresbIP.append(addressPart4->cleanText()); | ||||
} | ||||
r11 | QString QIPDialogBox::getIP() | |||
r0 | { | |||
return(gresbIP); | ||||
} | ||||
r11 | void QIPDialogBox::setIP(unsigned char address1, unsigned char address2, unsigned char address3, unsigned char address4) | |||
{ | ||||
addressPart1->setValue(address1); | ||||
addressPart2->setValue(address2); | ||||
addressPart3->setValue(address3); | ||||
addressPart4->setValue(address4); | ||||
addressPart1->repaint(); | ||||
addressPart2->repaint(); | ||||
addressPart3->repaint(); | ||||
addressPart4->repaint(); | ||||
} | ||||
r28 | ||||
admin@pc-p-leroy3.LAB-LPP.LOCAL
|
r33 | unsigned char QIPDialogBox::get_addressPart1() | ||
r28 | { | |||
return (unsigned char) addressPart1->value(); | ||||
} | ||||
admin@pc-p-leroy3.LAB-LPP.LOCAL
|
r33 | unsigned char QIPDialogBox::get_addressPart2() | ||
r28 | { | |||
return (unsigned char) addressPart2->value(); | ||||
} | ||||
admin@pc-p-leroy3.LAB-LPP.LOCAL
|
r33 | unsigned char QIPDialogBox::get_addressPart3() | ||
r28 | { | |||
return (unsigned char) addressPart3->value(); | ||||
} | ||||
admin@pc-p-leroy3.LAB-LPP.LOCAL
|
r33 | unsigned char QIPDialogBox::get_addressPart4() | ||
r28 | { | |||
return (unsigned char) addressPart4->value(); | ||||
} | ||||