qTox  Version: nightly | Commit: bc751c8e1cac455f9690654fcfe0f560d2d7dfdd
notificationgenerator.h
Go to the documentation of this file.
1 /*
2  Copyright © 2020 by The qTox Project Contributors
3 
4  This file is part of qTox, a Qt-based graphical interface for Tox.
5 
6  qTox is libre software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  qTox is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with qTox. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #pragma once
21 
22 
23 #include "notificationdata.h"
24 #include "friend.h"
25 #include "group.h"
26 
29 
30 #include <QObject>
31 #include <QHash>
32 
33 class NotificationGenerator : public QObject
34 {
35 public:
38  // Optional profile input to lookup avatars. Avatar lookup is not
39  // currently mockable so we allow profile to be nullptr for unit
40  // testing
41  Profile* profile);
42  virtual ~NotificationGenerator();
47 
48  NotificationData friendMessageNotification(const Friend* f, const QString& message);
49  NotificationData groupMessageNotification(const Group* g, const ToxPk& sender, const QString& message);
50  NotificationData fileTransferNotification(const Friend* f, const QString& filename, size_t fileSize);
52  NotificationData friendRequestNotification(const ToxPk& sender, const QString& message);
53 
54 public slots:
56 
57 private:
62 };
profile.h
friend.h
Profile
Handles all qTox internal paths.
Definition: profile.h:42
group.h
NotificationGenerator::onNotificationActivated
void onNotificationActivated()
Definition: notificationgenerator.cpp:266
NotificationGenerator::profile
Profile * profile
Definition: notificationgenerator.h:59
NotificationGenerator::groupInvitationNotification
NotificationData groupInvitationNotification(const Friend *from)
Definition: notificationgenerator.cpp:235
NotificationData
Definition: notificationdata.h:25
NotificationGenerator::NotificationGenerator
NotificationGenerator(INotificationSettings const &notificationSettings, Profile *profile)
Definition: notificationgenerator.cpp:159
NotificationGenerator
Definition: notificationgenerator.h:33
HistMessageContentType::message
@ message
ToxPk
This class represents a Tox Public Key, which is a part of Tox ID.
Definition: toxpk.h:26
Friend
Definition: friend.h:31
inotificationsettings.h
NotificationGenerator::friendNotifications
QHash< const Friend *, size_t > friendNotifications
Definition: notificationgenerator.h:60
QHash< const Friend *, size_t >
NotificationGenerator::friendMessageNotification
NotificationData friendMessageNotification(const Friend *f, const QString &message)
Definition: notificationgenerator.cpp:168
NotificationGenerator::notificationSettings
INotificationSettings const & notificationSettings
Definition: notificationgenerator.h:58
NotificationGenerator::friendRequestNotification
NotificationData friendRequestNotification(const ToxPk &sender, const QString &message)
Definition: notificationgenerator.cpp:251
NotificationGenerator::~NotificationGenerator
virtual ~NotificationGenerator()
notificationdata.h
Group
Definition: group.h:34
NotificationGenerator::groupMessageNotification
NotificationData groupMessageNotification(const Group *g, const ToxPk &sender, const QString &message)
Definition: notificationgenerator.cpp:186
NotificationGenerator::operator=
NotificationGenerator & operator=(const NotificationGenerator &)=delete
NotificationGenerator::fileTransferNotification
NotificationData fileTransferNotification(const Friend *f, const QString &filename, size_t fileSize)
Definition: notificationgenerator.cpp:204
NotificationGenerator::groupNotifications
QHash< const Group *, size_t > groupNotifications
Definition: notificationgenerator.h:61
INotificationSettings
Definition: inotificationsettings.h:24