mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
parent
0a2f541945
commit
f137ba710c
@ -20,6 +20,7 @@
|
|||||||
#include "groupinviteform.h"
|
#include "groupinviteform.h"
|
||||||
|
|
||||||
#include <tox/tox.h>
|
#include <tox/tox.h>
|
||||||
|
#include <QDebug>
|
||||||
#include <QSignalMapper>
|
#include <QSignalMapper>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QBoxLayout>
|
#include <QBoxLayout>
|
||||||
@ -136,8 +137,7 @@ void GroupInviteForm::onGroupInviteAccepted()
|
|||||||
GroupInvite invite = groupInvites.at(index);
|
GroupInvite invite = groupInvites.at(index);
|
||||||
groupInvites.removeAt(index);
|
groupInvites.removeAt(index);
|
||||||
|
|
||||||
groupWidget->deleteLater();
|
deleteInviteButtons(groupWidget);
|
||||||
inviteLayout->removeWidget(groupWidget);
|
|
||||||
|
|
||||||
emit groupInviteAccepted(invite.friendId, invite.type, invite.invite);
|
emit groupInviteAccepted(invite.friendId, invite.type, invite.invite);
|
||||||
}
|
}
|
||||||
@ -149,8 +149,27 @@ void GroupInviteForm::onGroupInviteRejected()
|
|||||||
int index = inviteLayout->indexOf(groupWidget);
|
int index = inviteLayout->indexOf(groupWidget);
|
||||||
groupInvites.removeAt(index);
|
groupInvites.removeAt(index);
|
||||||
|
|
||||||
groupWidget->deleteLater();
|
|
||||||
inviteLayout->removeWidget(groupWidget);
|
deleteInviteButtons(groupWidget);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GroupInviteForm::deleteInviteButtons(QWidget *widget)
|
||||||
|
{
|
||||||
|
QList<QPushButton*> buttons = widget->findChildren<QPushButton*>();
|
||||||
|
|
||||||
|
if (acceptButtons.contains(buttons.at(0)))
|
||||||
|
{
|
||||||
|
acceptButtons.remove(buttons.at(0));
|
||||||
|
rejectButtons.remove(buttons.at(1));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
acceptButtons.remove(buttons.at(1));
|
||||||
|
rejectButtons.remove(buttons.at(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
widget->deleteLater();
|
||||||
|
inviteLayout->removeWidget(widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GroupInviteForm::retranslateUi()
|
void GroupInviteForm::retranslateUi()
|
||||||
|
@ -78,6 +78,7 @@ private:
|
|||||||
QSet<QPushButton*> acceptButtons;
|
QSet<QPushButton*> acceptButtons;
|
||||||
QSet<QPushButton*> rejectButtons;
|
QSet<QPushButton*> rejectButtons;
|
||||||
QList<GroupInvite> groupInvites;
|
QList<GroupInvite> groupInvites;
|
||||||
|
void deleteInviteButtons(QWidget *widget);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // GROUPINVITEFORM_H
|
#endif // GROUPINVITEFORM_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user