From: Manuel Nickschas Date: Thu, 25 Sep 2008 23:27:44 +0000 (+0200) Subject: More build system tweaking, plus making icons work X-Git-Tag: 0.3.1~253 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=e8e1f038e6bf4a7bc938e316774374d3116ff39a More build system tweaking, plus making icons work --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 8b7e3dbe..041e2d78 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -86,23 +86,6 @@ if(EXECINFO_FOUND) link_libraries(${EXECINFO_LIBRARIES}) endif(EXECINFO_FOUND) -# Decide what to do with icons -if(WANT_QTCLIENT OR WANT_MONO) - if(QUASSEL_ICONS MATCHES "External") - message(STATUS "Install Quassel icons to ${CMAKE_INSTALL_PREFIX}/share/apps/quassel") - else(QUASSEL_ICONS MATCHES "External") - set(QUASSEL_ICONS "Builtin") - message(STATUS "Compile Quassel icons into the binary") - endif(QUASSEL_ICONS MATCHES "External") - - if(OXYGEN_ICONS MATCHES "External") - message(STATUS "Use system-installed Oxygen icon theme") - else(OXYGEN_ICONS MATCHES "External") - set(OXYGEN_ICONS "Builtin") - message(STATUS "Compile Oxygen icon theme subset into the binary") - endif(OXYGEN_ICONS MATCHES "External") -endif(WANT_QTCLIENT OR WANT_MONO) - # Select a Qt installation here, if you don't want to use system Qt if(QT) # FindQt4 will look for the qmake binary in $PATH, so we just prepend the Qt dir @@ -188,6 +171,22 @@ add_custom_target(genversion_run ALL ${GENVERSION_EXECUTABLE} ${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR}/src/common/version.gen) add_dependencies(genversion_run genversion) +# Decide what to do with icons +if(WANT_QTCLIENT OR WANT_MONO) + if(QUASSEL_ICONS MATCHES "External") + message(STATUS "Install Quassel icons to ${CMAKE_INSTALL_PREFIX}/share/apps/quassel") + else(QUASSEL_ICONS MATCHES "External") + set(QUASSEL_ICONS "Builtin") + message(STATUS "Compile Quassel icons into the binary") + endif(QUASSEL_ICONS MATCHES "External") + + if(OXYGEN_ICONS MATCHES "External") + message(STATUS "Use system-installed Oxygen icon theme") + else(OXYGEN_ICONS MATCHES "External") + set(OXYGEN_ICONS "Builtin") + message(STATUS "Compile Oxygen icon theme subset into the binary") + endif(OXYGEN_ICONS MATCHES "External") +endif(WANT_QTCLIENT OR WANT_MONO) # These variables will be added to the main targets (CORE, QTCLIENT, MONO) diff --git a/cmake/modules/QuasselMacros.cmake b/cmake/modules/QuasselMacros.cmake index d16dcd42..6b2f82d3 100644 --- a/cmake/modules/QuasselMacros.cmake +++ b/cmake/modules/QuasselMacros.cmake @@ -25,4 +25,4 @@ macro(generate_qm outvar basename) -silent -compress DEPENDS ${basename}.ts) set(${outvar} ${output}) -endmacro(generate_qm outvar basename) \ No newline at end of file +endmacro(generate_qm outvar basename) diff --git a/icons/CMakeLists.txt b/icons/CMakeLists.txt index c28de2ea..129bc884 100644 --- a/icons/CMakeLists.txt +++ b/icons/CMakeLists.txt @@ -3,9 +3,9 @@ if(QUASSEL_ICONS MATCHES "External") install(DIRECTORY hicolor DESTINATION ${ICON_INSTALL_DIR}) else(QUASSEL_ICONS MATCHES "External") - set(CLIENT_DEPS ${CLIENT_DEPS} hicolor.qrc) +# set(CLIENT_DEPS ${CLIENT_DEPS} hicolor.qrc) endif(QUASSEL_ICONS MATCHES "External") if(OXYGEN_ICONS MATCHES "Builtin") - set(CLIENT_DEPS ${CLIENT_DEPS} oxygen.qrc) +# set(CLIENT_DEPS ${CLIENT_DEPS} oxygen.qrc) endif(OXYGEN_ICONS MATCHES "Builtin") diff --git a/icons/hicolor.qrc b/icons/hicolor.qrc index d813d147..88e5c511 100644 --- a/icons/hicolor.qrc +++ b/icons/hicolor.qrc @@ -1,5 +1,5 @@ - + hicolor/16x16/apps/quassel_disconnected.png hicolor/16x16/apps/quassel_newmessage.png hicolor/16x16/apps/quassel.png diff --git a/icons/oxygen.qrc b/icons/oxygen.qrc index 9d080fd3..3fbfea5c 100644 --- a/icons/oxygen.qrc +++ b/icons/oxygen.qrc @@ -1,5 +1,46 @@ - + + oxygen/16x16/devices/audio-card.png + oxygen/16x16/devices/audio-headset.png + oxygen/16x16/devices/audio-input-line.png + oxygen/16x16/devices/audio-input-microphone.png + oxygen/16x16/devices/battery.png + oxygen/16x16/devices/camera-photo.png + oxygen/16x16/devices/camera-web.png + oxygen/16x16/devices/computer-laptop.png + oxygen/16x16/devices/computer.png + oxygen/16x16/devices/cpu.png + oxygen/16x16/devices/drive-harddisk.png + oxygen/16x16/devices/drive-optical.png + oxygen/16x16/devices/drive-removable-media.png + oxygen/16x16/devices/drive-removable-media-usb-pendrive.png + oxygen/16x16/devices/drive-removable-media-usb.png + oxygen/16x16/devices/input-gaming.png + oxygen/16x16/devices/input-keyboard.png + oxygen/16x16/devices/input-mouse.png + oxygen/16x16/devices/input-tablet.png + oxygen/16x16/devices/media-flash-memory-stick.png + oxygen/16x16/devices/media-flash.png + oxygen/16x16/devices/media-flash-sd-mmc.png + oxygen/16x16/devices/media-flash-smart-media.png + oxygen/16x16/devices/media-floppy.png + oxygen/16x16/devices/media-optical-audio.png + oxygen/16x16/devices/media-optical.png + oxygen/16x16/devices/media-optical-recordable.png + oxygen/16x16/devices/media-tape.png + oxygen/16x16/devices/modem.png + oxygen/16x16/devices/multimedia-player-apple-ipod.png + oxygen/16x16/devices/multimedia-player.png + oxygen/16x16/devices/network-wired.png + oxygen/16x16/devices/network-wireless.png + oxygen/16x16/devices/pda.png + oxygen/16x16/devices/phone-openmoko-freerunner.png + oxygen/16x16/devices/phone.png + oxygen/16x16/devices/printer.png + oxygen/16x16/devices/scanner.png + oxygen/16x16/devices/video-display.png + oxygen/16x16/devices/video-projector.png + oxygen/16x16/devices/video-television.png oxygen/16x16/emotes/face-angel.png oxygen/16x16/emotes/face-embarrassed.png oxygen/16x16/emotes/face-kiss.png diff --git a/icons/oxygen/16x16/devices/audio-card.png b/icons/oxygen/16x16/devices/audio-card.png new file mode 100644 index 00000000..b2a9d8a4 Binary files /dev/null and b/icons/oxygen/16x16/devices/audio-card.png differ diff --git a/icons/oxygen/16x16/devices/audio-headset.png b/icons/oxygen/16x16/devices/audio-headset.png new file mode 100644 index 00000000..fc8e068b Binary files /dev/null and b/icons/oxygen/16x16/devices/audio-headset.png differ diff --git a/icons/oxygen/16x16/devices/audio-input-line.png b/icons/oxygen/16x16/devices/audio-input-line.png new file mode 100644 index 00000000..8e8e1942 Binary files /dev/null and b/icons/oxygen/16x16/devices/audio-input-line.png differ diff --git a/icons/oxygen/16x16/devices/audio-input-microphone.png b/icons/oxygen/16x16/devices/audio-input-microphone.png new file mode 100644 index 00000000..f44eb0a9 Binary files /dev/null and b/icons/oxygen/16x16/devices/audio-input-microphone.png differ diff --git a/icons/oxygen/16x16/devices/battery.png b/icons/oxygen/16x16/devices/battery.png new file mode 100644 index 00000000..8b6e964b Binary files /dev/null and b/icons/oxygen/16x16/devices/battery.png differ diff --git a/icons/oxygen/16x16/devices/camera-photo.png b/icons/oxygen/16x16/devices/camera-photo.png new file mode 100644 index 00000000..c8f6334e Binary files /dev/null and b/icons/oxygen/16x16/devices/camera-photo.png differ diff --git a/icons/oxygen/16x16/devices/camera-web.png b/icons/oxygen/16x16/devices/camera-web.png new file mode 100644 index 00000000..db115cd0 Binary files /dev/null and b/icons/oxygen/16x16/devices/camera-web.png differ diff --git a/icons/oxygen/16x16/devices/computer-laptop.png b/icons/oxygen/16x16/devices/computer-laptop.png new file mode 100644 index 00000000..bf8a9893 Binary files /dev/null and b/icons/oxygen/16x16/devices/computer-laptop.png differ diff --git a/icons/oxygen/16x16/devices/computer.png b/icons/oxygen/16x16/devices/computer.png new file mode 100644 index 00000000..aa628915 Binary files /dev/null and b/icons/oxygen/16x16/devices/computer.png differ diff --git a/icons/oxygen/16x16/devices/cpu.png b/icons/oxygen/16x16/devices/cpu.png new file mode 100644 index 00000000..30050ebe Binary files /dev/null and b/icons/oxygen/16x16/devices/cpu.png differ diff --git a/icons/oxygen/16x16/devices/drive-harddisk.png b/icons/oxygen/16x16/devices/drive-harddisk.png new file mode 100644 index 00000000..bae21a83 Binary files /dev/null and b/icons/oxygen/16x16/devices/drive-harddisk.png differ diff --git a/icons/oxygen/16x16/devices/drive-optical.png b/icons/oxygen/16x16/devices/drive-optical.png new file mode 100644 index 00000000..e3d929b6 Binary files /dev/null and b/icons/oxygen/16x16/devices/drive-optical.png differ diff --git a/icons/oxygen/16x16/devices/drive-removable-media-usb-pendrive.png b/icons/oxygen/16x16/devices/drive-removable-media-usb-pendrive.png new file mode 100644 index 00000000..807edf5f Binary files /dev/null and b/icons/oxygen/16x16/devices/drive-removable-media-usb-pendrive.png differ diff --git a/icons/oxygen/16x16/devices/drive-removable-media-usb.png b/icons/oxygen/16x16/devices/drive-removable-media-usb.png new file mode 100644 index 00000000..c0e31d27 Binary files /dev/null and b/icons/oxygen/16x16/devices/drive-removable-media-usb.png differ diff --git a/icons/oxygen/16x16/devices/drive-removable-media.png b/icons/oxygen/16x16/devices/drive-removable-media.png new file mode 100644 index 00000000..8c22993c Binary files /dev/null and b/icons/oxygen/16x16/devices/drive-removable-media.png differ diff --git a/icons/oxygen/16x16/devices/input-gaming.png b/icons/oxygen/16x16/devices/input-gaming.png new file mode 100644 index 00000000..11979dd0 Binary files /dev/null and b/icons/oxygen/16x16/devices/input-gaming.png differ diff --git a/icons/oxygen/16x16/devices/input-keyboard.png b/icons/oxygen/16x16/devices/input-keyboard.png new file mode 100644 index 00000000..5aa1a224 Binary files /dev/null and b/icons/oxygen/16x16/devices/input-keyboard.png differ diff --git a/icons/oxygen/16x16/devices/input-mouse.png b/icons/oxygen/16x16/devices/input-mouse.png new file mode 100644 index 00000000..0696376f Binary files /dev/null and b/icons/oxygen/16x16/devices/input-mouse.png differ diff --git a/icons/oxygen/16x16/devices/input-tablet.png b/icons/oxygen/16x16/devices/input-tablet.png new file mode 100644 index 00000000..6468305c Binary files /dev/null and b/icons/oxygen/16x16/devices/input-tablet.png differ diff --git a/icons/oxygen/16x16/devices/media-flash-memory-stick.png b/icons/oxygen/16x16/devices/media-flash-memory-stick.png new file mode 100644 index 00000000..2448baec Binary files /dev/null and b/icons/oxygen/16x16/devices/media-flash-memory-stick.png differ diff --git a/icons/oxygen/16x16/devices/media-flash-sd-mmc.png b/icons/oxygen/16x16/devices/media-flash-sd-mmc.png new file mode 100644 index 00000000..e61f5bfa Binary files /dev/null and b/icons/oxygen/16x16/devices/media-flash-sd-mmc.png differ diff --git a/icons/oxygen/16x16/devices/media-flash-smart-media.png b/icons/oxygen/16x16/devices/media-flash-smart-media.png new file mode 100644 index 00000000..85cab3f7 Binary files /dev/null and b/icons/oxygen/16x16/devices/media-flash-smart-media.png differ diff --git a/icons/oxygen/16x16/devices/media-flash.png b/icons/oxygen/16x16/devices/media-flash.png new file mode 100644 index 00000000..04c45981 Binary files /dev/null and b/icons/oxygen/16x16/devices/media-flash.png differ diff --git a/icons/oxygen/16x16/devices/media-floppy.png b/icons/oxygen/16x16/devices/media-floppy.png new file mode 100644 index 00000000..fc40ea32 Binary files /dev/null and b/icons/oxygen/16x16/devices/media-floppy.png differ diff --git a/icons/oxygen/16x16/devices/media-optical-audio.png b/icons/oxygen/16x16/devices/media-optical-audio.png new file mode 100644 index 00000000..975508a7 Binary files /dev/null and b/icons/oxygen/16x16/devices/media-optical-audio.png differ diff --git a/icons/oxygen/16x16/devices/media-optical-recordable.png b/icons/oxygen/16x16/devices/media-optical-recordable.png new file mode 100644 index 00000000..de714f64 Binary files /dev/null and b/icons/oxygen/16x16/devices/media-optical-recordable.png differ diff --git a/icons/oxygen/16x16/devices/media-optical.png b/icons/oxygen/16x16/devices/media-optical.png new file mode 100644 index 00000000..42dda219 Binary files /dev/null and b/icons/oxygen/16x16/devices/media-optical.png differ diff --git a/icons/oxygen/16x16/devices/media-tape.png b/icons/oxygen/16x16/devices/media-tape.png new file mode 100644 index 00000000..5808be19 Binary files /dev/null and b/icons/oxygen/16x16/devices/media-tape.png differ diff --git a/icons/oxygen/16x16/devices/modem.png b/icons/oxygen/16x16/devices/modem.png new file mode 100644 index 00000000..fc7957ec Binary files /dev/null and b/icons/oxygen/16x16/devices/modem.png differ diff --git a/icons/oxygen/16x16/devices/multimedia-player-apple-ipod.png b/icons/oxygen/16x16/devices/multimedia-player-apple-ipod.png new file mode 100644 index 00000000..ee0b1548 Binary files /dev/null and b/icons/oxygen/16x16/devices/multimedia-player-apple-ipod.png differ diff --git a/icons/oxygen/16x16/devices/multimedia-player.png b/icons/oxygen/16x16/devices/multimedia-player.png new file mode 100644 index 00000000..d3444e15 Binary files /dev/null and b/icons/oxygen/16x16/devices/multimedia-player.png differ diff --git a/icons/oxygen/16x16/devices/network-wired.png b/icons/oxygen/16x16/devices/network-wired.png new file mode 100644 index 00000000..1f256a8d Binary files /dev/null and b/icons/oxygen/16x16/devices/network-wired.png differ diff --git a/icons/oxygen/16x16/devices/network-wireless.png b/icons/oxygen/16x16/devices/network-wireless.png new file mode 100644 index 00000000..d70f0f6d Binary files /dev/null and b/icons/oxygen/16x16/devices/network-wireless.png differ diff --git a/icons/oxygen/16x16/devices/pda.png b/icons/oxygen/16x16/devices/pda.png new file mode 100644 index 00000000..37129f24 Binary files /dev/null and b/icons/oxygen/16x16/devices/pda.png differ diff --git a/icons/oxygen/16x16/devices/phone-openmoko-freerunner.png b/icons/oxygen/16x16/devices/phone-openmoko-freerunner.png new file mode 100644 index 00000000..a75085e3 Binary files /dev/null and b/icons/oxygen/16x16/devices/phone-openmoko-freerunner.png differ diff --git a/icons/oxygen/16x16/devices/phone.png b/icons/oxygen/16x16/devices/phone.png new file mode 100644 index 00000000..6fb85725 Binary files /dev/null and b/icons/oxygen/16x16/devices/phone.png differ diff --git a/icons/oxygen/16x16/devices/printer.png b/icons/oxygen/16x16/devices/printer.png new file mode 100644 index 00000000..305072b5 Binary files /dev/null and b/icons/oxygen/16x16/devices/printer.png differ diff --git a/icons/oxygen/16x16/devices/scanner.png b/icons/oxygen/16x16/devices/scanner.png new file mode 100644 index 00000000..085cd41b Binary files /dev/null and b/icons/oxygen/16x16/devices/scanner.png differ diff --git a/icons/oxygen/16x16/devices/video-display.png b/icons/oxygen/16x16/devices/video-display.png new file mode 100644 index 00000000..10cd3226 Binary files /dev/null and b/icons/oxygen/16x16/devices/video-display.png differ diff --git a/icons/oxygen/16x16/devices/video-projector.png b/icons/oxygen/16x16/devices/video-projector.png new file mode 100644 index 00000000..cb2be225 Binary files /dev/null and b/icons/oxygen/16x16/devices/video-projector.png differ diff --git a/icons/oxygen/16x16/devices/video-television.png b/icons/oxygen/16x16/devices/video-television.png new file mode 100644 index 00000000..930c21c9 Binary files /dev/null and b/icons/oxygen/16x16/devices/video-television.png differ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 50819f5c..fc41ec1b 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -15,6 +15,16 @@ if(WANT_QTCLIENT OR WANT_MONO) include_directories(qtui) endif(WANT_QTCLIENT OR WANT_MONO) +if(QUASSEL_ICONS MATCHES "Builtin") + qt4_add_resources(RC_ICONS ../icons/hicolor.qrc) +endif(QUASSEL_ICONS MATCHES "Builtin") + +if(OXYGEN_ICONS MATCHES "Builtin") + qt4_add_resources(RC_ICONS ../icons/oxygen.qrc) +endif(OXYGEN_ICONS MATCHES "Builtin") + +set(CLIENT_DEPS ${CLIENT_DEPS} ${RC_ICONS}) + if(WANT_CORE) setup_qt4_variables(NETWORK SCRIPT SQL) add_executable(quasselcore common/main.cpp ${COMMON_DEPS} ${CORE_DEPS}) diff --git a/src/common/quassel.cpp b/src/common/quassel.cpp index 1ecc8969..2584a941 100644 --- a/src/common/quassel.cpp +++ b/src/common/quassel.cpp @@ -48,6 +48,8 @@ bool Quassel::_initialized = false; bool Quassel::DEBUG = false; Quassel::Quassel() { + Q_INIT_RESOURCE(i18n); + // We catch SIGTERM and SIGINT (caused by Ctrl+C) to graceful shutdown Quassel. signal(SIGTERM, handleSignal); signal(SIGINT, handleSignal); diff --git a/src/qtui/mainwin.cpp b/src/qtui/mainwin.cpp index d2363e6f..a8628580 100644 --- a/src/qtui/mainwin.cpp +++ b/src/qtui/mainwin.cpp @@ -36,7 +36,7 @@ #include "clientbacklogmanager.h" #include "coreinfodlg.h" #include "coreconnectdlg.h" -#include "icon.h" +#include "iconloader.h" #include "msgprocessorstatuswidget.h" #include "qtuimessageprocessor.h" #include "qtuiapplication.h" @@ -80,9 +80,9 @@ MainWin::MainWin(QWidget *parent) _titleSetter(this), systray(new QSystemTrayIcon(this)), - activeTrayIcon(":/icons/quassel-icon-active.png"), - onlineTrayIcon(":/icons/quassel-icon.png"), - offlineTrayIcon(":/icons/quassel-icon-offline.png"), + activeTrayIcon("quassel_newmessage"), + onlineTrayIcon("quassel"), + offlineTrayIcon("quassel_disconnected"), trayIconActive(false), timer(new QTimer(this)), @@ -422,7 +422,7 @@ void MainWin::setConnectedState() { qApp->setWindowIcon(onlineTrayIcon); systray->setIcon(onlineTrayIcon); if(sslLabel->width() == 0) - sslLabel->setPixmap(QPixmap::fromImage(QImage(":/16x16/status/no-ssl"))); + sslLabel->setPixmap(SmallIcon("security-low")); } void MainWin::loadLayout() { @@ -444,7 +444,7 @@ void MainWin::updateLagIndicator(int lag) { void MainWin::securedConnection() { // todo: make status bar entry - sslLabel->setPixmap(QPixmap::fromImage(QImage(":/16x16/status/ssl"))); + sslLabel->setPixmap(SmallIcon("security-high")); } void MainWin::disconnectedFromCore() { @@ -736,13 +736,13 @@ void MainWin::clientNetworkUpdated() { switch(net->connectionState()) { case Network::Initialized: - action->setIcon(QIcon(":/16x16/actions/network-connect")); + action->setIcon(SmallIcon("network-connect")); break; case Network::Disconnected: - action->setIcon(QIcon(":/16x16/actions/network-disconnect")); + action->setIcon(SmallIcon("network-disconnect")); break; default: - action->setIcon(QIcon(":/16x16/actions/gear")); + action->setIcon(SmallIcon("network-wired")); } } diff --git a/src/qtui/mainwin.h b/src/qtui/mainwin.h index ffa2ade1..a5626475 100644 --- a/src/qtui/mainwin.h +++ b/src/qtui/mainwin.h @@ -23,6 +23,7 @@ #include "ui_mainwin.h" +#include "icon.h" #include "qtui.h" #include "titlesetter.h" #include "sessionsettings.h" @@ -137,9 +138,9 @@ class MainWin : public QMainWindow { void enableMenus(); QSystemTrayIcon *systray; - QIcon activeTrayIcon; - QIcon onlineTrayIcon; - QIcon offlineTrayIcon; + Icon activeTrayIcon; + Icon onlineTrayIcon; + Icon offlineTrayIcon; bool trayIconActive; QTimer *timer; diff --git a/src/qtui/qtuiapplication.cpp b/src/qtui/qtuiapplication.cpp index 80cc4d40..6ae09c94 100644 --- a/src/qtui/qtuiapplication.cpp +++ b/src/qtui/qtuiapplication.cpp @@ -27,8 +27,6 @@ #include "qtui.h" #include "sessionsettings.h" -#include "iconloader.h" - QtUiApplication::QtUiApplication(int &argc, char **argv) : QApplication(argc, argv), Quassel() { setRunMode(Quassel::ClientOnly); @@ -48,9 +46,6 @@ bool QtUiApplication::init() { gui->init(); resumeSessionIfPossible(); - // DEBUG - QPixmap pix = IconLoader::global()->loadIcon("network-connect", IconLoader::Small); - qDebug() << pix; return true; } return false; diff --git a/src/uisupport/iconloader.cpp b/src/uisupport/iconloader.cpp index 0fff1e82..688d0b11 100644 --- a/src/uisupport/iconloader.cpp +++ b/src/uisupport/iconloader.cpp @@ -28,12 +28,16 @@ IconLoader IconLoader::_iconLoader; int IconLoader::_groupSize[] = { 48, 22, 22, 16, 32, 22 }; // default sizes taken from Oxygen IconLoader *IconLoader::global() { + // Workaround: the static _iconLoader might be initialized before the resources it needs + // This way, first call to global() will init it by setting the theme + if(_iconLoader.theme().isEmpty()) + _iconLoader.setTheme("oxygen"); return &_iconLoader; } IconLoader::IconLoader(QObject *parent) : QObject(parent) { - setTheme("oxygen"); + // setTheme("oxygen"); } IconLoader::~IconLoader() { @@ -59,17 +63,25 @@ void IconLoader::setTheme(const QString &theme) { if(QFile::exists(path)) _themedIconDirNames.append(path); - // Own icons in $data/apps/quassel/icons/hicolor and :/icons/hicolor - // Also, plain icon dirs $data/apps/quassel/pics and :/pics - dataDirNames.append(":"); + // Own icons in $data/apps/quassel/icons/hicolor + // Also, plain icon dirs $data/apps/quassel/pics foreach(QString dir, dataDirNames) { - path = QString("%1/apps/quassel/icons/hicolor"); + path = QString("%1/apps/quassel/icons/hicolor").arg(dir); if(QFile::exists(path)) _themedIconDirNames.append(path); - path = QString("%1/apps/quassel/pics"); + path = QString("%1/apps/quassel/pics").arg(dir); if(QFile::exists(path)) _plainIconDirNames.append(path); } + + // Same for :/icons/hicolor and :/pics + path = QString(":/icons/hicolor"); + if(QFile::exists(path)) + _themedIconDirNames.append(path); + + path = QString(":/pics"); + if(QFile::exists(path)) + _plainIconDirNames.append(path); } // TODO: optionally implement cache (speed/memory tradeoff?) @@ -110,3 +122,25 @@ QString IconLoader::findIconPath(const QString &name, int size) { return QString(); } + +// Convenience constructors + +QPixmap DesktopIcon(const QString& name, int force_size) { + IconLoader *loader = IconLoader::global(); + return loader->loadIcon(name, IconLoader::Desktop, force_size); +} + +QPixmap BarIcon(const QString& name, int force_size) { + IconLoader *loader = IconLoader::global(); + return loader->loadIcon(name, IconLoader::Toolbar, force_size); +} + +QPixmap MainBarIcon(const QString& name, int force_size) { + IconLoader *loader = IconLoader::global(); + return loader->loadIcon(name, IconLoader::MainToolbar, force_size); +} + +QPixmap SmallIcon(const QString& name, int force_size) { + IconLoader *loader = IconLoader::global(); + return loader->loadIcon(name, IconLoader::Small, force_size); +} diff --git a/src/uisupport/iconloader.h b/src/uisupport/iconloader.h index 165aa9b7..c40dc576 100644 --- a/src/uisupport/iconloader.h +++ b/src/uisupport/iconloader.h @@ -96,7 +96,7 @@ private: // convenience QPixmap DesktopIcon(const QString& name, int size = 0); QPixmap BarIcon(const QString& name, int size = 0); -QPixmap MainbarIcon(const QString& name, int size = 0); +QPixmap MainBarIcon(const QString& name, int size = 0); QPixmap SmallIcon(const QString& name, int size = 0); //QPixmap SmallMediumIcon(const QString &name, int size = 0); // not part of KIconLoader