UX: Enhance StreamConfigDialog

* Add stream name/enabled fields to dialog
* Change Dialog title to include current stream name
This commit is contained in:
Srivats P 2017-09-22 20:45:42 +05:30
parent 7d4f285d8d
commit 6bd687e2bc
4 changed files with 492 additions and 451 deletions

View File

@ -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);
}

View File

@ -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("<unnamed>") : 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));

View File

@ -47,6 +47,8 @@ public:
QWidget *parent = 0);
~StreamConfigDialog();
void setWindowTitle(const QString &title);
private:
enum ButtonId
@ -76,6 +78,7 @@ private:
QList<Stream*> _userStreamList;
QList<Stream*> _streamList;
const Port& mPort;
QString _windowTitle;
uint mCurrentStreamIndex;
Stream *mpStream;

View File

@ -1,3 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>StreamConfigDialog</class>
<widget class="QDialog" name="StreamConfigDialog">
@ -13,7 +14,7 @@
</rect>
</property>
<property name="sizePolicy">
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -22,14 +23,15 @@
<string>Edit Stream</string>
</property>
<property name="windowIcon">
<iconset resource="ostinato.qrc" >:/icons/stream_edit.png</iconset>
<iconset resource="ostinato.qrc">
<normaloff>:/icons/stream_edit.png</normaloff>:/icons/stream_edit.png</iconset>
</property>
<property name="styleSheet">
<string>QLineEdit:enabled[inputMask = "HH; "],&#xd;
QLineEdit:enabled[inputMask = "HH HH; "],&#xd;
QLineEdit:enabled[inputMask = "HH HH HH; "],&#xd;
QLineEdit:enabled[inputMask = "HH HH HH HH; "], &#xd;
QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff } &#xd;
<string>QLineEdit:enabled[inputMask = &quot;HH; &quot;],
QLineEdit:enabled[inputMask = &quot;HH HH; &quot;],
QLineEdit:enabled[inputMask = &quot;HH HH HH; &quot;],
QLineEdit:enabled[inputMask = &quot;HH HH HH HH; &quot;],
QLineEdit:enabled[inputMask = &quot;HH HH HH HH HH HH; &quot;] { background-color: #ccccff }
</string>
</property>
<property name="modal">
@ -49,20 +51,36 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff
<string>Protocol Selection</string>
</attribute>
<layout class="QGridLayout">
<item row="0" column="1">
<widget class="QGroupBox" name="groupBox">
<property name="title">
<string>Basics</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Name</string>
</property>
<property name="sizeHint" >
<size>
<width>241</width>
<height>20</height>
</size>
<property name="buddy">
<cstring>name</cstring>
</property>
</spacer>
</widget>
</item>
<item row="0" column="1">
<widget class="QLineEdit" name="name"/>
</item>
<item row="1" column="0" colspan="2">
<widget class="QCheckBox" name="enabled">
<property name="text">
<string>Enabled</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="2">
<widget class="QGroupBox" name="gbFrameLength">
<property name="title">
<string>Frame Length (including FCS)</string>
@ -136,7 +154,7 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff
</layout>
</widget>
</item>
<item row="1" column="0" colspan="2" >
<item row="1" column="0" colspan="3">
<widget class="QToolBox" name="tbSelectProtocols">
<property name="currentIndex">
<number>0</number>
@ -193,7 +211,7 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff
</layout>
</widget>
</item>
<item rowspan="2" row="0" column="1" >
<item row="0" column="1" rowspan="2">
<widget class="QGroupBox" name="gbFrameType">
<property name="enabled">
<bool>true</bool>
@ -637,7 +655,7 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
@ -651,10 +669,11 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff
<bool>false</bool>
</property>
<property name="text">
<string>></string>
<string>&gt;</string>
</property>
<property name="icon">
<iconset resource="ostinato.qrc" >:/icons/arrow_right.png</iconset>
<iconset resource="ostinato.qrc">
<normaloff>:/icons/arrow_right.png</normaloff>:/icons/arrow_right.png</iconset>
</property>
</widget>
</item>
@ -663,7 +682,7 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
@ -693,7 +712,8 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff
<string>^</string>
</property>
<property name="icon">
<iconset resource="ostinato.qrc" >:/icons/arrow_up.png</iconset>
<iconset resource="ostinato.qrc">
<normaloff>:/icons/arrow_up.png</normaloff>:/icons/arrow_up.png</iconset>
</property>
</widget>
</item>
@ -706,7 +726,8 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff
<string>v</string>
</property>
<property name="icon">
<iconset resource="ostinato.qrc" >:/icons/arrow_down.png</iconset>
<iconset resource="ostinato.qrc">
<normaloff>:/icons/arrow_down.png</normaloff>:/icons/arrow_down.png</iconset>
</property>
</widget>
</item>
@ -719,7 +740,8 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff
<string>-</string>
</property>
<property name="icon">
<iconset resource="ostinato.qrc" >:/icons/delete.png</iconset>
<iconset resource="ostinato.qrc">
<normaloff>:/icons/delete.png</normaloff>:/icons/delete.png</iconset>
</property>
</widget>
</item>
@ -728,7 +750,7 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
@ -773,7 +795,7 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff
</attribute>
<layout class="QHBoxLayout">
<item>
<widget class="VariableFieldsWidget" native="1" name="variableFieldsWidget" />
<widget class="VariableFieldsWidget" name="variableFieldsWidget" native="true"/>
</item>
</layout>
</widget>
@ -808,7 +830,7 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff
</layout>
</widget>
</item>
<item rowspan="2" row="0" column="1" >
<item row="0" column="1" rowspan="2">
<widget class="QGroupBox" name="groupBox_13">
<property name="title">
<string>Numbers</string>
@ -880,7 +902,7 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff
</layout>
</widget>
</item>
<item rowspan="2" row="0" column="2" >
<item row="0" column="2" rowspan="2">
<widget class="QGroupBox" name="groupBox_14">
<property name="title">
<string>Rate</string>
@ -949,7 +971,7 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff
</layout>
</widget>
</item>
<item rowspan="2" row="0" column="3" >
<item row="0" column="3" rowspan="2">
<widget class="QGroupBox" name="nextWhat">
<property name="title">
<string>After this stream</string>
@ -992,12 +1014,12 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff
</layout>
</widget>
</item>
<item rowspan="2" row="0" column="4" >
<item row="0" column="4" rowspan="2">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>41</height>
@ -1124,7 +1146,7 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0">
<size>
<width>153</width>
<height>21</height>
@ -1155,7 +1177,7 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff
<bool>true</bool>
</property>
</widget>
<widget class="DumpView" native="1" name="vwPacketDump" />
<widget class="DumpView" name="vwPacketDump" native="true"/>
</widget>
</item>
</layout>
@ -1183,7 +1205,7 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-color: #ccccff
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0">
<size>
<width>191</width>
<height>20</height>