Tweak find-replace UI

* matchAny op correctly hides findValue/findMask widgets
 * reorder widgets in the .ui file as per their actual appearance
 * remove tab order since the above reorder also fixes tab order
 * fix stretch factors so that UI redering doesn't change too much when
 things are checked/unchecked
This commit is contained in:
Srivats P 2021-12-12 10:52:43 +05:30
parent 16b353ae30
commit 9208423372
3 changed files with 62 additions and 118 deletions

View File

@ -139,6 +139,25 @@ void FindReplaceDialog::on_field_currentIndexChanged(int index)
}
}
void FindReplaceDialog::on_matchAny_toggled(bool checked)
{
if (checked) {
findValueLabel->setHidden(true);
findValue->setHidden(true);
useFindMask->setHidden(true);
findMask->setHidden(true);
findMaskHint->setHidden(true);
} else {
findValueLabel->setVisible(true);
findValue->setVisible(true);
useFindMask->setVisible(true);
if (useFindMask->isChecked()) {
findMask->setVisible(true);
findMaskHint->setVisible(true);
}
}
}
void FindReplaceDialog::on_buttonBox_accepted()
{
FieldAttrib fieldAttrib = fieldAttrib_.at(field->currentIndex());

View File

@ -33,6 +33,7 @@ public:
private slots:
void on_protocol_currentIndexChanged(const QString &name);
void on_field_currentIndexChanged(int index);
void on_matchAny_toggled(bool checked);
void on_buttonBox_accepted();
private:

View File

@ -23,40 +23,7 @@
<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="FieldEdit" 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>
<layout class="QGridLayout" name="gridLayout" columnstretch="0,1,0">
<item row="0" column="0">
<widget class="QLabel" name="protocolLabel">
<property name="text">
@ -67,8 +34,8 @@
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="FieldEdit" name="findValue"/>
<item row="0" column="1" colspan="2">
<widget class="QComboBox" name="protocol"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="fieldLabel">
@ -80,8 +47,34 @@
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QComboBox" name="field"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="findValueLabel">
<property name="text">
<string>Value</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="FieldEdit" name="findValue"/>
</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="3" column="1">
<widget class="FieldEdit" name="findMask"/>
</item>
<item row="3" column="2">
<widget class="QLabel" name="label_2">
<widget class="QLabel" name="findMaskHint">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;Matches a field only if &lt;span style=&quot;white-space:nowrap&quot;&gt;(FieldValue &amp;amp; FindMask) = FindValue&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
@ -90,6 +83,13 @@
</property>
</widget>
</item>
<item row="4" column="0" colspan="3">
<widget class="QCheckBox" name="matchAny">
<property name="text">
<string>Match any value</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -98,7 +98,7 @@
<property name="title">
<string>Replace with</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<layout class="QGridLayout" name="gridLayout_2" columnstretch="0,1,0">
<item row="0" column="0">
<widget class="QLabel" name="replaceValueLabel">
<property name="text">
@ -106,7 +106,7 @@
</property>
</widget>
</item>
<item row="0" column="1">
<item row="0" column="1" colspan="2">
<widget class="FieldEdit" name="replaceValue"/>
</item>
<item row="1" column="0">
@ -123,7 +123,7 @@
<widget class="FieldEdit" name="replaceMask"/>
</item>
<item row="1" column="2">
<widget class="QLabel" name="label">
<widget class="QLabel" name="replaceMaskHint">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;New field value = &lt;span style=&quot;white-space:nowrap&quot;&gt;(OldFieldValue &amp;amp; ~ReplaceMask) | (ReplaceValue &amp;amp; ReplaceMask)&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
@ -161,18 +161,6 @@
<header>fieldedit.h</header>
</customwidget>
</customwidgets>
<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>
@ -241,74 +229,10 @@
</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>
<receiver>replaceMaskHint</receiver>
<slot>setVisible(bool)</slot>
<hints>
<hint type="sourcelabel">
@ -324,7 +248,7 @@
<connection>
<sender>useFindMask</sender>
<signal>toggled(bool)</signal>
<receiver>label_2</receiver>
<receiver>findMaskHint</receiver>
<slot>setVisible(bool)</slot>
<hints>
<hint type="sourcelabel">