From c346526a5414105dea8e7dabac2494e33622d06b Mon Sep 17 00:00:00 2001 From: Manuel Nickschas Date: Thu, 25 Dec 2008 01:20:47 +0100 Subject: [PATCH] Support KIcon and KIconLoader Now Quassel uses your KDE4 icon theme! Enabling KDE support implicitly disables integrating our own Oxygen copy into the binary as well. --- CMakeLists.txt | 3 ++- src/uisupport/icon.cpp | 4 ++++ src/uisupport/icon.h | 14 ++++++++++++++ src/uisupport/iconloader.cpp | 4 ++++ src/uisupport/iconloader.h | 9 +++++++++ 5 files changed, 33 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d643ac8b..c473282e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -62,7 +62,7 @@ set(CMAKE_BUILD_WITH_INSTALL_RPATH 1) # Define install locations. Using variables will allow overriding this by the KDE macros later. set(BIN_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/bin) -set(DATA_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/apps) +set(DATA_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/apps/quassel) set(ICON_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/icons) set(XDG_APPS_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/share/applications) @@ -179,6 +179,7 @@ if(WITH_KDE) set(HAVE_KDE 1) set(MOC_DEFINES ${MOC_DEFINES} -DHAVE_KDE) set(QUASSEL_KDE_LIBRARIES ${KDE4_KDECORE_LIBS} ${KDE4_KDEUI_LIBRARY}) + set(OXYGEN_ICONS "External") else(KDE4_FOUND) message(STATUS "KDE4 not found, disabling KDE integration") endif(KDE4_FOUND) diff --git a/src/uisupport/icon.cpp b/src/uisupport/icon.cpp index 3694a3a2..791380dd 100644 --- a/src/uisupport/icon.cpp +++ b/src/uisupport/icon.cpp @@ -18,6 +18,8 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ +#ifndef HAVE_KDE + #include "icon.h" #include "iconloader.h" @@ -39,3 +41,5 @@ Icon& Icon::operator=(const Icon &other) { } return *this; } + +#endif diff --git a/src/uisupport/icon.h b/src/uisupport/icon.h index 2586f824..beed48db 100644 --- a/src/uisupport/icon.h +++ b/src/uisupport/icon.h @@ -21,6 +21,8 @@ #ifndef ICON_H_ #define ICON_H_ +#ifndef HAVE_KDE + #include /// A very thin wrapper around QIcon @@ -38,4 +40,16 @@ class Icon : public QIcon { Icon& operator=(const Icon &other); }; +#else /* HAVE_KDE */ +#include +class Icon : public KIcon { + + public: + inline Icon() : KIcon() {}; + inline explicit Icon(const QString &iconName) : KIcon(iconName) {}; + inline explicit Icon(const QIcon& copy) : KIcon(copy) {}; +}; + +#endif /* HAVE_KDE */ + #endif diff --git a/src/uisupport/iconloader.cpp b/src/uisupport/iconloader.cpp index b37c4623..d356b70a 100644 --- a/src/uisupport/iconloader.cpp +++ b/src/uisupport/iconloader.cpp @@ -18,6 +18,8 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ +#ifndef HAVE_KDE + #include #include #include @@ -157,3 +159,5 @@ QPixmap SmallIcon(const QString& name, int force_size) { IconLoader *loader = IconLoader::global(); return loader->loadIcon(name, IconLoader::Small, force_size); } + +#endif diff --git a/src/uisupport/iconloader.h b/src/uisupport/iconloader.h index c40dc576..81059d82 100644 --- a/src/uisupport/iconloader.h +++ b/src/uisupport/iconloader.h @@ -24,6 +24,8 @@ #ifndef ICONLOADER_H_ #define ICONLOADER_H_ +#ifndef HAVE_KDE + #include /// Provides basic facilities to load icons from standard locations or resources @@ -102,4 +104,11 @@ QPixmap SmallIcon(const QString& name, int size = 0); QString IconLoader::theme() const { return _theme; } +#else /* HAVE_KDE */ + +#include +class IconLoader : public KIconLoader { Q_OBJECT }; + +#endif /* HAVE_KDE */ + #endif -- 2.20.1