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); streams.append(new Stream);
StreamConfigDialog scd(streams, curPort, this); StreamConfigDialog scd(streams, curPort, this);
scd.setWindowTitle(tr("Add Stream(s)")); scd.setWindowTitle(tr("Add Stream"));
if (scd.exec() == QDialog::Accepted) if (scd.exec() == QDialog::Accepted)
streamModel->insert(row, streams); streamModel->insert(row, streams);
} }

View File

@ -67,6 +67,8 @@ StreamConfigDialog::StreamConfigDialog(
setupUi(this); setupUi(this);
setupUiExtra(); setupUiExtra();
_windowTitle = windowTitle();
for (int i = ProtoMin; i < ProtoMax; i++) for (int i = ProtoMin; i < ProtoMax; i++)
{ {
bgProto[i]->setProperty("ProtocolLevel", i); bgProto[i]->setProperty("ProtocolLevel", i);
@ -333,6 +335,12 @@ StreamConfigDialog::~StreamConfigDialog()
delete _streamList.takeFirst(); delete _streamList.takeFirst();
} }
void StreamConfigDialog::setWindowTitle(const QString &title)
{
_windowTitle = title;
QDialog::setWindowTitle(title);
}
void StreamConfigDialog::loadProtocolWidgets() void StreamConfigDialog::loadProtocolWidgets()
{ {
ProtocolListIterator *iter; ProtocolListIterator *iter;
@ -950,8 +958,14 @@ void StreamConfigDialog::LoadCurrentStream()
qDebug("loading mpStream %p", mpStream); qDebug("loading mpStream %p", mpStream);
variableFieldsWidget->setStream(mpStream); variableFieldsWidget->setStream(mpStream);
QDialog::setWindowTitle(QString("%1 [%2]").arg(_windowTitle)
.arg(mpStream->name().isEmpty() ?
tr("<unnamed>") : mpStream->name()));
// Meta Data // Meta Data
{ {
name->setText(mpStream->name());
enabled->setChecked(mpStream->isEnabled());
cmbPktLenMode->setCurrentIndex(mpStream->lenMode()); cmbPktLenMode->setCurrentIndex(mpStream->lenMode());
lePktLen->setText(str.setNum(mpStream->frameLen())); lePktLen->setText(str.setNum(mpStream->frameLen()));
lePktLenMin->setText(str.setNum(mpStream->frameLenMin())); lePktLenMin->setText(str.setNum(mpStream->frameLenMin()));
@ -1037,6 +1051,8 @@ void StreamConfigDialog::StoreCurrentStream()
qDebug("storing pStream %p", pStream); qDebug("storing pStream %p", pStream);
// Meta Data // Meta Data
pStream->setName(name->text());
pStream->setEnabled(enabled->isChecked());
pStream->setLenMode((Stream::FrameLengthMode) cmbPktLenMode->currentIndex()); pStream->setLenMode((Stream::FrameLengthMode) cmbPktLenMode->currentIndex());
pStream->setFrameLen(lePktLen->text().toULong(&isOk)); pStream->setFrameLen(lePktLen->text().toULong(&isOk));
pStream->setFrameLenMin(lePktLenMin->text().toULong(&isOk)); pStream->setFrameLenMin(lePktLenMin->text().toULong(&isOk));

View File

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

File diff suppressed because it is too large Load Diff