Qt: Split the filter dropdown arrow icon into dark and light versions.
The capture and display filter widgets set their dropdown arrow icons using CSS, which means we can't use a template icon without a significant amount of hackery. This is the only instance where we set an icon using CSS, so split it into dark and light versions and use them as appropriate. Ping-Bug: 15511 Change-Id: I699ddc327d8eb109129e60bcb5036b14e6e34414 Reviewed-on: https://code.wireshark.org/review/33696 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com>
|
@ -45,8 +45,10 @@
|
|||
<file>stock_icons/14x14/x-filter-clear.selected@2x.png</file>
|
||||
<file>stock_icons/14x14/x-filter-deprecated.png</file>
|
||||
<file>stock_icons/14x14/x-filter-deprecated@2x.png</file>
|
||||
<file>stock_icons/14x14/x-filter-dropdown.png</file>
|
||||
<file>stock_icons/14x14/x-filter-dropdown@2x.png</file>
|
||||
<file>stock_icons/14x14/x-filter-dropdown.dark.png</file>
|
||||
<file>stock_icons/14x14/x-filter-dropdown.dark@2x.png</file>
|
||||
<file>stock_icons/14x14/x-filter-dropdown.light.png</file>
|
||||
<file>stock_icons/14x14/x-filter-dropdown.light@2x.png</file>
|
||||
<file>stock_icons/14x14/x-filter-invalid.png</file>
|
||||
<file>stock_icons/14x14/x-filter-invalid@2x.png</file>
|
||||
<file>stock_icons/14x14/x-filter-matching-bookmark.png</file>
|
||||
|
|
After Width: | Height: | Size: 224 B |
|
@ -0,0 +1,108 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="14"
|
||||
height="14"
|
||||
viewBox="0 0 14 14"
|
||||
id="svg2"
|
||||
version="1.1"
|
||||
inkscape:version="0.92.2 5c3e80d, 2017-08-06"
|
||||
sodipodi:docname="x-filter-dropdown.dark.svg"
|
||||
inkscape:export-filename="/Users/gerald/Development/wireshark/image/x-filter-apply.png"
|
||||
inkscape:export-xdpi="90"
|
||||
inkscape:export-ydpi="90">
|
||||
<defs
|
||||
id="defs4">
|
||||
<linearGradient
|
||||
id="Wireshark_highlight">
|
||||
<stop
|
||||
style="stop-color:#ffffff;stop-opacity:0.15753424;"
|
||||
offset="0"
|
||||
id="stop4516" />
|
||||
<stop
|
||||
style="stop-color:#ffffff;stop-opacity:0;"
|
||||
offset="1"
|
||||
id="stop4518" />
|
||||
</linearGradient>
|
||||
</defs>
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="46.857143"
|
||||
inkscape:cx="7"
|
||||
inkscape:cy="7"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="true"
|
||||
units="px"
|
||||
showguides="true"
|
||||
inkscape:guide-bbox="true"
|
||||
inkscape:window-width="1401"
|
||||
inkscape:window-height="817"
|
||||
inkscape:window-x="266"
|
||||
inkscape:window-y="877"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:object-nodes="true">
|
||||
<inkscape:grid
|
||||
type="xygrid"
|
||||
id="grid4136"
|
||||
spacingx="0.5"
|
||||
spacingy="0.5" />
|
||||
<sodipodi:guide
|
||||
position="7,8"
|
||||
orientation="0,1"
|
||||
id="guide4140"
|
||||
inkscape:locked="false" />
|
||||
</sodipodi:namedview>
|
||||
<metadata
|
||||
id="metadata7">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(0,-1038.3622)">
|
||||
<path
|
||||
sodipodi:type="star"
|
||||
style="fill:#d3d7cf;stroke:none;fill-opacity:1"
|
||||
id="path3912"
|
||||
sodipodi:sides="3"
|
||||
sodipodi:cx="116"
|
||||
sodipodi:cy="6.0121169"
|
||||
sodipodi:r1="0.22362253"
|
||||
sodipodi:r2="0.97227186"
|
||||
sodipodi:arg1="1.5707963"
|
||||
sodipodi:arg2="2.6179939"
|
||||
inkscape:flatsided="true"
|
||||
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,-2089.4275,982.04694)"
|
||||
inkscape:transform-center-y="2.5363326"
|
||||
inkscape:transform-center-x="0.018274753"
|
||||
inkscape:export-filename="/Users/gcombs/Development/qtshark/qt/dfilter_dropdown.png"
|
||||
inkscape:export-xdpi="90"
|
||||
inkscape:export-ydpi="90" />
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 268 B |
Before Width: | Height: | Size: 120 B After Width: | Height: | Size: 120 B |
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
Before Width: | Height: | Size: 146 B After Width: | Height: | Size: 146 B |
|
@ -64,7 +64,8 @@ ICONS="
|
|||
x-filter-clear.active
|
||||
x-filter-clear.selected
|
||||
x-filter-deprecated
|
||||
x-filter-dropdown
|
||||
x-filter-dropdown.dark
|
||||
x-filter-dropdown.light
|
||||
x-filter-invalid
|
||||
x-filter-matching-bookmark
|
||||
x-filter-matching-bookmark.active
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include <epan/prefs.h>
|
||||
|
||||
#include <ui/qt/widgets/capture_filter_combo.h>
|
||||
#include <ui/qt/utils/color_utils.h>
|
||||
#include "wireshark_application.h"
|
||||
|
||||
CaptureFilterCombo::CaptureFilterCombo(QWidget *parent, bool plain) :
|
||||
|
@ -34,35 +35,7 @@ CaptureFilterCombo::CaptureFilterCombo(QWidget *parent, bool plain) :
|
|||
setSizePolicy(QSizePolicy::MinimumExpanding, sizePolicy().verticalPolicy());
|
||||
setInsertPolicy(QComboBox::NoInsert);
|
||||
setAccessibleName(tr("Capture filter selector"));
|
||||
setStyleSheet(
|
||||
"QComboBox {"
|
||||
#ifdef Q_OS_MAC
|
||||
" border: 1px solid gray;"
|
||||
#else
|
||||
" border: 1px solid palette(shadow);"
|
||||
#endif
|
||||
" border-radius: 3px;"
|
||||
" padding: 0px 0px 0px 0px;"
|
||||
" margin-left: 0px;"
|
||||
" min-width: 20em;"
|
||||
" }"
|
||||
|
||||
"QComboBox::drop-down {"
|
||||
" subcontrol-origin: padding;"
|
||||
" subcontrol-position: top right;"
|
||||
" width: 16px;"
|
||||
" border-left-width: 0px;"
|
||||
" }"
|
||||
|
||||
"QComboBox::down-arrow {"
|
||||
" image: url(:/stock_icons/14x14/x-filter-dropdown.png);"
|
||||
" }"
|
||||
|
||||
"QComboBox::down-arrow:on { /* shift the arrow when popup is open */"
|
||||
" top: 1px;"
|
||||
" left: 1px;"
|
||||
"}"
|
||||
);
|
||||
updateStyleSheet();
|
||||
|
||||
connect(this, &CaptureFilterCombo::interfacesChanged, cf_edit_,
|
||||
static_cast<void (CaptureFilterEdit::*)()>(&CaptureFilterEdit::checkFilter));
|
||||
|
@ -93,6 +66,54 @@ void CaptureFilterCombo::writeRecent(FILE *rf)
|
|||
}
|
||||
}
|
||||
|
||||
bool CaptureFilterCombo::event(QEvent *event)
|
||||
{
|
||||
switch (event->type()) {
|
||||
case QEvent::PaletteChange:
|
||||
updateStyleSheet();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return QComboBox::event(event);
|
||||
}
|
||||
|
||||
void CaptureFilterCombo::updateStyleSheet()
|
||||
{
|
||||
const char *display_mode = ColorUtils::themeIsDark() ? "dark" : "light";
|
||||
|
||||
QString ss = QString(
|
||||
"QComboBox {"
|
||||
#ifdef Q_OS_MAC
|
||||
" border: 1px solid gray;"
|
||||
#else
|
||||
" border: 1px solid palette(shadow);"
|
||||
#endif
|
||||
" border-radius: 3px;"
|
||||
" padding: 0px 0px 0px 0px;"
|
||||
" margin-left: 0px;"
|
||||
" min-width: 20em;"
|
||||
" }"
|
||||
|
||||
"QComboBox::drop-down {"
|
||||
" subcontrol-origin: padding;"
|
||||
" subcontrol-position: top right;"
|
||||
" width: 16px;"
|
||||
" border-left-width: 0px;"
|
||||
" }"
|
||||
|
||||
"QComboBox::down-arrow {"
|
||||
" image: url(:/stock_icons/14x14/x-filter-dropdown.%1.png);"
|
||||
" }"
|
||||
|
||||
"QComboBox::down-arrow:on { /* shift the arrow when popup is open */"
|
||||
" top: 1px;"
|
||||
" left: 1px;"
|
||||
"}"
|
||||
).arg(display_mode);
|
||||
setStyleSheet(ss);
|
||||
}
|
||||
|
||||
void CaptureFilterCombo::saveAndRebuildFilterList()
|
||||
{
|
||||
if (!currentText().isEmpty()) {
|
||||
|
|
|
@ -31,9 +31,11 @@ signals:
|
|||
void captureFilterSyntaxChanged(bool valid);
|
||||
void startCapture();
|
||||
|
||||
public slots:
|
||||
protected:
|
||||
virtual bool event(QEvent *event);
|
||||
|
||||
private:
|
||||
void updateStyleSheet();
|
||||
CaptureFilterEdit *cf_edit_;
|
||||
|
||||
private slots:
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
#include <ui/qt/widgets/display_filter_edit.h>
|
||||
#include <ui/qt/widgets/display_filter_combo.h>
|
||||
#include <ui/qt/utils/color_utils.h>
|
||||
#include "wireshark_application.h"
|
||||
|
||||
// If we ever add support for multiple windows this will need to be replaced.
|
||||
|
@ -37,36 +38,8 @@ DisplayFilterCombo::DisplayFilterCombo(QWidget *parent) :
|
|||
// Default is Preferred.
|
||||
setSizePolicy(QSizePolicy::MinimumExpanding, sizePolicy().verticalPolicy());
|
||||
setAccessibleName(tr("Display filter selector"));
|
||||
cur_display_filter_combo = this;
|
||||
setStyleSheet(
|
||||
"QComboBox {"
|
||||
#ifdef Q_OS_MAC
|
||||
" border: 1px solid gray;"
|
||||
#else
|
||||
" border: 1px solid palette(shadow);"
|
||||
#endif
|
||||
" border-radius: 3px;"
|
||||
" padding: 0px 0px 0px 0px;"
|
||||
" margin-left: 0px;"
|
||||
" min-width: 20em;"
|
||||
" }"
|
||||
|
||||
"QComboBox::drop-down {"
|
||||
" subcontrol-origin: padding;"
|
||||
" subcontrol-position: top right;"
|
||||
" width: 14px;"
|
||||
" border-left-width: 0px;"
|
||||
" }"
|
||||
|
||||
"QComboBox::down-arrow {"
|
||||
" image: url(:/stock_icons/14x14/x-filter-dropdown.png);"
|
||||
" }"
|
||||
|
||||
"QComboBox::down-arrow:on { /* shift the arrow when popup is open */"
|
||||
" top: 1px;"
|
||||
" left: 1px;"
|
||||
"}"
|
||||
);
|
||||
cur_display_filter_combo = this;
|
||||
updateStyleSheet();
|
||||
setToolTip(tr("Select from previously used filters."));
|
||||
|
||||
connect(wsApp, &WiresharkApplication::preferencesChanged, this, &DisplayFilterCombo::updateMaxCount);
|
||||
|
@ -105,12 +78,51 @@ bool DisplayFilterCombo::event(QEvent *event)
|
|||
}
|
||||
break;
|
||||
}
|
||||
case QEvent::PaletteChange:
|
||||
updateStyleSheet();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return QComboBox::event(event);
|
||||
}
|
||||
|
||||
void DisplayFilterCombo::updateStyleSheet()
|
||||
{
|
||||
const char *display_mode = ColorUtils::themeIsDark() ? "dark" : "light";
|
||||
|
||||
QString ss = QString(
|
||||
"QComboBox {"
|
||||
#ifdef Q_OS_MAC
|
||||
" border: 1px solid gray;"
|
||||
#else
|
||||
" border: 1px solid palette(shadow);"
|
||||
#endif
|
||||
" border-radius: 3px;"
|
||||
" padding: 0px 0px 0px 0px;"
|
||||
" margin-left: 0px;"
|
||||
" min-width: 20em;"
|
||||
" }"
|
||||
|
||||
"QComboBox::drop-down {"
|
||||
" subcontrol-origin: padding;"
|
||||
" subcontrol-position: top right;"
|
||||
" width: 14px;"
|
||||
" border-left-width: 0px;"
|
||||
" }"
|
||||
|
||||
"QComboBox::down-arrow {"
|
||||
" image: url(:/stock_icons/14x14/x-filter-dropdown.%1.png);"
|
||||
" }"
|
||||
|
||||
"QComboBox::down-arrow:on { /* shift the arrow when popup is open */"
|
||||
" top: 1px;"
|
||||
" left: 1px;"
|
||||
"}"
|
||||
).arg(display_mode);
|
||||
setStyleSheet(ss);
|
||||
}
|
||||
|
||||
bool DisplayFilterCombo::checkDisplayFilter()
|
||||
{
|
||||
DisplayFilterEdit *df_edit = qobject_cast<DisplayFilterEdit *>(lineEdit());
|
||||
|
|
|
@ -21,11 +21,12 @@ public:
|
|||
bool addRecentCapture(const char *filter);
|
||||
void writeRecent(FILE *rf);
|
||||
|
||||
signals:
|
||||
|
||||
protected:
|
||||
virtual bool event(QEvent *event);
|
||||
|
||||
private:
|
||||
void updateStyleSheet();
|
||||
|
||||
public slots:
|
||||
bool checkDisplayFilter();
|
||||
void applyDisplayFilter();
|
||||
|
|