- About Dialog added

- Stream Dialog now remembers the "selected" tabs across close and reopen
- Other trivial UI enhancements
This commit is contained in:
Srivats P. 2009-04-05 07:19:37 +00:00
parent 53bcc077da
commit 238f332ac4
19 changed files with 271 additions and 283 deletions

View File

@ -1,88 +1,118 @@
<ui version="4.0" >
<class>Dialog</class>
<widget class="QDialog" name="Dialog" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle" >
<string>Dialog</string>
</property>
<layout class="QVBoxLayout" >
<item>
<widget class="QFrame" name="frame" >
<property name="frameShape" >
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" >
<item>
<widget class="QLabel" name="label" >
<property name="text" >
<string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
p, li { white-space: pre-wrap; }
&lt;/style>&lt;/head>&lt;body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">
&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;span style=" font-size:29pt; font-weight:600;">Ostinato&lt;/span>&lt;/p>&lt;/body>&lt;/html></string>
</property>
<property name="alignment" >
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons" >
<set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>Dialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel" >
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel" >
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>Dialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel" >
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel" >
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>
<ui version="4.0" >
<class>About</class>
<widget class="QDialog" name="About" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle" >
<string>About</string>
</property>
<layout class="QVBoxLayout" >
<item>
<widget class="QFrame" name="frame" >
<property name="frameShape" >
<enum>QFrame::Box</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" >
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>360</width>
<height>51</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label" >
<property name="text" >
<string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">&#xd;
p, li { white-space: pre-wrap; }&#xd;
&lt;/style>&lt;/head>&lt;body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;">&#xd;
&lt;p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">&lt;span style=" font-size:29pt; font-weight:600;">Ostinato&lt;/span>&lt;/p>&lt;/body>&lt;/html></string>
</property>
<property name="alignment" >
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_3" >
<property name="text" >
<string>Copyright (c) 2007-2009 Srivats P.</string>
</property>
<property name="alignment" >
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_2" >
<property name="text" >
<string>Icons (c): Mark James (http://www.famfamfam.com/lab/icons/silk/)</string>
</property>
<property name="alignment" >
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox" >
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons" >
<set>QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>About</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel" >
<x>353</x>
<y>280</y>
</hint>
<hint type="destinationlabel" >
<x>286</x>
<y>262</y>
</hint>
</hints>
</connection>
</connections>
</ui>

Binary file not shown.

After

Width:  |  Height:  |  Size: 367 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 736 B

View File

@ -1,9 +1,8 @@
#include <QtGui>
#include "mainwindow.h"
#include "portswindow.h"
#include "portstatswindow.h"
#include "portgrouplist.h"
#include "ui_about.h"
PortGroupList *pgl;
MainWindow::MainWindow(QWidget *parent)
@ -11,20 +10,38 @@ MainWindow::MainWindow(QWidget *parent)
{
pgl = new PortGroupList;
PortsWindow *portsWindow = new PortsWindow(pgl, this);
PortStatsWindow *statsWindow = new PortStatsWindow(pgl, this);
QDockWidget *dock = new QDockWidget(tr("Ports"), this);
QDockWidget *dock2 = new QDockWidget(tr("Stats"), this);
portsWindow = new PortsWindow(pgl, this);
statsWindow = new PortStatsWindow(pgl, this);
portsDock = new QDockWidget(tr("Ports"), this);
statsDock = new QDockWidget(tr("Stats"), this);
setupUi(this);
dock2->setWidget(statsWindow);
addDockWidget(Qt::BottomDockWidgetArea, dock2);
dock->setWidget(portsWindow);
addDockWidget(Qt::TopDockWidgetArea, dock);
statsDock->setWidget(statsWindow);
addDockWidget(Qt::BottomDockWidgetArea, statsDock);
portsDock->setWidget(portsWindow);
addDockWidget(Qt::TopDockWidgetArea, portsDock);
connect(actionFileExit, SIGNAL(triggered()), this, SLOT(close()));
}
void MainWindow::on_actionPreferences_triggered()
MainWindow::~MainWindow()
{
delete statsDock;
delete portsDock;
delete statsWindow;
delete portsWindow;
}
void MainWindow::on_actionHelpAbout_triggered()
{
QDialog *aboutDialog = new QDialog;
Ui::About about;
about.setupUi(aboutDialog);
aboutDialog->exec();
delete aboutDialog;
}

View File

@ -2,16 +2,29 @@
#define _MAIN_WINDOW_H
#include <QMainWindow>
#include <QDockWidget>
#include "ui_mainwindow.h"
#include "portswindow.h"
#include "portstatswindow.h"
class MainWindow : public QMainWindow, private Ui::MainWindow
{
Q_OBJECT
private:
PortsWindow *portsWindow;
PortStatsWindow *statsWindow;
QDockWidget *portsDock;
QDockWidget *statsDock;
public:
MainWindow(QWidget *parent = 0);
~MainWindow();
public slots:
void on_actionPreferences_triggered();
void on_actionHelpAbout_triggered();
};
#endif

View File

@ -10,7 +10,7 @@
</rect>
</property>
<property name="windowTitle" >
<string>MainWindow</string>
<string>Ostinato</string>
</property>
<widget class="QWidget" name="centralwidget" />
<widget class="QMenuBar" name="menubar" >
@ -26,131 +26,26 @@
<property name="title" >
<string>File</string>
</property>
<addaction name="actionE_xit" />
</widget>
<widget class="QMenu" name="menuView" >
<property name="title" >
<string>View</string>
</property>
<addaction name="actionPreferences" />
</widget>
<widget class="QMenu" name="menuWindow" >
<property name="title" >
<string>Window</string>
</property>
<addaction name="actionMinimize" />
<addaction name="actionMaximize_Restore" />
<addaction name="actionMinimize_All" />
<addaction name="actionMaximize_Restoe_All" />
<addaction name="actionArrange_All_Cascade" />
<addaction name="actionArrange_All_Tile" />
<addaction name="actionDock" />
<addaction name="actionFileExit" />
</widget>
<widget class="QMenu" name="menuHelp" >
<property name="title" >
<string>Help</string>
</property>
<addaction name="actionAbout" />
<addaction name="actionHelpAbout" />
</widget>
<addaction name="menuFile" />
<addaction name="menuView" />
<addaction name="menuWindow" />
<addaction name="menuHelp" />
</widget>
<widget class="QStatusBar" name="statusbar" />
<action name="actionOpen_Config" >
<property name="text" >
<string>Open Config</string>
</property>
</action>
<action name="actionSave_Config" >
<property name="text" >
<string>Save Config</string>
</property>
</action>
<action name="actionSave_Config_As" >
<property name="text" >
<string>Save Config As ...</string>
</property>
</action>
<action name="actionOpen_Capture" >
<property name="text" >
<string>Open Capture</string>
</property>
</action>
<action name="actionSave_Capture" >
<property name="text" >
<string>Save Capture</string>
</property>
</action>
<action name="actionSave_Capture_As" >
<property name="text" >
<string>Save Capture As ...</string>
</property>
</action>
<action name="actionE_xit" >
<action name="actionFileExit" >
<property name="text" >
<string>E&amp;xit</string>
</property>
</action>
<action name="actionCopy_Port_Config" >
<action name="actionHelpAbout" >
<property name="text" >
<string>Copy Port Config</string>
</property>
</action>
<action name="actionPaste_Port_Config" >
<property name="text" >
<string>Paste Port Config</string>
</property>
</action>
<action name="actionPreferences" >
<property name="text" >
<string>Preferences</string>
</property>
</action>
<action name="actionMinimize" >
<property name="text" >
<string>Minimize</string>
</property>
</action>
<action name="actionMaximize_Restore" >
<property name="text" >
<string>Maximize/Restore</string>
</property>
</action>
<action name="actionMinimize_All" >
<property name="text" >
<string>Minimize All</string>
</property>
</action>
<action name="actionMaximize_Restoe_All" >
<property name="text" >
<string>Maximize/Restoe All</string>
</property>
</action>
<action name="actionArrange_All_Cascade" >
<property name="text" >
<string>Arrange All - Cascade</string>
</property>
</action>
<action name="actionArrange_All_Tile" >
<property name="text" >
<string>Arrange All - Tile</string>
</property>
</action>
<action name="actionDock" >
<property name="text" >
<string>Dock</string>
</property>
</action>
<action name="actionHelp" >
<property name="text" >
<string>Help</string>
</property>
</action>
<action name="actionAbout" >
<property name="text" >
<string>About</string>
<string>&amp;About</string>
</property>
</action>
</widget>

View File

@ -24,6 +24,7 @@ HEADERS += \
streammodel.h
FORMS += \
about.ui \
mainwindow.ui \
portstatsfilter.ui \
portstatswindow.ui \

View File

@ -12,6 +12,8 @@
<file>icons/portgroup_connect.png</file>
<file>icons/portgroup_delete.png</file>
<file>icons/portgroup_disconnect.png</file>
<file>icons/portstats_clear.png</file>
<file>icons/portstats_clear_all.png</file>
<file>icons/portstats_filter.png</file>
<file>icons/sound_mute.png</file>
<file>icons/sound_none.png</file>

View File

@ -5,12 +5,12 @@
<rect>
<x>0</x>
<y>0</y>
<width>588</width>
<height>320</height>
<width>319</width>
<height>193</height>
</rect>
</property>
<property name="windowTitle" >
<string>Dialog</string>
<string>Select Ports</string>
</property>
<layout class="QVBoxLayout" >
<item>

View File

@ -171,9 +171,9 @@ QVariant PortStatsModel::headerData(int section, Qt::Orientation orientation, in
getDomainIndexes(index(0, section), portGroupIdx, portIdx);
#ifdef Q_OS_WIN32
return QString("Port %1/%2 (*)").arg(portGroupIdx).arg(portIdx);
return QString("Port %1-%2 (*)").arg(portGroupIdx).arg(portIdx);
#else
return QString("Port %1/%2").arg(portGroupIdx).arg(portIdx);
return QString("Port %1-%2").arg(portGroupIdx).arg(portIdx);
#endif
}
else

View File

@ -65,6 +65,9 @@
<property name="text" >
<string>Clear</string>
</property>
<property name="icon" >
<iconset resource="ostinato.qrc" >:/icons/portstats_clear.png</iconset>
</property>
</widget>
</item>
<item>
@ -78,6 +81,9 @@
<property name="text" >
<string>Clear All</string>
</property>
<property name="icon" >
<iconset resource="ostinato.qrc" >:/icons/portstats_clear_all.png</iconset>
</property>
</widget>
</item>
<item>

View File

@ -61,6 +61,9 @@ PortsWindow::PortsWindow(PortGroupList *pgl, QWidget *parent)
// Initially we don't have any ports/streams - so send signal triggers
when_portView_currentChanged(QModelIndex(), QModelIndex());
when_streamView_currentChanged(QModelIndex(), QModelIndex());
//! \todo Hide the Aggregate Box till we add support
frAggregate->setHidden(true);
}
PortsWindow::~PortsWindow()

View File

@ -6,7 +6,7 @@
<x>0</x>
<y>0</y>
<width>689</width>
<height>320</height>
<height>389</height>
</rect>
</property>
<property name="windowTitle" >
@ -28,11 +28,11 @@
</widget>
<widget class="QStackedWidget" name="swDetail" >
<property name="currentIndex" >
<number>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="portDetail" >
<layout class="QVBoxLayout" >
<item>
<layout class="QGridLayout" >
<item row="0" column="0" >
<layout class="QHBoxLayout" >
<item>
<spacer>
@ -56,64 +56,59 @@
</item>
</layout>
</item>
<item>
<layout class="QGridLayout" >
<item rowspan="2" row="0" column="0" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>31</width>
<height>41</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1" >
<widget class="QLabel" name="label" >
<property name="text" >
<string>Capacity</string>
</property>
</widget>
</item>
<item row="0" column="2" >
<widget class="QLineEdit" name="lineEdit_3" />
</item>
<item row="0" column="3" >
<widget class="QLabel" name="label_3" >
<property name="text" >
<string>Aggr fps</string>
</property>
</widget>
</item>
<item row="0" column="4" >
<widget class="QLineEdit" name="lineEdit" />
</item>
<item row="1" column="1" >
<widget class="QLabel" name="label_2" >
<property name="text" >
<string>% age</string>
</property>
</widget>
</item>
<item row="1" column="2" >
<widget class="QLineEdit" name="lineEdit_4" />
</item>
<item row="1" column="3" >
<widget class="QLabel" name="label_4" >
<property name="text" >
<string>Aggr bps</string>
</property>
</widget>
</item>
<item row="1" column="4" >
<widget class="QLineEdit" name="lineEdit_2" />
</item>
</layout>
<item row="1" column="0" >
<widget class="QFrame" name="frAggregate" >
<property name="frameShape" >
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Raised</enum>
</property>
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QLabel" name="label" >
<property name="text" >
<string>Capacity</string>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="QLineEdit" name="lineEdit_3" />
</item>
<item row="0" column="2" >
<widget class="QLabel" name="label_3" >
<property name="text" >
<string>Aggr fps</string>
</property>
</widget>
</item>
<item row="0" column="3" >
<widget class="QLineEdit" name="lineEdit" />
</item>
<item row="1" column="0" >
<widget class="QLabel" name="label_2" >
<property name="text" >
<string>% age</string>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="QLineEdit" name="lineEdit_4" />
</item>
<item row="1" column="2" >
<widget class="QLabel" name="label_4" >
<property name="text" >
<string>Aggr bps</string>
</property>
</widget>
</item>
<item row="1" column="3" >
<widget class="QLineEdit" name="lineEdit_2" />
</item>
</layout>
</widget>
</item>
<item>
<item row="2" column="0" >
<widget class="QTabWidget" name="tabWidget" >
<property name="currentIndex" >
<number>0</number>
@ -147,7 +142,10 @@
<item>
<widget class="QLabel" name="label_5" >
<property name="text" >
<string>Port Group Detail</string>
<string>Select a port to configure streams</string>
</property>
<property name="alignment" >
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>

View File

@ -15,6 +15,7 @@ QString PayloadProtocol::fieldTextValue(int index)
if (parentStream)
{
qDebug("phs = %d", parentStream->protocolHeaderSize());
len = parentStream->frameLen() - parentStream->protocolHeaderSize();
pat = parentStream->pattern();
}
@ -48,6 +49,7 @@ QByteArray PayloadProtocol::fieldRawValue(int index)
if (parentStream)
{
qDebug("phs = %d", parentStream->protocolHeaderSize());
len = parentStream->frameLen() - parentStream->protocolHeaderSize();
pat = parentStream->pattern();
}
@ -1015,7 +1017,8 @@ bool Stream::update(OstProto::Stream *stream)
mIp->update(stream->ip());
mArp->update(stream->arp());
mTcp->update(stream->tcp());
//mTcp->update(stream->tcp());
mTcp->setProtoData(stream->mutable_tcp());
mUdp->update(stream->udp());
mIcmp->update(stream->icmp());
mIgmp->update(stream->igmp());

View File

@ -33,6 +33,9 @@ public:
void getConfig(::google::protobuf::Message *msg)
{ msg->CopyFrom(data()); }
bool setProtoData(::google::protobuf::Message *msg)
{ data().MergeFrom(*msg); return true; }
virtual QString protocolName()
{ return QString("AbstractProtocol"); }
virtual QString protocolShortName()

View File

@ -4,6 +4,9 @@
#include "modeltest.h"
int StreamConfigDialog::lastTopLevelTabIndex = 0;
int StreamConfigDialog::lastProtoTabIndex = 0;
// TODO(HI): Write HexLineEdit::setNum() and num() and use it in
// Load/Store stream methods
@ -177,6 +180,11 @@ StreamConfigDialog::StreamConfigDialog(Port &port, uint streamIndex,
disconnect(rbActionGotoStream, SIGNAL(toggled(bool)), leStreamId, SLOT(setEnabled(bool)));
//! \todo Support Continuous Mode
rbModeContinuous->setDisabled(true);
// Finally, restore the saved last selected tab for the various tab widgets
twTopLevel->setCurrentIndex(lastTopLevelTabIndex);
if (twProto->isTabEnabled(lastProtoTabIndex))
twProto->setCurrentIndex(lastProtoTabIndex);
}
void StreamConfigDialog::setupUiExtra()
@ -230,8 +238,6 @@ void StreamConfigDialog::setupUiExtra()
connect(rbModeContinuous, SIGNAL(toggled(bool)),
this, SLOT(update_NumPacketsAndNumBursts()));
// Show "Packet Config" page by default
twTopLevel->setCurrentIndex(0);
}
StreamConfigDialog::~StreamConfigDialog()
@ -1115,6 +1121,8 @@ void StreamConfigDialog::on_pbOk_clicked()
// Store dialog contents into stream
StoreCurrentStream();
qDebug("stream stored");
lastTopLevelTabIndex = twTopLevel->currentIndex();
lastProtoTabIndex = twProto->currentIndex();
}
//Junk Line for introducing a compiler error

View File

@ -34,6 +34,12 @@ private:
PacketModel *mpPacketModel;
ModelTest *mpPacketModelTester;
// The following static variables are used to track the "selected" tab
// for the various tab widgets so that it can be restored when the dialog
// is opened the next time
static int lastTopLevelTabIndex;
static int lastProtoTabIndex;
void setupUiExtra();
void LoadCurrentStream();
void StoreCurrentStream();

View File

@ -13,7 +13,7 @@
</rect>
</property>
<property name="windowTitle" >
<string>Dialog</string>
<string>Edit Stream</string>
</property>
<property name="styleSheet" >
<string>QLineEdit:enabled[inputMask = "HH; "],&#xd;

View File

@ -85,6 +85,9 @@ _restart:
if (returnToQIdx >= 0)
{
i = returnToQIdx;
// FIXME: 1s fixed; Change this to ipg of last stream
(*pf_usleep)(1000000);
goto _restart;
}