summaryrefslogtreecommitdiff
path: root/ui/qt5
diff options
context:
space:
mode:
Diffstat (limited to 'ui/qt5')
-rw-r--r--ui/qt5/subnetbox.cc11
-rw-r--r--ui/qt5/subnetbox.hh4
2 files changed, 15 insertions, 0 deletions
diff --git a/ui/qt5/subnetbox.cc b/ui/qt5/subnetbox.cc
index 54f1732..071cec8 100644
--- a/ui/qt5/subnetbox.cc
+++ b/ui/qt5/subnetbox.cc
@@ -40,10 +40,16 @@ int SubnetBox::subnetCIDR(void) const {
return cidr->value();
}
+void SubnetBox::setSubnetCIDR(int value) {
+ cidr->setValue(value);
+ cidrEdited(value);
+}
+
void SubnetBox::subnetEdited(const QString &text) {
int value = subnet_mask_to_cidr(text.toUtf8());
if(value > 0) {
cidr->setValue(value);
+ emit valueChanged(value);
}
}
@@ -60,6 +66,11 @@ void SubnetBox::cidrEdited(int value) {
}
snprintf(temp, 4, "%d", lastfilled);
data.append(temp);
+ for(int i = 3; i > bytes; i--) {
+ data.append(".0");
+ }
subnet->setText(data);
+
+ emit valueChanged(value);
}
diff --git a/ui/qt5/subnetbox.hh b/ui/qt5/subnetbox.hh
index 9f2edbf..8104a6b 100644
--- a/ui/qt5/subnetbox.hh
+++ b/ui/qt5/subnetbox.hh
@@ -26,11 +26,15 @@ public:
SubnetBox(QWidget *parent = nullptr);
QString subnetMask() const;
int subnetCIDR() const;
+ void setSubnetCIDR(int value);
public slots:
void subnetEdited(const QString &text);
void cidrEdited(int value);
+signals:
+ void valueChanged(int value);
+
private:
QHBoxLayout *layout;
QLineEdit *subnet;