Fix Filter Tooltip button and frame

Make the frame into a two-row frame to better accomodate
the comments field, and reinstate the correct action for the
buttons

Change-Id: I171e4bc3c7f195b7179cd6b1c2ab4ab42ede9c04
Reviewed-on: https://code.wireshark.org/review/22405
Petri-Dish: Roland Knall <rknall@gmail.com>
Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Roland Knall <rknall@gmail.com>
This commit is contained in:
Roland Knall 2017-06-26 13:02:07 +02:00 committed by Roland Knall
parent 707b789074
commit 680d1df7a0
5 changed files with 162 additions and 133 deletions

View File

@ -56,7 +56,6 @@ void FilterExpressionFrame::addExpression(const QString filter_text)
return;
}
ui->labelLineEdit->setText(tr("Apply this filter"));
ui->displayFilterLineEdit->setText(filter_text);
}
@ -79,7 +78,7 @@ void FilterExpressionFrame::updateWidgets()
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(ok_enable);
}
void FilterExpressionFrame::on_filterExpressionPreferencesToolButton_clicked()
void FilterExpressionFrame::on_filterExpressionPreferencesPushButton_clicked()
{
on_buttonBox_rejected();
emit showPreferencesDialog(PreferencesDialog::ppFilterExpressions);
@ -97,6 +96,9 @@ void FilterExpressionFrame::on_buttonBox_accepted()
QByteArray expr_ba = ui->displayFilterLineEdit->text().toUtf8();
QByteArray comment_ba = ui->commentLineEdit->text().toUtf8();
if ( ui->labelLineEdit->text().length() == 0 )
return;
filter_expression_new(label_ba.constData(), expr_ba.constData(), comment_ba.constData(), TRUE);
on_buttonBox_rejected();

View File

@ -51,7 +51,7 @@ private:
private slots:
void updateWidgets();
void on_filterExpressionPreferencesToolButton_clicked();
void on_filterExpressionPreferencesPushButton_clicked();
void on_labelLineEdit_textChanged(const QString);
void on_buttonBox_accepted();
void on_buttonBox_rejected();

View File

@ -6,10 +6,22 @@
<rect>
<x>0</x>
<y>0</y>
<width>745</width>
<height>34</height>
<width>796</width>
<height>82</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>82</height>
</size>
</property>
<property name="windowTitle">
<string>Frame</string>
</property>
@ -19,140 +31,158 @@
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0,1,0,0,0,0,1,0,0">
<property name="topMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QToolButton" name="filterExpressionPreferencesToolButton">
<property name="text">
<string>Filter Expression Preferences…</string>
</property>
</widget>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QPushButton" name="filterExpressionPreferencesPushButton">
<property name="text">
<string>Filter Buttons Preferences…</string>
</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>5</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>88</width>
<height>5</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="labelLabel">
<property name="text">
<string>Label:</string>
</property>
</widget>
</item>
<item>
<widget class="SyntaxLineEdit" name="labelLineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>5</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="filterLabel">
<property name="text">
<string>Filter:</string>
</property>
</widget>
</item>
<item>
<widget class="DisplayFilterEdit" name="displayFilterLineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="commentLabel">
<property name="text">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="labelLabel">
<property name="text">
<string>Label:</string>
</property>
</widget>
</item>
<item>
<widget class="SyntaxLineEdit" name="labelLineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="placeholderText">
<string>Enter a description for the filter button</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="filterLabel">
<property name="text">
<string>Filter:</string>
</property>
</widget>
</item>
<item>
<widget class="DisplayFilterEdit" name="displayFilterLineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
</size>
</property>
<property name="placeholderText">
<string>Enter a filter expression to be applied</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="commentLabel">
<property name="text">
<string>Comment:</string>
</property>
</widget>
</item>
<item>
<widget class="SyntaxLineEdit" name="commentLineEdit">
<property name="sizePolicy">
</property>
</widget>
</item>
<item>
<widget class="SyntaxLineEdit" name="commentLineEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>0</height>
<width>80</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>5</height>
</size>
</property>
</spacer>
</property>
<property name="placeholderText">
<string>Enter a comment for the filter button</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>27</height>
</size>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</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>5</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>

View File

@ -110,9 +110,6 @@ void FilterExpressionsPreferencesFrame::setUat(epan_uat *uat)
this, SLOT(modelRowsRemoved()));
connect(ui->uatTreeView, SIGNAL(currentItemChanged(QModelIndex,QModelIndex)),
this, SLOT(viewCurrentChanged(QModelIndex,QModelIndex)));
connect(this, SIGNAL(rejected()), this, SLOT(rejectChanges()));
connect(this, SIGNAL(accepted()), this, SLOT(acceptChanges()));
}
setWindowTitle(title);

View File

@ -921,7 +921,7 @@ gboolean MainWindow::filter_expression_add_action(const void *key _U_, void *val
dfb_action->setData(fe->expression);
dfb_action->setProperty(dfe_property_, true);
data->window->filter_expression_toolbar_->addAction(dfb_action);
connect(dfb_action, SIGNAL(data->window->triggered()), data->window, SLOT(data->window->displayFilterButtonClicked()));
connect(dfb_action, SIGNAL(triggered()), data->window, SLOT(displayFilterButtonClicked()));
data->actions_added = true;
return FALSE;
}