From b4a4de78d8f78f0cea54b9ae846a120c2a68d893 Mon Sep 17 00:00:00 2001 From: Gerald Combs Date: Wed, 14 Oct 2015 15:29:04 -0700 Subject: Use buttons to display the main status bar icons. Use QToolButtons to display the expert indicator and comment icons in the main status bar. Use the same style sheet hack we use in ProgressFrame to un-style the buttons. Make sure we specify the @2x comment icon in our .qrc file so that it's loaded and used on retina displays. Move the comment and expert .pngs to the stock icon directory and use StockIcon to load them. Remove status.qrc since it's no longer used. Change-Id: I84485b22656f8f9af29ad3c02446ffefb6657ed5 Reviewed-on: https://code.wireshark.org/review/11048 Petri-Dish: Gerald Combs Tested-by: Petri Dish Buildbot Reviewed-by: Gerald Combs --- Makefile.am | 27 +- image/capture_comment_update@2x.png | Bin 1586 -> 0 bytes image/expert_chat.png | Bin 512 -> 0 bytes image/expert_chat@2x.png | Bin 1155 -> 0 bytes image/expert_error.png | Bin 487 -> 0 bytes image/expert_error@2x.png | Bin 1085 -> 0 bytes image/expert_indicators.svg | 618 -------------- image/expert_none.png | Bin 488 -> 0 bytes image/expert_none@2x.png | Bin 1095 -> 0 bytes image/expert_note.png | Bin 465 -> 0 bytes image/expert_note@2x.png | Bin 1002 -> 0 bytes image/expert_warn.png | Bin 501 -> 0 bytes image/expert_warn@2x.png | Bin 1143 -> 0 bytes image/status.qrc | 17 - image/toolbar.qrc | 12 + image/toolbar/14x14/expert_indicators.svg | 618 ++++++++++++++ image/toolbar/14x14/x-capture-comment-update.png | Bin 0 -> 605 bytes image/toolbar/14x14/x-capture-comment-update.svg | 930 +++++++++++++++++++++ .../toolbar/14x14/x-capture-comment-update@2x.png | Bin 0 -> 1586 bytes image/toolbar/14x14/x-expert-chat.png | Bin 0 -> 512 bytes image/toolbar/14x14/x-expert-chat@2x.png | Bin 0 -> 1155 bytes image/toolbar/14x14/x-expert-error.png | Bin 0 -> 487 bytes image/toolbar/14x14/x-expert-error@2x.png | Bin 0 -> 1085 bytes image/toolbar/14x14/x-expert-none.png | Bin 0 -> 488 bytes image/toolbar/14x14/x-expert-none@2x.png | Bin 0 -> 1095 bytes image/toolbar/14x14/x-expert-note.png | Bin 0 -> 465 bytes image/toolbar/14x14/x-expert-note@2x.png | Bin 0 -> 1002 bytes image/toolbar/14x14/x-expert-warn.png | Bin 0 -> 501 bytes image/toolbar/14x14/x-expert-warn@2x.png | Bin 0 -> 1143 bytes ui/qt/CMakeLists.txt | 1 - ui/qt/Makefile.common | 1 - ui/qt/Wireshark.pro | 1 - ui/qt/main_status_bar.cpp | 77 +- ui/qt/main_status_bar.h | 5 +- ui/qt/wireshark_application.cpp | 1 - 35 files changed, 1623 insertions(+), 685 deletions(-) delete mode 100644 image/capture_comment_update@2x.png delete mode 100644 image/expert_chat.png delete mode 100644 image/expert_chat@2x.png delete mode 100644 image/expert_error.png delete mode 100644 image/expert_error@2x.png delete mode 100644 image/expert_indicators.svg delete mode 100644 image/expert_none.png delete mode 100644 image/expert_none@2x.png delete mode 100644 image/expert_note.png delete mode 100644 image/expert_note@2x.png delete mode 100644 image/expert_warn.png delete mode 100644 image/expert_warn@2x.png delete mode 100644 image/status.qrc create mode 100644 image/toolbar/14x14/expert_indicators.svg create mode 100644 image/toolbar/14x14/x-capture-comment-update.png create mode 100644 image/toolbar/14x14/x-capture-comment-update.svg create mode 100644 image/toolbar/14x14/x-capture-comment-update@2x.png create mode 100644 image/toolbar/14x14/x-expert-chat.png create mode 100644 image/toolbar/14x14/x-expert-chat@2x.png create mode 100644 image/toolbar/14x14/x-expert-error.png create mode 100644 image/toolbar/14x14/x-expert-error@2x.png create mode 100644 image/toolbar/14x14/x-expert-none.png create mode 100644 image/toolbar/14x14/x-expert-none@2x.png create mode 100644 image/toolbar/14x14/x-expert-note.png create mode 100644 image/toolbar/14x14/x-expert-note@2x.png create mode 100644 image/toolbar/14x14/x-expert-warn.png create mode 100644 image/toolbar/14x14/x-expert-warn@2x.png diff --git a/Makefile.am b/Makefile.am index b8e0161188..4a1d70fe20 100644 --- a/Makefile.am +++ b/Makefile.am @@ -893,23 +893,11 @@ EXTRA_DIST = \ image/capture_comment_disabled.png \ image/capture_comment_update.png \ image/capture_comment_update.svg \ - image/capture_comment_update@2x.png \ image/clist_ascend.xpm \ image/clist_descend.xpm \ image/copy-8.png \ image/dumpcap.rc.in \ image/editcap.rc.in \ - image/expert_chat.png \ - image/expert_chat@2x.png \ - image/expert_error.png \ - image/expert_error@2x.png \ - image/expert_indicators.svg \ - image/expert_none.png \ - image/expert_none@2x.png \ - image/expert_note.png \ - image/expert_note@2x.png \ - image/expert_warn.png \ - image/expert_warn@2x.png \ image/file_dlg_win32.rc \ image/hi16-app-wireshark.png \ image/hi32-app-wireshark.png \ @@ -949,7 +937,6 @@ EXTRA_DIST = \ image/README.image \ image/reordercap.rc.in \ image/rubberband-16.png \ - image/status.qrc \ image/stock_dialog_error_48.xpm \ image/stock_dialog_info_48.xpm \ image/stock_dialog_question_48.xpm \ @@ -957,6 +944,20 @@ EXTRA_DIST = \ image/stock_dialog_warning_48.xpm \ image/text2pcap.rc.in \ image/tfshark.rc.in \ + image/toolbar/14x14/x-capture-comment-update.png \ + image/toolbar/14x14/x-capture-comment-update.svg \ + image/toolbar/14x14/x-capture-comment-update@2x.png \ + image/toolbar/14x14/x-expert-chat.png \ + image/toolbar/14x14/x-expert-chat@2x.png \ + image/toolbar/14x14/x-expert-error.png \ + image/toolbar/14x14/x-expert-error@2x.png \ + image/toolbar/14x14/x-expert-indicators.svg \ + image/toolbar/14x14/x-expert-none.png \ + image/toolbar/14x14/x-expert-none@2x.png \ + image/toolbar/14x14/x-expert-note.png \ + image/toolbar/14x14/x-expert-note@2x.png \ + image/toolbar/14x14/x-expert-warn.png \ + image/toolbar/14x14/x-expert-warn@2x.png \ image/toolbar/14x14/x-filter-bookmark.active.png \ image/toolbar/14x14/x-filter-bookmark.active.svg \ image/toolbar/14x14/x-filter-bookmark.active@2x.png \ diff --git a/image/capture_comment_update@2x.png b/image/capture_comment_update@2x.png deleted file mode 100644 index 74cda2e3cd..0000000000 Binary files a/image/capture_comment_update@2x.png and /dev/null differ diff --git a/image/expert_chat.png b/image/expert_chat.png deleted file mode 100644 index a7af30f7c9..0000000000 Binary files a/image/expert_chat.png and /dev/null differ diff --git a/image/expert_chat@2x.png b/image/expert_chat@2x.png deleted file mode 100644 index e0e306e671..0000000000 Binary files a/image/expert_chat@2x.png and /dev/null differ diff --git a/image/expert_error.png b/image/expert_error.png deleted file mode 100644 index 0eb09c7f0e..0000000000 Binary files a/image/expert_error.png and /dev/null differ diff --git a/image/expert_error@2x.png b/image/expert_error@2x.png deleted file mode 100644 index 9dea7e0119..0000000000 Binary files a/image/expert_error@2x.png and /dev/null differ diff --git a/image/expert_indicators.svg b/image/expert_indicators.svg deleted file mode 100644 index 4c019e4228..0000000000 --- a/image/expert_indicators.svg +++ /dev/null @@ -1,618 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - image/svg+xml - - - - - - - Chat - Error - Note - None - Warn - - - - - - - - - - - - - - - - - - diff --git a/image/expert_none.png b/image/expert_none.png deleted file mode 100644 index 0d1a81adc9..0000000000 Binary files a/image/expert_none.png and /dev/null differ diff --git a/image/expert_none@2x.png b/image/expert_none@2x.png deleted file mode 100644 index 71c659fd87..0000000000 Binary files a/image/expert_none@2x.png and /dev/null differ diff --git a/image/expert_note.png b/image/expert_note.png deleted file mode 100644 index 76e3dbc2ed..0000000000 Binary files a/image/expert_note.png and /dev/null differ diff --git a/image/expert_note@2x.png b/image/expert_note@2x.png deleted file mode 100644 index a3ffaf2c4d..0000000000 Binary files a/image/expert_note@2x.png and /dev/null differ diff --git a/image/expert_warn.png b/image/expert_warn.png deleted file mode 100644 index 337775a877..0000000000 Binary files a/image/expert_warn.png and /dev/null differ diff --git a/image/expert_warn@2x.png b/image/expert_warn@2x.png deleted file mode 100644 index 1860a18b8a..0000000000 Binary files a/image/expert_warn@2x.png and /dev/null differ diff --git a/image/status.qrc b/image/status.qrc deleted file mode 100644 index 2a5e8bcfd1..0000000000 --- a/image/status.qrc +++ /dev/null @@ -1,17 +0,0 @@ - - - expert_chat.png - expert_chat@2x.png - expert_error.png - expert_error@2x.png - expert_none.png - expert_none@2x.png - expert_note.png - expert_note@2x.png - expert_warn.png - expert_warn@2x.png - - - capture_comment_update.png - - diff --git a/image/toolbar.qrc b/image/toolbar.qrc index 1c9b546070..f6839621d1 100644 --- a/image/toolbar.qrc +++ b/image/toolbar.qrc @@ -9,6 +9,18 @@ copy-8.png + toolbar/14x14/x-capture-comment-update.png + toolbar/14x14/x-capture-comment-update@2x.png + toolbar/14x14/x-expert-chat.png + toolbar/14x14/x-expert-chat@2x.png + toolbar/14x14/x-expert-error.png + toolbar/14x14/x-expert-error@2x.png + toolbar/14x14/x-expert-none.png + toolbar/14x14/x-expert-none@2x.png + toolbar/14x14/x-expert-note.png + toolbar/14x14/x-expert-note@2x.png + toolbar/14x14/x-expert-warn.png + toolbar/14x14/x-expert-warn@2x.png toolbar/14x14/x-filter-clear.png toolbar/14x14/x-filter-clear@2x.png toolbar/14x14/x-filter-clear.active.png diff --git a/image/toolbar/14x14/expert_indicators.svg b/image/toolbar/14x14/expert_indicators.svg new file mode 100644 index 0000000000..4c019e4228 --- /dev/null +++ b/image/toolbar/14x14/expert_indicators.svg @@ -0,0 +1,618 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + Chat + Error + Note + None + Warn + + + + + + + + + + + + + + + + + + diff --git a/image/toolbar/14x14/x-capture-comment-update.png b/image/toolbar/14x14/x-capture-comment-update.png new file mode 100644 index 0000000000..99f5b16e08 Binary files /dev/null and b/image/toolbar/14x14/x-capture-comment-update.png differ diff --git a/image/toolbar/14x14/x-capture-comment-update.svg b/image/toolbar/14x14/x-capture-comment-update.svg new file mode 100644 index 0000000000..4bffb99275 --- /dev/null +++ b/image/toolbar/14x14/x-capture-comment-update.svg @@ -0,0 +1,930 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/image/toolbar/14x14/x-capture-comment-update@2x.png b/image/toolbar/14x14/x-capture-comment-update@2x.png new file mode 100644 index 0000000000..74cda2e3cd Binary files /dev/null and b/image/toolbar/14x14/x-capture-comment-update@2x.png differ diff --git a/image/toolbar/14x14/x-expert-chat.png b/image/toolbar/14x14/x-expert-chat.png new file mode 100644 index 0000000000..a7af30f7c9 Binary files /dev/null and b/image/toolbar/14x14/x-expert-chat.png differ diff --git a/image/toolbar/14x14/x-expert-chat@2x.png b/image/toolbar/14x14/x-expert-chat@2x.png new file mode 100644 index 0000000000..e0e306e671 Binary files /dev/null and b/image/toolbar/14x14/x-expert-chat@2x.png differ diff --git a/image/toolbar/14x14/x-expert-error.png b/image/toolbar/14x14/x-expert-error.png new file mode 100644 index 0000000000..0eb09c7f0e Binary files /dev/null and b/image/toolbar/14x14/x-expert-error.png differ diff --git a/image/toolbar/14x14/x-expert-error@2x.png b/image/toolbar/14x14/x-expert-error@2x.png new file mode 100644 index 0000000000..9dea7e0119 Binary files /dev/null and b/image/toolbar/14x14/x-expert-error@2x.png differ diff --git a/image/toolbar/14x14/x-expert-none.png b/image/toolbar/14x14/x-expert-none.png new file mode 100644 index 0000000000..0d1a81adc9 Binary files /dev/null and b/image/toolbar/14x14/x-expert-none.png differ diff --git a/image/toolbar/14x14/x-expert-none@2x.png b/image/toolbar/14x14/x-expert-none@2x.png new file mode 100644 index 0000000000..71c659fd87 Binary files /dev/null and b/image/toolbar/14x14/x-expert-none@2x.png differ diff --git a/image/toolbar/14x14/x-expert-note.png b/image/toolbar/14x14/x-expert-note.png new file mode 100644 index 0000000000..76e3dbc2ed Binary files /dev/null and b/image/toolbar/14x14/x-expert-note.png differ diff --git a/image/toolbar/14x14/x-expert-note@2x.png b/image/toolbar/14x14/x-expert-note@2x.png new file mode 100644 index 0000000000..a3ffaf2c4d Binary files /dev/null and b/image/toolbar/14x14/x-expert-note@2x.png differ diff --git a/image/toolbar/14x14/x-expert-warn.png b/image/toolbar/14x14/x-expert-warn.png new file mode 100644 index 0000000000..337775a877 Binary files /dev/null and b/image/toolbar/14x14/x-expert-warn.png differ diff --git a/image/toolbar/14x14/x-expert-warn@2x.png b/image/toolbar/14x14/x-expert-warn@2x.png new file mode 100644 index 0000000000..1860a18b8a Binary files /dev/null and b/image/toolbar/14x14/x-expert-warn@2x.png differ diff --git a/ui/qt/CMakeLists.txt b/ui/qt/CMakeLists.txt index 376ad38b87..ed3d0a5e59 100644 --- a/ui/qt/CMakeLists.txt +++ b/ui/qt/CMakeLists.txt @@ -426,7 +426,6 @@ set(WIRESHARK_QT_QRC ../../image/about.qrc ../../image/languages/languages.qrc ../../image/layout.qrc - ../../image/status.qrc ../../image/toolbar.qrc ../../image/wsicon.qrc i18n.qrc diff --git a/ui/qt/Makefile.common b/ui/qt/Makefile.common index 409dca819c..eb3bba2290 100644 --- a/ui/qt/Makefile.common +++ b/ui/qt/Makefile.common @@ -369,7 +369,6 @@ QRC_FILES = \ ../../image/about.qrc \ ../../image/languages/languages.qrc \ ../../image/layout.qrc \ - ../../image/status.qrc \ ../../image/toolbar.qrc \ ../../image/wsicon.qrc \ i18n.qrc diff --git a/ui/qt/Wireshark.pro b/ui/qt/Wireshark.pro index a2361c9124..fa422dd8a1 100644 --- a/ui/qt/Wireshark.pro +++ b/ui/qt/Wireshark.pro @@ -571,7 +571,6 @@ RESOURCES += \ ../../image/about.qrc \ ../../image/languages/languages.qrc \ ../../image/layout.qrc \ - ../../image/status.qrc \ ../../image/toolbar.qrc \ ../../image/wsicon.qrc \ i18n.qrc \ diff --git a/ui/qt/main_status_bar.cpp b/ui/qt/main_status_bar.cpp index 1e466266be..47598e6615 100644 --- a/ui/qt/main_status_bar.cpp +++ b/ui/qt/main_status_bar.cpp @@ -25,24 +25,26 @@ #include "file.h" -#include "epan/expert.h" -#include "wsutil/filesystem.h" +#include + +#include +#include #include "ui/main_statusbar.h" #include "ui/profile.h" #include "ui/qt/qt_ui_utils.h" -#include + #include "capture_file.h" #include "main_status_bar.h" #include "profile_dialog.h" - -#include -#include -#include - +#include "stock_icon.h" #include "tango_colors.h" +#include +#include +#include +#include // XXX - The GTK+ code assigns priorities to these and pushes/pops accordingly. @@ -116,28 +118,41 @@ MainStatusBar::MainStatusBar(QWidget *parent) : " border-right: 1px solid palette(mid);" "}" )); -#elif defined(Q_OS_MAC) - expert_status_.setAttribute(Qt::WA_MacSmallSize, true); #endif - expert_status_.setTextFormat(Qt::RichText); - expert_status_.hide(); + QString button_ss = + "QToolButton {" + " border: none;" + " background: transparent;" // Disables platform style on Windows. + " padding: 0px;" + " margin: 0px;" + "}"; + + expert_button_ = new QToolButton(this); + expert_button_->setIconSize(QSize(14, 14)); + expert_button_->setStyleSheet(button_ss); + expert_button_->hide(); // We just want a clickable image. Using a QPushButton or QToolButton would require // a lot of adjustment. - comment_label_.setText(""); - comment_label_.setToolTip(tr("Open the Capture File Properties dialog")); - comment_label_.setEnabled(false); - connect(&expert_status_, SIGNAL(linkActivated(QString)), this, SIGNAL(showExpertInfo())); - connect(&comment_label_, SIGNAL(linkActivated(QString)), this, SIGNAL(editCaptureComment())); + StockIcon comment_icon("x-capture-comment-update"); + comment_button_ = new QToolButton(this); + comment_button_->setIcon(comment_icon); + comment_button_->setIconSize(QSize(14, 14)); + comment_button_->setStyleSheet(button_ss); + + comment_button_->setToolTip(tr("Open the Capture File Properties dialog")); + comment_button_->setEnabled(false); + connect(expert_button_, SIGNAL(clicked(bool)), this, SIGNAL(showExpertInfo())); + connect(comment_button_, SIGNAL(clicked(bool)), this, SIGNAL(editCaptureComment())); info_progress_hb->setContentsMargins(0, 0, 0, 0); info_status_.setTemporaryContext(STATUS_CTX_TEMPORARY); info_status_.setShrinkable(true); - info_progress_hb->addWidget(&expert_status_); - info_progress_hb->addWidget(&comment_label_); + info_progress_hb->addWidget(expert_button_); + info_progress_hb->addWidget(comment_button_); info_progress_hb->addWidget(&info_status_); info_progress_hb->addWidget(&progress_frame_); info_progress_hb->addStretch(10); @@ -197,7 +212,7 @@ void MainStatusBar::showExpert() { } void MainStatusBar::captureFileClosing() { - expert_status_.hide(); + expert_button_->hide(); progress_frame_.captureFileClosing(); } @@ -205,39 +220,39 @@ void MainStatusBar::expertUpdate() { // won't load @2x versions in Qt versions earlier than 5.4. // https://bugreports.qt.io/browse/QTBUG-36383 // We might have to switch to a QPushButton. - QString img_text = ""); // break; default: - img_text.append("none"); + stock_name.append("none"); tt_text = tr("No expert information"); break; } - img_text.append(".png\">"); - expert_status_.setText(img_text); - expert_status_.setToolTip(tt_text); - expert_status_.show(); + StockIcon expert_icon(stock_name); + expert_button_->setIcon(expert_icon); + expert_button_->setToolTip(tt_text); + expert_button_->show(); } // ui/gtk/main_statusbar.c @@ -255,7 +270,7 @@ void MainStatusBar::setFileName(CaptureFile &cf) void MainStatusBar::setCaptureFile(capture_file *cf) { cap_file_ = cf; - comment_label_.setEnabled(cap_file_ != NULL); + comment_button_->setEnabled(cap_file_ != NULL); } void MainStatusBar::pushTemporaryStatus(const QString &message) { diff --git a/ui/qt/main_status_bar.h b/ui/qt/main_status_bar.h index 89c5c6eaa2..b1e5ef80fc 100644 --- a/ui/qt/main_status_bar.h +++ b/ui/qt/main_status_bar.h @@ -37,6 +37,7 @@ #include class CaptureFile; +class QToolButton; class MainStatusBar : public QStatusBar { @@ -49,8 +50,8 @@ public: void setFileName(CaptureFile &cf); private: - QLabel expert_status_; - QLabel comment_label_; + QToolButton *expert_button_; + QToolButton *comment_button_; LabelStack info_status_; ProgressFrame progress_frame_; LabelStack packet_status_; diff --git a/ui/qt/wireshark_application.cpp b/ui/qt/wireshark_application.cpp index e7ffa0b80f..1a516a02fe 100644 --- a/ui/qt/wireshark_application.cpp +++ b/ui/qt/wireshark_application.cpp @@ -491,7 +491,6 @@ WiresharkApplication::WiresharkApplication(int &argc, char **argv) : Q_INIT_RESOURCE(about); Q_INIT_RESOURCE(i18n); Q_INIT_RESOURCE(layout); - Q_INIT_RESOURCE(status); Q_INIT_RESOURCE(toolbar); Q_INIT_RESOURCE(wsicon); Q_INIT_RESOURCE(languages); -- cgit v1.2.1