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 FRIENDLISTLAYOUT_H 21 #define FRIENDLISTLAYOUT_H 22 23 #include "genericchatitemlayout.h" 24 #include "src/model/status.h" 25 #include "src/core/core.h" 26 #include <QBoxLayout> 27 28 class FriendWidget; 29 class FriendListWidget; 30 31 class FriendListLayout : public QVBoxLayout 32 { 33 Q_OBJECT 34 public: 35 explicit FriendListLayout(); 36 explicit FriendListLayout(QWidget* parent); 37 38 void addFriendWidget(FriendWidget* widget, Status::Status s); 39 void removeFriendWidget(FriendWidget* widget, Status::Status s); 40 int indexOfFriendWidget(GenericChatItemWidget* widget, bool online) const; 41 void moveFriendWidgets(FriendListWidget* listWidget); 42 int friendOnlineCount() const; 43 int friendTotalCount() const; 44 45 bool hasChatrooms() const; 46 void searchChatrooms(const QString& searchString, bool hideOnline = false, 47 bool hideOffline = false); 48 49 QLayout* getLayoutOnline() const; 50 QLayout* getLayoutOffline() const; 51 52 private: 53 void init(); 54 QLayout* getFriendLayout(Status::Status s) const; 55 56 GenericChatItemLayout friendOnlineLayout; 57 GenericChatItemLayout friendOfflineLayout; 58 }; 59 60 #endif // FRIENDLISTLAYOUT_H 61