Add Find & Replace UI with skeletal code
This commit is contained in:
parent
90f855ecdf
commit
990c13e67a
30
client/findreplace.cpp
Normal file
30
client/findreplace.cpp
Normal file
@ -0,0 +1,30 @@
|
||||
/*
|
||||
Copyright (C) 2021 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 "findreplace.h"
|
||||
|
||||
FindReplaceDialog::FindReplaceDialog(QWidget *parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
// Keep things simple and don't use mask(s) (default)
|
||||
useFindMask->setChecked(false);
|
||||
useReplaceMask->setChecked(false);
|
||||
}
|
33
client/findreplace.h
Normal file
33
client/findreplace.h
Normal file
@ -0,0 +1,33 @@
|
||||
/*
|
||||
Copyright (C) 2021 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 _FIND_REPLACE_H
|
||||
#define _FIND_REPLACE_H
|
||||
|
||||
#include "ui_findreplace.h"
|
||||
|
||||
class FindReplaceDialog: public QDialog, public Ui::FindReplace
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
FindReplaceDialog(QWidget *parent = 0);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
334
client/findreplace.ui
Normal file
334
client/findreplace.ui
Normal file
@ -0,0 +1,334 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>FindReplace</class>
|
||||
<widget class="QDialog" name="FindReplace">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>361</width>
|
||||
<height>309</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Find & Replace</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset resource="ostinato.qrc">
|
||||
<normaloff>:/icons/find.png</normaloff>:/icons/find.png</iconset>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="find">
|
||||
<property name="title">
|
||||
<string>Find</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="protocol"/>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="findValueLabel">
|
||||
<property name="text">
|
||||
<string>Value</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="findMask"/>
|
||||
</item>
|
||||
<item row="4" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="matchAny">
|
||||
<property name="text">
|
||||
<string>Match any value</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QCheckBox" name="useFindMask">
|
||||
<property name="text">
|
||||
<string>Mask</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="field"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="protocolLabel">
|
||||
<property name="text">
|
||||
<string>Protocol</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>protocol</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="findValue"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="fieldLabel">
|
||||
<property name="text">
|
||||
<string>Field</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>field</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="2">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p align="center">Matches a field only if <span style="white-space:nowrap">(FieldValue &amp; FindMask) = FindValue</span></p></body></html></string>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="ostinato.qrc">:/icons/info.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="replace">
|
||||
<property name="title">
|
||||
<string>Replace with</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="replaceValueLabel">
|
||||
<property name="text">
|
||||
<string>Value</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="replaceValue"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="useReplaceMask">
|
||||
<property name="text">
|
||||
<string>Mask</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="replaceMask"/>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="toolTip">
|
||||
<string><html><head/><body><p align="center">New field value = <span style="white-space:nowrap">(OldFieldValue &amp; ~ReplaceMask) | (ReplaceValue &amp; ReplaceMask)</span></p></body></html></string>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="ostinato.qrc">:/icons/info.png</pixmap>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="selectedStreamsOnly">
|
||||
<property name="text">
|
||||
<string>Selected Streams Only</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<tabstops>
|
||||
<tabstop>protocol</tabstop>
|
||||
<tabstop>field</tabstop>
|
||||
<tabstop>findValue</tabstop>
|
||||
<tabstop>useFindMask</tabstop>
|
||||
<tabstop>findMask</tabstop>
|
||||
<tabstop>matchAny</tabstop>
|
||||
<tabstop>replaceValue</tabstop>
|
||||
<tabstop>useReplaceMask</tabstop>
|
||||
<tabstop>replaceMask</tabstop>
|
||||
<tabstop>selectedStreamsOnly</tabstop>
|
||||
</tabstops>
|
||||
<resources>
|
||||
<include location="ostinato.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>FindReplace</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>277</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>FindReplace</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>283</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>useFindMask</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>findMask</receiver>
|
||||
<slot>setVisible(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>60</x>
|
||||
<y>115</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>76</x>
|
||||
<y>119</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>useReplaceMask</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>replaceMask</receiver>
|
||||
<slot>setVisible(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>56</x>
|
||||
<y>228</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>73</x>
|
||||
<y>227</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>matchAny</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>findValue</receiver>
|
||||
<slot>setHidden(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>319</x>
|
||||
<y>152</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>316</x>
|
||||
<y>96</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>matchAny</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>findValueLabel</receiver>
|
||||
<slot>setHidden(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>45</x>
|
||||
<y>140</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>44</x>
|
||||
<y>99</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>matchAny</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>useFindMask</receiver>
|
||||
<slot>setHidden(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>60</x>
|
||||
<y>143</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>61</x>
|
||||
<y>123</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>matchAny</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>findMask</receiver>
|
||||
<slot>setHidden(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>141</x>
|
||||
<y>136</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>92</x>
|
||||
<y>126</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>useReplaceMask</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>label</receiver>
|
||||
<slot>setVisible(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>50</x>
|
||||
<y>230</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>333</x>
|
||||
<y>233</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>useFindMask</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>label_2</receiver>
|
||||
<slot>setVisible(bool)</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>46</x>
|
||||
<y>116</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>335</x>
|
||||
<y>122</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
BIN
client/icons/find.png
Normal file
BIN
client/icons/find.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 659 B |
BIN
client/icons/info.png
Normal file
BIN
client/icons/info.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 778 B |
@ -44,6 +44,7 @@ HEADERS += \
|
||||
hexlineedit.h \
|
||||
logsmodel.h \
|
||||
logswindow.h \
|
||||
findreplace.h \
|
||||
mainwindow.h \
|
||||
ndpstatusmodel.h \
|
||||
packetmodel.h \
|
||||
@ -74,6 +75,7 @@ FORMS += \
|
||||
about.ui \
|
||||
devicegroupdialog.ui \
|
||||
deviceswidget.ui \
|
||||
findreplace.ui \
|
||||
logswindow.ui \
|
||||
mainwindow.ui \
|
||||
portconfigdialog.ui \
|
||||
@ -99,6 +101,7 @@ SOURCES += \
|
||||
hexlineedit.cpp \
|
||||
logsmodel.cpp \
|
||||
logswindow.cpp \
|
||||
findreplace.cpp \
|
||||
main.cpp \
|
||||
mainwindow.cpp \
|
||||
ndpstatusmodel.cpp \
|
||||
|
@ -1,5 +1,7 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>icons/find.png</file>
|
||||
<file>icons/info.png</file>
|
||||
<file>icons/about.png</file>
|
||||
<file>icons/add.png</file>
|
||||
<file>icons/anime_error.gif</file>
|
||||
|
@ -20,6 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||
#include "streamswidget.h"
|
||||
|
||||
#include "clipboardhelper.h"
|
||||
#include "findreplace.h"
|
||||
#include "portgrouplist.h"
|
||||
#include "streamconfigdialog.h"
|
||||
#include "streamfileformat.h"
|
||||
@ -52,6 +53,12 @@ StreamsWidget::StreamsWidget(QWidget *parent)
|
||||
sep2->setSeparator(true);
|
||||
tvStreamList->addAction(sep2);
|
||||
|
||||
tvStreamList->addAction(actionFind_Replace);
|
||||
|
||||
QAction *sep3 = new QAction(this);
|
||||
sep3->setSeparator(true);
|
||||
tvStreamList->addAction(sep3);
|
||||
|
||||
tvStreamList->addAction(actionOpen_Streams);
|
||||
tvStreamList->addAction(actionSave_Streams);
|
||||
|
||||
@ -61,9 +68,9 @@ StreamsWidget::StreamsWidget(QWidget *parent)
|
||||
// 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);
|
||||
QAction *sep4 = new QAction("Clipboard", this);
|
||||
sep4->setSeparator(true);
|
||||
tvStreamList->insertAction(sep2, sep4);
|
||||
tvStreamList->insertActions(sep2, clipboardHelper->actions());
|
||||
}
|
||||
|
||||
@ -186,6 +193,9 @@ void StreamsWidget::updateStreamViewActions()
|
||||
actionDuplicate_Stream->setDisabled(true);
|
||||
actionDelete_Stream->setDisabled(true);
|
||||
}
|
||||
|
||||
actionFind_Replace->setEnabled(tvStreamList->model()->rowCount() > 0);
|
||||
|
||||
actionOpen_Streams->setEnabled(plm->isPort(currentPortIndex_));
|
||||
actionSave_Streams->setEnabled(tvStreamList->model()->rowCount() > 0);
|
||||
}
|
||||
@ -290,6 +300,16 @@ void StreamsWidget::on_actionDelete_Stream_triggered()
|
||||
qDebug("No selection");
|
||||
}
|
||||
|
||||
void StreamsWidget::on_actionFind_Replace_triggered()
|
||||
{
|
||||
qDebug("Find & Replace Action");
|
||||
|
||||
FindReplaceDialog findReplace(this);
|
||||
if (findReplace.exec() == QDialog::Accepted) {
|
||||
// TODO
|
||||
}
|
||||
}
|
||||
|
||||
void StreamsWidget::on_actionOpen_Streams_triggered()
|
||||
{
|
||||
qDebug("Open Streams Action");
|
||||
|
@ -49,6 +49,8 @@ private slots:
|
||||
void on_actionDuplicate_Stream_triggered();
|
||||
void on_actionDelete_Stream_triggered();
|
||||
|
||||
void on_actionFind_Replace_triggered();
|
||||
|
||||
void on_actionOpen_Streams_triggered();
|
||||
void on_actionSave_Streams_triggered();
|
||||
|
||||
|
@ -105,6 +105,18 @@ Right-click to create a stream</string>
|
||||
<string>Duplicate Stream</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionFind_Replace">
|
||||
<property name="icon">
|
||||
<iconset resource="ostinato.qrc">
|
||||
<normaloff>:/icons/find.png</normaloff>:/icons/find.png</iconset>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Find && Replace</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Find & Replace protocol field values</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
|
Loading…
Reference in New Issue
Block a user