File indexing completed on 2024-05-05 04:57:29

0001 /*
0002     This file is part of Choqok, the KDE micro-blogging client
0003 
0004     SPDX-FileCopyrightText: 2011-2012 Mehrdad Momeny <mehrdad.momeny@gmail.com>
0005 
0006     SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0007 */
0008 
0009 #ifndef NOTIFY_H
0010 #define NOTIFY_H
0011 
0012 #include <QMap>
0013 #include <QQueue>
0014 #include <QPoint>
0015 #include <QPointer>
0016 #include <QTimer>
0017 
0018 #include "plugin.h"
0019 
0020 class Notification;
0021 namespace Choqok
0022 {
0023 namespace UI
0024 {
0025 class PostWidget;
0026 }
0027 class Account;
0028 }
0029 
0030 class Notify : public Choqok::Plugin
0031 {
0032     Q_OBJECT
0033 public:
0034     Notify(QObject *parent, const QList< QVariant > &args);
0035     ~Notify();
0036 
0037 protected Q_SLOTS:
0038     void slotNewPostWidgetAdded(Choqok::UI::PostWidget *, Choqok::Account *, QString);
0039     void notifyNextPost();
0040     void stopNotifications();
0041     void slotPostReaded();
0042 
0043 private:
0044     void notify(QPointer< Choqok::UI::PostWidget > post);
0045     void hideLastNotificationAndShowThis(Notification *nextNotificationToShow = nullptr);
0046 
0047     QTimer timer;
0048     QMap<QString, QStringList> accountsList;
0049     QQueue<Choqok::UI::PostWidget *> postQueueToNotify;
0050     Notification *notification;
0051     QPoint notifyPosition;
0052 };
0053 
0054 #endif //NOTIFY_H