1 /*
2     Copyright © 2019 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 #ifndef I_FRIEND_SETTINGS_H
21 #define I_FRIEND_SETTINGS_H
22 
23 #include "src/model/interface.h"
24 
25 #include <QObject>
26 #include <QFlag>
27 
28 class ToxPk;
29 
30 class IFriendSettings
31 {
32 public:
33     enum class AutoAcceptCall
34     {
35         None = 0x00,
36         Audio = 0x01,
37         Video = 0x02,
38         AV = Audio | Video
39     };
40     Q_DECLARE_FLAGS(AutoAcceptCallFlags, AutoAcceptCall)
41 
42     virtual ~IFriendSettings() = default;
43 
44     virtual QString getContactNote(const ToxPk& pk) const = 0;
45     virtual void setContactNote(const ToxPk& pk, const QString& note) = 0;
46 
47     virtual QString getAutoAcceptDir(const ToxPk& pk) const = 0;
48     virtual void setAutoAcceptDir(const ToxPk& pk, const QString& dir) = 0;
49 
50     virtual AutoAcceptCallFlags getAutoAcceptCall(const ToxPk& pk) const = 0;
51     virtual void setAutoAcceptCall(const ToxPk& pk, AutoAcceptCallFlags accept) = 0;
52 
53     virtual bool getAutoGroupInvite(const ToxPk& pk) const = 0;
54     virtual void setAutoGroupInvite(const ToxPk& pk, bool accept) = 0;
55 
56     virtual QString getFriendAlias(const ToxPk& pk) const = 0;
57     virtual void setFriendAlias(const ToxPk& pk, const QString& alias) = 0;
58 
59     virtual int getFriendCircleID(const ToxPk& pk) const = 0;
60     virtual void setFriendCircleID(const ToxPk& pk, int circleID) = 0;
61 
62     virtual QDateTime getFriendActivity(const ToxPk& pk) const = 0;
63     virtual void setFriendActivity(const ToxPk& pk, const QDateTime& date) = 0;
64 
65     virtual void saveFriendSettings(const ToxPk& pk) = 0;
66     virtual void removeFriendSettings(const ToxPk& pk) = 0;
67 
68 signals:
69     DECLARE_SIGNAL(autoAcceptCallChanged, const ToxPk& pk, AutoAcceptCallFlags accept);
70     DECLARE_SIGNAL(autoGroupInviteChanged, const ToxPk& pk, bool accept);
71     DECLARE_SIGNAL(autoAcceptDirChanged, const ToxPk& pk, const QString& dir);
72     DECLARE_SIGNAL(contactNoteChanged, const ToxPk& pk, const QString& note);
73 };
74 
75 Q_DECLARE_OPERATORS_FOR_FLAGS(IFriendSettings::AutoAcceptCallFlags)
76 #endif // I_FRIEND_SETTINGS_H
77