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
${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)
-silent -compress
DEPENDS ${basename}.ts)
set(${outvar} ${output})
-endmacro(generate_qm outvar basename)
\ No newline at end of file
+endmacro(generate_qm outvar basename)
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")
<RCC>
- <qresource prefix="icons" >
+ <qresource prefix="/icons" >
<file>hicolor/16x16/apps/quassel_disconnected.png</file>
<file>hicolor/16x16/apps/quassel_newmessage.png</file>
<file>hicolor/16x16/apps/quassel.png</file>
<RCC>
- <qresource prefix="icons" >
+ <qresource prefix="/icons" >
+ <file>oxygen/16x16/devices/audio-card.png</file>
+ <file>oxygen/16x16/devices/audio-headset.png</file>
+ <file>oxygen/16x16/devices/audio-input-line.png</file>
+ <file>oxygen/16x16/devices/audio-input-microphone.png</file>
+ <file>oxygen/16x16/devices/battery.png</file>
+ <file>oxygen/16x16/devices/camera-photo.png</file>
+ <file>oxygen/16x16/devices/camera-web.png</file>
+ <file>oxygen/16x16/devices/computer-laptop.png</file>
+ <file>oxygen/16x16/devices/computer.png</file>
+ <file>oxygen/16x16/devices/cpu.png</file>
+ <file>oxygen/16x16/devices/drive-harddisk.png</file>
+ <file>oxygen/16x16/devices/drive-optical.png</file>
+ <file>oxygen/16x16/devices/drive-removable-media.png</file>
+ <file>oxygen/16x16/devices/drive-removable-media-usb-pendrive.png</file>
+ <file>oxygen/16x16/devices/drive-removable-media-usb.png</file>
+ <file>oxygen/16x16/devices/input-gaming.png</file>
+ <file>oxygen/16x16/devices/input-keyboard.png</file>
+ <file>oxygen/16x16/devices/input-mouse.png</file>
+ <file>oxygen/16x16/devices/input-tablet.png</file>
+ <file>oxygen/16x16/devices/media-flash-memory-stick.png</file>
+ <file>oxygen/16x16/devices/media-flash.png</file>
+ <file>oxygen/16x16/devices/media-flash-sd-mmc.png</file>
+ <file>oxygen/16x16/devices/media-flash-smart-media.png</file>
+ <file>oxygen/16x16/devices/media-floppy.png</file>
+ <file>oxygen/16x16/devices/media-optical-audio.png</file>
+ <file>oxygen/16x16/devices/media-optical.png</file>
+ <file>oxygen/16x16/devices/media-optical-recordable.png</file>
+ <file>oxygen/16x16/devices/media-tape.png</file>
+ <file>oxygen/16x16/devices/modem.png</file>
+ <file>oxygen/16x16/devices/multimedia-player-apple-ipod.png</file>
+ <file>oxygen/16x16/devices/multimedia-player.png</file>
+ <file>oxygen/16x16/devices/network-wired.png</file>
+ <file>oxygen/16x16/devices/network-wireless.png</file>
+ <file>oxygen/16x16/devices/pda.png</file>
+ <file>oxygen/16x16/devices/phone-openmoko-freerunner.png</file>
+ <file>oxygen/16x16/devices/phone.png</file>
+ <file>oxygen/16x16/devices/printer.png</file>
+ <file>oxygen/16x16/devices/scanner.png</file>
+ <file>oxygen/16x16/devices/video-display.png</file>
+ <file>oxygen/16x16/devices/video-projector.png</file>
+ <file>oxygen/16x16/devices/video-television.png</file>
<file>oxygen/16x16/emotes/face-angel.png</file>
<file>oxygen/16x16/emotes/face-embarrassed.png</file>
<file>oxygen/16x16/emotes/face-kiss.png</file>
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})
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);
#include "clientbacklogmanager.h"
#include "coreinfodlg.h"
#include "coreconnectdlg.h"
-#include "icon.h"
+#include "iconloader.h"
#include "msgprocessorstatuswidget.h"
#include "qtuimessageprocessor.h"
#include "qtuiapplication.h"
_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)),
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() {
void MainWin::securedConnection() {
// todo: make status bar entry
- sslLabel->setPixmap(QPixmap::fromImage(QImage(":/16x16/status/ssl")));
+ sslLabel->setPixmap(SmallIcon("security-high"));
}
void MainWin::disconnectedFromCore() {
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"));
}
}
#include "ui_mainwin.h"
+#include "icon.h"
#include "qtui.h"
#include "titlesetter.h"
#include "sessionsettings.h"
void enableMenus();
QSystemTrayIcon *systray;
- QIcon activeTrayIcon;
- QIcon onlineTrayIcon;
- QIcon offlineTrayIcon;
+ Icon activeTrayIcon;
+ Icon onlineTrayIcon;
+ Icon offlineTrayIcon;
bool trayIconActive;
QTimer *timer;
#include "qtui.h"
#include "sessionsettings.h"
-#include "iconloader.h"
-
QtUiApplication::QtUiApplication(int &argc, char **argv) : QApplication(argc, argv), Quassel() {
setRunMode(Quassel::ClientOnly);
gui->init();
resumeSessionIfPossible();
- // DEBUG
- QPixmap pix = IconLoader::global()->loadIcon("network-connect", IconLoader::Small);
- qDebug() << pix;
return true;
}
return false;
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() {
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?)
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);
+}
// 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