Extract streamswidget.ui out of portswindow.ui

Only UI extraction is done. PortsWindow is still a combined class that
will be separated in the subsequent commit(s).

Although this commit builds successfully, but the stream actions don't
work because the stream widget's signals are not connected to port
window's slots
This commit is contained in:
Srivats P 2021-11-03 21:05:23 +05:30
parent d9d68ad65c
commit b52d1c5be3
5 changed files with 114 additions and 579 deletions

View File

@ -81,6 +81,7 @@ FORMS += \
preferences.ui \ preferences.ui \
streamconfigdialog.ui \ streamconfigdialog.ui \
streamstatswindow.ui \ streamstatswindow.ui \
streamswidget.ui \
variablefieldswidget.ui variablefieldswidget.ui
SOURCES += \ SOURCES += \

View File

@ -54,7 +54,8 @@ PortsWindow::PortsWindow(PortGroupList *pgl, QWidget *parent)
//plm = new PortGroupList(); //plm = new PortGroupList();
plm = pgl; plm = pgl;
setupUi(this); Ui::PortsWindow::setupUi(this);
Ui::StreamsWidget::setupUi(streamsWidget);
applyMsg_ = new ApplyMessage(); applyMsg_ = new ApplyMessage();
devicesWidget->setPortGroupList(plm); devicesWidget->setPortGroupList(plm);

View File

@ -23,6 +23,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
#include <QWidget> #include <QWidget>
#include <QAbstractItemModel> #include <QAbstractItemModel>
#include "ui_portswindow.h" #include "ui_portswindow.h"
#include "ui_streamswidget.h"
#include "portgrouplist.h" #include "portgrouplist.h"
class ApplyMessage; class ApplyMessage;
@ -34,7 +35,7 @@ namespace OstProto {
class SessionContent; class SessionContent;
} }
class PortsWindow : public QWidget, private Ui::PortsWindow class PortsWindow : public QWidget, private Ui::PortsWindow, private Ui::StreamsWidget
{ {
Q_OBJECT Q_OBJECT

View File

@ -213,114 +213,7 @@
</attribute> </attribute>
<layout class="QVBoxLayout"> <layout class="QVBoxLayout">
<item> <item>
<layout class="QHBoxLayout"> <widget class="QWidget" name="streamsWidget" native="true"/>
<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> </item>
</layout> </layout>
</widget> </widget>
@ -378,33 +271,6 @@ Right-click to create a stream</string>
<string>Disconnect Port Group</string> <string>Disconnect Port Group</string>
</property> </property>
</action> </action>
<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="actionExclusive_Control"> <action name="actionExclusive_Control">
<property name="checkable"> <property name="checkable">
<bool>true</bool> <bool>true</bool>
@ -413,30 +279,11 @@ Right-click to create a stream</string>
<string>Exclusive Port Control (EXPERIMENTAL)</string> <string>Exclusive Port Control (EXPERIMENTAL)</string>
</property> </property>
</action> </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="actionPort_Configuration"> <action name="actionPort_Configuration">
<property name="text"> <property name="text">
<string>Port Configuration ...</string> <string>Port Configuration ...</string>
</property> </property>
</action> </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> </widget>
<customwidgets> <customwidgets>
<customwidget> <customwidget>
@ -450,47 +297,9 @@ Right-click to create a stream</string>
<extends>QTreeView</extends> <extends>QTreeView</extends>
<header>xtreeview.h</header> <header>xtreeview.h</header>
</customwidget> </customwidget>
<customwidget>
<class>XTableView</class>
<extends>QTableView</extends>
<header>xtableview.h</header>
</customwidget>
</customwidgets> </customwidgets>
<resources> <resources>
<include location="ostinato.qrc"/> <include location="ostinato.qrc"/>
</resources> </resources>
<connections> <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> </ui>

View File

@ -1,383 +1,130 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>PortsWindow</class> <class>StreamsWidget</class>
<widget class="QWidget" name="PortsWindow"> <widget class="QWidget" name="StreamsWidget">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>663</width> <width>602</width>
<height>352</height> <height>364</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Form</string> <string>Form</string>
</property> </property>
<layout class="QGridLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item row="0" column="0"> <item>
<widget class="QSplitter" name="splitter"> <layout class="QHBoxLayout">
<property name="orientation"> <item>
<enum>Qt::Horizontal</enum> <widget class="QToolButton" name="startTx">
</property> <property name="toolTip">
<property name="childrenCollapsible"> <string>Start Transmit</string>
<bool>false</bool> </property>
</property> <property name="statusTip">
<widget class="XTreeView" name="tvPortList"> <string>Start transmit on selected port</string>
<property name="sizePolicy"> </property>
<sizepolicy hsizetype="Expanding" vsizetype="Expanding"> <property name="text">
<horstretch>1</horstretch> <string/>
<verstretch>0</verstretch> </property>
</sizepolicy> <property name="icon">
</property> <iconset resource="ostinato.qrc">
<property name="contextMenuPolicy"> <normaloff>:/icons/control_play.png</normaloff>:/icons/control_play.png</iconset>
<enum>Qt::ActionsContextMenu</enum> </property>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
</property>
</widget>
<widget class="QStackedWidget" name="swDetail">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>2</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="currentIndex">
<number>2</number>
</property>
<widget class="QWidget" name="blankPage">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>&lt;p&gt;&lt;b&gt;Welcome to Ostinato!&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;The port list on the left contains all the ports on which you can transmit packets.&lt;/p&gt;
&lt;p&gt;Ports belong to a port group. Make sure the Port Group has a &lt;img src=&quot;:/icons/bullet_green.png&quot;/&gt; next to it, then double click the port group to show or hide the ports in the port group.&lt;/p&gt;
&lt;p&gt;To generate packets, you need to create and configure packet streams. A stream is a sequence of one or more packets.&lt;/p&gt;
&lt;p&gt;To create a stream, select the port on which you want to send packets.&lt;/p&gt;
&lt;hr/&gt;
&lt;p&gt;Don't see the port that you want (or any ports at all) inside the port group? &lt;a href=&quot;https://jump.ostinato.org/noports&quot;&gt;Get Help!&lt;/a&gt;&lt;/p&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget> </widget>
<widget class="QWidget" name="portGroupDetail"> </item>
<layout class="QVBoxLayout" name="verticalLayout_2"> <item>
<item> <widget class="QToolButton" name="stopTx">
<widget class="QLabel" name="label_5"> <property name="toolTip">
<property name="text"> <string>Stop Transmit</string>
<string>&lt;p&gt;You have selected a port group in the port list on the left.&lt;/p&gt; </property>
&lt;p&gt;You can transmit packets on any of the ports within the port group.&lt;/p&gt; <property name="statusTip">
&lt;p&gt;Make sure the port group has a &lt;img src=&quot;:/icons/bullet_green.png&quot;/&gt; next to it and then double click the port group to show or hide the ports in the port group.&lt;/p&gt; <string>Stop transmit on selected port</string>
&lt;p&gt;To generate packets, you need to create and configure packet streams. A stream is a sequence of one or more packets.&lt;/p&gt; </property>
&lt;p&gt;To create a stream, select the port on which you want to send packets. &lt;/p&gt; <property name="text">
&lt;hr/&gt; <string/>
&lt;p&gt;Don't see the port that you want (or any ports at all) inside the port group? &lt;a href=&quot;https://jump.ostinato.org/noports&quot;&gt;Get Help!&lt;/a&gt;&lt;/p&gt;</string> </property>
</property> <property name="icon">
<property name="alignment"> <iconset resource="ostinato.qrc">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> <normaloff>:/icons/control_stop.png</normaloff>:/icons/control_stop.png</iconset>
</property> </property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>177</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget> </widget>
<widget class="QWidget" name="portDetail"> </item>
<layout class="QVBoxLayout"> <item>
<property name="leftMargin"> <spacer>
<number>0</number> <property name="orientation">
</property> <enum>Qt::Horizontal</enum>
<property name="topMargin"> </property>
<number>0</number> <property name="sizeHint" stdset="0">
</property> <size>
<property name="rightMargin"> <width>40</width>
<number>0</number> <height>20</height>
</property> </size>
<property name="bottomMargin"> </property>
<number>0</number> </spacer>
</property> </item>
<item> <item>
<widget class="QFrame" name="frame"> <widget class="QRadioButton" name="radioButton">
<property name="frameShape"> <property name="text">
<enum>QFrame::Panel</enum> <string>Avg pps</string>
</property> </property>
<property name="frameShadow"> <property name="checked">
<enum>QFrame::Raised</enum> <bool>true</bool>
</property> </property>
<layout class="QHBoxLayout"> </widget>
<property name="leftMargin"> </item>
<number>3</number> <item>
</property> <widget class="QLineEdit" name="averagePacketsPerSec"/>
<property name="topMargin"> </item>
<number>3</number> <item>
</property> <widget class="QRadioButton" name="radioButton_2">
<property name="rightMargin"> <property name="text">
<number>3</number> <string>Avg bps</string>
</property> </property>
<property name="bottomMargin"> </widget>
<number>3</number> </item>
</property> <item>
<item> <widget class="QLineEdit" name="averageBitsPerSec">
<spacer> <property name="enabled">
<property name="orientation"> <bool>false</bool>
<enum>Qt::Horizontal</enum> </property>
</property> </widget>
<property name="sizeHint" stdset="0"> </item>
<size> </layout>
<width>40</width> </item>
<height>20</height> <item>
</size> <widget class="XTableView" name="tvStreamList">
</property> <property name="sizePolicy">
</spacer> <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
</item> <horstretch>0</horstretch>
<item> <verstretch>1</verstretch>
<widget class="QLabel" name="applyHint"> </sizepolicy>
<property name="text"> </property>
<string>Apply Hint</string> <property name="contextMenuPolicy">
</property> <enum>Qt::ActionsContextMenu</enum>
</widget> </property>
</item> <property name="whatsThis">
<item> <string>This is the stream list for the selected port
<spacer name="horizontalSpacer">
<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="QPushButton" name="pbApply">
<property name="text">
<string>Apply</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QTabWidget" name="portConfig">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="streamsTab">
<attribute name="title">
<string>Streams</string>
</attribute>
<layout class="QVBoxLayout">
<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 A stream is a sequence of one or more packets
Right-click to create a stream</string> Right-click to create a stream</string>
</property> </property>
<property name="frameShape"> <property name="frameShape">
<enum>QFrame::StyledPanel</enum> <enum>QFrame::StyledPanel</enum>
</property> </property>
<property name="lineWidth"> <property name="lineWidth">
<number>1</number> <number>1</number>
</property> </property>
<property name="selectionMode"> <property name="selectionMode">
<enum>QAbstractItemView::ExtendedSelection</enum> <enum>QAbstractItemView::ExtendedSelection</enum>
</property> </property>
<property name="selectionBehavior"> <property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum> <enum>QAbstractItemView::SelectRows</enum>
</property> </property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="devicesTab">
<attribute name="title">
<string>Devices</string>
</attribute>
<layout class="QVBoxLayout">
<item>
<widget class="DevicesWidget" name="devicesWidget" native="true"/>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</widget>
</widget> </widget>
</item> </item>
</layout> </layout>
<action name="actionNew_Port_Group">
<property name="icon">
<iconset resource="ostinato.qrc">
<normaloff>:/icons/portgroup_add.png</normaloff>:/icons/portgroup_add.png</iconset>
</property>
<property name="text">
<string>New Port Group</string>
</property>
</action>
<action name="actionDelete_Port_Group">
<property name="icon">
<iconset resource="ostinato.qrc">
<normaloff>:/icons/portgroup_delete.png</normaloff>:/icons/portgroup_delete.png</iconset>
</property>
<property name="text">
<string>Delete Port Group</string>
</property>
</action>
<action name="actionConnect_Port_Group">
<property name="icon">
<iconset resource="ostinato.qrc">
<normaloff>:/icons/portgroup_connect.png</normaloff>:/icons/portgroup_connect.png</iconset>
</property>
<property name="text">
<string>Connect Port Group</string>
</property>
</action>
<action name="actionDisconnect_Port_Group">
<property name="icon">
<iconset resource="ostinato.qrc">
<normaloff>:/icons/portgroup_disconnect.png</normaloff>:/icons/portgroup_disconnect.png</iconset>
</property>
<property name="text">
<string>Disconnect Port Group</string>
</property>
</action>
<action name="actionNew_Stream"> <action name="actionNew_Stream">
<property name="icon"> <property name="icon">
<iconset resource="ostinato.qrc"> <iconset resource="ostinato.qrc">
@ -405,14 +152,6 @@ Right-click to create a stream</string>
<string>Edit Stream</string> <string>Edit Stream</string>
</property> </property>
</action> </action>
<action name="actionExclusive_Control">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Exclusive Port Control (EXPERIMENTAL)</string>
</property>
</action>
<action name="actionOpen_Streams"> <action name="actionOpen_Streams">
<property name="text"> <property name="text">
<string>Open Streams ...</string> <string>Open Streams ...</string>
@ -423,11 +162,6 @@ Right-click to create a stream</string>
<string>Save Streams ...</string> <string>Save Streams ...</string>
</property> </property>
</action> </action>
<action name="actionPort_Configuration">
<property name="text">
<string>Port Configuration ...</string>
</property>
</action>
<action name="actionDuplicate_Stream"> <action name="actionDuplicate_Stream">
<property name="icon"> <property name="icon">
<iconset resource="ostinato.qrc"> <iconset resource="ostinato.qrc">
@ -439,17 +173,6 @@ Right-click to create a stream</string>
</action> </action>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget>
<class>DevicesWidget</class>
<extends>QWidget</extends>
<header>deviceswidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>XTreeView</class>
<extends>QTreeView</extends>
<header>xtreeview.h</header>
</customwidget>
<customwidget> <customwidget>
<class>XTableView</class> <class>XTableView</class>
<extends>QTableView</extends> <extends>QTableView</extends>