aboutsummaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorGerald Combs <gerald@zing.org>2014-09-20 19:27:24 -0700
committerGerald Combs <gerald@wireshark.org>2014-09-21 16:45:14 +0000
commit5d1aafbb36335bd23d5a5dd09a11eb19b54f0d46 (patch)
treefffc6b08958951d7888049eebb1193a82e40ce99 /ui
parente1a420aeb42db947115cedc9477a7404c24a8517 (diff)
Qt: Multi-state capture start icon.
Add ".on" versions of the x-capture-start icon along with corresponding code in the StockIcon constructor to look for ".on" variants and add them with the QIcon::On state. Make the plain versions of x-capture-start blue to match the general application icon. The goal is to make the toolbar and app icon fins blue when Wireshark is "at rest" and green when it's capturing. Change-Id: I31f4f9d910fc99c41d7c63bd9a722db1611760c7 Reviewed-on: https://code.wireshark.org/review/4225 Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'ui')
-rw-r--r--ui/qt/main_window.cpp8
-rw-r--r--ui/qt/stock_icon.cpp6
2 files changed, 10 insertions, 4 deletions
diff --git a/ui/qt/main_window.cpp b/ui/qt/main_window.cpp
index fe0b27225d..cc7027299e 100644
--- a/ui/qt/main_window.cpp
+++ b/ui/qt/main_window.cpp
@@ -137,12 +137,12 @@ MainWindow::MainWindow(QWidget *parent) :
connect(df_edit, SIGNAL(addBookmark(QString)), this, SLOT(addDisplayFilterButton(QString)));
connect(this, SIGNAL(displayFilterSuccess(bool)), df_edit, SLOT(displayFilterSuccess(bool)));
-#if defined(Q_OS_MAC)
- // XXX Force icons to 24x24 for now, otherwise actionFileOpen looks wonky on OS X.
- main_ui_->mainToolBar->setIconSize(QSize(24, 24));
-#elif defined(Q_OS_WIN)
+#if defined(Q_OS_WIN)
// Current GTK+ and other Windows app behavior.
main_ui_->mainToolBar->setIconSize(QSize(16, 16));
+#else
+ // Force icons to 24x24 for now, otherwise actionFileOpen looks wonky.
+ main_ui_->mainToolBar->setIconSize(QSize(24, 24));
#endif
main_ui_->actionCaptureStart->setIcon(StockIcon("x-capture-start"));
diff --git a/ui/qt/stock_icon.cpp b/ui/qt/stock_icon.cpp
index c365aaac7c..a3195fe83e 100644
--- a/ui/qt/stock_icon.cpp
+++ b/ui/qt/stock_icon.cpp
@@ -73,10 +73,16 @@ StockIcon::StockIcon(const char *icon_name) :
} else {
QStringList types = QStringList() << "16x16" << "24x24";
foreach (QString type, types) {
+ // Along with each name check for "<name>.on" to use for the on (checked) state.
+ // XXX Add checks for each combination of QIcon::Mode + QIcon::State
QString icon_path = path_pfx_ + QString("%1/%2.png").arg(type).arg(icon_name);
+ QString icon_path_on = path_pfx_ + QString("%1/%2.on.png").arg(type).arg(icon_name);
if (QFile::exists(icon_path)) {
addFile(icon_path);
}
+ if (QFile::exists(icon_path_on)) {
+ addFile(icon_path_on, QSize(), QIcon::Normal, QIcon::On);
+ }
}
}
}