Add Filter Expressions^WButton^WShortcut^WBookmark preferences.

Add comments noting that

- We might want to do something different when the bookmark button is
  pressed.
- The display filters (dfilters file) and gui.filter_expressions
  preferences should be merged.
- Many buttons on Qt4 + OS X + unifiedTitleAndToolBarOnMac makes the
  main window really wide.

Add a qstring_strdup convenience routine. Add "disabled" display filter
edit icons. Fix up whitespace and descriptions in a couple of places.

svn path=/trunk/; revision=47522
This commit is contained in:
Gerald Combs 2013-02-06 18:22:54 +00:00
parent ae527cbf10
commit 1c0deb0fc8
25 changed files with 753 additions and 90 deletions

View File

@ -25,8 +25,6 @@
#ifndef __FILTER_EXPRESSIONS_H__
#define __FILTER_EXPRESSIONS_H__
#include "globals.h"
struct filter_expression {
gpointer button; /* Filter toolbar */
gchar *label;
@ -34,7 +32,7 @@ struct filter_expression {
gint index;
gboolean enabled; /* Can be set to FALSE by Preferences Dialog */
gboolean deleted; /* Can be set to TRUE by Preferences Dialog */
gboolean deleted; /* Can be set to TRUE by Preferences Dialog (GTK+ only) */
struct filter_expression *next;
};

Binary file not shown.

After

Width:  |  Height:  |  Size: 333 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 634 B

View File

@ -12,5 +12,7 @@
<file>dfilter_apply_hover.png</file>
<file>dfilter_apply_normal.png</file>
<file>dfilter_apply_pressed.png</file>
<file>dfilter_apply_disabled.png</file>
<file>dfilter_bookmark_disabled.png</file>
</qresource>
</RCC>

View File

@ -251,7 +251,7 @@ filter_expression_save_dlg(gpointer data)
/* */
main_filter_save_hb = ws_gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 3, FALSE);
gtk_box_pack_start(GTK_BOX (main_vb), main_filter_save_hb, TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX (main_vb), main_filter_save_hb, TRUE, TRUE, 0);
gtk_widget_show(main_filter_save_hb);
/* Filter Save frame */
@ -268,7 +268,7 @@ filter_expression_save_dlg(gpointer data)
/* filter_save type row */
filter_save_type_hb = ws_gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 3, FALSE);
gtk_box_pack_start(GTK_BOX (filter_save_type_vb), filter_save_type_hb, TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX (filter_save_type_vb), filter_save_type_hb, TRUE, TRUE, 0);
gtk_widget_show(filter_save_type_hb);

View File

@ -232,7 +232,7 @@ filter_toolbar_new(void)
filter_save,
-1);
gtk_widget_set_tooltip_text(GTK_WIDGET(filter_save), "Save this filter string");
gtk_widget_set_tooltip_text(GTK_WIDGET(filter_save), "Create a button based on the current display filter");
/* Sets the text entry widget pointer as the E_DILTER_TE_KEY data
* of any widget that ends up calling a callback which needs
@ -432,4 +432,3 @@ main_filter_packets(capture_file *cf, const gchar *dftext, gboolean force)
* ex: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/

View File

@ -184,25 +184,28 @@ win32:SOURCES_WS_C += \
HEADERS_WS_C = \
../../wsutil/privileges.h
FORMS += main_window.ui \
FORMS += \
capture_preferences_frame.ui \
column_preferences_frame.ui \
export_object_dialog.ui \
file_set_dialog.ui \
filter_expressions_preferences_frame.ui \
font_color_preferences_frame.ui \
import_text_dialog.ui \
layout_preferences_frame.ui \
main_welcome.ui \
main_window.ui \
main_window_preferences_frame.ui \
packet_comment_dialog.ui \
packet_format_group_box.ui \
packet_range_group_box.ui \
preferences_dialog.ui \
print_dialog.ui \
profile_dialog.ui \
search_frame.ui \
splash_overlay.ui \
time_shift_dialog.ui \
profile_dialog.ui \
preferences_dialog.ui \
main_window_preferences_frame.ui \
layout_preferences_frame.ui \
column_preferences_frame.ui \
font_color_preferences_frame.ui \
capture_preferences_frame.ui
win32 { ## These should be in config.pri ??
!isEmpty(PORTAUDIO_DIR) {
@ -227,21 +230,23 @@ win32 { ## These should be in config.pri ??
HEADERS += $$HEADERS_WS_C \
accordion_frame.h \
capture_preferences_frame.h \
column_preferences_frame.h \
export_dissection_dialog.h \
export_object_dialog.h \
filter_expressions_preferences_frame.h \
font_color_preferences_frame.h \
layout_preferences_frame.h \
main_window_preferences_frame.h \
packet_comment_dialog.h \
packet_format_group_box.h \
preferences_dialog.h \
print_dialog.h \
profile_dialog.h \
search_frame.h \
splash_overlay.h \
tango_colors.h \
profile_dialog.h \
preferences_dialog.h \
main_window_preferences_frame.h \
layout_preferences_frame.h \
column_preferences_frame.h \
font_color_preferences_frame.h \
capture_preferences_frame.h
win32 {
OBJECTS_WS_C = $$SOURCES_WS_C
@ -348,11 +353,12 @@ win32 {
RESOURCES += \
../../image/display_filter.qrc \
../../image/layout.qrc \
../../image/status.qrc \
../../image/toolbar.qrc \
welcome.qrc \
i18n.qrc \
../../image/layout.qrc
welcome.qrc \
TRANSLATIONS = \
qtshark_de.ts \
@ -416,7 +422,8 @@ HEADERS += \
sparkline_delegate.h \
syntax_line_edit.h \
time_shift_dialog.h \
wireshark_application.h
wireshark_application.h \
SOURCES += \
accordion_frame.cpp \
@ -425,20 +432,26 @@ SOURCES += \
capture_file_dialog.cpp \
capture_info_dialog.cpp \
capture_interface_dialog.cpp \
capture_preferences_frame.cpp \
color_dialog.cpp \
color_utils.cpp \
column_preferences_frame.cpp \
display_filter_combo.cpp \
display_filter_edit.cpp \
export_dissection_dialog.cpp \
export_object_dialog.cpp \
file_set_dialog.cpp \
filter_expressions_preferences_frame.cpp \
font_color_preferences_frame.cpp \
import_text_dialog.cpp \
interface_tree.cpp \
label_stack.cpp \
layout_preferences_frame.cpp \
main.cpp \
main_status_bar.cpp \
main_welcome.cpp \
main_window.cpp \
main_window_preferences_frame.cpp \
main_window_slots.cpp \
packet_comment_dialog.cpp \
packet_format_group_box.cpp \
@ -446,7 +459,9 @@ SOURCES += \
packet_list_model.cpp \
packet_list_record.cpp \
packet_range_group_box.cpp \
preferences_dialog.cpp \
print_dialog.cpp \
profile_dialog.cpp \
progress_bar.cpp \
proto_tree.cpp \
qt_ui_utils.cpp \
@ -457,11 +472,4 @@ SOURCES += \
splash_overlay.cpp \
syntax_line_edit.cpp \
time_shift_dialog.cpp \
wireshark_application.cpp \
profile_dialog.cpp \
preferences_dialog.cpp \
main_window_preferences_frame.cpp \
layout_preferences_frame.cpp \
column_preferences_frame.cpp \
font_color_preferences_frame.cpp \
capture_preferences_frame.cpp
wireshark_application.cpp

View File

@ -44,8 +44,6 @@
#include <QLineEdit>
#include <QKeyEvent>
#include <QDebug>
const int visible_col_ = 0;
const int title_col_ = 1;
const int type_col_ = 2;
@ -61,8 +59,8 @@ ColumnPreferencesFrame::ColumnPreferencesFrame(QWidget *parent) :
ui->setupUi(this);
int one_em = ui->columnTreeWidget->fontMetrics().height();
ui->columnTreeWidget->setColumnWidth(3, one_em * 10);
ui->columnTreeWidget->setColumnWidth(4, one_em * 5);
ui->columnTreeWidget->setColumnWidth(custom_field_col_, one_em * 10);
ui->columnTreeWidget->setColumnWidth(custom_occurrence_col_, one_em * 5);
ui->columnTreeWidget->setMinimumWidth(one_em * 20);
ui->columnTreeWidget->setMinimumHeight(one_em * 12);
@ -130,11 +128,6 @@ void ColumnPreferencesFrame::unstash()
}
}
void ColumnPreferencesFrame::showEvent(QShowEvent *evt)
{
Q_UNUSED(evt);
}
void ColumnPreferencesFrame::keyPressEvent(QKeyEvent *evt)
{
if (cur_line_edit_ && cur_line_edit_->hasFocus()) {
@ -368,7 +361,7 @@ void ColumnPreferencesFrame::customFieldTextChanged(QString)
const char *field_text = syntax_edit->text().toUtf8().constData();
if (strlen(field_text) < 1) {
syntax_edit->setSyntaxState(SyntaxLineEdit::Empty);
} else if (proto_check_field_name(field_text) != 0 || !dfilter_compile(field_text, &dfp)) {
} else if (!dfilter_compile(field_text, &dfp)) {
syntax_edit->setSyntaxState(SyntaxLineEdit::Invalid);
} else {
syntax_edit->setSyntaxState(SyntaxLineEdit::Valid);

View File

@ -43,7 +43,6 @@ public:
void unstash();
protected:
void showEvent(QShowEvent *evt);
void keyPressEvent(QKeyEvent *evt);
private:

View File

@ -14,7 +14,7 @@
height="16"
id="svg2"
version="1.1"
inkscape:version="0.48.0 r9654"
inkscape:version="0.48.2 r9819"
sodipodi:docname="display_filter_16.svg"
inkscape:export-filename="/Users/gerald/Development/wxshark/image/toolbar/capture_start_24.png"
inkscape:export-xdpi="90"
@ -26,16 +26,16 @@
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="5.656854"
inkscape:cx="97.434735"
inkscape:cy="12.40242"
inkscape:zoom="4.3710938"
inkscape:cx="92.435027"
inkscape:cy="10.723041"
inkscape:document-units="px"
inkscape:current-layer="layer1"
showgrid="true"
inkscape:window-width="1130"
inkscape:window-height="793"
inkscape:window-x="139"
inkscape:window-y="798"
inkscape:window-width="1280"
inkscape:window-height="787"
inkscape:window-x="-5"
inkscape:window-y="865"
inkscape:window-maximized="0"
objecttolerance="2"
guidetolerance="5"
@ -386,7 +386,7 @@
inkscape:connector-curvature="0" />
</g>
<flowRoot
transform="matrix(1.0165643,0,0,1.0165643,98.219446,1021.2438)"
transform="matrix(1.0165643,0,0,1.0165643,114.21945,1021.2438)"
style="font-size:1.5px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
id="flowRoot3968"
xml:space="preserve"><flowRegion
@ -406,7 +406,7 @@
sodipodi:rx="4.8761611"
sodipodi:ry="4.8390093"
d="M 44.767801,8.8390093 A 4.8761611,4.8390093 0 1 1 39.89164,4"
transform="matrix(0.82031745,0,0,0.82661548,71.276192,1037.0557)"
transform="matrix(0.82031745,0,0,0.82661548,87.276192,1037.0557)"
sodipodi:start="0"
sodipodi:end="4.712389"
sodipodi:open="true"
@ -435,7 +435,7 @@
sodipodi:open="true"
sodipodi:end="4.712389"
sodipodi:start="0"
transform="matrix(0.82031745,0,0,0.82661548,87.276192,1037.0557)"
transform="matrix(0.82031745,0,0,0.82661548,103.27619,1037.0557)"
d="M 44.767801,8.8390093 A 4.8761611,4.8390093 0 1 1 39.89164,4"
sodipodi:ry="4.8390093"
sodipodi:rx="4.8761611"
@ -473,14 +473,14 @@
id="rect3052"
width="16"
height="16"
x="96"
x="112"
y="1036.3622"
inkscape:export-filename="/Users/gcombs/Development/qtshark/qt/dfilter_refresh_active.png"
inkscape:export-xdpi="16.560936"
inkscape:export-ydpi="16.560936" />
<rect
y="1036.3622"
x="112"
x="128"
height="16"
width="16"
id="rect3054"
@ -579,7 +579,7 @@
inkscape:rounded="-3.469447e-18"
inkscape:randomized="0"
d="m 104,3.0166731 1.31811,3.1691085 3.42132,0.2742858 -2.60669,2.2329023 0.79639,3.3386263 L 104,10.242497 l -2.92913,1.789099 0.79639,-3.3386262 -2.606685,-2.2329026 3.421315,-0.2742855 z"
transform="matrix(1.3714742,0,0,1.3732785,9.366679,1034.1395)"
transform="matrix(1.3714742,0,0,1.3732785,25.366679,1034.1395)"
inkscape:transform-center-y="-0.65350952"
inkscape:export-filename="/Users/gcombs/Development/qtshark/qt/dfilter_favorite.png"
inkscape:export-xdpi="90"
@ -592,13 +592,13 @@
id="rect3899"
width="16"
height="16"
x="144"
x="160"
y="1036.3622" />
<flowRoot
xml:space="preserve"
id="flowRoot3901"
style="font-size:1.5px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
transform="matrix(1.0165643,0,0,1.0165643,144.21945,1021.2438)"><flowRegion
transform="matrix(1.0165643,0,0,1.0165643,160.21945,1021.2438)"><flowRegion
id="flowRegion3903"><rect
id="rect3905"
width="36"
@ -622,7 +622,7 @@
inkscape:rounded="-3.469447e-18"
inkscape:randomized="0"
d="m 116,6.2357394 -0.19366,-0.3354338 0.38732,0 z"
transform="matrix(18.072651,0,0,10.43425,-1896.4275,981.79694)"
transform="matrix(18.072651,0,0,10.43425,-1864.4275,981.79694)"
inkscape:transform-center-y="2.5363326"
inkscape:transform-center-x="0.018274753"
inkscape:export-filename="/Users/gcombs/Development/qtshark/qt/dfilter_dropdown.png"
@ -630,7 +630,7 @@
inkscape:export-ydpi="90" />
<rect
y="1036.3622"
x="192"
x="224"
height="16"
width="16"
id="rect3914"
@ -642,7 +642,7 @@
xml:space="preserve"
id="flowRoot3916"
style="font-size:1.5px;font-style:normal;font-weight:normal;text-align:center;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans"
transform="matrix(1.0165643,0,0,1.0165643,194.21945,1021.2438)"><flowRegion
transform="matrix(1.0165643,0,0,1.0165643,226.21945,1021.2438)"><flowRegion
id="flowRegion3918"><rect
id="rect3920"
width="36"
@ -684,7 +684,7 @@
inkscape:export-xdpi="90"
inkscape:export-filename="/Users/gcombs/Development/qtshark/qt/dfilter_bookmark_pressed.png"
inkscape:transform-center-y="-0.65350952"
transform="matrix(1.3714742,0,0,1.3732785,41.366679,1034.1395)"
transform="matrix(1.3714742,0,0,1.3732785,57.366679,1034.1395)"
d="m 104,3.0166731 1.31811,3.1691085 3.42132,0.2742858 -2.60669,2.2329023 0.79639,3.3386263 L 104,10.242497 l -2.92913,1.789099 0.79639,-3.3386262 -2.606685,-2.2329026 3.421315,-0.2742855 z"
inkscape:randomized="0"
inkscape:rounded="-3.469447e-18"
@ -701,7 +701,7 @@
sodipodi:type="star" />
<rect
y="1036.3622"
x="176"
x="192"
height="16"
width="16"
id="rect3339"
@ -724,7 +724,7 @@
inkscape:rounded="-3.469447e-18"
inkscape:randomized="0"
d="m 104,3.0166731 1.31811,3.1691085 3.42132,0.2742858 -2.60669,2.2329023 0.79639,3.3386263 L 104,10.242497 l -2.92913,1.789099 0.79639,-3.3386262 -2.606685,-2.2329026 3.421315,-0.2742855 z"
transform="matrix(1.3714742,0,0,1.3732785,25.366679,1034.1395)"
transform="matrix(1.3714742,0,0,1.3732785,41.366679,1034.1395)"
inkscape:transform-center-y="-0.65350952"
inkscape:export-filename="/Users/gcombs/Development/qtshark/qt/dfilter_bookmark_hover.png"
inkscape:export-xdpi="90"
@ -737,7 +737,7 @@
id="rect3087"
width="16"
height="16"
x="160"
x="176"
y="1036.3622" />
<rect
inkscape:export-ydpi="90"
@ -777,14 +777,14 @@
inkscape:export-xdpi="16.560936"
inkscape:export-filename="/Users/gcombs/Development/qtshark/qt/dfilter_refresh_active.png"
sodipodi:type="arc"
style="fill:none;stroke:#0099ff;stroke-width:2.42877483000000005;stroke-linecap:butt;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-start:none;marker-mid:none;marker-end:url(#TriangleInSxF)"
style="fill:none;stroke:#0099ff;stroke-width:2.42877483;stroke-linecap:butt;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;marker-start:none;marker-mid:none;marker-end:url(#TriangleInSxF)"
id="path3098"
sodipodi:cx="39.89164"
sodipodi:cy="8.8390093"
sodipodi:rx="4.8761611"
sodipodi:ry="4.8390093"
d="M 44.767801,8.8390093 A 4.8761611,4.8390093 0 1 1 39.89164,4"
transform="matrix(0.82031745,0,0,0.82661548,103.27619,1037.0557)"
transform="matrix(0.82031745,0,0,0.82661548,119.27619,1037.0557)"
sodipodi:start="0"
sodipodi:end="4.712389"
sodipodi:open="true" />
@ -796,7 +796,106 @@
id="rect3100"
width="16"
height="16"
x="128"
x="144"
y="1036.3622" />
<path
inkscape:export-ydpi="90"
inkscape:export-xdpi="90"
inkscape:export-filename="/Users/gcombs/Development/qtshark/image/dfilter_bookmark_disabled.png"
inkscape:transform-center-y="-0.65350952"
transform="matrix(1.3714742,0,0,1.3732785,73.366679,1034.1395)"
d="m 104,3.0166731 1.31811,3.1691085 3.42132,0.2742858 -2.60669,2.2329023 0.79639,3.3386263 L 104,10.242497 l -2.92913,1.789099 0.79639,-3.3386262 -2.606685,-2.2329026 3.421315,-0.2742855 z"
inkscape:randomized="0"
inkscape:rounded="-3.469447e-18"
inkscape:flatsided="false"
sodipodi:arg2="-0.9424778"
sodipodi:arg1="-1.5707963"
sodipodi:r2="2.2424972"
sodipodi:r1="4.9833269"
sodipodi:cy="8"
sodipodi:cx="104"
sodipodi:sides="5"
id="path3314"
style="fill:none;stroke:#babdb6;stroke-width:0.72866326999999997;stroke-linecap:square;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
sodipodi:type="star" />
<g
inkscape:export-ydpi="90"
inkscape:export-xdpi="90"
inkscape:export-filename="/Users/gcombs/Development/qtshark/qt/dfilter_apply_normal.png"
transform="translate(-16,0)"
style="stroke:#555753"
id="g3316">
<path
style="fill:none;stroke:#555753;stroke-width:1.99999988;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="m 66,1044.4492 c 10.17421,0 10.17421,0 10.17421,0"
id="path3318"
inkscape:connector-curvature="0" />
<path
inkscape:connector-curvature="0"
id="path3320"
d="m 75,1041.8621 c 2.5,2.5 2.5,2.5 2.5,2.5"
style="fill:none;stroke:#555753;stroke-width:1.99999988;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<path
style="fill:none;stroke:#555753;stroke-width:1.99999988;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="m 74.999996,1046.8622 c 2.5,-2.5 2.5,-2.5 2.5,-2.5"
id="path3322"
inkscape:connector-curvature="0" />
</g>
<rect
inkscape:export-ydpi="90"
inkscape:export-xdpi="90"
inkscape:export-filename="/Users/gcombs/Development/qtshark/image/dfilter_apply_disabled.png"
y="1036.3622"
x="96"
height="16"
width="16"
id="rect3324"
style="fill:none;stroke:none" />
<g
inkscape:export-ydpi="90"
inkscape:export-xdpi="90"
inkscape:export-filename="/Users/gcombs/Development/qtshark/image/dfilter_apply_disabled.png"
style="stroke:#555753"
id="g3326"
transform="translate(32,0)">
<path
style="fill:none;stroke:#555753;stroke-width:1.99999988;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="m 66,1044.4492 c 10.17421,0 10.17421,0 10.17421,0"
id="path3328"
inkscape:connector-curvature="0" />
<path
inkscape:connector-curvature="0"
id="path3330"
d="m 75,1041.8621 c 2.5,2.5 2.5,2.5 2.5,2.5"
style="fill:none;stroke:#555753;stroke-width:1.99999988;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<path
style="fill:none;stroke:#555753;stroke-width:1.99999988;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="m 74.999996,1046.8622 c 2.5,-2.5 2.5,-2.5 2.5,-2.5"
id="path3332"
inkscape:connector-curvature="0" />
</g>
<g
id="g3334"
style="stroke:#babdb6"
inkscape:export-filename="/Users/gcombs/Development/qtshark/image/dfilter_apply_disabled.png"
inkscape:export-xdpi="90"
inkscape:export-ydpi="90"
transform="translate(32,0)">
<path
inkscape:connector-curvature="0"
id="path3336"
d="m 66,1044.4492 c 10.17421,0 10.17421,0 10.17421,0"
style="fill:none;stroke:#babdb6;stroke-width:1.99999988000000006;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
<path
style="fill:none;stroke:#babdb6;stroke-width:1.99999988000000006;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
d="m 75,1041.8621 c 2.5,2.5 2.5,2.5 2.5,2.5"
id="path3338"
inkscape:connector-curvature="0" />
<path
inkscape:connector-curvature="0"
id="path3340"
d="m 74.999996,1046.8622 c 2.5,-2.5 2.5,-2.5 2.5,-2.5"
style="fill:none;stroke:#babdb6;stroke-width:1.99999988000000006;stroke-linecap:square;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 36 KiB

View File

@ -104,7 +104,7 @@ DisplayFilterEdit::DisplayFilterEdit(QWidget *parent, bool plain) :
// DispalyFilterEdit
// Clear button
// Apply (right arrow) + Cancel (x) + Reload (arrowed circle)
// Down Arrow
// Combo drop-down
// XXX - Move bookmark and apply buttons to the toolbar a la Firefox, Chrome & Safari?
// XXX - Use native buttons on OS X?
@ -131,11 +131,14 @@ DisplayFilterEdit::DisplayFilterEdit(QWidget *parent, bool plain) :
"QToolButton:pressed {"
" image: url(:/dfilter/dfilter_bookmark_pressed.png) center;"
"}"
"QToolButton:disabled {"
" image: url(:/dfilter/dfilter_bookmark_disabled.png) center;"
"}"
).arg(plain_ ? 0 : 1)
);
connect(bookmark_button_, SIGNAL(clicked()), this, SLOT(showDisplayFilterDialog()));
connect(bookmark_button_, SIGNAL(clicked()), this, SLOT(bookmarkClicked()));
clear_button_ = new QToolButton(this);
clear_button_->setCursor(Qt::ArrowCursor);
@ -175,6 +178,9 @@ DisplayFilterEdit::DisplayFilterEdit(QWidget *parent, bool plain) :
"QToolButton:pressed {"
" image: url(:/dfilter/dfilter_apply_pressed.png) center;"
"}"
"QToolButton:disabled {"
" image: url(:/dfilter/dfilter_apply_disabled.png) center;"
"}"
);
connect(apply_button_, SIGNAL(clicked()), this, SLOT(applyDisplayFilter()));
connect(this, SIGNAL(returnPressed()), this, SLOT(applyDisplayFilter()));
@ -290,14 +296,15 @@ void DisplayFilterEdit::checkFilter(const QString& text)
emit pushFilterSyntaxStatus(invalidMsg);
}
bookmark_button_->setEnabled(syntaxState() == Valid || syntaxState() == Deprecated);
if (apply_button_) {
apply_button_->setEnabled(SyntaxState() == Empty || syntaxState() == Valid);
apply_button_->setEnabled(SyntaxState() != Invalid);
}
}
void DisplayFilterEdit::showDisplayFilterDialog()
void DisplayFilterEdit::bookmarkClicked()
{
g_log(NULL, G_LOG_LEVEL_DEBUG, "FIX: implement display filter dialog for \"%s\"", this->text().toUtf8().constData());
emit addBookmark(text());
}
void DisplayFilterEdit::applyDisplayFilter()

View File

@ -45,7 +45,7 @@ public slots:
private slots:
void checkFilter(const QString &text);
void showDisplayFilterDialog();
void bookmarkClicked();
private:
bool plain_;
@ -60,6 +60,7 @@ signals:
void popFilterSyntaxStatus();
void pushFilterSyntaxWarning(QString&);
void filterPackets(QString& new_filter, bool force);
void addBookmark(QString filter);
};

View File

@ -0,0 +1,313 @@
/* filter_expressions_preferences_frame.cpp
*
* $Id$
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* This program 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 2
* 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "config.h"
#include <glib.h>
#include <epan/filter_expressions.h>
#include "filter_expressions_preferences_frame.h"
#include "ui_filter_expressions_preferences_frame.h"
#include "syntax_line_edit.h"
#include "wireshark_application.h"
#include <qt_ui_utils.h>
#include <QKeyEvent>
#include <QTreeWidgetItemIterator>
const int enabled_col_ = 0;
const int label_col_ = 1;
const int expression_col_ = 2;
// This shouldn't exist in its current form. Instead it should be the "display filters"
// dialog, and the "dfilters" file should support a "show in toolbar" flag.
FilterExpressionsPreferencesFrame::FilterExpressionsPreferencesFrame(QWidget *parent) :
QFrame(parent),
ui(new Ui::FilterExpressionsPreferencesFrame),
cur_line_edit_(NULL)
{
ui->setupUi(this);
int one_em = ui->expressionTreeWidget->fontMetrics().height();
ui->expressionTreeWidget->resizeColumnToContents(enabled_col_);
ui->expressionTreeWidget->setColumnWidth(label_col_, one_em * 10);
ui->expressionTreeWidget->setColumnWidth(expression_col_, one_em * 5);
ui->expressionTreeWidget->setMinimumWidth(one_em * 15);
ui->expressionTreeWidget->setMinimumHeight(one_em * 10);
ui->expressionTreeWidget->setSelectionMode(QAbstractItemView::SingleSelection);
ui->expressionTreeWidget->setDragEnabled(true);
ui->expressionTreeWidget->viewport()->setAcceptDrops(true);
ui->expressionTreeWidget->setDropIndicatorShown(true);
ui->expressionTreeWidget->setDragDropMode(QAbstractItemView::InternalMove);
updateWidgets();
connect(wsApp, SIGNAL(filterExpressionsChanged()), this, SLOT(updateWidgets()));
}
FilterExpressionsPreferencesFrame::~FilterExpressionsPreferencesFrame()
{
delete ui;
}
void FilterExpressionsPreferencesFrame::unstash()
{
struct filter_expression *cur_fe = *pfilter_expression_head, *new_fe_head = NULL, *new_fe = NULL;
bool changed = false;
QTreeWidgetItemIterator it(ui->expressionTreeWidget);
while (*it) {
struct filter_expression *fe = g_new0(struct filter_expression, 1);
if (!new_fe_head) {
new_fe_head = fe;
} else {
new_fe->next = fe;
}
new_fe = fe;
new_fe->enabled = (*it)->checkState(enabled_col_) == Qt::Checked ? TRUE : FALSE;
new_fe->label = qstring_strdup((*it)->text(label_col_));
new_fe->expression = qstring_strdup((*it)->text(expression_col_));
if (cur_fe == NULL) {
changed = true;
} else {
if (cur_fe->enabled != new_fe->enabled ||
g_strcmp0(cur_fe->label, new_fe->label) != 0 ||
g_strcmp0(cur_fe->expression, new_fe->expression) != 0) {
changed = true;
}
cur_fe = cur_fe->next;
}
++it;
}
if (cur_fe) changed = true;
cur_fe = new_fe_head;
if (changed) {
cur_fe = *pfilter_expression_head;
*pfilter_expression_head = new_fe_head;
wsApp->emitAppSignal(WiresharkApplication::FilterExpressionsChanged);
}
while (cur_fe) {
struct filter_expression *fe = cur_fe;
cur_fe = fe->next;
g_free(fe->label);
g_free(fe->expression);
g_free(fe);
}
}
void FilterExpressionsPreferencesFrame::keyPressEvent(QKeyEvent *evt)
{
if (cur_line_edit_ && cur_line_edit_->hasFocus()) {
switch (evt->key()) {
case Qt::Key_Escape:
cur_line_edit_->setText(saved_col_string_);
case Qt::Key_Enter:
case Qt::Key_Return:
switch (cur_column_) {
case label_col_:
labelEditingFinished();
break;
case expression_col_:
expressionEditingFinished();
break;
default:
break;
}
delete cur_line_edit_;
return;
default:
break;
}
}
QFrame::keyPressEvent(evt);
}
void FilterExpressionsPreferencesFrame::addExpression(bool enabled, const char *label, char *expression)
{
QTreeWidgetItem *item = new QTreeWidgetItem(ui->expressionTreeWidget);
item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
item->setFlags(item->flags() & ~(Qt::ItemIsDropEnabled));
item->setCheckState(enabled_col_, enabled ? Qt::Checked : Qt::Unchecked);
item->setText(label_col_, label);
item->setText(expression_col_, expression);
}
void FilterExpressionsPreferencesFrame::updateWidgets()
{
ui->expressionTreeWidget->clear();
for (struct filter_expression *fe = *pfilter_expression_head; fe != NULL; fe = fe->next) {
if (fe->deleted) continue;
addExpression(fe->enabled, fe->label, fe->expression);
}
}
void FilterExpressionsPreferencesFrame::on_expressionTreeWidget_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous)
{
ui->deleteToolButton->setEnabled(current ? true : false);
if (previous && ui->expressionTreeWidget->itemWidget(previous, label_col_)) {
ui->expressionTreeWidget->removeItemWidget(previous, label_col_);
}
if (previous && ui->expressionTreeWidget->itemWidget(previous, expression_col_)) {
ui->expressionTreeWidget->removeItemWidget(previous, expression_col_);
}
}
void FilterExpressionsPreferencesFrame::on_expressionTreeWidget_itemActivated(QTreeWidgetItem *item, int column)
{
if (!item || cur_line_edit_) return;
QWidget *editor = NULL;
cur_column_ = column;
switch (column) {
case label_col_:
{
cur_line_edit_ = new QLineEdit();
cur_column_ = column;
saved_col_string_ = item->text(label_col_);
connect(cur_line_edit_, SIGNAL(editingFinished()), this, SLOT(labelEditingFinished()));
editor = cur_line_edit_;
break;
}
case expression_col_:
{
SyntaxLineEdit *syntax_edit = new SyntaxLineEdit();
saved_col_string_ = item->text(expression_col_);
connect(syntax_edit, SIGNAL(textChanged(QString)),
this, SLOT(expressionTextChanged(QString)));
connect(syntax_edit, SIGNAL(editingFinished()), this, SLOT(expressionEditingFinished()));
editor = cur_line_edit_ = syntax_edit;
break;
}
default:
return;
}
if (cur_line_edit_) {
cur_line_edit_->setText(saved_col_string_);
cur_line_edit_->selectAll();
connect(cur_line_edit_, SIGNAL(destroyed()), this, SLOT(lineEditDestroyed()));
}
if (editor) {
QFrame *edit_frame = new QFrame();
QHBoxLayout *hb = new QHBoxLayout();
QSpacerItem *spacer = new QSpacerItem(5, 10);
hb->addWidget(editor, 0);
hb->addSpacerItem(spacer);
hb->setStretch(1, 1);
hb->setContentsMargins(0, 0, 0, 0);
edit_frame->setLineWidth(0);
edit_frame->setFrameStyle(QFrame::NoFrame);
// The documentation suggests setting autoFillbackground. That looks silly
// so we clear the item text instead.
item->setText(cur_column_, "");
edit_frame->setLayout(hb);
ui->expressionTreeWidget->setItemWidget(item, cur_column_, edit_frame);
editor->setFocus();
}
}
void FilterExpressionsPreferencesFrame::lineEditDestroyed()
{
cur_line_edit_ = NULL;
}
void FilterExpressionsPreferencesFrame::labelEditingFinished()
{
QTreeWidgetItem *item = ui->expressionTreeWidget->currentItem();
if (!cur_line_edit_ || !item) return;
item->setText(label_col_, cur_line_edit_->text());
ui->expressionTreeWidget->removeItemWidget(item, label_col_);
}
void FilterExpressionsPreferencesFrame::expressionTextChanged(QString)
{
SyntaxLineEdit *syntax_edit = qobject_cast<SyntaxLineEdit *>(cur_line_edit_);
QTreeWidgetItem *item = ui->expressionTreeWidget->currentItem();
if (!syntax_edit || !item) return;
dfilter_t *dfp = NULL;
const char *field_text = syntax_edit->text().toUtf8().constData();
if (strlen(field_text) < 1) {
syntax_edit->setSyntaxState(SyntaxLineEdit::Empty);
} else if (proto_check_field_name(field_text) != 0 || !dfilter_compile(field_text, &dfp)) {
syntax_edit->setSyntaxState(SyntaxLineEdit::Invalid);
} else {
syntax_edit->setSyntaxState(SyntaxLineEdit::Valid);
}
dfilter_free(dfp);
}
void FilterExpressionsPreferencesFrame::expressionEditingFinished()
{
QTreeWidgetItem *item = ui->expressionTreeWidget->currentItem();
if (!cur_line_edit_ || !item) return;
item->setText(expression_col_, cur_line_edit_->text());
ui->expressionTreeWidget->removeItemWidget(item, expression_col_);
}
void FilterExpressionsPreferencesFrame::on_newToolButton_clicked()
{
addExpression(true, "My Filter", NULL);
}
void FilterExpressionsPreferencesFrame::on_deleteToolButton_clicked()
{
QTreeWidgetItem *item = ui->expressionTreeWidget->currentItem();
if (item) {
ui->expressionTreeWidget->invisibleRootItem()->removeChild(item);
}
}
/*
* Editor modelines
*
* Local Variables:
* c-basic-offset: 4
* tab-width: 8
* indent-tabs-mode: nil
* End:
*
* ex: set shiftwidth=4 tabstop=8 expandtab:
* :indentSize=4:tabSize=8:noTabs=true:
*/

View File

@ -0,0 +1,69 @@
/* filter_expressions_preferences_frame.h
*
* $Id$
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* This program 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 2
* 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, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef FILTER_EXPRESSIONS_PREFERENCES_FRAME_H
#define FILTER_EXPRESSIONS_PREFERENCES_FRAME_H
#include <QFrame>
#include <QLineEdit>
#include <QTreeWidgetItem>
namespace Ui {
class FilterExpressionsPreferencesFrame;
}
class FilterExpressionsPreferencesFrame : public QFrame
{
Q_OBJECT
public:
explicit FilterExpressionsPreferencesFrame(QWidget *parent = 0);
~FilterExpressionsPreferencesFrame();
void unstash();
protected:
void keyPressEvent(QKeyEvent *evt);
private:
Ui::FilterExpressionsPreferencesFrame *ui;
int cur_column_;
QLineEdit *cur_line_edit_;
QString saved_col_string_;
void addExpression(bool enabled, const char *label, char *expression);
private slots:
void updateWidgets(void);
void on_expressionTreeWidget_currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous);
void on_expressionTreeWidget_itemActivated(QTreeWidgetItem *item, int column);
void lineEditDestroyed();
void labelEditingFinished();
void expressionTextChanged(QString);
void expressionEditingFinished();
void on_newToolButton_clicked();
void on_deleteToolButton_clicked();
};
#endif // FILTER_EXPRESSIONS_PREFERENCES_FRAME_H

View File

@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>FilterExpressionsPreferencesFrame</class>
<widget class="QFrame" name="FilterExpressionsPreferencesFrame">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>513</width>
<height>397</height>
</rect>
</property>
<property name="windowTitle">
<string>Frame</string>
</property>
<property name="lineWidth">
<number>0</number>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTreeWidget" name="expressionTreeWidget">
<column>
<property name="text">
<string>Enabled</string>
</property>
</column>
<column>
<property name="text">
<string>Label</string>
</property>
</column>
<column>
<property name="text">
<string>Filter Expression</string>
</property>
</column>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QToolButton" name="newToolButton">
<property name="icon">
<iconset resource="../../image/toolbar.qrc">
<normaloff>:/stock/plus-8.png</normaloff>:/stock/plus-8.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="deleteToolButton">
<property name="icon">
<iconset resource="../../image/toolbar.qrc">
<normaloff>:/stock/minus-8.png</normaloff>:/stock/minus-8.png</iconset>
</property>
</widget>
</item>
<item>
<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>
</layout>
</item>
</layout>
</widget>
<resources>
<include location="../../image/toolbar.qrc"/>
</resources>
<connections/>
</ui>

View File

@ -99,7 +99,8 @@ MainWindow::MainWindow(QWidget *parent) :
connect(df_edit, SIGNAL(popFilterSyntaxStatus()), main_ui_->statusBar, SLOT(popFilterStatus()));
connect(df_edit, SIGNAL(pushFilterSyntaxWarning(QString&)), main_ui_->statusBar, SLOT(pushTemporaryStatus(QString&)));
connect(df_edit, SIGNAL(filterPackets(QString&,bool)), this, SLOT(filterPackets(QString&,bool)));
connect (this, SIGNAL(displayFilterSuccess(bool)), df_edit, SLOT(displayFilterSuccess(bool)));
connect(df_edit, SIGNAL(addBookmark(QString)), this, SLOT(addDisplayFilterButton(QString)));
connect(this, SIGNAL(displayFilterSuccess(bool)), df_edit, SLOT(displayFilterSuccess(bool)));
// http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html
// http://qt-project.org/doc/qt-4.8/qstyle.html#StandardPixmap-enum
@ -195,6 +196,10 @@ MainWindow::MainWindow(QWidget *parent) :
this, SLOT(recreatePacketList()));
connect(wsApp, SIGNAL(packetDissectionChanged()),
this, SLOT(redissectPackets()));
connect(wsApp, SIGNAL(appInitialized()),
this, SLOT(filterExpressionsChanged()));
connect(wsApp, SIGNAL(filterExpressionsChanged()),
this, SLOT(filterExpressionsChanged()));
connect(main_welcome_, SIGNAL(startCapture()),
this, SLOT(startCapture()));

View File

@ -159,6 +159,7 @@ public slots:
void captureFileClosed(const capture_file *cf);
void configurationProfileChanged(const gchar *profile_name);
void filterExpressionsChanged();
private slots:
// in main_window_slots.cpp
@ -176,6 +177,9 @@ private slots:
void redissectPackets();
void recreatePacketList();
void addDisplayFilterButton(QString df_text);
void displayFilterButtonClicked();
// We should probably move these to main_window_actions.cpp similar to
// gtk/main_menubar.c
void on_actionFileOpen_triggered();

View File

@ -338,9 +338,6 @@
</widget>
<widget class="MainStatusBar" name="statusBar"/>
<widget class="QToolBar" name="displayFilterToolBar">
<property name="windowTitle">
<string>toolBar</string>
</property>
<property name="movable">
<bool>false</bool>
</property>

View File

@ -53,11 +53,13 @@
#include "wsutil/file_util.h"
#include "epan/column.h"
#include "epan/filter_expressions.h"
#include "ui/alert_box.h"
#include "ui/capture_globals.h"
#include "ui/help_url.h"
#include "ui/main_statusbar.h"
#include "ui/preference_utils.h"
#include "ui/ssl_key_export.h"
#include "capture_file_dialog.h"
@ -67,10 +69,11 @@
#include "preferences_dialog.h"
#include "print_dialog.h"
#include "profile_dialog.h"
#include "qt_ui_utils.h"
#include "wireshark_application.h"
#include <QMessageBox>
#include <QClipboard>
#include <QMessageBox>
#include <QDebug>
@ -78,6 +81,8 @@
// Public slots
//
const char *dfe_property_ = "display filter expression";
void MainWindow::openCaptureFile(QString &cf_path, QString &display_filter)
{
QString file_name = "";
@ -352,7 +357,7 @@ void MainWindow::configurationProfileChanged(const gchar *profile_name) {
Q_UNUSED(profile_name);
/* Update window view and redraw the toolbar */
// main_titlebar_update();
// filter_expression_reinit(FILTER_EXPRESSION_REINIT_CREATE);
filterExpressionsChanged();
// toolbar_redraw_all();
/* Reload list of interfaces on welcome page */
@ -362,7 +367,29 @@ void MainWindow::configurationProfileChanged(const gchar *profile_name) {
recreatePacketList();
/* Reload pane geometry, must be done after recreating the list */
// main_pane_load_window_geometry();
// main_pane_load_window_geometry();
}
void MainWindow::filterExpressionsChanged()
{
// Recreate filter buttons
foreach (QAction *act, main_ui_->displayFilterToolBar->actions()) {
// Permanent actions shouldn't have data
if (act->property(dfe_property_).isValid()) {
main_ui_->displayFilterToolBar->removeAction(act);
delete act;
}
}
for (struct filter_expression *fe = *pfilter_expression_head; fe != NULL; fe = fe->next) {
if (!fe->enabled) continue;
QAction *dfb_action = new QAction(fe->label, main_ui_->displayFilterToolBar);
dfb_action->setToolTip(fe->expression);
dfb_action->setData(fe->expression);
dfb_action->setProperty(dfe_property_, true);
main_ui_->displayFilterToolBar->addAction(dfb_action);
connect(dfb_action, SIGNAL(triggered()), this, SLOT(displayFilterButtonClicked()));
}
}
//
@ -936,6 +963,47 @@ void MainWindow::recreatePacketList()
cfile.columns_changed = FALSE; /* Reset value */
}
// On Qt4 + OS X with unifiedTitleAndToolBarOnMac set it's possible to make
// the main window obnoxiously wide.
// We might want to do something different here. We should probably merge
// the dfilter and gui.filter_expressions code first.
void MainWindow::addDisplayFilterButton(QString df_text)
{
struct filter_expression *cur_fe = *pfilter_expression_head;
struct filter_expression *fe = g_new0(struct filter_expression, 1);
QFontMetrics fm = main_ui_->displayFilterToolBar->fontMetrics();
QString label = fm.elidedText(df_text, Qt::ElideMiddle, fm.height() * 15);
fe->enabled = TRUE;
fe->label = qstring_strdup(label);
fe->expression = qstring_strdup(df_text);
if (!cur_fe) {
*pfilter_expression_head = fe;
} else {
while (cur_fe->next) {
cur_fe = cur_fe->next;
}
cur_fe->next = fe;
}
prefs_main_write();
filterExpressionsChanged();
}
void MainWindow::displayFilterButtonClicked()
{
QAction *dfb_action = qobject_cast<QAction*>(sender());
if (dfb_action) {
df_combo_box_->lineEdit()->setText(dfb_action->data().toString());
df_combo_box_->applyDisplayFilter();
df_combo_box_->lineEdit()->setFocus();
}
}
// File Menu
void MainWindow::on_actionFileOpen_triggered()

View File

@ -660,6 +660,7 @@ void PreferencesDialog::on_buttonBox_accepted()
prefs_modules_foreach_submodules(NULL, module_prefs_unstash, (gpointer) &must_redissect);
pd_ui_->columnFrame->unstash();
pd_ui_->filterExpressonsFrame->unstash();
prefs_main_write();

View File

@ -64,10 +64,7 @@
</item>
<item>
<property name="text">
<string>Filter Expressions</string>
</property>
<property name="flags">
<set>ItemIsDragEnabled|ItemIsUserCheckable</set>
<string>Filter Bookmarks</string>
</property>
</item>
<item>
@ -112,7 +109,7 @@
<widget class="ColumnPreferencesFrame" name="columnFrame"/>
<widget class="FontColorPreferencesFrame" name="fontandcolorFrame"/>
<widget class="CapturePreferencesFrame" name="captureFrame"/>
<widget class="QFrame" name="filterFrame"/>
<widget class="FilterExpressionsPreferencesFrame" name="filterExpressonsFrame"/>
<widget class="QFrame" name="nameresolutionFrame"/>
<widget class="QFrame" name="protocolsFrame"/>
<widget class="QFrame" name="statisticsFrame"/>
@ -220,6 +217,12 @@
<header>capture_preferences_frame.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>FilterExpressionsPreferencesFrame</class>
<extends>QFrame</extends>
<header>filter_expressions_preferences_frame.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections>

View File

@ -36,11 +36,17 @@ format_size_flags_e operator|(format_size_flags_e lhs, format_size_flags_e rhs)
return (format_size_flags_e) ((int)lhs| (int)rhs);
}
/*
* We might want to create our own "wsstring" class with convenience
* methods for handling g_malloc()ed strings, GStrings, and a shortcut
* to .toUtf8().constData().
*/
gchar *qstring_strdup(QString q_string) {
return g_strdup(q_string.toUtf8().constData());
}
QString gchar_free_to_qstring(gchar *glib_string) {
QString *qt_string = new QString(glib_string);
g_free(glib_string);

View File

@ -75,12 +75,20 @@ extern gboolean main_do_quit(void);
}
#endif /* __cplusplus */
/** Create a glib-compatible copy of a QString.
*
* @param q_string A QString.
*
* @return A copy of the QString. UTF-8 allocated with g_malloc().
*/
gchar *qstring_strdup(QString q_string);
/** Transfer ownership of a GLib character string to a newly constructed QString
*
* @param glib_string A string allocated with g_malloc() or NULL. Will be
* freed.
*
* @return a QString instance created from the input string.
* @return A QString instance created from the input string.
*/
QString gchar_free_to_qstring(gchar *glib_string);

View File

@ -422,7 +422,6 @@ void WiresharkApplication::setConfigurationProfile(const gchar *profile_name)
/* Set profile name and update the status bar */
set_profile_name (profile_name);
emit configurationProfileChanged(profile_name);
// filter_expression_reinit(FILTER_EXPRESSION_REINIT_DESTROY);
/* Reset current preferences and apply the new */
prefs_reset();
@ -444,8 +443,10 @@ void WiresharkApplication::setConfigurationProfile(const gchar *profile_name)
timestamp_set_seconds_type (recent.gui_seconds_format);
color_filters_enable(recent.packet_list_colorize);
prefsToCaptureOpts();
prefs_apply_all();
emit filterExpressionsChanged();
// macros_post_update();
/* Enable all protocols and disable from the disabled list */
@ -595,6 +596,8 @@ void WiresharkApplication::emitAppSignal(AppSignal signal)
case ColumnsChanged:
emit columnsChanged();
break;
case FilterExpressionsChanged:
emit filterExpressionsChanged();
case PreferencesChanged:
emit preferencesChanged();
break;

View File

@ -63,6 +63,7 @@ public:
enum AppSignal {
ColumnsChanged,
FilterExpressionsChanged,
PacketDissectionChanged,
PreferencesChanged
};
@ -107,6 +108,7 @@ signals:
void configurationProfileChanged(const gchar *profile_name);
void columnsChanged();
void filterExpressionsChanged();
void packetDissectionChanged();
void preferencesChanged();