summaryrefslogtreecommitdiff
path: root/ui/qt
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2015-10-14 15:29:04 -0700
committerGerald Combs <gerald@wireshark.org>2015-10-16 03:52:42 +0000
commitb4a4de78d8f78f0cea54b9ae846a120c2a68d893 (patch)
treee0d7c75cb1a94e4dd625738d61b324e9f8301b83 /ui/qt
parentb84b0315d3e917b7ab294f36cfc7a24e9c2d3cd0 (diff)
downloadwireshark-b4a4de78d8f78f0cea54b9ae846a120c2a68d893.tar.gz
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 <gerald@wireshark.org> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'ui/qt')
-rw-r--r--ui/qt/CMakeLists.txt1
-rw-r--r--ui/qt/Makefile.common1
-rw-r--r--ui/qt/Wireshark.pro1
-rw-r--r--ui/qt/main_status_bar.cpp77
-rw-r--r--ui/qt/main_status_bar.h5
-rw-r--r--ui/qt/wireshark_application.cpp1
6 files changed, 49 insertions, 37 deletions
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 <epan/expert.h>
+
+#include <wsutil/filesystem.h>
+#include <wsutil/utf8_entities.h>
#include "ui/main_statusbar.h"
#include "ui/profile.h"
#include "ui/qt/qt_ui_utils.h"
-#include <wsutil/utf8_entities.h>
+
#include "capture_file.h"
#include "main_status_bar.h"
#include "profile_dialog.h"
-
-#include <QSplitter>
-#include <QHBoxLayout>
-#include <QAction>
-
+#include "stock_icon.h"
#include "tango_colors.h"
+#include <QAction>
+#include <QHBoxLayout>
+#include <QSplitter>
+#include <QToolButton>
// 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("<a href><img src=\":/comment/capture_comment_update.png\"></img></a>");
- 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() {
// <img> 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 = "<a href><img src=\":/expert/expert_";
+ QString stock_name = "x-expert-";
QString tt_text = tr(" is the highest expert information level");
switch(expert_get_highest_severity()) {
case(PI_ERROR):
- img_text.append("error");
+ stock_name.append("error");
tt_text.prepend(tr("ERROR"));
break;
case(PI_WARN):
- img_text.append("warn");
+ stock_name.append("warn");
tt_text.prepend(tr("WARNING"));
break;
case(PI_NOTE):
- img_text.append("note");
+ stock_name.append("note");
tt_text.prepend(tr("NOTE"));
break;
case(PI_CHAT):
- img_text.append("chat");
+ stock_name.append("chat");
tt_text.prepend(tr("CHAT"));
break;
// case(PI_COMMENT):
// m_expertStatus.setText("<img src=\":/expert/expert_comment.png\"></img>");
// break;
default:
- img_text.append("none");
+ stock_name.append("none");
tt_text = tr("No expert information");
break;
}
- img_text.append(".png\"></img></a>");
- 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 <QStatusBar>
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);