settingspagedlg.cpp
simplenetworkeditor.cpp
systemtray.cpp
+ systrayanimationnotificationbackend.cpp
systraynotificationbackend.cpp
taskbarnotificationbackend.cpp
titlesetter.cpp
#else /* HAVE_KDE */
# include "knotificationbackend.h"
#endif /* HAVE_KDE */
+#include "systrayanimationnotificationbackend.h"
#ifdef HAVE_LIBSNORE
#endif /* HAVE_KDE */
+#ifndef QT_NO_SYSTEMTRAYICON
+ QtUi::registerNotificationBackend(new SystrayAnimationNotificationBackend(this));
+#endif
#ifdef HAVE_LIBSNORE
QtUi::registerNotificationBackend(new SnoreNotificationBackend(this));
#elif !defined(QT_NO_SYSTEMTRAYICON) && !defined(HAVE_KDE)
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2005-2016 by the Quassel Project *
+ * devel@quassel-irc.org *
+ * *
+ * 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 <QApplication>
+#include <QCheckBox>
+#include <QGroupBox>
+#include <QIcon>
+#include <QHBoxLayout>
+
+#include "systrayanimationnotificationbackend.h"
+
+#include "client.h"
+#include "clientsettings.h"
+#include "mainwin.h"
+#include "networkmodel.h"
+#include "qtui.h"
+#include "systemtray.h"
+
+SystrayAnimationNotificationBackend::SystrayAnimationNotificationBackend(QObject *parent)
+ : AbstractNotificationBackend(parent)
+{
+ NotificationSettings notificationSettings;
+ notificationSettings.initAndNotify("Systray/Animate", this, SLOT(animateChanged(QVariant)), true);
+}
+
+
+void SystrayAnimationNotificationBackend::notify(const Notification &n)
+{
+ if (n.type != Highlight && n.type != PrivMsg)
+ return;
+
+ if (_animate)
+ QtUi::mainWindow()->systemTray()->setAlert(true);
+}
+
+
+void SystrayAnimationNotificationBackend::close(uint notificationId)
+{
+ QtUi::mainWindow()->systemTray()->setAlert(false);
+}
+
+
+void SystrayAnimationNotificationBackend::animateChanged(const QVariant &v)
+{
+ _animate = v.toBool();
+}
+
+
+SettingsPage *SystrayAnimationNotificationBackend::createConfigWidget() const
+{
+ return nullptr;
+}
\ No newline at end of file
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2005-2016 by the Quassel Project *
+ * devel@quassel-irc.org *
+ * *
+ * 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. *
+ ***************************************************************************/
+
+#pragma once
+
+#include "abstractnotificationbackend.h"
+#include "settingspage.h"
+#include "systemtray.h"
+
+class QCheckBox;
+
+class SystrayAnimationNotificationBackend : public AbstractNotificationBackend
+{
+ Q_OBJECT
+
+public:
+ SystrayAnimationNotificationBackend(QObject *parent = 0);
+
+ void notify(const Notification &);
+ void close(uint notificationId);
+ virtual SettingsPage *createConfigWidget() const;
+
+private slots:
+ void animateChanged(const QVariant &);
+
+private:
+ bool _animate;
+};
\ No newline at end of file
{
NotificationSettings notificationSettings;
notificationSettings.initAndNotify("Systray/ShowBubble", this, SLOT(showBubbleChanged(QVariant)), true);
- notificationSettings.initAndNotify("Systray/Animate", this, SLOT(animateChanged(QVariant)), true);
connect(QtUi::mainWindow()->systemTray(), SIGNAL(messageClicked(uint)), SLOT(notificationActivated(uint)));
connect(QtUi::mainWindow()->systemTray(), SIGNAL(activated(SystemTray::ActivationReason)),
QtUi::mainWindow()->systemTray()->showMessage(title, message, SystemTray::Information, 10000, n.notificationId);
}
- if (_animate)
- QtUi::mainWindow()->systemTray()->setAlert(true);
-
updateToolTip();
}
QtUi::mainWindow()->systemTray()->closeMessage(notificationId);
- //if(!_notifications.count()) //FIXME make configurable
- QtUi::mainWindow()->systemTray()->setAlert(false);
-
updateToolTip();
}
}
-void SystrayNotificationBackend::animateChanged(const QVariant &v)
-{
- _animate = v.toBool();
-}
-
-
void SystrayNotificationBackend::updateToolTip()
{
QtUi::mainWindow()->systemTray()->setToolTip("Quassel IRC",
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#ifndef SYSTRAYNOTIFICATIONBACKEND_H_
-#define SYSTRAYNOTIFICATIONBACKEND_H_
+#pragma once
#include "abstractnotificationbackend.h"
#include "settingspage.h"
void notificationActivated(uint notificationId);
void notificationActivated(SystemTray::ActivationReason);
- void animateChanged(const QVariant &);
void showBubbleChanged(const QVariant &);
void updateToolTip();
class ConfigWidget;
bool _showBubble;
- bool _animate;
QList<Notification> _notifications;
bool _blockActivation;
};
QCheckBox *_showBubbleBox;
bool _showBubble;
};
-
-
-#endif