69 lines
1.8 KiB
C++
69 lines
1.8 KiB
C++
|
/*
|
||
|
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 <http://www.gnu.org/licenses/>
|
||
|
*/
|
||
|
|
||
|
#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;
|
||
|
}
|
||
|
}
|