qt4-b-gone: Remove support for libindicate
authorManuel Nickschas <sputnick@quassel-irc.org>
Tue, 17 Jul 2018 20:07:03 +0000 (22:07 +0200)
committerManuel Nickschas <sputnick@quassel-irc.org>
Sun, 18 Nov 2018 10:06:43 +0000 (11:06 +0100)
libindicate-qt only exists for the dead Qt4, so remove support
for it.

cmake/FindIndicateQt.cmake [deleted file]
src/qtui/indicatornotificationbackend.cpp [deleted file]
src/qtui/indicatornotificationbackend.h [deleted file]
src/qtui/mainwin.cpp
src/qtui/ui/indicatornotificationconfigwidget.ui [deleted file]

diff --git a/cmake/FindIndicateQt.cmake b/cmake/FindIndicateQt.cmake
deleted file mode 100644 (file)
index 5279c06..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-# CMake wrapper for finding indicate-qt
-# This is not very flexible (e.g. no version check), but allows using
-# a normal find_package call and thus support for feature_summary
-#
-# (C) 2014 by the Quassel Project <devel@quassel-irc.org>
-#
-# Redistribution and use is allowed according to the terms of the BSD license.
-# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
-#
-# Once found, sets the standard set of variables:
-# INDICATEQT_FOUND - IndicateQt available in the system
-# INDICATEQT_LIBRARIES - Libraries to link with
-# INDICATEQT_INCLUDE_DIRS - Include directories containing the headers
-#
-##############################################################################
-
-include(FindPackageHandleStandardArgs)
-
-if (USE_QT4)
-    # requires PkgConfig for now; patches for finding it directly welcome!
-    find_package(PkgConfig QUIET)
-    if (PKG_CONFIG_FOUND)
-        pkg_check_modules(INDICATEQT QUIET indicate-qt>=0.2.1)
-    endif()
-endif()
-
-find_package_handle_standard_args(IndicateQt DEFAULT_MSG INDICATEQT_LIBRARIES INDICATEQT_INCLUDE_DIRS)
-mark_as_advanced(INDICATEQT_LIBRARIES INDICATEQT_INCLUDE_DIRS)
diff --git a/src/qtui/indicatornotificationbackend.cpp b/src/qtui/indicatornotificationbackend.cpp
deleted file mode 100644 (file)
index b5ae55b..0000000
+++ /dev/null
@@ -1,228 +0,0 @@
-/***************************************************************************
- *   Copyright (C) 2005-09 Canonical Ltd                                   *
- *   author: aurelien.gateau@canonical.com                                 *
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) version 3.                                           *
- *                                                                         *
- *   This program is distributed in the hope that it will be useful,       *
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
- *   GNU General Public License for more details.                          *
- *                                                                         *
- *   You should have received a copy of the GNU General Public License     *
- *   along with this program; if not, write to the                         *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
- ***************************************************************************/
-
-#include "indicatornotificationbackend.h"
-
-#include <QIcon>
-#include <QImage>
-
-#include <qindicateserver.h>
-#include <qindicateindicator.h>
-
-#include "client.h"
-#include "clientsettings.h"
-#include "icon.h"
-#include "mainwin.h"
-#include "networkmodel.h"
-#include "qtui.h"
-
-#define STR(x) #x
-#define XSTR(x) STR(x)
-
-class Indicator : public QIndicate::Indicator
-{
-public:
-    uint lastNotificationId;
-};
-
-
-IndicatorNotificationBackend::IndicatorNotificationBackend(QObject *parent)
-    : AbstractNotificationBackend(parent)
-{
-    NotificationSettings notificationSettings;
-    _enabled = notificationSettings.value("Indicator/Enabled", false).toBool();
-
-    notificationSettings.notify("Indicator/Enabled", this, SLOT(enabledChanged(const QVariant &)));
-
-    _server = QIndicate::Server::defaultInstance();
-    _server->setType("message.irc");
-    QString desktopFile = QString("%1/%2.desktop")
-                          .arg(XSTR(XDG_APPS_INSTALL_DIR))
-                          .arg(QCoreApplication::applicationFilePath().section('/', -1));
-    _server->setDesktopFile(desktopFile);
-    connect(_server, SIGNAL(serverDisplay()), SLOT(activateMainWidget()));
-
-    if (_enabled) {
-        _server->show();
-    }
-}
-
-
-IndicatorNotificationBackend::~IndicatorNotificationBackend()
-{
-    qDeleteAll(_indicatorHash);
-}
-
-
-void IndicatorNotificationBackend::activateMainWidget()
-{
-    GraphicalUi::activateMainWidget();
-}
-
-
-void IndicatorNotificationBackend::notify(const Notification &notification)
-{
-    if (!_enabled) {
-        return;
-    }
-    if (notification.type != Highlight && notification.type != PrivMsg) {
-        return;
-    }
-    BufferId bufferId = notification.bufferId;
-    Indicator *indicator = _indicatorHash.value(bufferId);
-    if (!indicator) {
-        indicator = new Indicator;
-        _indicatorHash.insert(bufferId, indicator);
-        connect(indicator, SIGNAL(display(QIndicate::Indicator *)),
-            SLOT(indicatorDisplayed(QIndicate::Indicator *)));
-    }
-    indicator->lastNotificationId = notification.notificationId;
-
-    BufferInfo::Type type = Client::networkModel()->bufferType(bufferId);
-    QString name;
-    if (type == BufferInfo::QueryBuffer) {
-        name = notification.sender;
-    }
-    else {
-        name = QString("%1 (%2)")
-               .arg(Client::networkModel()->bufferName(bufferId))
-               .arg(notification.sender);
-    }
-    indicator->setNameProperty(name);
-
-    indicator->setTimeProperty(QDateTime::currentDateTime());
-
-    QModelIndex index = Client::networkModel()->bufferIndex(bufferId);
-    QVariant icon = QtUi::style()->bufferViewItemData(index, Qt::DecorationRole);
-    if (icon.canConvert<QIcon>()) {
-        QImage image = icon.value<QIcon>().pixmap(16).toImage();
-        indicator->setIconProperty(image);
-    }
-
-    indicator->setDrawAttentionProperty(true);
-    indicator->show();
-}
-
-
-void IndicatorNotificationBackend::close(uint notificationId)
-{
-    // If we find an indicator whose lastNotificationId is notificationId, we
-    // delete it
-
-    IndicatorHash::Iterator
-        it = _indicatorHash.begin(),
-        end = _indicatorHash.end();
-    for (; it != end; ++it) {
-        if (it.value()->lastNotificationId == notificationId) {
-            break;
-        }
-    }
-    if (it == end) {
-        // Not found, maybe there was no indicator for this notification or another
-        // notification happened after
-        return;
-    }
-    _indicatorHash.erase(it);
-    delete it.value();
-}
-
-
-void IndicatorNotificationBackend::enabledChanged(const QVariant &v)
-{
-    _enabled = v.toBool();
-    if (_enabled) {
-        _server->show();
-        // TODO: Create indicators for existing highlighted buffers?
-    }
-    else {
-        _server->hide();
-        qDeleteAll(_indicatorHash);
-    }
-}
-
-
-void IndicatorNotificationBackend::indicatorDisplayed(QIndicate::Indicator *_indicator)
-{
-    Indicator *indicator = static_cast<Indicator *>(_indicator);
-    emit activated(indicator->lastNotificationId);
-}
-
-
-SettingsPage *IndicatorNotificationBackend::createConfigWidget() const
-{
-    return new ConfigWidget();
-}
-
-
-/***************************************************************************/
-
-IndicatorNotificationBackend::ConfigWidget::ConfigWidget(QWidget *parent)
-    : SettingsPage("Internal", "IndicatorNotification", parent)
-{
-    ui.setupUi(this);
-    // FIXME find proper icon (this one is used by the plasmoid as well)
-    ui.enabled->setIcon(icon::get("mail-message-new"));
-
-    connect(ui.enabled, SIGNAL(toggled(bool)), SLOT(widgetChanged()));
-}
-
-
-IndicatorNotificationBackend::ConfigWidget::~ConfigWidget()
-{
-}
-
-
-void IndicatorNotificationBackend::ConfigWidget::widgetChanged()
-{
-    bool changed = enabled != ui.enabled->isChecked();
-
-    if (changed != hasChanged()) setChangedState(changed);
-}
-
-
-bool IndicatorNotificationBackend::ConfigWidget::hasDefaults() const
-{
-    return true;
-}
-
-
-void IndicatorNotificationBackend::ConfigWidget::defaults()
-{
-    ui.enabled->setChecked(false);
-    widgetChanged();
-}
-
-
-void IndicatorNotificationBackend::ConfigWidget::load()
-{
-    NotificationSettings s;
-    enabled = s.value("Indicator/Enabled", false).toBool();
-
-    ui.enabled->setChecked(enabled);
-    setChangedState(false);
-}
-
-
-void IndicatorNotificationBackend::ConfigWidget::save()
-{
-    NotificationSettings s;
-    s.setValue("Indicator/Enabled", ui.enabled->isChecked());
-    load();
-}
diff --git a/src/qtui/indicatornotificationbackend.h b/src/qtui/indicatornotificationbackend.h
deleted file mode 100644 (file)
index 2e54db9..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-/***************************************************************************
- *   Copyright (C) 2009 Canonical Ltd                                      *
- *   author: aurelien.gateau@canonical.com                                 *
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) version 3.                                           *
- *                                                                         *
- *   This program is distributed in the hope that it will be useful,       *
- *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
- *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
- *   GNU General Public License for more details.                          *
- *                                                                         *
- *   You should have received a copy of the GNU General Public License     *
- *   along with this program; if not, write to the                         *
- *   Free Software Foundation, Inc.,                                       *
- *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
- ***************************************************************************/
-
-#ifndef INDICATORNOTIFICATIONBACKEND_H_
-#define INDICATORNOTIFICATIONBACKEND_H_
-
-#include <QHash>
-
-#include "abstractnotificationbackend.h"
-#include "settingspage.h"
-
-#include "ui_indicatornotificationconfigwidget.h"
-
-namespace QIndicate {
-class Server;
-class Indicator;
-}
-
-class Indicator;
-
-typedef QHash<BufferId, Indicator *> IndicatorHash;
-
-class IndicatorNotificationBackend : public AbstractNotificationBackend
-{
-    Q_OBJECT
-
-public:
-    IndicatorNotificationBackend(QObject *parent = 0);
-    ~IndicatorNotificationBackend();
-
-    void notify(const Notification &);
-    void close(uint notificationId);
-    virtual SettingsPage *createConfigWidget() const;
-
-private slots:
-    void activateMainWidget();
-    void enabledChanged(const QVariant &);
-    void indicatorDisplayed(QIndicate::Indicator *);
-
-private:
-    class ConfigWidget;
-
-    bool _enabled;
-
-    QIndicate::Server *_server;
-    IndicatorHash _indicatorHash;
-};
-
-
-class IndicatorNotificationBackend::ConfigWidget : public SettingsPage
-{
-    Q_OBJECT
-
-public:
-    ConfigWidget(QWidget *parent = 0);
-    ~ConfigWidget();
-
-    void save();
-    void load();
-    bool hasDefaults() const;
-    void defaults();
-
-private slots:
-    void widgetChanged();
-
-private:
-    Ui::IndicatorNotificationConfigWidget ui;
-
-    bool enabled;
-};
-
-
-#endif
index e06d28b..f2ed0d7 100644 (file)
 #  include "sslinfodlg.h"
 #endif
 
 #  include "sslinfodlg.h"
 #endif
 
-#ifdef HAVE_INDICATEQT
-  #include "indicatornotificationbackend.h"
-#endif
-
 #ifdef HAVE_NOTIFICATION_CENTER
   #include "osxnotificationbackend.h"
 #endif
 #ifdef HAVE_NOTIFICATION_CENTER
   #include "osxnotificationbackend.h"
 #endif
@@ -275,10 +271,6 @@ void MainWin::init()
     QtUi::registerNotificationBackend(new SystrayNotificationBackend(this));
 #endif
 
     QtUi::registerNotificationBackend(new SystrayNotificationBackend(this));
 #endif
 
-#ifdef HAVE_INDICATEQT
-    QtUi::registerNotificationBackend(new IndicatorNotificationBackend(this));
-#endif
-
 #ifdef HAVE_NOTIFICATION_CENTER
     QtUi::registerNotificationBackend(new OSXNotificationBackend(this));
 #endif
 #ifdef HAVE_NOTIFICATION_CENTER
     QtUi::registerNotificationBackend(new OSXNotificationBackend(this));
 #endif
diff --git a/src/qtui/ui/indicatornotificationconfigwidget.ui b/src/qtui/ui/indicatornotificationconfigwidget.ui
deleted file mode 100644 (file)
index 3f2c506..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<ui version="4.0">
- <class>IndicatorNotificationConfigWidget</class>
- <widget class="QWidget" name="IndicatorNotificationConfigWidget">
-  <property name="geometry">
-   <rect>
-    <x>0</x>
-    <y>0</y>
-    <width>438</width>
-    <height>35</height>
-   </rect>
-  </property>
-  <property name="windowTitle">
-   <string>Form</string>
-  </property>
-  <layout class="QVBoxLayout" name="verticalLayout_2">
-   <item>
-    <widget class="QCheckBox" name="enabled">
-     <property name="toolTip">
-      <string>This enables support for the Ayatana Project's application indicator (libindicate).</string>
-     </property>
-     <property name="text">
-      <string>Show messages in application indicator</string>
-     </property>
-    </widget>
-   </item>
-   <item>
-    <spacer name="verticalSpacer">
-     <property name="orientation">
-      <enum>Qt::Vertical</enum>
-     </property>
-     <property name="sizeHint" stdset="0">
-      <size>
-       <width>20</width>
-       <height>40</height>
-      </size>
-     </property>
-    </spacer>
-   </item>
-  </layout>
- </widget>
- <resources/>
- <connections/>
-</ui>