Qt: Use wsiconcap while we're capturing.

Set the main window icon to the "wsiconcap" version while we're capturing
similar to the GTK+ version. Verified on Windows. Not sure if this will
do anything on other platforms.

Change-Id: I9b082601a2c47e5f52cc38ac8d9b4d9f5fb9a4d9
Reviewed-on: https://code.wireshark.org/review/4230
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
This commit is contained in:
Gerald Combs 2014-09-21 13:28:29 -07:00 committed by Gerald Combs
parent 19d55ca5a2
commit 2474af635d
8 changed files with 47 additions and 4 deletions

View File

@ -1065,6 +1065,7 @@ EXTRA_DIST = \
image/WiresharkDoc-128.png \
image/WiresharkDoc-256.png \
image/wiretap.rc.in \
image/wsicon.qrc \
image/wsicon.svg \
image/wsicon16.png \
image/wsicon24.png \

22
image/wsicon.qrc Normal file
View File

@ -0,0 +1,22 @@
<RCC>
<qresource prefix="/wsicon">
<file>wsiconcap16.png</file>
<file>wsiconcap24.png</file>
<file>wsiconcap32.png</file>
<file>wsiconcap48.png</file>
<file>wsiconcap64.png</file>
<file>wsiconcap128.png</file>
<file>wsiconcap256.png</file>
<file>wsiconcap512.png</file>
<file>wsiconcap1024.png</file>
<file>wsicon16.png</file>
<file>wsicon24.png</file>
<file>wsicon32.png</file>
<file>wsicon48.png</file>
<file>wsicon64.png</file>
<file>wsicon128.png</file>
<file>wsicon256.png</file>
<file>wsicon512.png</file>
<file>wsicon1024.png</file>
</qresource>
</RCC>

View File

@ -283,6 +283,7 @@ set(WIRESHARK_QT_QRC
../../image/layout.qrc
../../image/status.qrc
../../image/toolbar.qrc
../../image/wsicon.qrc
i18n.qrc
)

View File

@ -263,6 +263,7 @@ QRC_FILES = \
../../image/layout.qrc \
../../image/status.qrc \
../../image/toolbar.qrc \
../../image/wsicon.qrc \
i18n.qrc
#

View File

@ -499,6 +499,7 @@ RESOURCES += \
../../image/layout.qrc \
../../image/status.qrc \
../../image/toolbar.qrc \
../../image/wsicon.qrc \
i18n.qrc \

View File

@ -373,10 +373,7 @@ void MainWindow::captureCapturePrepared(capture_session *cap_session) {
qDebug() << "FIX captureCapturePrepared";
setTitlebarForCaptureInProgress();
// if(icon_list == NULL) {
// icon_list = icon_list_create(wsiconcap16_xpm, wsiconcap32_xpm, wsiconcap48_xpm, NULL);
// }
// gtk_window_set_icon_list(GTK_WINDOW(top_level), icon_list);
setWindowIcon(wsApp->captureIcon());
/* Disable menu items that make no sense if you're currently running
a capture. */
@ -417,6 +414,8 @@ void MainWindow::captureCaptureUpdateFinished(capture_session *cap_session) {
/* Enable menu items that make sense if you're not currently running
a capture. */
setForCaptureInProgress(false);
setWindowIcon(wsApp->normalIcon());
#endif // HAVE_LIBPCAP
}
void MainWindow::captureCaptureFixedStarted(capture_session *cap_session) {
@ -436,6 +435,8 @@ void MainWindow::captureCaptureFixedFinished(capture_session *cap_session) {
/* Enable menu items that make sense if you're not currently running
a capture. */
setForCaptureInProgress(false);
setWindowIcon(wsApp->normalIcon());
#endif // HAVE_LIBPCAP
}
void MainWindow::captureCaptureStopping(capture_session *cap_session) {
@ -454,6 +455,8 @@ void MainWindow::captureCaptureFailed(capture_session *cap_session) {
capture_stopping_ = false;
setForCaptureInProgress(false);
setWindowIcon(wsApp->normalIcon());
#endif // HAVE_LIBPCAP
}

View File

@ -580,6 +580,7 @@ WiresharkApplication::WiresharkApplication(int &argc, char **argv) :
Q_INIT_RESOURCE(layout);
Q_INIT_RESOURCE(status);
Q_INIT_RESOURCE(toolbar);
Q_INIT_RESOURCE(wsicon);
#ifdef Q_OS_WIN
/* RichEd20.DLL is needed for native file dialog filter entries. */
@ -594,6 +595,14 @@ WiresharkApplication::WiresharkApplication(int &argc, char **argv) :
setAttribute(Qt::AA_DontShowIconsInMenus, true);
QList<int> icon_sizes = QList<int>() << 16 << 24 << 32 << 48 << 64 << 128 << 256 << 512 << 1024;
foreach (int icon_size, icon_sizes) {
QString icon_path = QString(":/wsicon/wsicon%1.png").arg(icon_size);
normal_icon_.addFile(icon_path);
icon_path = QString(":/wsicon/wsiconcap%1.png").arg(icon_size);
capture_icon_.addFile(icon_path);
}
recent_timer_.setParent(this);
connect(&recent_timer_, SIGNAL(timeout()), this, SLOT(refreshRecentFiles()));
recent_timer_.start(2000);

View File

@ -38,6 +38,7 @@
#include <QApplication>
#include <QFileInfo>
#include <QFont>
#include <QIcon>
#include <QList>
#include <QSocketNotifier>
#include <QThread>
@ -89,6 +90,8 @@ public:
int monospaceTextSize(const char *str, bool bold = false);
void setConfigurationProfile(const gchar *profile_name);
bool isInitialized() { return initialized_; }
const QIcon &normalIcon() const { return normal_icon_; }
const QIcon &captureIcon() const { return capture_icon_; }
private:
bool initialized_;
@ -99,6 +102,8 @@ private:
QTimer tap_update_timer_;
QList<QString> pending_open_files_;
QSocketNotifier *if_notifier_;
QIcon normal_icon_;
QIcon capture_icon_;
protected:
bool event(QEvent *event);