aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2019-06-16 11:07:13 -0700
committerAnders Broman <a.broman58@gmail.com>2019-06-17 00:46:21 +0000
commit178e7ce9a533ba9e5e152c9f7bc08f5ba8f25f0b (patch)
tree2b668ea6426fd35b212c14d951f5b11f6fe2b3a7 /ui
parentc6bed352540a8859c3820ad38de52ae7bf27cbe6 (diff)
Qt: Filter expression toolbar dark mode updates.
Move plus-8.png to stock_icons/8x8 and rename it list-add.template.png which conforms to the Freedesktop icon naming specifications and makes it a template icon. Update our style sheet when we recive a QEvent::PaletteChange. Ping-Bug: 15511 Change-Id: I4b8ddcb4eb64f11faec21d5df4a3fd7fdc5cf488 Reviewed-on: https://code.wireshark.org/review/33626 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'ui')
-rw-r--r--ui/qt/main_window.cpp2
-rw-r--r--ui/qt/main_window.ui10
-rw-r--r--ui/qt/utils/stock_icon.cpp2
-rw-r--r--ui/qt/widgets/filter_expression_toolbar.cpp42
-rw-r--r--ui/qt/widgets/filter_expression_toolbar.h4
5 files changed, 37 insertions, 23 deletions
diff --git a/ui/qt/main_window.cpp b/ui/qt/main_window.cpp
index 6a532dec09..fabde28ecf 100644
--- a/ui/qt/main_window.cpp
+++ b/ui/qt/main_window.cpp
@@ -2012,6 +2012,8 @@ void MainWindow::initMainToolbarIcons()
main_ui_->actionViewZoomOut->setIcon(StockIcon("zoom-out"));
main_ui_->actionViewNormalSize->setIcon(StockIcon("zoom-original"));
main_ui_->actionViewResizeColumns->setIcon(StockIcon("x-resize-columns"));
+
+ main_ui_->actionNewDisplayFilterExpression->setIcon(StockIcon("list-add"));
}
void MainWindow::initShowHideMainWidgets()
diff --git a/ui/qt/main_window.ui b/ui/qt/main_window.ui
index 80e3603cec..4d2dcff706 100644
--- a/ui/qt/main_window.ui
+++ b/ui/qt/main_window.ui
@@ -2953,16 +2953,6 @@
</property>
</action>
<action name="actionNewDisplayFilterExpression">
- <property name="icon">
- <iconset resource="../../image/stock_icons.qrc">
- <normaloff>:/stock/plus-8.png</normaloff>:/stock/plus-8.png</iconset>
- </property>
- <property name="text">
- <string>Add a filter button</string>
- </property>
- <property name="iconText">
- <string>Expression…</string>
- </property>
<property name="toolTip">
<string>Add a display filter button.</string>
</property>
diff --git a/ui/qt/utils/stock_icon.cpp b/ui/qt/utils/stock_icon.cpp
index 3ba3d04c83..b54b36dac8 100644
--- a/ui/qt/utils/stock_icon.cpp
+++ b/ui/qt/utils/stock_icon.cpp
@@ -75,7 +75,7 @@ StockIcon::StockIcon(const QString icon_name) :
}
// Is this one of our locally sourced, cage-free, organic icons?
- QStringList types = QStringList() << "14x14" << "16x16" << "24x14" << "24x24";
+ QStringList types = QStringList() << "8x8" << "14x14" << "16x16" << "24x14" << "24x24";
QList<QPalette::ColorGroup> color_groups = QList<QPalette::ColorGroup>()
<< QPalette::Disabled
<< QPalette::Active
diff --git a/ui/qt/widgets/filter_expression_toolbar.cpp b/ui/qt/widgets/filter_expression_toolbar.cpp
index 42036f23c6..cc56e46c87 100644
--- a/ui/qt/widgets/filter_expression_toolbar.cpp
+++ b/ui/qt/widgets/filter_expression_toolbar.cpp
@@ -34,18 +34,7 @@ struct filter_expression_data
FilterExpressionToolBar::FilterExpressionToolBar(QWidget * parent) :
DragDropToolBar(parent)
{
- // Try to draw 1-pixel-wide separator lines from the button label
- // ascent to its baseline.
- int sep_margin = (fontMetrics().height() * 0.5) - 1;
- QColor sep_color = ColorUtils::alphaBlend(palette().text(), palette().base(), 0.3);
- setStyleSheet(QString(
- "QToolBar { background: none; border: none; spacing: 1px; }"
- "QFrame {"
- " min-width: 1px; max-width: 1px;"
- " margin: %1px 0 %2px 0; padding: 0;"
- " background-color: %3;"
- "}"
- ).arg(sep_margin).arg(sep_margin - 1).arg(sep_color.name()));
+ updateStyleSheet();
setContextMenuPolicy(Qt::CustomContextMenu);
@@ -60,6 +49,19 @@ FilterExpressionToolBar::FilterExpressionToolBar(QWidget * parent) :
}
+bool FilterExpressionToolBar::event(QEvent *event)
+{
+ switch (event->type()) {
+ case QEvent::PaletteChange:
+ updateStyleSheet();
+ break;
+ default:
+ break;
+
+ }
+ return DragDropToolBar::event(event);
+}
+
void FilterExpressionToolBar::onCustomMenuHandler(const QPoint& pos)
{
QAction * filterAction = actionAt(pos);
@@ -200,6 +202,22 @@ void FilterExpressionToolBar::toolBarShowPreferences()
emit filterPreferences();
}
+void FilterExpressionToolBar::updateStyleSheet()
+{
+ // Try to draw 1-pixel-wide separator lines from the button label
+ // ascent to its baseline.
+ int sep_margin = (fontMetrics().height() * 0.5) - 1;
+ QColor sep_color = ColorUtils::alphaBlend(palette().text(), palette().base(), 0.3);
+ setStyleSheet(QString(
+ "QToolBar { background: none; border: none; spacing: 1px; }"
+ "QFrame {"
+ " min-width: 1px; max-width: 1px;"
+ " margin: %1px 0 %2px 0; padding: 0;"
+ " background-color: %3;"
+ "}"
+ ).arg(sep_margin).arg(sep_margin - 1).arg(sep_color.name()));
+}
+
int FilterExpressionToolBar::uatRowIndexForFilter(QString label, QString expression)
{
int result = -1;
diff --git a/ui/qt/widgets/filter_expression_toolbar.h b/ui/qt/widgets/filter_expression_toolbar.h
index af4956c770..5601825549 100644
--- a/ui/qt/widgets/filter_expression_toolbar.h
+++ b/ui/qt/widgets/filter_expression_toolbar.h
@@ -20,6 +20,9 @@ class FilterExpressionToolBar : public DragDropToolBar
public:
explicit FilterExpressionToolBar(QWidget * parent = Q_NULLPTR);
+protected:
+ virtual bool event(QEvent *event);
+
public slots:
void filterExpressionsChanged();
@@ -41,6 +44,7 @@ private slots:
void toolBarShowPreferences();
private:
+ void updateStyleSheet();
int uatRowIndexForFilter(QString label, QString expression);
static gboolean filter_expression_add_action(const void *key, void *value, void *user_data);