From: Patrick von Reth Date: Tue, 25 Feb 2014 23:26:06 +0000 (+0100) Subject: Use Snore only if building without KDE X-Git-Tag: 0.10-rc1~13 X-Git-Url: https://git.quassel-irc.org/?p=quassel.git;a=commitdiff_plain;h=90ca2d5de312eaab9fa410d87dae019e63599378 Use Snore only if building without KDE Also use the system tray backend as default. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 3e4ee9c2..42bacd81 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -397,6 +397,13 @@ if(BUILD_GUI) else(WITH_PHONON) message(STATUS "Not enabling Phonon support") endif(WITH_PHONON) + + find_package(Libsnore) + if(LIBSNORE_FOUND) + add_definitions(-DHAVE_LIBSNORE) + set(CLIENT_LIBRARIES ${CLIENT_LIBRARIES} ${LIBSNORE_LIBRARIES}) + set(HAVE_SNORENOTIFY true) + endif(LIBSNORE_FOUND) endif(NOT HAVE_KDE) # Setup libindicate-qt support @@ -425,13 +432,6 @@ if(BUILD_GUI) /System/Library/Frameworks/Foundation.framework ) endif() - -find_package(Libsnore) -if(LIBSNORE_FOUND) - add_definitions(-DHAVE_LIBSNORE -DLIBSNORE_PLUGIN_PATH="${LIBSNORE_PLUGIN_PATH}") - set(CLIENT_LIBRARIES ${CLIENT_LIBRARIES} ${LIBSNORE_LIBRARIES}) - set(HAVE_SNORENOTIFY true) -endif(LIBSNORE_FOUND) endif(BUILD_GUI) # Core-only deps diff --git a/cmake/modules/FindLibsnore.cmake b/cmake/modules/FindLibsnore.cmake index 4dc0b9e0..1af3944a 100644 --- a/cmake/modules/FindLibsnore.cmake +++ b/cmake/modules/FindLibsnore.cmake @@ -4,8 +4,7 @@ # LIBSNORE_FOUND - system has the LIBSNORE library # LIBSNORE_LIBRARIES - The libraries needed to use LIBSNORE # LIBSNORE_INCLUDE_DIRS - The includes needed to use LIBSNORE -# LIBSNORE_PLUGIN_PATH - Path of the plugins -# Copyright 2013 Patrick von Reth +# Copyright 2013-2014 Patrick von Reth find_path(LIBSNORE_INCLUDE_DIR NAMES snore/core/snore.h @@ -19,12 +18,6 @@ find_library(LIBSNORE_LIBRARY PATHS ${KDE4_LIB_DIR} ) -find_path(LIBSNORE_PLUGIN_PATH snoreplugins) - -if(LIBSNORE_LIBRARY AND LIBSNORE_PLUGIN_PATH) - set(LIBSNORE_PLUGIN_PATH ${LIBSNORE_PLUGIN_PATH}/snoreplugins) -endif() - set(LIBSNORE_LIBRARIES ${LIBSNORE_LIBRARY}) set(LIBSNORE_INCLUDE_DIRS ${LIBSNORE_INCLUDE_DIR}) diff --git a/src/qtui/snorenotificationbackend.cpp b/src/qtui/snorenotificationbackend.cpp index f07aedd4..3612bb02 100644 --- a/src/qtui/snorenotificationbackend.cpp +++ b/src/qtui/snorenotificationbackend.cpp @@ -37,7 +37,7 @@ SnoreNotificationBackend::SnoreNotificationBackend (QObject *parent) - :AbstractNotificationBackend(parent), + : AbstractNotificationBackend(parent), m_systrayBackend(NULL) { NotificationSettings notificationSettings; @@ -50,12 +50,12 @@ SnoreNotificationBackend::SnoreNotificationBackend (QObject *parent) //TODO: try to get an instance of the tray icon to be able to show popups m_snore = new Snore::SnoreCore(); m_snore->loadPlugins(Snore::SnorePlugin::BACKEND); - m_application = Snore::Application("Quassel", Snore::Icon(DesktopIcon("quassel").toImage())); + m_icon = Snore::Icon(DesktopIcon("quassel").toImage()); + m_application = Snore::Application("Quassel", m_icon); m_application.hints().setValue("WINDOWS_APP_ID","QuasselProject.QuasselIRC"); connect(m_snore, SIGNAL(actionInvoked(Snore::Notification)), this, SLOT(actionInvoked(Snore::Notification))); - m_icon = Snore::Icon(DesktopIcon("dialog-information").toImage()); m_alert = Snore::Alert(tr("Private Message"), m_icon); m_application.addAlert(m_alert); @@ -76,12 +76,7 @@ SnoreNotificationBackend::~SnoreNotificationBackend() void SnoreNotificationBackend::backendChanged(const QVariant &v) { QString backend = v.toString(); - if (backend == "Default") { - if (m_snore->setPrimaryNotificationBackend()) {//try to find the default backend for the platform - return; - } - } - else if (backend != "SystemTray") { + if (backend != "Default") { if (setSnoreBackend(backend)) { return; } @@ -154,8 +149,10 @@ SnoreNotificationBackend::ConfigWidget::ConfigWidget(Snore::SnoreCore *snore, QW m_snore(snore) { ui.setupUi(this); - ui.backends->insertItem(0, "Default"); - ui.backends->insertItems(1, m_snore->notificationBackends()); + QStringList backends = m_snore->notificationBackends(); + backends.append("Default"); + qSort(backends); + ui.backends->insertItems(0, backends); connect(ui.backends, SIGNAL(currentIndexChanged(QString)), SLOT(backendChanged(QString))); connect(ui.timeout, SIGNAL(valueChanged(int)), this, SLOT(timeoutChanged(int))); @@ -188,10 +185,7 @@ void SnoreNotificationBackend::ConfigWidget::defaults() void SnoreNotificationBackend::ConfigWidget::load() { NotificationSettings s; - QString backend = m_snore->primaryNotificationBackend(); - if (backend.isEmpty()) { - backend = "SystemTray"; - } + QString backend = s.value("Snore/Backend", "Default").toString(); int timeout = s.value("Snore/Timeout", 10).toInt(); ui.backends->setCurrentIndex(ui.backends->findText(backend)); ui.timeout->setValue(timeout);