qTox  Version: nightly | Commit: bc751c8e1cac455f9690654fcfe0f560d2d7dfdd
friendchatroom.h
Go to the documentation of this file.
1 /*
2  Copyright © 2014-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 #pragma once
21 
22 #include "chatroom.h"
23 
24 #include <QObject>
25 #include <QString>
26 #include <QVector>
27 
28 class Core;
29 class IDialogsManager;
30 class Friend;
31 class Group;
32 
34 {
35  QString name;
37 };
38 
40 {
41  QString name;
42  int circleId;
43 };
44 
45 class FriendChatroom : public QObject, public Chatroom
46 {
47  Q_OBJECT
48 public:
50 
51  Contact* getContact() override;
52 
53 public slots:
54 
55  Friend* getFriend();
56 
57  void setActive(bool active);
58 
59  bool canBeInvited() const;
60 
61  int getCircleId() const;
62  QString getCircleName() const;
63 
64  void inviteToNewGroup();
65  void inviteFriend(const Group* group);
66 
67  bool autoAcceptEnabled() const;
68  QString getAutoAcceptDir() const;
69  void disableAutoAccept();
70  void setAutoAcceptDir(const QString& dir);
71 
72  QVector<GroupToDisplay> getGroups() const;
73  QVector<CircleToDisplay> getOtherCircles() const;
74 
75  void resetEventFlags();
76 
77  bool possibleToOpenInNewWindow() const;
78  bool canBeRemovedFromWindow() const;
79  bool friendCanBeRemoved() const;
81 
82 signals:
83  void activeChanged(bool activated);
84 
85 private:
86  bool active{false};
87  Friend* frnd{nullptr};
90 };
CircleToDisplay::circleId
int circleId
Definition: friendchatroom.h:42
IDialogsManager
Definition: idialogsmanager.h:27
FriendChatroom::dialogsManager
IDialogsManager * dialogsManager
Definition: friendchatroom.h:88
FriendChatroom::getContact
Contact * getContact() override
Definition: friendchatroom.cpp:57
FriendChatroom::activeChanged
void activeChanged(bool activated)
FriendChatroom::FriendChatroom
FriendChatroom(Friend *frnd, IDialogsManager *dialogsManager, Core &_core)
Definition: friendchatroom.cpp:45
FriendChatroom::inviteToNewGroup
void inviteToNewGroup()
Definition: friendchatroom.cpp:86
FriendChatroom::autoAcceptEnabled
bool autoAcceptEnabled() const
Definition: friendchatroom.cpp:110
FriendChatroom::resetEventFlags
void resetEventFlags()
Definition: friendchatroom.cpp:162
FriendChatroom::possibleToOpenInNewWindow
bool possibleToOpenInNewWindow() const
Definition: friendchatroom.cpp:167
FriendChatroom::friendCanBeRemoved
bool friendCanBeRemoved() const
Definition: friendchatroom.cpp:181
FriendChatroom::setActive
void setActive(bool active)
Definition: friendchatroom.cpp:62
CircleToDisplay
Definition: friendchatroom.h:39
FriendChatroom::getCircleName
QString getCircleName() const
Definition: friendchatroom.cpp:80
chatroom.h
CircleToDisplay::name
QString name
Definition: friendchatroom.h:41
FriendChatroom::setAutoAcceptDir
void setAutoAcceptDir(const QString &dir)
Definition: friendchatroom.cpp:99
FriendChatroom::getCircleId
int getCircleId() const
Definition: friendchatroom.cpp:75
Chatroom
Definition: chatroom.h:24
Contact
Definition: contact.h:26
Friend
Definition: friend.h:31
FriendChatroom::getGroups
QVector< GroupToDisplay > getGroups() const
Definition: friendchatroom.cpp:122
FriendChatroom::getAutoAcceptDir
QString getAutoAcceptDir() const
Definition: friendchatroom.cpp:93
FriendChatroom::active
bool active
Definition: friendchatroom.h:86
FriendChatroom::frnd
Friend * frnd
Definition: friendchatroom.h:87
Group
Definition: group.h:34
FriendChatroom::getOtherCircles
QVector< CircleToDisplay > getOtherCircles() const
Return sorted list of circles exclude current circle.
Definition: friendchatroom.cpp:137
FriendChatroom::inviteFriend
void inviteFriend(const Group *group)
Definition: friendchatroom.cpp:115
FriendChatroom::canBeRemovedFromWindow
bool canBeRemovedFromWindow() const
Definition: friendchatroom.cpp:174
FriendChatroom::canBeInvited
bool canBeInvited() const
Definition: friendchatroom.cpp:70
FriendChatroom::removeFriendFromDialogs
void removeFriendFromDialogs()
Definition: friendchatroom.cpp:188
FriendChatroom::disableAutoAccept
void disableAutoAccept()
Definition: friendchatroom.cpp:105
FriendChatroom::core
Core & core
Definition: friendchatroom.h:89
FriendChatroom::getFriend
Friend * getFriend()
Definition: friendchatroom.cpp:52
GroupToDisplay::name
QString name
Definition: friendchatroom.h:35
Core
Definition: core.h:59
GroupToDisplay::group
Group * group
Definition: friendchatroom.h:36
FriendChatroom
Definition: friendchatroom.h:45
GroupToDisplay
Definition: friendchatroom.h:33