mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
docs: added documentation for GroupInviteForm class
This commit is contained in:
parent
adba773c6d
commit
e68aef19f9
|
@ -1,7 +1,35 @@
|
|||
/*
|
||||
Copyright © 2017 by The qTox Project Contributors
|
||||
|
||||
This file is part of qTox, a Qt-based graphical interface for Tox.
|
||||
|
||||
qTox is libre software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
qTox is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with qTox. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "groupinvite.h"
|
||||
|
||||
GroupInvite::GroupInvite(const int32_t FriendId, const uint8_t Type, const QByteArray& Invite)
|
||||
: friendId(FriendId), type(Type), invite(Invite), date(QDateTime::currentDateTime())
|
||||
/**
|
||||
* @class GroupInvite
|
||||
*
|
||||
* @brief This class contains information needed to create a group invite
|
||||
*/
|
||||
|
||||
GroupInvite::GroupInvite(int32_t friendID, uint8_t inviteType, const QByteArray& data)
|
||||
: friendId { friendID }
|
||||
, type { inviteType }
|
||||
, invite { data }
|
||||
, date { QDateTime::currentDateTime() }
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -1,3 +1,22 @@
|
|||
/*
|
||||
Copyright © 2017 by The qTox Project Contributors
|
||||
|
||||
This file is part of qTox, a Qt-based graphical interface for Tox.
|
||||
|
||||
qTox is libre software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
qTox is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with qTox. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GROUPINVITE_H
|
||||
#define GROUPINVITE_H
|
||||
|
||||
|
@ -8,7 +27,7 @@
|
|||
class GroupInvite
|
||||
{
|
||||
public:
|
||||
GroupInvite(const int32_t FriendId, const uint8_t Type, const QByteArray& Invite);
|
||||
GroupInvite(int32_t friendID, uint8_t inviteType, const QByteArray& data);
|
||||
bool operator ==(const GroupInvite& other) const;
|
||||
|
||||
int32_t getFriendId() const;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright © 2015 by The qTox Project Contributors
|
||||
Copyright © 2015-2017 by The qTox Project Contributors
|
||||
|
||||
This file is part of qTox, a Qt-based graphical interface for Tox.
|
||||
|
||||
|
@ -27,9 +27,6 @@
|
|||
#include "src/widget/translator.h"
|
||||
#include "ui_mainwindow.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <tox/tox.h>
|
||||
|
||||
#include <QVBoxLayout>
|
||||
#include <QDateTime>
|
||||
#include <QDebug>
|
||||
|
@ -39,6 +36,15 @@
|
|||
#include <QSignalMapper>
|
||||
#include <QWindow>
|
||||
|
||||
#include <algorithm>
|
||||
#include <tox/tox.h>
|
||||
|
||||
/**
|
||||
* @class GroupInviteForm
|
||||
*
|
||||
* @brief This form contains all group invites you received
|
||||
*/
|
||||
|
||||
GroupInviteForm::GroupInviteForm()
|
||||
: createButton(new QPushButton(this))
|
||||
, inviteBox(new QGroupBox(this))
|
||||
|
@ -47,7 +53,7 @@ GroupInviteForm::GroupInviteForm()
|
|||
, headWidget(new QWidget(this))
|
||||
{
|
||||
QVBoxLayout* layout = new QVBoxLayout(this);
|
||||
connect(createButton, &QPushButton::clicked, [=]()
|
||||
connect(createButton, &QPushButton::clicked, [this]()
|
||||
{
|
||||
emit groupCreate(TOX_CONFERENCE_TYPE_AV);
|
||||
});
|
||||
|
@ -80,6 +86,10 @@ GroupInviteForm::~GroupInviteForm()
|
|||
Translator::unregister(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Detects that form is shown
|
||||
* @return True if form is visible
|
||||
*/
|
||||
bool GroupInviteForm::isShown() const
|
||||
{
|
||||
bool result = isVisible();
|
||||
|
@ -90,6 +100,10 @@ bool GroupInviteForm::isShown() const
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Shows the form
|
||||
* @param contentLayout Main layout that contains all components of the form
|
||||
*/
|
||||
void GroupInviteForm::show(ContentLayout* contentLayout)
|
||||
{
|
||||
contentLayout->mainContent->layout()->addWidget(this);
|
||||
|
@ -98,20 +112,26 @@ void GroupInviteForm::show(ContentLayout* contentLayout)
|
|||
headWidget->show();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Adds group invite
|
||||
* @param friendId Id of a friend that invited you
|
||||
* @param type Type of the invitation - text or AV
|
||||
* @param invite Information that invited person needs to see an invitation
|
||||
*/
|
||||
void GroupInviteForm::addGroupInvite(int32_t friendId, uint8_t type, QByteArray invite)
|
||||
{
|
||||
GroupInviteWidget* addingInviteWidget = new GroupInviteWidget(this, GroupInvite(friendId, type, invite));
|
||||
scroll->widget()->layout()->addWidget(addingInviteWidget);
|
||||
invites.append(addingInviteWidget);
|
||||
connect(addingInviteWidget, &GroupInviteWidget::accepted,
|
||||
[=] (const GroupInvite& inviteInfo) {
|
||||
GroupInviteWidget* widget = new GroupInviteWidget(this, GroupInvite(friendId, type, invite));
|
||||
scroll->widget()->layout()->addWidget(widget);
|
||||
invites.append(widget);
|
||||
connect(widget, &GroupInviteWidget::accepted,
|
||||
[this] (const GroupInvite& inviteInfo) {
|
||||
deleteInviteWidget(inviteInfo);
|
||||
emit groupInviteAccepted(inviteInfo.getFriendId(),
|
||||
inviteInfo.getType(),
|
||||
inviteInfo.getInvite());
|
||||
});
|
||||
connect(addingInviteWidget, &GroupInviteWidget::rejected,
|
||||
[=] (const GroupInvite& inviteInfo) {
|
||||
connect(widget, &GroupInviteWidget::rejected,
|
||||
[this] (const GroupInvite& inviteInfo) {
|
||||
deleteInviteWidget(inviteInfo);
|
||||
});
|
||||
if (isVisible()) {
|
||||
|
@ -125,6 +145,10 @@ void GroupInviteForm::showEvent(QShowEvent* event)
|
|||
emit groupInvitesSeen();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Deletes accepted/declined group invite widget
|
||||
* @param inviteInfo Invite information of accepted/declined widget
|
||||
*/
|
||||
void GroupInviteForm::deleteInviteWidget(const GroupInvite &inviteInfo)
|
||||
{
|
||||
auto deletingWidget = std::find_if(invites.begin(), invites.end(),
|
||||
|
|
|
@ -1,3 +1,22 @@
|
|||
/*
|
||||
Copyright © 2017 by The qTox Project Contributors
|
||||
|
||||
This file is part of qTox, a Qt-based graphical interface for Tox.
|
||||
|
||||
qTox is libre software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
qTox is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with qTox. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "groupinvitewidget.h"
|
||||
|
||||
#include "src/core/core.h"
|
||||
|
@ -55,8 +74,8 @@ void GroupInviteWidget::retranslateUi()
|
|||
}
|
||||
|
||||
/**
|
||||
* @brief Returns invite information object
|
||||
* @return Returns invite information object
|
||||
* @brief Returns infomation about invitation - e.g., who and when sent
|
||||
* @return Invite information object
|
||||
*/
|
||||
const GroupInvite GroupInviteWidget::getInviteInfo() const
|
||||
{
|
||||
|
|
|
@ -1,3 +1,22 @@
|
|||
/*
|
||||
Copyright © 2017 by The qTox Project Contributors
|
||||
|
||||
This file is part of qTox, a Qt-based graphical interface for Tox.
|
||||
|
||||
qTox is libre software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
qTox is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with qTox. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef GROUPINVITEWIDGET_H
|
||||
#define GROUPINVITEWIDGET_H
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user