[vlc-devel] [PATCH] Load icons on runtime
Christopher Kankare
christopher.kankare at gmail.com
Wed Nov 25 01:05:38 CET 2009
Hello,
I must agree that the last one wasn't sufficient enought. Now I changed
it a bit, and as you can see the old icons is still used if there is no
one in the config_GetUserDir( VLC_DATA_DIR ).
So now users can change the icons, which I believe will be appreciated.
---
modules/gui/qt4/main_interface.cpp | 13 ++++++++++++-
modules/gui/qt4/qt4.cpp | 14 ++++++++++++--
2 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/modules/gui/qt4/main_interface.cpp
b/modules/gui/qt4/main_interface.cpp
index a967e06..b399b01 100644
--- a/modules/gui/qt4/main_interface.cpp
+++ b/modules/gui/qt4/main_interface.cpp
@@ -57,6 +57,7 @@
#include <QLabel>
#include <QGroupBox>
#include <QPushButton>
+#include <QFile>
#ifdef WIN32
#include <vlc_windows_interfaces.h>
@@ -1113,7 +1114,17 @@ void MainInterface::createSystray()
if( QDate::currentDate().dayOfYear() >= 354 )
iconVLC = QIcon( ":/logo/vlc128-christmas.png" );
else
- iconVLC = QIcon( ":/logo/vlc128.png" );
+ {
+ char *psz_icon = NULL;
+ if (asprintf( &psz_icon, "%s" DIR_SEP "vlc128x128.png" ,
config_GetUserDir( VLC_DATA_DIR ) ) == -1)
+ psz_icon = NULL;
+ if (QFile::exists( psz_icon ) )
+ iconVLC = QIcon( psz_icon );
+ else
+ iconVLC = QIcon( ":/logo/vlc128.png" );
+ free( psz_icon );
+ }
+
sysTray = new QSystemTrayIcon( iconVLC, this );
sysTray->setToolTip( qtr( "VLC media player" ));
diff --git a/modules/gui/qt4/qt4.cpp b/modules/gui/qt4/qt4.cpp
index f42f87d..958bc23 100644
--- a/modules/gui/qt4/qt4.cpp
+++ b/modules/gui/qt4/qt4.cpp
@@ -33,6 +33,7 @@
#include <QMutex>
#include <QMutexLocker>
#include <QWaitCondition>
+#include <QFile>
#include "qt4.hpp"
@@ -384,9 +385,18 @@ static void *Thread( void *obj )
/* Icon setting */
if( QDate::currentDate().dayOfYear() >= 352 ) /* One Week before
Xmas */
- app.setWindowIcon( QIcon(vlc_christmas_xpm) );
+ app.setWindowIcon( QIcon( vlc_christmas_xpm ) );
else
- app.setWindowIcon( QIcon(vlc_xpm) );
+ {
+ char *psz_icon = NULL;
+ if (asprintf( &psz_icon, "%s" DIR_SEP "vlc32x32.png" ,
config_GetUserDir( VLC_DATA_DIR ) ) == -1)
+ psz_icon = NULL;
+ if (QFile::exists( psz_icon ) )
+ app.setWindowIcon( QIcon( psz_icon ) );
+ else
+ app.setWindowIcon( QIcon( vlc_xpm ) );
+ free( psz_icon );
+ }
/* Initialize timers and the Dialog Provider */
DialogsProvider::getInstance( p_intf );
--
1.6.3.3
Christopher Kankare
More information about the vlc-devel
mailing list