Support KIcon and KIconLoader
authorManuel Nickschas <sputnick@quassel-irc.org>
Thu, 25 Dec 2008 00:20:47 +0000 (01:20 +0100)
committerManuel Nickschas <sputnick@quassel-irc.org>
Fri, 26 Dec 2008 00:08:42 +0000 (01:08 +0100)
Now Quassel uses your KDE4 icon theme! Enabling KDE support implicitly
disables integrating our own Oxygen copy into the binary as well.

CMakeLists.txt
src/uisupport/icon.cpp
src/uisupport/icon.h
src/uisupport/iconloader.cpp
src/uisupport/iconloader.h

index d643ac8..c473282 100644 (file)
@@ -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)
 
 # 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)
 
 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(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)
   else(KDE4_FOUND)
     message(STATUS "KDE4 not found, disabling KDE integration")
   endif(KDE4_FOUND)
index 3694a3a..791380d 100644 (file)
@@ -18,6 +18,8 @@
  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
  ***************************************************************************/
 
  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
  ***************************************************************************/
 
+#ifndef HAVE_KDE
+
 #include "icon.h"
 #include "iconloader.h"
 
 #include "icon.h"
 #include "iconloader.h"
 
@@ -39,3 +41,5 @@ Icon& Icon::operator=(const Icon &other) {
   }
   return *this;
 }
   }
   return *this;
 }
+
+#endif
index 2586f82..beed48d 100644 (file)
@@ -21,6 +21,8 @@
 #ifndef ICON_H_
 #define ICON_H_
 
 #ifndef ICON_H_
 #define ICON_H_
 
+#ifndef HAVE_KDE
+
 #include <QIcon>
 
 /// A very thin wrapper around QIcon
 #include <QIcon>
 
 /// A very thin wrapper around QIcon
@@ -38,4 +40,16 @@ class Icon : public QIcon {
     Icon& operator=(const Icon &other);
 };
 
     Icon& operator=(const Icon &other);
 };
 
+#else /* HAVE_KDE */
+#include <KIcon>
+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
 #endif
index b37c462..d356b70 100644 (file)
@@ -18,6 +18,8 @@
  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
  ***************************************************************************/
 
  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
  ***************************************************************************/
 
+#ifndef HAVE_KDE
+
 #include <QCoreApplication>
 #include <QDebug>
 #include <QDir>
 #include <QCoreApplication>
 #include <QDebug>
 #include <QDir>
@@ -157,3 +159,5 @@ QPixmap SmallIcon(const QString& name, int force_size) {
   IconLoader *loader = IconLoader::global();
   return loader->loadIcon(name, IconLoader::Small, force_size);
 }
   IconLoader *loader = IconLoader::global();
   return loader->loadIcon(name, IconLoader::Small, force_size);
 }
+
+#endif
index c40dc57..81059d8 100644 (file)
@@ -24,6 +24,8 @@
 #ifndef ICONLOADER_H_
 #define ICONLOADER_H_
 
 #ifndef ICONLOADER_H_
 #define ICONLOADER_H_
 
+#ifndef HAVE_KDE
+
 #include <QPixmap>
 
 /// Provides basic facilities to load icons from standard locations or resources
 #include <QPixmap>
 
 /// 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; }
 
 
 QString IconLoader::theme() const { return _theme; }
 
+#else /* HAVE_KDE */
+
+#include <KIconLoader>
+class IconLoader : public KIconLoader { Q_OBJECT };
+
+#endif /* HAVE_KDE */
+
 #endif
 #endif