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 #ifndef GROUPCHATFORM_H 21 #define GROUPCHATFORM_H 22 23 #include "genericchatform.h" 24 #include "src/core/toxpk.h" 25 #include <QMap> 26 27 namespace Ui { 28 class MainWindow; 29 } 30 class Group; 31 class TabCompleter; 32 class FlowLayout; 33 class QTimer; 34 class GroupId; 35 class IMessageDispatcher; 36 class Message; 37 38 class GroupChatForm : public GenericChatForm 39 { 40 Q_OBJECT 41 public: 42 explicit GroupChatForm(Group* chatGroup, IChatLog& chatLog, IMessageDispatcher& messageDispatcher); 43 ~GroupChatForm(); 44 45 void peerAudioPlaying(ToxPk peerPk); 46 47 private slots: 48 void onScreenshotClicked() override; 49 void onAttachClicked() override; 50 void onMicMuteToggle(); 51 void onVolMuteToggle(); 52 void onCallClicked(); 53 void onUserJoined(const ToxPk& user, const QString& name); 54 void onUserLeft(const ToxPk& user, const QString& name); 55 void onPeerNameChanged(const ToxPk& peer, const QString& oldName, const QString& newName); 56 void onTitleChanged(const QString& author, const QString& title); 57 void onLabelContextMenuRequested(const QPoint& localPos); 58 59 protected: 60 virtual GenericNetCamView* createNetcam() final override; 61 virtual void keyPressEvent(QKeyEvent* ev) final override; 62 virtual void keyReleaseEvent(QKeyEvent* ev) final override; 63 // drag & drop 64 virtual void dragEnterEvent(QDragEnterEvent* ev) final override; 65 virtual void dropEvent(QDropEvent* ev) final override; 66 67 private: 68 void retranslateUi(); 69 void updateUserCount(int numPeers); 70 void updateUserNames(); 71 void joinGroupCall(); 72 void leaveGroupCall(); 73 74 private: 75 Group* group; 76 QMap<ToxPk, QLabel*> peerLabels; 77 QMap<ToxPk, QTimer*> peerAudioTimers; 78 FlowLayout* namesListLayout; 79 QLabel* nusersLabel; 80 TabCompleter* tabber; 81 bool inCall; 82 }; 83 84 #endif // GROUPCHATFORM_H 85