Parcourir la source

wpa_gui: Add a PNG version of the tray icon for Windows binary build

It looks like Qt does not support SVG format by default on Windows and
it was not trivial to add the plugin into the build, so for now, build a
16x16 PNG icon file for Windows binary to avoid showing an invisible
icon in the tray.
Jouni Malinen il y a 16 ans
Parent
commit
8038591be2

+ 5 - 0
wpa_supplicant/wpa_gui-qt4/icons_png.qrc

@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/icons" >
+  <file alias="wpa_gui.png">icons/hicolor/16x16/apps/wpa_gui.png</file>
+ </qresource>
+</RCC>

+ 2 - 0
wpa_supplicant/wpa_gui-qt4/setup-mingw-cross-compiling

@@ -9,3 +9,5 @@ cat Makefile.Release |
     sed s%/usr/lib/qt4%/q/jm/qt4-win/4.3.3/lib%g |
     sed s%/usr/include/qt4%/q/jm/qt4-win/4.3.3/include%g > tmp.Makefile.Release &&
 mv -f tmp.Makefile.Release Makefile.Release
+
+make -C icons

+ 1 - 0
wpa_supplicant/wpa_gui-qt4/wpa_gui.pro

@@ -14,6 +14,7 @@ win32 {
   LIBS += -lws2_32 -static
   DEFINES += CONFIG_NATIVE_WINDOWS CONFIG_CTRL_IFACE_NAMED_PIPE
   SOURCES += ../../src/utils/os_win32.c
+  RESOURCES += icons_png.qrc
 } else {
   DEFINES += CONFIG_CTRL_IFACE_UNIX
   SOURCES += ../../src/utils/os_unix.c

+ 5 - 1
wpa_supplicant/wpa_gui-qt4/wpagui.cpp

@@ -20,6 +20,7 @@
 #include <cstdio>
 #include <QMessageBox>
 #include <QCloseEvent>
+#include <QImageReader>
 
 #include "wpagui.h"
 #include "dirent.h"
@@ -1095,7 +1096,10 @@ void WpaGui::createTrayIcon(bool trayOnly)
 
 	tray_icon = new QSystemTrayIcon(this);
 	tray_icon->setToolTip(qAppName() + " - wpa_supplicant user interface");
-	tray_icon->setIcon(QIcon(":/icons/wpa_gui.svg"));
+	if (QImageReader::supportedImageFormats().contains(QByteArray("svg")))
+		tray_icon->setIcon(QIcon(":/icons/wpa_gui.svg"));
+	else
+		tray_icon->setIcon(QIcon(":/icons/wpa_gui.png"));
 
 	connect(tray_icon,
 		SIGNAL(activated(QSystemTrayIcon::ActivationReason)),