diff --git a/README.md b/README.md index aa1b6ffb7..815d30fb6 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,8 @@ However, it is not a fork.

Features

-- Friends chat -- Group chats (experimental, can only accept invitations) +- One to one chat with friends +- Group chats - File transfers, with previewing of images - Audio calls diff --git a/core.cpp b/core.cpp index 3d4c6d28c..4ecc27fb3 100644 --- a/core.cpp +++ b/core.cpp @@ -786,6 +786,7 @@ QList Core::getGroupPeerNames(int groupId) const int Core::joinGroupchat(int32_t friendnumber, uint8_t* friend_group_public_key) const { + qDebug() << QString("Trying to join groupchat invite by friend %1").arg(friendnumber); return tox_join_groupchat(tox, friendnumber, friend_group_public_key); } @@ -1162,3 +1163,8 @@ void Core::sendCallAudio(int callId, ToxAv* toxav) QThread::msleep(5); } } + +void Core::groupInviteFriend(int friendId, int groupId) +{ + tox_invite_friend(tox, friendId, groupId); +} diff --git a/core.h b/core.h index 179795dae..bf1bcf34e 100644 --- a/core.h +++ b/core.h @@ -116,6 +116,7 @@ public slots: void acceptFriendRequest(const QString& userId); void requestFriendship(const QString& friendAddress, const QString& message); + void groupInviteFriend(int friendId, int groupId); void removeFriend(int friendId); void removeGroup(int groupId); diff --git a/main.cpp b/main.cpp index 524648613..38460b56f 100644 --- a/main.cpp +++ b/main.cpp @@ -25,7 +25,6 @@ int main(int argc, char *argv[]) * Adjust all status icons to match the mockup, including scooting the friendslist ones to the left and making the user one the same size * Sidepanel (friendlist) should be resizeable * The online/offline/away status at the top (our) is way too big i think (follow the mockup/uTox) - * In-chat messages should have line wrapping * An extra side panel for groupchats, like Venom does (?) * */ diff --git a/widget/friendwidget.cpp b/widget/friendwidget.cpp index a676f4dd5..c1a9e8c48 100644 --- a/widget/friendwidget.cpp +++ b/widget/friendwidget.cpp @@ -1,4 +1,8 @@ #include "friendwidget.h" +#include "group.h" +#include "grouplist.h" +#include "groupwidget.h" +#include "widget.h" #include #include @@ -52,6 +56,15 @@ void FriendWidget::contextMenuEvent(QContextMenuEvent * event) QPoint pos = event->globalPos(); QMenu menu; menu.addAction("Remove friend"); + QMenu* inviteMenu = menu.addMenu("Invite in group"); + QMap groupActions; + for (Group* group : GroupList::groupList) + { + QAction* groupAction = inviteMenu->addAction(group->widget->name.text()); + groupActions[groupAction] = group; + } + if (groupActions.isEmpty()) + inviteMenu->setEnabled(false); QAction* selectedItem = menu.exec(pos); if (selectedItem) @@ -62,6 +75,11 @@ void FriendWidget::contextMenuEvent(QContextMenuEvent * event) emit removeFriend(friendId); return; } + else if (groupActions.contains(selectedItem)) + { + Group* group = groupActions[selectedItem]; + Widget::getInstance()->getCore()->groupInviteFriend(friendId, group->groupId); + } } }