diff --git a/client/devicegroupdialog.cpp b/client/devicegroupdialog.cpp new file mode 100644 index 0000000..587fdc3 --- /dev/null +++ b/client/devicegroupdialog.cpp @@ -0,0 +1,68 @@ +/* +Copyright (C) 2016 Srivats P. + +This file is part of "Ostinato" + +This is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*/ + +#include "devicegroupdialog.h" + +enum { kIpNone, kIp4, kIp6, kIpDual }; +static QStringList ipStackItems = QStringList() + << "None" << "IPv4" << "IPv6" << "Dual"; + +DeviceGroupDialog::DeviceGroupDialog(QWidget *parent, Qt::WindowFlags flags) + : QDialog(parent, flags) +{ + // Setup the Dialog + setupUi(this); + vlanTagCount->setRange(0, kMaxVlanTags); + ipStack->insertItems(0, ipStackItems); +} + +// +// Private Slots +// +void DeviceGroupDialog::on_vlanTagCount_valueChanged(int value) +{ + Q_ASSERT((value >= 0) && (value <= kMaxVlanTags)); + + vlans->setVisible(value > 0); +} + +void DeviceGroupDialog::on_ipStack_currentIndexChanged(int index) +{ + switch (index) { + case kIpNone: + ip4->hide(); + ip6->hide(); + break; + case kIp4: + ip4->show(); + ip6->hide(); + break; + case kIp6: + ip4->hide(); + ip6->show(); + break; + case kIpDual: + ip4->show(); + ip6->show(); + break; + default: + Q_ASSERT(false); // Unreachable! + break; + } +} diff --git a/client/devicegroupdialog.h b/client/devicegroupdialog.h new file mode 100644 index 0000000..15d5815 --- /dev/null +++ b/client/devicegroupdialog.h @@ -0,0 +1,41 @@ +/* +Copyright (C) 2016 Srivats P. + +This file is part of "Ostinato" + +This is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see +*/ + +#ifndef _DEVICE_GROUP_DIALOG_H +#define _DEVICE_GROUP_DIALOG_H + +#include "ui_devicegroupdialog.h" + +#include + +class DeviceGroupDialog: public QDialog, private Ui::DeviceGroupDialog +{ + Q_OBJECT +public: + DeviceGroupDialog(QWidget *parent = NULL, Qt::WindowFlags flags = 0); + +private slots: + void on_vlanTagCount_valueChanged(int value); + void on_ipStack_currentIndexChanged(int index); + +private: + static const int kMaxVlanTags = 4; +}; + +#endif diff --git a/client/devicegroupdialog.ui b/client/devicegroupdialog.ui new file mode 100644 index 0000000..37d5024 --- /dev/null +++ b/client/devicegroupdialog.ui @@ -0,0 +1,399 @@ + + DeviceGroupDialog + + + + 0 + 0 + 504 + 465 + + + + Dialog + + + + + + + + Name + + + + + + + + + + Vlan Tags + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + # + + + + + Vlan Id + + + + + Count + + + + + Step + + + + + CFI/DE + + + + + Prio + + + + + TPID + + + + + + + + + + Total Vlans + + + + + + + false + + + + + + + Devices Per Vlan + + + devicePerVlanCount + + + + + + + + + + Total Devices + + + + + + + false + + + + + + + Mac Address + + + + + + + + + + Step + + + + + + + + + + IP Stack + + + + + + + + + + + + QFrame::Box + + + QFrame::Plain + + + + + + IPv4 Address + + + + + + + + + + + 0 + 0 + + + + / + + + + + + + Step + + + + + + + + + + Gateway + + + + + + + + + + 1 + + + 32 + + + + + + + + + + QFrame::Box + + + QFrame::Plain + + + + + + IPv6 Address + + + + + + + + + + + 0 + 0 + + + + / + + + + + + + Step + + + + + + + + + + Gateway + + + + + + + + + + 1 + + + 128 + + + + + + + + + + + + + + < + + + + + + + > + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok + + + + + + + + + name + vlanTagCount + vlans + devicePerVlanCount + macAddress + macStep + ipStack + ip4Address + ip4PrefixLength + ip4Step + ip4Gateway + ip6Address + ip6PrefixLength + ip6Step + ip6Gateway + prev + next + buttonBox + + + + + buttonBox + accepted() + DeviceGroupDialog + accept() + + + 227 + 289 + + + 157 + 274 + + + + + buttonBox + rejected() + DeviceGroupDialog + reject() + + + 295 + 295 + + + 286 + 274 + + + + + diff --git a/client/ostinato.pro b/client/ostinato.pro index a8073b3..2d9e3a0 100644 --- a/client/ostinato.pro +++ b/client/ostinato.pro @@ -33,6 +33,7 @@ LIBS += -lprotobuf LIBS += -L"../extra/qhexedit2/$(OBJECTS_DIR)/" -lqhexedit2 RESOURCES += ostinato.qrc HEADERS += \ + devicegroupdialog.h \ devicegroupmodel.h \ dumpview.h \ hexlineedit.h \ @@ -58,6 +59,7 @@ HEADERS += \ FORMS += \ about.ui \ + devicegroupdialog.ui \ mainwindow.ui \ portconfigdialog.ui \ portstatsfilter.ui \ @@ -68,6 +70,7 @@ FORMS += \ variablefieldswidget.ui SOURCES += \ + devicegroupdialog.cpp \ devicegroupmodel.cpp \ dumpview.cpp \ stream.cpp \ diff --git a/client/portswindow.cpp b/client/portswindow.cpp index c348091..0de2756 100644 --- a/client/portswindow.cpp +++ b/client/portswindow.cpp @@ -20,6 +20,7 @@ along with this program. If not, see #include "portswindow.h" #include "abstractfileformat.h" +#include "devicegroupdialog.h" #include "portconfigdialog.h" #include "settings.h" #include "streamconfigdialog.h" @@ -813,3 +814,15 @@ _retry: _exit: return; } + +// +// DeviceGroup slots +// +void PortsWindow::on_deviceGroupList_activated(const QModelIndex &index) +{ + if (!index.isValid()) + return; + + DeviceGroupDialog dgd(this); + dgd.exec(); +} diff --git a/client/portswindow.h b/client/portswindow.h index 560ca36..7c12ab1 100644 --- a/client/portswindow.h +++ b/client/portswindow.h @@ -80,6 +80,8 @@ private slots: void on_actionSave_Streams_triggered(); void streamModelDataChanged(); + + void on_deviceGroupList_activated(const QModelIndex &index); }; #endif