Prepare to extract portWidget from streamsWidget
This commit is contained in:
parent
0a825a0aa3
commit
295fc93e7b
505
client/portwidget.cpp
Normal file
505
client/portwidget.cpp
Normal file
@ -0,0 +1,505 @@
|
||||
/*
|
||||
Copyright (C) 2010 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 "streamswidget.h"
|
||||
|
||||
#include "clipboardhelper.h"
|
||||
#include "portgrouplist.h"
|
||||
#include "streamconfigdialog.h"
|
||||
#include "streamfileformat.h"
|
||||
#include "streamlistdelegate.h"
|
||||
#include "xqlocale.h"
|
||||
|
||||
#include <QInputDialog>
|
||||
#include <QItemSelectionModel>
|
||||
#include <QMessageBox>
|
||||
|
||||
extern ClipboardHelper *clipboardHelper;
|
||||
|
||||
StreamsWidget::StreamsWidget(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
delegate = new StreamListDelegate;
|
||||
tvStreamList->setItemDelegate(delegate);
|
||||
|
||||
tvStreamList->verticalHeader()->setDefaultSectionSize(
|
||||
tvStreamList->verticalHeader()->minimumSectionSize());
|
||||
|
||||
// Populate StreamList Context Menu Actions
|
||||
tvStreamList->addAction(actionNew_Stream);
|
||||
tvStreamList->addAction(actionEdit_Stream);
|
||||
tvStreamList->addAction(actionDuplicate_Stream);
|
||||
tvStreamList->addAction(actionDelete_Stream);
|
||||
|
||||
QAction *sep2 = new QAction(this);
|
||||
sep2->setSeparator(true);
|
||||
tvStreamList->addAction(sep2);
|
||||
|
||||
tvStreamList->addAction(actionOpen_Streams);
|
||||
tvStreamList->addAction(actionSave_Streams);
|
||||
|
||||
// StreamWidget's actions is an aggegate of all sub-widget's actions
|
||||
addActions(tvStreamList->actions());
|
||||
|
||||
// Add the clipboard actions to the context menu of streamList
|
||||
// but not to StreamsWidget's actions since they are already available
|
||||
// in the global Edit Menu
|
||||
QAction *sep3 = new QAction("Clipboard", this);
|
||||
sep3->setSeparator(true);
|
||||
tvStreamList->insertAction(sep2, sep3);
|
||||
tvStreamList->insertActions(sep2, clipboardHelper->actions());
|
||||
}
|
||||
|
||||
void StreamsWidget::setPortGroupList(PortGroupList *portGroups)
|
||||
{
|
||||
plm = portGroups;
|
||||
|
||||
tvStreamList->setModel(plm->getStreamModel());
|
||||
|
||||
connect(plm->getStreamModel(), SIGNAL(rowsInserted(QModelIndex, int, int)),
|
||||
SLOT(updateStreamViewActions()));
|
||||
connect(plm->getStreamModel(), SIGNAL(rowsRemoved(QModelIndex, int, int)),
|
||||
SLOT(updateStreamViewActions()));
|
||||
|
||||
connect(tvStreamList->selectionModel(),
|
||||
SIGNAL(currentChanged(const QModelIndex&, const QModelIndex&)),
|
||||
SLOT(updateStreamViewActions()));
|
||||
connect(tvStreamList->selectionModel(),
|
||||
SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)),
|
||||
SLOT(updateStreamViewActions()));
|
||||
|
||||
tvStreamList->resizeColumnToContents(StreamModel::StreamIcon);
|
||||
tvStreamList->resizeColumnToContents(StreamModel::StreamStatus);
|
||||
|
||||
updateStreamViewActions();
|
||||
|
||||
connect(plm->getStreamModel(),
|
||||
SIGNAL(dataChanged(const QModelIndex&, const QModelIndex&)),
|
||||
this, SLOT(streamModelDataChanged()));
|
||||
connect(plm->getStreamModel(),
|
||||
SIGNAL(modelReset()),
|
||||
this, SLOT(streamModelDataChanged()));
|
||||
}
|
||||
|
||||
void StreamsWidget::streamModelDataChanged()
|
||||
{
|
||||
if (plm->isPort(currentPortIndex_))
|
||||
plm->port(currentPortIndex_).recalculateAverageRates();
|
||||
}
|
||||
|
||||
StreamsWidget::~StreamsWidget()
|
||||
{
|
||||
delete delegate;
|
||||
}
|
||||
|
||||
void StreamsWidget::on_tvStreamList_activated(const QModelIndex & index)
|
||||
{
|
||||
if (!index.isValid())
|
||||
{
|
||||
qDebug("%s: invalid index", __FUNCTION__);
|
||||
return;
|
||||
}
|
||||
|
||||
qDebug("stream list activated\n");
|
||||
|
||||
Port &curPort = plm->port(currentPortIndex_);
|
||||
|
||||
QList<Stream*> streams;
|
||||
streams.append(curPort.mutableStreamByIndex(index.row(), false));
|
||||
|
||||
StreamConfigDialog scd(streams, curPort, this);
|
||||
if (scd.exec() == QDialog::Accepted) {
|
||||
curPort.recalculateAverageRates();
|
||||
curPort.setLocalConfigChanged(true);
|
||||
}
|
||||
}
|
||||
|
||||
void StreamsWidget::setCurrentPortIndex(const QModelIndex &portIndex)
|
||||
{
|
||||
if (!plm)
|
||||
return;
|
||||
|
||||
// XXX: We assume portIndex corresponds to sourceModel, not proxyModel
|
||||
if (!plm->isPort(portIndex))
|
||||
return;
|
||||
|
||||
qDebug("In %s", __FUNCTION__);
|
||||
|
||||
// Disconnect previous port
|
||||
if (plm->isPort(currentPortIndex_))
|
||||
disconnect(&(plm->port(currentPortIndex_)),
|
||||
SIGNAL(portRateChanged(int, int)),
|
||||
this, SLOT(updatePortRates()));
|
||||
|
||||
currentPortIndex_ = portIndex;
|
||||
plm->getStreamModel()->setCurrentPortIndex(portIndex);
|
||||
|
||||
// Connect current port
|
||||
if (plm->isPort(currentPortIndex_))
|
||||
connect(&(plm->port(currentPortIndex_)),
|
||||
SIGNAL(portRateChanged(int, int)),
|
||||
this, SLOT(updatePortRates()));
|
||||
updatePortRates();
|
||||
updateStreamViewActions();
|
||||
}
|
||||
|
||||
void StreamsWidget::on_startTx_clicked()
|
||||
{
|
||||
Q_ASSERT(plm->isPort(currentPortIndex_));
|
||||
|
||||
QModelIndex curPortGroup = plm->getPortModel()->parent(currentPortIndex_);
|
||||
Q_ASSERT(curPortGroup.isValid());
|
||||
Q_ASSERT(plm->isPortGroup(curPortGroup));
|
||||
|
||||
QList<uint> portList({plm->port(currentPortIndex_).id()});
|
||||
plm->portGroup(curPortGroup).startTx(&portList);
|
||||
}
|
||||
|
||||
void StreamsWidget::on_stopTx_clicked()
|
||||
{
|
||||
Q_ASSERT(plm->isPort(currentPortIndex_));
|
||||
|
||||
QModelIndex curPortGroup = plm->getPortModel()->parent(currentPortIndex_);
|
||||
Q_ASSERT(curPortGroup.isValid());
|
||||
Q_ASSERT(plm->isPortGroup(curPortGroup));
|
||||
|
||||
QList<uint> portList({plm->port(currentPortIndex_).id()});
|
||||
plm->portGroup(curPortGroup).stopTx(&portList);
|
||||
}
|
||||
|
||||
void StreamsWidget::on_averagePacketsPerSec_editingFinished()
|
||||
{
|
||||
Q_ASSERT(plm->isPort(currentPortIndex_));
|
||||
|
||||
bool isOk;
|
||||
double pps = XLocale().toDouble(averagePacketsPerSec->text(), &isOk);
|
||||
|
||||
plm->port(currentPortIndex_).setAveragePacketRate(pps);
|
||||
}
|
||||
|
||||
void StreamsWidget::on_averageBitsPerSec_editingFinished()
|
||||
{
|
||||
Q_ASSERT(plm->isPort(currentPortIndex_));
|
||||
|
||||
bool isOk;
|
||||
double bps = XLocale().toDouble(averageBitsPerSec->text(), &isOk);
|
||||
|
||||
plm->port(currentPortIndex_).setAverageBitRate(bps);
|
||||
}
|
||||
|
||||
void StreamsWidget::updatePortRates()
|
||||
{
|
||||
if (!currentPortIndex_.isValid())
|
||||
return;
|
||||
|
||||
if (!plm->isPort(currentPortIndex_))
|
||||
return;
|
||||
|
||||
averagePacketsPerSec->setText(QString("%L1")
|
||||
.arg(plm->port(currentPortIndex_).averagePacketRate(), 0, 'f', 4));
|
||||
averageBitsPerSec->setText(QString("%L1")
|
||||
.arg(plm->port(currentPortIndex_).averageBitRate(), 0, 'f', 0));
|
||||
}
|
||||
|
||||
void StreamsWidget::updateStreamViewActions()
|
||||
{
|
||||
// For some reason hasSelection() returns true even if selection size is 0
|
||||
// so additional check for size introduced
|
||||
if (tvStreamList->selectionModel()->hasSelection() &&
|
||||
(tvStreamList->selectionModel()->selection().size() > 0))
|
||||
{
|
||||
qDebug("Has selection %d",
|
||||
tvStreamList->selectionModel()->selection().size());
|
||||
|
||||
// If more than one non-contiguous ranges selected,
|
||||
// disable "New" and "Edit"
|
||||
if (tvStreamList->selectionModel()->selection().size() > 1)
|
||||
{
|
||||
actionNew_Stream->setDisabled(true);
|
||||
actionEdit_Stream->setDisabled(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
actionNew_Stream->setEnabled(true);
|
||||
actionEdit_Stream->setEnabled(true);
|
||||
}
|
||||
|
||||
// Duplicate/Delete are always enabled as long as we have a selection
|
||||
actionDuplicate_Stream->setEnabled(true);
|
||||
actionDelete_Stream->setEnabled(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug("No selection");
|
||||
if (plm->isPort(currentPortIndex_))
|
||||
actionNew_Stream->setEnabled(true);
|
||||
else
|
||||
actionNew_Stream->setDisabled(true);
|
||||
actionEdit_Stream->setDisabled(true);
|
||||
actionDuplicate_Stream->setDisabled(true);
|
||||
actionDelete_Stream->setDisabled(true);
|
||||
}
|
||||
actionOpen_Streams->setEnabled(plm->isPort(currentPortIndex_));
|
||||
actionSave_Streams->setEnabled(tvStreamList->model()->rowCount() > 0);
|
||||
|
||||
startTx->setEnabled(tvStreamList->model()->rowCount() > 0);
|
||||
stopTx->setEnabled(tvStreamList->model()->rowCount() > 0);
|
||||
}
|
||||
|
||||
void StreamsWidget::on_actionNew_Stream_triggered()
|
||||
{
|
||||
qDebug("New Stream Action");
|
||||
|
||||
QItemSelectionModel* selectionModel = tvStreamList->selectionModel();
|
||||
if (selectionModel->selection().size() > 1) {
|
||||
qDebug("%s: Unexpected selection size %d, can't add", __FUNCTION__,
|
||||
selectionModel->selection().size());
|
||||
return;
|
||||
}
|
||||
|
||||
// In case nothing is selected, insert 1 row at the end
|
||||
StreamModel *streamModel = plm->getStreamModel();
|
||||
int row = streamModel->rowCount(), count = 1;
|
||||
|
||||
// In case we have a single range selected; insert as many rows as
|
||||
// in the singe selected range before the top of the selected range
|
||||
if (selectionModel->selection().size() == 1)
|
||||
{
|
||||
row = selectionModel->selection().at(0).top();
|
||||
count = selectionModel->selection().at(0).height();
|
||||
}
|
||||
|
||||
Port &curPort = plm->port(currentPortIndex_);
|
||||
|
||||
QList<Stream*> streams;
|
||||
for (int i = 0; i < count; i++)
|
||||
streams.append(new Stream);
|
||||
|
||||
StreamConfigDialog scd(streams, curPort, this);
|
||||
scd.setWindowTitle(tr("Add Stream"));
|
||||
if (scd.exec() == QDialog::Accepted)
|
||||
streamModel->insert(row, streams);
|
||||
}
|
||||
|
||||
void StreamsWidget::on_actionEdit_Stream_triggered()
|
||||
{
|
||||
qDebug("Edit Stream Action");
|
||||
|
||||
QItemSelectionModel* streamModel = tvStreamList->selectionModel();
|
||||
if (!streamModel->hasSelection())
|
||||
return;
|
||||
|
||||
Port &curPort = plm->port(currentPortIndex_);
|
||||
|
||||
QList<Stream*> streams;
|
||||
foreach(QModelIndex index, streamModel->selectedRows())
|
||||
streams.append(curPort.mutableStreamByIndex(index.row(), false));
|
||||
|
||||
StreamConfigDialog scd(streams, curPort, this);
|
||||
if (scd.exec() == QDialog::Accepted) {
|
||||
curPort.recalculateAverageRates();
|
||||
curPort.setLocalConfigChanged(true);
|
||||
}
|
||||
}
|
||||
|
||||
void StreamsWidget::on_actionDuplicate_Stream_triggered()
|
||||
{
|
||||
QItemSelectionModel* model = tvStreamList->selectionModel();
|
||||
|
||||
qDebug("Duplicate Stream Action");
|
||||
|
||||
if (model->hasSelection())
|
||||
{
|
||||
bool isOk;
|
||||
int count = QInputDialog::getInt(this, "Duplicate Streams",
|
||||
"Count", 1, 1, 9999, 1, &isOk);
|
||||
|
||||
if (!isOk)
|
||||
return;
|
||||
|
||||
QList<int> list;
|
||||
foreach(QModelIndex index, model->selectedRows())
|
||||
list.append(index.row());
|
||||
plm->port(currentPortIndex_).duplicateStreams(list, count);
|
||||
}
|
||||
else
|
||||
qDebug("No selection");
|
||||
}
|
||||
|
||||
void StreamsWidget::on_actionDelete_Stream_triggered()
|
||||
{
|
||||
qDebug("Delete Stream Action");
|
||||
|
||||
QModelIndex index;
|
||||
|
||||
if (tvStreamList->selectionModel()->hasSelection())
|
||||
{
|
||||
qDebug("SelectedIndexes %d",
|
||||
tvStreamList->selectionModel()->selectedRows().size());
|
||||
while(tvStreamList->selectionModel()->selectedRows().size())
|
||||
{
|
||||
index = tvStreamList->selectionModel()->selectedRows().at(0);
|
||||
plm->getStreamModel()->removeRows(index.row(), 1);
|
||||
}
|
||||
}
|
||||
else
|
||||
qDebug("No selection");
|
||||
}
|
||||
|
||||
void StreamsWidget::on_actionOpen_Streams_triggered()
|
||||
{
|
||||
qDebug("Open Streams Action");
|
||||
|
||||
QStringList fileTypes = StreamFileFormat::supportedFileTypes(
|
||||
StreamFileFormat::kOpenFile);
|
||||
QString fileType;
|
||||
static QString dirName;
|
||||
QString fileName;
|
||||
QString errorStr;
|
||||
bool append = true;
|
||||
bool ret;
|
||||
|
||||
Q_ASSERT(plm->isPort(currentPortIndex_));
|
||||
|
||||
if (fileTypes.size())
|
||||
fileType = fileTypes.at(0);
|
||||
|
||||
fileName = QFileDialog::getOpenFileName(this, tr("Open Streams"),
|
||||
dirName, fileTypes.join(";;"), &fileType);
|
||||
if (fileName.isEmpty())
|
||||
goto _exit;
|
||||
|
||||
if (tvStreamList->model()->rowCount())
|
||||
{
|
||||
QMessageBox msgBox(QMessageBox::Question, qApp->applicationName(),
|
||||
tr("Append to existing streams? Or overwrite?"),
|
||||
QMessageBox::NoButton, this);
|
||||
QPushButton *appendBtn = msgBox.addButton(tr("Append"),
|
||||
QMessageBox::ActionRole);
|
||||
QPushButton *overwriteBtn = msgBox.addButton(tr("Overwrite"),
|
||||
QMessageBox::ActionRole);
|
||||
QPushButton *cancelBtn = msgBox.addButton(QMessageBox::Cancel);
|
||||
|
||||
msgBox.exec();
|
||||
|
||||
if (msgBox.clickedButton() == cancelBtn)
|
||||
goto _exit;
|
||||
else if (msgBox.clickedButton() == appendBtn)
|
||||
append = true;
|
||||
else if (msgBox.clickedButton() == overwriteBtn)
|
||||
append = false;
|
||||
else
|
||||
Q_ASSERT(false);
|
||||
}
|
||||
|
||||
ret = plm->port(currentPortIndex_).openStreams(fileName, append, errorStr);
|
||||
if (!ret || !errorStr.isEmpty())
|
||||
{
|
||||
QMessageBox msgBox(this);
|
||||
QStringList str = errorStr.split("\n\n\n\n");
|
||||
|
||||
msgBox.setIcon(ret ? QMessageBox::Warning : QMessageBox::Critical);
|
||||
msgBox.setWindowTitle(qApp->applicationName());
|
||||
msgBox.setText(str.at(0));
|
||||
if (str.size() > 1)
|
||||
msgBox.setDetailedText(str.at(1));
|
||||
msgBox.setStandardButtons(QMessageBox::Ok);
|
||||
|
||||
msgBox.exec();
|
||||
}
|
||||
dirName = QFileInfo(fileName).absolutePath();
|
||||
updateStreamViewActions();
|
||||
|
||||
_exit:
|
||||
return;
|
||||
}
|
||||
|
||||
void StreamsWidget::on_actionSave_Streams_triggered()
|
||||
{
|
||||
qDebug("Save Streams Action");
|
||||
|
||||
static QString fileName;
|
||||
QStringList fileTypes = StreamFileFormat::supportedFileTypes(
|
||||
StreamFileFormat::kSaveFile);
|
||||
QString fileType;
|
||||
QString errorStr;
|
||||
QFileDialog::Options options;
|
||||
|
||||
// On Mac OS with Native Dialog, getSaveFileName() ignores fileType
|
||||
// which we need
|
||||
#if defined(Q_OS_MAC)
|
||||
options |= QFileDialog::DontUseNativeDialog;
|
||||
#endif
|
||||
|
||||
if (fileTypes.size())
|
||||
fileType = fileTypes.at(0);
|
||||
|
||||
Q_ASSERT(plm->isPort(currentPortIndex_));
|
||||
|
||||
_retry:
|
||||
fileName = QFileDialog::getSaveFileName(this, tr("Save Streams"),
|
||||
fileName, fileTypes.join(";;"), &fileType, options);
|
||||
if (fileName.isEmpty())
|
||||
goto _exit;
|
||||
|
||||
if (QFileInfo(fileName).suffix().isEmpty()) {
|
||||
QString fileExt = fileType.section(QRegExp("[\\*\\)]"), 1, 1);
|
||||
qDebug("Adding extension '%s' to '%s'",
|
||||
qPrintable(fileExt), qPrintable(fileName));
|
||||
fileName.append(fileExt);
|
||||
if (QFileInfo(fileName).exists()) {
|
||||
if (QMessageBox::warning(this, tr("Overwrite File?"),
|
||||
QString("The file \"%1\" already exists.\n\n"
|
||||
"Do you wish to overwrite it?")
|
||||
.arg(QFileInfo(fileName).fileName()),
|
||||
QMessageBox::Yes|QMessageBox::No,
|
||||
QMessageBox::No) != QMessageBox::Yes)
|
||||
goto _retry;
|
||||
}
|
||||
}
|
||||
|
||||
fileType = fileType.remove(QRegExp("\\(.*\\)")).trimmed();
|
||||
if (!fileType.startsWith("Ostinato")
|
||||
&& !fileType.startsWith("Python"))
|
||||
{
|
||||
if (QMessageBox::warning(this, tr("Ostinato"),
|
||||
QString("You have chosen to save in %1 format. All stream "
|
||||
"attributes may not be saved in this format.\n\n"
|
||||
"It is recommended to save in native Ostinato format.\n\n"
|
||||
"Continue to save in %2 format?").arg(fileType).arg(fileType),
|
||||
QMessageBox::Yes|QMessageBox::No,
|
||||
QMessageBox::No) != QMessageBox::Yes)
|
||||
goto _retry;
|
||||
}
|
||||
|
||||
// TODO: all or selected?
|
||||
|
||||
if (!plm->port(currentPortIndex_).saveStreams(fileName, fileType, errorStr))
|
||||
QMessageBox::critical(this, qApp->applicationName(), errorStr);
|
||||
else if (!errorStr.isEmpty())
|
||||
QMessageBox::warning(this, qApp->applicationName(), errorStr);
|
||||
|
||||
fileName = QFileInfo(fileName).absolutePath();
|
||||
_exit:
|
||||
return;
|
||||
}
|
||||
|
||||
|
71
client/portwidget.h
Normal file
71
client/portwidget.h
Normal file
@ -0,0 +1,71 @@
|
||||
/*
|
||||
Copyright (C) 2010 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/>
|
||||
*/
|
||||
|
||||
#ifndef _STREAMS_WIDGET_H
|
||||
#define _STREAMS_WIDGET_H
|
||||
|
||||
#include "ui_streamswidget.h"
|
||||
#include <QWidget>
|
||||
//#include <QAbstractItemModel>
|
||||
|
||||
class PortGroupList;
|
||||
class QAbstractItemDelegate;
|
||||
|
||||
class StreamsWidget : public QWidget, private Ui::StreamsWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
StreamsWidget(QWidget *parent = 0);
|
||||
~StreamsWidget();
|
||||
|
||||
void setPortGroupList(PortGroupList *portGroups);
|
||||
|
||||
public slots:
|
||||
void setCurrentPortIndex(const QModelIndex &portIndex);
|
||||
|
||||
private slots:
|
||||
void updateStreamViewActions();
|
||||
|
||||
void on_startTx_clicked();
|
||||
void on_stopTx_clicked();
|
||||
void on_averagePacketsPerSec_editingFinished();
|
||||
void on_averageBitsPerSec_editingFinished();
|
||||
void updatePortRates();
|
||||
void on_tvStreamList_activated(const QModelIndex & index);
|
||||
|
||||
void on_actionNew_Stream_triggered();
|
||||
void on_actionEdit_Stream_triggered();
|
||||
void on_actionDuplicate_Stream_triggered();
|
||||
void on_actionDelete_Stream_triggered();
|
||||
|
||||
void on_actionOpen_Streams_triggered();
|
||||
void on_actionSave_Streams_triggered();
|
||||
|
||||
void streamModelDataChanged();
|
||||
|
||||
private:
|
||||
PortGroupList *plm{nullptr}; // FIXME: rename to portGroups_?
|
||||
QModelIndex currentPortIndex_;
|
||||
|
||||
QAbstractItemDelegate *delegate;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
219
client/portwidget.ui
Normal file
219
client/portwidget.ui
Normal file
@ -0,0 +1,219 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>StreamsWidget</class>
|
||||
<widget class="QWidget" name="StreamsWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>602</width>
|
||||
<height>364</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout">
|
||||
<item>
|
||||
<widget class="QToolButton" name="startTx">
|
||||
<property name="toolTip">
|
||||
<string>Start Transmit</string>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string>Start transmit on selected port</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="ostinato.qrc">
|
||||
<normaloff>:/icons/control_play.png</normaloff>:/icons/control_play.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="stopTx">
|
||||
<property name="toolTip">
|
||||
<string>Stop Transmit</string>
|
||||
</property>
|
||||
<property name="statusTip">
|
||||
<string>Stop transmit on selected port</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="ostinato.qrc">
|
||||
<normaloff>:/icons/control_stop.png</normaloff>:/icons/control_stop.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButton">
|
||||
<property name="text">
|
||||
<string>Avg pps</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="averagePacketsPerSec"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioButton_2">
|
||||
<property name="text">
|
||||
<string>Avg bps</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="averageBitsPerSec">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="XTableView" name="tvStreamList">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>1</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::ActionsContextMenu</enum>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string>This is the stream list for the selected port
|
||||
|
||||
A stream is a sequence of one or more packets
|
||||
|
||||
Right-click to create a stream</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::ExtendedSelection</enum>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
<action name="actionNew_Stream">
|
||||
<property name="icon">
|
||||
<iconset resource="ostinato.qrc">
|
||||
<normaloff>:/icons/stream_add.png</normaloff>:/icons/stream_add.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>New Stream</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDelete_Stream">
|
||||
<property name="icon">
|
||||
<iconset resource="ostinato.qrc">
|
||||
<normaloff>:/icons/stream_delete.png</normaloff>:/icons/stream_delete.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Delete Stream</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionEdit_Stream">
|
||||
<property name="icon">
|
||||
<iconset resource="ostinato.qrc">
|
||||
<normaloff>:/icons/stream_edit.png</normaloff>:/icons/stream_edit.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Edit Stream</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionOpen_Streams">
|
||||
<property name="text">
|
||||
<string>Open Streams ...</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSave_Streams">
|
||||
<property name="text">
|
||||
<string>Save Streams ...</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionDuplicate_Stream">
|
||||
<property name="icon">
|
||||
<iconset resource="ostinato.qrc">
|
||||
<normaloff>:/icons/stream_duplicate.png</normaloff>:/icons/stream_duplicate.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Duplicate Stream</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>XTableView</class>
|
||||
<extends>QTableView</extends>
|
||||
<header>xtableview.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="ostinato.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>radioButton</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>averagePacketsPerSec</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>326</x>
|
||||
<y>80</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>454</x>
|
||||
<y>79</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>radioButton_2</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>averageBitsPerSec</receiver>
|
||||
<slot>setEnabled(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>523</x>
|
||||
<y>80</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>651</x>
|
||||
<y>88</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
Loading…
Reference in New Issue
Block a user