From 6bd687e2bc2d9997903d978ac8ebcc6aed9624be Mon Sep 17 00:00:00 2001 From: Srivats P Date: Fri, 22 Sep 2017 20:45:42 +0530 Subject: [PATCH] UX: Enhance StreamConfigDialog * Add stream name/enabled fields to dialog * Change Dialog title to include current stream name --- client/portswindow.cpp | 2 +- client/streamconfigdialog.cpp | 16 + client/streamconfigdialog.h | 3 + client/streamconfigdialog.ui | 922 +++++++++++++++++----------------- 4 files changed, 492 insertions(+), 451 deletions(-) diff --git a/client/portswindow.cpp b/client/portswindow.cpp index 2fa93bc..d47d2d7 100644 --- a/client/portswindow.cpp +++ b/client/portswindow.cpp @@ -797,7 +797,7 @@ void PortsWindow::on_actionNew_Stream_triggered() streams.append(new Stream); StreamConfigDialog scd(streams, curPort, this); - scd.setWindowTitle(tr("Add Stream(s)")); + scd.setWindowTitle(tr("Add Stream")); if (scd.exec() == QDialog::Accepted) streamModel->insert(row, streams); } diff --git a/client/streamconfigdialog.cpp b/client/streamconfigdialog.cpp index e8db52e..7c4bcd8 100644 --- a/client/streamconfigdialog.cpp +++ b/client/streamconfigdialog.cpp @@ -67,6 +67,8 @@ StreamConfigDialog::StreamConfigDialog( setupUi(this); setupUiExtra(); + _windowTitle = windowTitle(); + for (int i = ProtoMin; i < ProtoMax; i++) { bgProto[i]->setProperty("ProtocolLevel", i); @@ -333,6 +335,12 @@ StreamConfigDialog::~StreamConfigDialog() delete _streamList.takeFirst(); } +void StreamConfigDialog::setWindowTitle(const QString &title) +{ + _windowTitle = title; + QDialog::setWindowTitle(title); +} + void StreamConfigDialog::loadProtocolWidgets() { ProtocolListIterator *iter; @@ -950,8 +958,14 @@ void StreamConfigDialog::LoadCurrentStream() qDebug("loading mpStream %p", mpStream); variableFieldsWidget->setStream(mpStream); + QDialog::setWindowTitle(QString("%1 [%2]").arg(_windowTitle) + .arg(mpStream->name().isEmpty() ? + tr("") : mpStream->name())); + // Meta Data { + name->setText(mpStream->name()); + enabled->setChecked(mpStream->isEnabled()); cmbPktLenMode->setCurrentIndex(mpStream->lenMode()); lePktLen->setText(str.setNum(mpStream->frameLen())); lePktLenMin->setText(str.setNum(mpStream->frameLenMin())); @@ -1037,6 +1051,8 @@ void StreamConfigDialog::StoreCurrentStream() qDebug("storing pStream %p", pStream); // Meta Data + pStream->setName(name->text()); + pStream->setEnabled(enabled->isChecked()); pStream->setLenMode((Stream::FrameLengthMode) cmbPktLenMode->currentIndex()); pStream->setFrameLen(lePktLen->text().toULong(&isOk)); pStream->setFrameLenMin(lePktLenMin->text().toULong(&isOk)); diff --git a/client/streamconfigdialog.h b/client/streamconfigdialog.h index cecb9cc..62c2fdd 100644 --- a/client/streamconfigdialog.h +++ b/client/streamconfigdialog.h @@ -47,6 +47,8 @@ public: QWidget *parent = 0); ~StreamConfigDialog(); + void setWindowTitle(const QString &title); + private: enum ButtonId @@ -76,6 +78,7 @@ private: QList _userStreamList; QList _streamList; const Port& mPort; + QString _windowTitle; uint mCurrentStreamIndex; Stream *mpStream; diff --git a/client/streamconfigdialog.ui b/client/streamconfigdialog.ui index eacf894..2c02119 100644 --- a/client/streamconfigdialog.ui +++ b/client/streamconfigdialog.ui @@ -1,10 +1,11 @@ - + + StreamConfigDialog - - + + Qt::ApplicationModal - + 0 0 @@ -12,123 +13,140 @@ 507 - - + + 0 0 - + Edit Stream - - :/icons/stream_edit.png + + + :/icons/stream_edit.png:/icons/stream_edit.png - - QLineEdit:enabled[inputMask = "HH; "], -QLineEdit:enabled[inputMask = "HH HH; "], -QLineEdit:enabled[inputMask = "HH HH HH; "], -QLineEdit:enabled[inputMask = "HH HH HH HH; "], -QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff } + + QLineEdit:enabled[inputMask = "HH; "], +QLineEdit:enabled[inputMask = "HH HH; "], +QLineEdit:enabled[inputMask = "HH HH HH; "], +QLineEdit:enabled[inputMask = "HH HH HH HH; "], +QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff } - + true - - - - + + + + - + 0 - - + + Protocol Selection - - - - - Qt::Horizontal + + + + + Basics - - - 241 - 20 - - - + + + + + Name + + + name + + + + + + + + + + Enabled + + + + + - - - + + + Frame Length (including FCS) - - - + + + - + Fixed - + Increment - + Decrement - + Random - - - + + + Min - - - + + + false - + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - + + + Max - - - + + + false - + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -136,13 +154,13 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff - - - + + + 0 - - + + 0 0 @@ -150,42 +168,42 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff 269 - + Simple - - - - + + + + L1 - + - - + + None - + true - - + + Mac - + false - - + + false - + Other @@ -193,65 +211,65 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff - - - + + + true - + L2 - + - - + + None - + true - - + + Ethernet II - + false - - + + 802.3 Raw - - + + 802.3 LLC - + false - - + + 802.3 LLC SNAP - - + + false - + Other @@ -259,116 +277,116 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff - - - + + + true - + L3 - - - - + + + + None - + true - - - + + + false - + ARP - - - + + + false - + IPv4 - + false - - - + + + false - + IPv6 - - - + + + false - + IP 6over4 - + false - - - + + + false - + IP 4over6 - + false - - - + + + false - + IP 4over4 - + false - - - + + + false - + IP 6over6 - + false - - - + + + false - + Other @@ -376,41 +394,41 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff - - - + + + true - + L5 - + - - + + None - + true - - + + false - + Text - - + + false - + Other @@ -418,41 +436,41 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff - - - + + + true - + VLAN - + false - + false - + - - + + Untagged - + true - - + + Tagged - - + + Stacked @@ -460,81 +478,81 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff - - - + + + true - + L4 - - - - + + + + None - + true - - - + + + false - + ICMP - - - + + + false - + IGMP - - - + + + false - + TCP - - - + + + false - + UDP - - - + + + false - + Other - - - + + + false - + MLD @@ -542,48 +560,48 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff - - - + + + true - + Payload - + - - + + None - + true - - + + Pattern - + false - - + + Hex Dump - - + + false - + Other @@ -593,8 +611,8 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff - - + + 0 0 @@ -602,28 +620,28 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff 135 - + Advanced - + - + - - + + Available Protocols - - + + true - + QAbstractItemView::ExtendedSelection - + QAbstractItemView::SelectRows @@ -631,13 +649,13 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff - + - + Qt::Vertical - + 20 40 @@ -646,24 +664,25 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff - - + + false - - > + + > - - :/icons/arrow_right.png + + + :/icons/arrow_right.png:/icons/arrow_right.png - + Qt::Vertical - + 20 40 @@ -674,61 +693,64 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff - + - - + + Selected Protocols - + - - + + false - + ^ - - :/icons/arrow_up.png + + + :/icons/arrow_up.png:/icons/arrow_up.png - - + + false - + v - - :/icons/arrow_down.png + + + :/icons/arrow_down.png:/icons/arrow_down.png - - + + false - + - - - :/icons/delete.png + + + :/icons/delete.png:/icons/delete.png - + Qt::Horizontal - + 40 20 @@ -739,8 +761,8 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff - - + + QAbstractItemView::SelectRows @@ -753,54 +775,54 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff - - + + Protocol Data - + - - + + -1 - - + + Variable Fields - + - + - - + + Stream Control - - - - + + + + Send - + - - + + Packets - + true - - + + Bursts @@ -808,71 +830,71 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff - - - + + + Numbers - + - - + + Number of Packets - + leNumPackets - - + + - + - + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - + + Number of Bursts - + leNumBursts - - + + false - + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - + + Packets per Burst - + lePacketsPerBurst - - + + false - + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -880,68 +902,68 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff - - - + + + Rate - + false - + false - + - - + + Packets/Sec - + true - - + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - + + false - + Bursts/Sec - - + + false - + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - + + Bits/Sec - - + + false - + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -949,42 +971,42 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff - - - + + + After this stream - + - - + + Stop - - + + Goto Next Stream - + true - - + + Goto First - - + + false - + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -992,12 +1014,12 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff - + - + Qt::Horizontal - + 20 41 @@ -1005,25 +1027,25 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff - - - + + + Mode - + - - + + Fixed - + true - - + + Continuous @@ -1031,87 +1053,87 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff - - - + + + true - + Gaps (in seconds) - + false - + false - - - - + + + + - - :/icons/gaps.png + + :/icons/gaps.png - - - + + + ISG - + leGapIsg - - - + + + false - + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - + + + IBG - + leGapIbg - - - + + + false - + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - + + + IPG - + leGapIpg - - - + + + false - + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter @@ -1119,12 +1141,12 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff - + - + Qt::Vertical - + 153 21 @@ -1134,56 +1156,56 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff - - + + Packet View - + - - + + Qt::Vertical - - + + QAbstractItemView::SelectItems - + QAbstractItemView::ScrollPerPixel - + true - + - - + + - - + + Prev - - + + Next - + Qt::Horizontal - + 191 20 @@ -1192,18 +1214,18 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff - - + + OK - + true - - + + Cancel @@ -1298,7 +1320,7 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff pbCancel - + @@ -1307,11 +1329,11 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff StreamConfigDialog reject() - + 623 496 - + 533 466 @@ -1323,11 +1345,11 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff leStreamId setEnabled(bool) - + 463 143 - + 463 177 @@ -1339,11 +1361,11 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff rbPacketsPerSec setEnabled(bool) - + 30 68 - + 299 82 @@ -1355,11 +1377,11 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff rbBurstsPerSec setEnabled(bool) - + 30 95 - + 299 132 @@ -1371,11 +1393,11 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff lePacketsPerBurst setEnabled(bool) - + 30 95 - + 134 189 @@ -1387,11 +1409,11 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff lePacketsPerSec setEnabled(bool) - + 299 82 - + 299 108 @@ -1403,11 +1425,11 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff leBurstsPerSec setEnabled(bool) - + 299 132 - + 299 158 @@ -1419,11 +1441,11 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff leBitsPerSec setEnabled(bool) - + 299 182 - + 299 208 @@ -1435,11 +1457,11 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff rbPacketsPerSec setChecked(bool) - + 95 70 - + 299 82 @@ -1451,11 +1473,11 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff rbBurstsPerSec setChecked(bool) - + 96 98 - + 299 132 @@ -1467,11 +1489,11 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff leNumPackets setDisabled(bool) - + 73 196 - + 164 108 @@ -1483,11 +1505,11 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff leNumBursts setDisabled(bool) - + 96 199 - + 226 155