aboutsummaryrefslogtreecommitdiffstats
path: root/ui/qt
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2014-09-18 14:09:55 -0700
committerGerald Combs <gerald@wireshark.org>2014-09-20 19:54:04 +0000
commit8576e1c103cb0606d100c31b9794bcdb61bd50c6 (patch)
tree429fcda5b0cf673edf8411b2b65e79f2c8bd9d71 /ui/qt
parent801824b8a7a9885ab066ee7d10e7e03a2a948315 (diff)
Qt: Add stock icons.
The new icons are patterned after the existing capture icons. They could probably benefit from some adjustments here and there. Start moving toward icon names and a directory layout compliant with freedesktop.org's Icon Naming Specification and Icon Theme Specification. We aren't fully compliant and might never be but anyone with exposure to FDO icon themes should at least know where everything is. Make Capture Start (x-capture-start) the first icon in the toolbar. Define the Colorize Packets, Auto Scroll, and zoom icons even though the Qt UI doesn't use them yet. Leave the Capture Filter, Display Filter, Coloring Rules, Preferences, and Help icons off for now. The GTK+ toolbar is overly cluttered and I'm not sure they're necessary. Try not to break ui/gtk/toolbar_icons.h. Remove welcome.qrc. I initially added it in case we needed to overlay the welcome screen with translucent .pngs but that never happened. To do: - Move the old GTK+ icons to their own directory. - Find a better name for the "toolbar" directory. "stock"? - Make the toolbar configurable. Change-Id: Ie07592113d307b8db786aedace672312a870fe38 Reviewed-on: https://code.wireshark.org/review/4182 Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'ui/qt')
-rw-r--r--ui/qt/CMakeLists.txt3
-rw-r--r--ui/qt/Makefile.common7
-rw-r--r--ui/qt/Wireshark.pro2
-rw-r--r--ui/qt/main_window.cpp55
-rw-r--r--ui/qt/main_window.h4
-rw-r--r--ui/qt/main_window.ui65
-rw-r--r--ui/qt/main_window_slots.cpp8
-rw-r--r--ui/qt/stock_icon.cpp95
-rw-r--r--ui/qt/stock_icon.h58
-rw-r--r--ui/qt/welcome.qrc3
-rw-r--r--ui/qt/wireshark_application.cpp1
11 files changed, 230 insertions, 71 deletions
diff --git a/ui/qt/CMakeLists.txt b/ui/qt/CMakeLists.txt
index cbd9a63118..28d982d530 100644
--- a/ui/qt/CMakeLists.txt
+++ b/ui/qt/CMakeLists.txt
@@ -107,6 +107,7 @@ file(GLOB EXTA_QT_HEADERS
qt_ui_utils.h
related_packet_delegate.h
sparkline_delegate.h
+ stock_icon.h
)
set(WIRESHARK_QT_SRC
@@ -182,6 +183,7 @@ set(WIRESHARK_QT_SRC
simple_dialog_qt.cpp
splash_overlay.cpp
sparkline_delegate.cpp
+ stock_icon.cpp
summary_dialog.cpp
syntax_line_edit.cpp
tcp_stream_dialog.cpp
@@ -264,7 +266,6 @@ set(WIRESHARK_QT_QRC
../../image/status.qrc
../../image/toolbar.qrc
i18n.qrc
- welcome.qrc
)
set(WIRESHARK_QT_TS
diff --git a/ui/qt/Makefile.common b/ui/qt/Makefile.common
index dd34ebc240..d869da1501 100644
--- a/ui/qt/Makefile.common
+++ b/ui/qt/Makefile.common
@@ -263,8 +263,7 @@ QRC_FILES = \
../../image/layout.qrc \
../../image/status.qrc \
../../image/toolbar.qrc \
- i18n.qrc \
- welcome.qrc
+ i18n.qrc
#
# .ts files.
@@ -374,9 +373,10 @@ WIRESHARK_QT_SRC = \
sequence_dialog.cpp \
simple_dialog_qt.cpp \
sparkline_delegate.cpp \
+ splash_overlay.cpp \
stats_tree_dialog.cpp \
+ stock_icon.cpp \
summary_dialog.cpp \
- splash_overlay.cpp \
syntax_line_edit.cpp \
tcp_stream_dialog.cpp \
time_shift_dialog.cpp \
@@ -392,4 +392,5 @@ noinst_HEADERS = \
packet_list_record.h \
qcustomplot.h \
qt_ui_utils.h \
+ stock_icon.h \
tango_colors.h
diff --git a/ui/qt/Wireshark.pro b/ui/qt/Wireshark.pro
index 51693d29de..01a27b9b35 100644
--- a/ui/qt/Wireshark.pro
+++ b/ui/qt/Wireshark.pro
@@ -500,7 +500,6 @@ RESOURCES += \
../../image/status.qrc \
../../image/toolbar.qrc \
i18n.qrc \
- welcome.qrc \
# wireshark_en should be pluralonly.
@@ -658,6 +657,7 @@ SOURCES += \
sparkline_delegate.cpp \
splash_overlay.cpp \
stats_tree_dialog.cpp \
+ stock_icon.cpp \
summary_dialog.cpp \
syntax_line_edit.cpp \
tcp_stream_dialog.cpp \
diff --git a/ui/qt/main_window.cpp b/ui/qt/main_window.cpp
index 07e635979a..fe0b27225d 100644
--- a/ui/qt/main_window.cpp
+++ b/ui/qt/main_window.cpp
@@ -44,12 +44,13 @@
#include "ui/recent.h"
#include "ui/util.h"
-#include "wireshark_application.h"
-#include "proto_tree.h"
#include "byte_view_tab.h"
#include "display_filter_edit.h"
-#include "import_text_dialog.h"
#include "export_dissection_dialog.h"
+#include "import_text_dialog.h"
+#include "proto_tree.h"
+#include "stock_icon.h"
+#include "wireshark_application.h"
#include "qt_ui_utils.h"
@@ -136,13 +137,37 @@ MainWindow::MainWindow(QWidget *parent) :
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
- main_ui_->actionFileOpen->setIcon(
- QIcon().fromTheme("document-open", style()->standardIcon(QStyle::SP_DirIcon)));
- // main_ui_->actionFileSave set in main_window.ui
- main_ui_->actionFileClose->setIcon(
- QIcon().fromTheme("process-stop", style()->standardIcon(QStyle::SP_DialogCloseButton)));
+#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)
+ // Current GTK+ and other Windows app behavior.
+ main_ui_->mainToolBar->setIconSize(QSize(16, 16));
+#endif
+
+ main_ui_->actionCaptureStart->setIcon(StockIcon("x-capture-start"));
+ main_ui_->actionCaptureStop->setIcon(StockIcon("x-capture-stop"));
+ main_ui_->actionCaptureRestart->setIcon(StockIcon("x-capture-restart"));
+ main_ui_->actionCaptureOptions->setIcon(StockIcon("x-capture-options"));
+
+ main_ui_->actionFileOpen->setIcon(StockIcon("document-open"));
+ main_ui_->actionFileSave->setIcon(StockIcon("x-capture-file-save"));
+ main_ui_->actionFileClose->setIcon(StockIcon("x-capture-file-close"));
+ main_ui_->actionViewReload->setIcon(StockIcon("x-capture-file-reload"));
+
+ main_ui_->actionEditFindPacket->setIcon(StockIcon("edit-find"));
+ main_ui_->actionGoPreviousPacket->setIcon(StockIcon("go-previous"));
+ main_ui_->actionGoNextPacket->setIcon(StockIcon("go-next"));
+ main_ui_->actionGoGoToPacket->setIcon(StockIcon("go-jump"));
+ main_ui_->actionGoFirstPacket->setIcon(StockIcon("go-first"));
+ main_ui_->actionGoLastPacket->setIcon(StockIcon("go-last"));
+
+// main_ui_->actionViewColorizePackets->setIcon(StockIcon("x-colorize-packets"));
+// main_ui_->actionViewAutoScroll->setIcon(StockIcon("x-stay-last"));
+
+// main_ui_->actionViewZoomIn->setIcon(StockIcon("zoom-in"));
+// main_ui_->actionViewZoomOut->setIcon(StockIcon("zoom-out"));
+// main_ui_->actionViewZoomOriginal->setIcon(StockIcon("zoom-original"));
// In Qt4 multiple toolbars and "pretty" are mutually exculsive on OS X. If
// unifiedTitleAndToolBarOnMac is enabled everything ends up in the same row.
@@ -1484,9 +1509,9 @@ void MainWindow::setMenusForCaptureInProgress(bool capture_in_progress) {
#ifdef HAVE_LIBPCAP
main_ui_->actionCaptureOptions->setEnabled(!capture_in_progress);
- main_ui_->actionStartCapture->setEnabled(!capture_in_progress);
- main_ui_->actionStartCapture->setChecked(capture_in_progress);
- main_ui_->actionStopCapture->setEnabled(capture_in_progress);
+ main_ui_->actionCaptureStart->setEnabled(!capture_in_progress);
+ main_ui_->actionCaptureStart->setChecked(capture_in_progress);
+ main_ui_->actionCaptureStop->setEnabled(capture_in_progress);
main_ui_->actionCaptureRestart->setEnabled(capture_in_progress);
#endif /* HAVE_LIBPCAP */
@@ -1496,8 +1521,8 @@ void MainWindow::setMenusForCaptureStopping() {
main_ui_->actionFileQuit->setEnabled(false);
main_ui_->actionSummary->setEnabled(false);
#ifdef HAVE_LIBPCAP
- main_ui_->actionStartCapture->setChecked(false);
- main_ui_->actionStopCapture->setEnabled(false);
+ main_ui_->actionCaptureStart->setChecked(false);
+ main_ui_->actionCaptureStop->setEnabled(false);
main_ui_->actionCaptureRestart->setEnabled(false);
#endif /* HAVE_LIBPCAP */
}
diff --git a/ui/qt/main_window.h b/ui/qt/main_window.h
index df20da5078..ff328967a9 100644
--- a/ui/qt/main_window.h
+++ b/ui/qt/main_window.h
@@ -336,8 +336,8 @@ private slots:
void on_goToCancel_clicked();
void on_goToGo_clicked();
void on_goToLineEdit_returnPressed();
- void on_actionStartCapture_triggered();
- void on_actionStopCapture_triggered();
+ void on_actionCaptureStart_triggered();
+ void on_actionCaptureStop_triggered();
void on_actionSummary_triggered();
void on_actionStatisticsFlowGraph_triggered();
diff --git a/ui/qt/main_window.ui b/ui/qt/main_window.ui
index 5e42d75660..d24b2b0503 100644
--- a/ui/qt/main_window.ui
+++ b/ui/qt/main_window.ui
@@ -177,8 +177,8 @@
<string>&amp;Capture</string>
</property>
<addaction name="actionCaptureOptions"/>
- <addaction name="actionStartCapture"/>
- <addaction name="actionStopCapture"/>
+ <addaction name="actionCaptureStart"/>
+ <addaction name="actionCaptureStop"/>
<addaction name="actionCaptureRestart"/>
<addaction name="actionCaptureCaptureFilters"/>
<addaction name="actionCaptureRefreshInterfaces"/>
@@ -462,15 +462,12 @@
<string>Main Toolbar</string>
</property>
<property name="movable">
- <bool>true</bool>
- </property>
- <property name="allowedAreas">
- <set>Qt::BottomToolBarArea|Qt::TopToolBarArea</set>
+ <bool>false</bool>
</property>
<property name="iconSize">
<size>
- <width>24</width>
- <height>24</height>
+ <width>32</width>
+ <height>32</height>
</size>
</property>
<property name="toolButtonStyle">
@@ -482,12 +479,23 @@
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
- <addaction name="actionStartCapture"/>
- <addaction name="actionStopCapture"/>
+ <addaction name="actionCaptureStart"/>
+ <addaction name="actionCaptureStop"/>
+ <addaction name="actionCaptureRestart"/>
+ <addaction name="actionCaptureOptions"/>
<addaction name="separator"/>
<addaction name="actionFileOpen"/>
<addaction name="actionFileSave"/>
<addaction name="actionFileClose"/>
+ <addaction name="actionViewReload"/>
+ <addaction name="separator"/>
+ <addaction name="actionEditFindPacket"/>
+ <addaction name="actionGoPreviousPacket"/>
+ <addaction name="actionGoNextPacket"/>
+ <addaction name="actionGoGoToPacket"/>
+ <addaction name="actionGoFirstPacket"/>
+ <addaction name="actionGoLastPacket"/>
+ <addaction name="separator"/>
</widget>
<widget class="MainStatusBar" name="statusBar"/>
<widget class="QToolBar" name="displayFilterToolBar">
@@ -529,27 +537,10 @@
<enum>QAction::QuitRole</enum>
</property>
</action>
- <action name="actionCaptureInterfaces">
- <property name="text">
- <string>&amp;Interfaces...</string>
- </property>
- <property name="toolTip">
- <string>Show interface details</string>
- </property>
- <property name="shortcut">
- <string>Ctrl+I</string>
- </property>
- </action>
- <action name="actionStartCapture">
+ <action name="actionCaptureStart">
<property name="checkable">
<bool>true</bool>
</property>
- <property name="icon">
- <iconset resource="../../image/toolbar.qrc">
- <normaloff>:/toolbar/main/capture_start_24.png</normaloff>
- <normalon>:/toolbar/main/capture_start_active_24.png</normalon>
- <disabledon>:/toolbar/main/capture_start_active_24.png</disabledon>:/toolbar/main/capture_start_24.png</iconset>
- </property>
<property name="text">
<string>&amp;Start</string>
</property>
@@ -560,11 +551,7 @@
<string>Ctrl+E</string>
</property>
</action>
- <action name="actionStopCapture">
- <property name="icon">
- <iconset resource="../../image/toolbar.qrc">
- <normaloff>:/toolbar/main/capture_stop_24.png</normaloff>:/toolbar/main/capture_stop_24.png</iconset>
- </property>
+ <action name="actionCaptureStop">
<property name="text">
<string>S&amp;top</string>
</property>
@@ -580,7 +567,7 @@
<string>Close</string>
</property>
<property name="toolTip">
- <string>Close the current capture file</string>
+ <string>Close this capture file</string>
</property>
<property name="shortcut">
<string>Ctrl+W</string>
@@ -816,15 +803,11 @@
</property>
</action>
<action name="actionFileSave">
- <property name="icon">
- <iconset resource="../../image/toolbar.qrc">
- <normaloff>:/toolbar/main/toolbar/toolbar_wireshark_file_24.png</normaloff>:/toolbar/main/toolbar/toolbar_wireshark_file_24.png</iconset>
- </property>
<property name="text">
<string>&amp;Save</string>
</property>
<property name="toolTip">
- <string>Save the current file</string>
+ <string>Save this capture file</string>
</property>
<property name="shortcut">
<string>Ctrl+S</string>
@@ -832,7 +815,7 @@
</action>
<action name="actionFileSaveAs">
<property name="icon">
- <iconset resource="../../image/toolbar.qrc">
+ <iconset>
<normaloff>:/toolbar/main/toolbar/toolbar_wireshark_file_24.png</normaloff>:/toolbar/main/toolbar/toolbar_wireshark_file_24.png</iconset>
</property>
<property name="text">
@@ -894,7 +877,7 @@
<string>&amp;Reload</string>
</property>
<property name="toolTip">
- <string>Reload the current file</string>
+ <string>Reload this file</string>
</property>
<property name="shortcut">
<string>Ctrl+R</string>
diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp
index 714e8b5ee8..712c08c3b6 100644
--- a/ui/qt/main_window_slots.cpp
+++ b/ui/qt/main_window_slots.cpp
@@ -1158,9 +1158,9 @@ void MainWindow::interfaceSelectionChanged()
// XXX This doesn't disable the toolbar button when using
// QtMacExtras.
if (global_capture_opts.num_selected > 0 && capture_filter_valid_) {
- main_ui_->actionStartCapture->setEnabled(true);
+ main_ui_->actionCaptureStart->setEnabled(true);
} else {
- main_ui_->actionStartCapture->setEnabled(false);
+ main_ui_->actionCaptureStart->setEnabled(false);
}
#endif // HAVE_LIBPCAP
}
@@ -2326,7 +2326,7 @@ void MainWindow::on_goToLineEdit_returnPressed()
on_goToGo_clicked();
}
-void MainWindow::on_actionStartCapture_triggered()
+void MainWindow::on_actionCaptureStart_triggered()
{
//#ifdef HAVE_AIRPCAP
// airpcap_if_active = airpcap_if_selected;
@@ -2368,7 +2368,7 @@ void MainWindow::on_actionStartCapture_triggered()
#endif // HAVE_LIBPCAP
}
-void MainWindow::on_actionStopCapture_triggered()
+void MainWindow::on_actionCaptureStop_triggered()
{
stopCapture();
}
diff --git a/ui/qt/stock_icon.cpp b/ui/qt/stock_icon.cpp
new file mode 100644
index 0000000000..c365aaac7c
--- /dev/null
+++ b/ui/qt/stock_icon.cpp
@@ -0,0 +1,95 @@
+/* stock_icon.cpp
+ *
+ * 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 "stock_icon.h"
+
+// Stock icons. Based on gtk/stock_icons.h
+
+// Toolbar icon sizes:
+// OS X freestanding: 32x32, 32x32@2x, segmented (inside a button): <= 19x19
+// Windows: 16x16, 24x24, 32x32
+// GNOME: 24x24 (default), 48x48
+
+// References:
+//
+// http://standards.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html
+// http://standards.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html
+//
+// http://mithatkonar.com/wiki/doku.php/qt/icons
+//
+// https://developer.apple.com/library/mac/documentation/userexperience/conceptual/applehiguidelines/IconsImages/IconsImages.html#//apple_ref/doc/uid/20000967-TPXREF102
+// http://msdn.microsoft.com/en-us/library/windows/desktop/dn742485.aspx
+// https://developer.gnome.org/hig-book/stable/icons-types.html.en
+// http://msdn.microsoft.com/en-us/library/ms246582.aspx
+
+// To do:
+// - 32x32, 48x48, 64x64, and unscaled (.svg) icons
+// - Indent find & go actions when those panes are open.
+// - Replace or remove:
+// WIRESHARK_STOCK_CAPTURE_FILTER x-capture-filter
+// WIRESHARK_STOCK_DISPLAY_FILTER x-display-filter
+// GTK_STOCK_SELECT_COLOR x-coloring-rules
+// GTK_STOCK_PREFERENCES preferences-system
+// GTK_STOCK_HELP help-contents
+
+#include "wireshark_application.h"
+
+#include <QFile>
+#include <QStyle>
+
+QString path_pfx_ = ":/icons/toolbar/";
+
+StockIcon::StockIcon(const char *icon_name) :
+ QIcon()
+{
+ if (strcmp(icon_name, "document-open") == 0) {
+ QIcon dir_icon = fromTheme(icon_name, wsApp->style()->standardIcon(QStyle::SP_DirIcon));
+ swap(dir_icon);
+ return;
+ }
+
+ if (hasThemeIcon(icon_name)) {
+ QIcon theme_icon = fromTheme(icon_name);
+ swap(theme_icon);
+ return;
+ } else {
+ QStringList types = QStringList() << "16x16" << "24x24";
+ foreach (QString type, types) {
+ QString icon_path = path_pfx_ + QString("%1/%2.png").arg(type).arg(icon_name);
+ if (QFile::exists(icon_path)) {
+ addFile(icon_path);
+ }
+ }
+ }
+}
+
+/*
+ * 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:
+ */
diff --git a/ui/qt/stock_icon.h b/ui/qt/stock_icon.h
new file mode 100644
index 0000000000..3c83beb7ba
--- /dev/null
+++ b/ui/qt/stock_icon.h
@@ -0,0 +1,58 @@
+/* stock_icon.h
+ *
+ * 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 STOCK_ICON_H
+#define STOCK_ICON_H
+
+#include <QIcon>
+
+/** @file
+ * Goal: Beautiful icons appropriate for each of our supported platforms.
+ */
+
+// Supported standard names:
+// document-open
+
+// Supported custom names (see images/toolbar):
+// x-capture-file-close
+// x-capture-file-save
+
+class StockIcon : public QIcon
+{
+public:
+ explicit StockIcon(const char *icon_name);
+
+};
+
+#endif // STOCK_ICON_H
+
+/*
+ * 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:
+ */
diff --git a/ui/qt/welcome.qrc b/ui/qt/welcome.qrc
deleted file mode 100644
index bf4962eb02..0000000000
--- a/ui/qt/welcome.qrc
+++ /dev/null
@@ -1,3 +0,0 @@
-<RCC>
- <qresource prefix="/welcome"/>
-</RCC>
diff --git a/ui/qt/wireshark_application.cpp b/ui/qt/wireshark_application.cpp
index 4e524f1ac3..04ac8b03cb 100644
--- a/ui/qt/wireshark_application.cpp
+++ b/ui/qt/wireshark_application.cpp
@@ -580,7 +580,6 @@ WiresharkApplication::WiresharkApplication(int &argc, char **argv) :
Q_INIT_RESOURCE(layout);
Q_INIT_RESOURCE(status);
Q_INIT_RESOURCE(toolbar);
- Q_INIT_RESOURCE(welcome);
#ifdef Q_OS_WIN
/* RichEd20.DLL is needed for native file dialog filter entries. */