blob: 5aef5219dad53cc35a13fad50a8064774f0c5766 [file] [log] [blame]
Ilya Moiseenko18c8a132013-10-24 01:52:52 -07001/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil -*- */
2/*
3 * @copyright See LICENCE for copyright and license information.
4 *
5 * @author Ilya Moiseenko <iliamo@ucla.edu>
6 */
7
8#include "fib-input-dialog.h"
9#include <QVBoxLayout>
10#include <QHBoxLayout>
11
12FibInputDialog::FibInputDialog(QWidget *parent)
13 : QDialog(parent)
14{
15 prefixLabel = new QLabel(tr("NDN name (prefix): "));
16 prefixTextField = new QLineEdit;
17 prefixLabel->setBuddy(prefixTextField);
18
19 tunnelLabel = new QLabel(tr("Tunnel type: "));
20 tunnelComboBox = new QComboBox;
21 tunnelComboBox->addItem(tr("TCP"));
22 tunnelComboBox->addItem(tr("UDP"));
23 tunnelComboBox->setEditable(false);
24 tunnelComboBox->setCurrentIndex(0);
25
26 endpointLabel = new QLabel(tr("Endpoint (IP address): "));
27 endpointTextField = new QLineEdit;
28 endpointLabel->setBuddy(endpointTextField);
29
30 okButton = new QPushButton(tr("&Ok"));
31 cancelButton = new QPushButton(tr("&Cancel"));
32
33 connect(okButton,SIGNAL(pressed()), parent, SLOT(addFibEntry()));
34 connect(cancelButton,SIGNAL(pressed()), this, SLOT(hide()));
35
36 buttonBox = new QDialogButtonBox(Qt::Horizontal);
37 buttonBox->addButton(cancelButton, QDialogButtonBox::ActionRole);
38 buttonBox->addButton(okButton, QDialogButtonBox::ActionRole);
39
40 QHBoxLayout *hlayout = new QHBoxLayout;
41 hlayout->addWidget(tunnelLabel);
42 hlayout->addWidget(tunnelComboBox);
43
44 QVBoxLayout *layout = new QVBoxLayout;
45 layout->addWidget(prefixLabel);
46 layout->addWidget(prefixTextField);
47 layout->addLayout(hlayout);
48 layout->addWidget(endpointLabel);
49 layout->addWidget(endpointTextField);
50 layout->addWidget(buttonBox);
51
52 setLayout(layout);
53
54 setWindowTitle(tr("NDNx Control Center"));
55}
56
57QString
58FibInputDialog::getPrefixName()
59{
60 return prefixTextField->text();
61}
62
63QString
64FibInputDialog::getEndpoint()
65{
66 return endpointTextField->text();
67}
68
69QString
70FibInputDialog::getTunnelType()
71{
72 return tunnelComboBox->currentText();
73}