mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
style(groupinviteform): extracted few variables
This commit is contained in:
parent
f137ba710c
commit
24b28b1e51
|
@ -96,7 +96,9 @@ void GroupInviteForm::addGroupInvite(int32_t friendId, uint8_t type, QByteArray
|
||||||
QHBoxLayout* groupLayout = new QHBoxLayout(groupWidget);
|
QHBoxLayout* groupLayout = new QHBoxLayout(groupWidget);
|
||||||
|
|
||||||
CroppingLabel* groupLabel = new CroppingLabel(this);
|
CroppingLabel* groupLabel = new CroppingLabel(this);
|
||||||
groupLabel->setText(tr("Invited by <b>%1</b> on %2.").arg(Nexus::getCore()->getFriendUsername(friendId), QDateTime::currentDateTime().toString()));
|
QString name = Nexus::getCore()->getFriendUsername(friendId);
|
||||||
|
QString time = QDateTime::currentDateTime().toString();
|
||||||
|
groupLabel->setText(tr("Invited by <b>%1</b> on %2.").arg(name, time));
|
||||||
groupLayout->addWidget(groupLabel);
|
groupLayout->addWidget(groupLabel);
|
||||||
|
|
||||||
QPushButton* acceptButton = new QPushButton(this);
|
QPushButton* acceptButton = new QPushButton(this);
|
||||||
|
@ -153,7 +155,7 @@ void GroupInviteForm::onGroupInviteRejected()
|
||||||
deleteInviteButtons(groupWidget);
|
deleteInviteButtons(groupWidget);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GroupInviteForm::deleteInviteButtons(QWidget *widget)
|
void GroupInviteForm::deleteInviteButtons(QWidget* widget)
|
||||||
{
|
{
|
||||||
QList<QPushButton*> buttons = widget->findChildren<QPushButton*>();
|
QList<QPushButton*> buttons = widget->findChildren<QPushButton*>();
|
||||||
|
|
||||||
|
@ -188,12 +190,12 @@ void GroupInviteForm::retranslateUi()
|
||||||
retranslateRejectButton(rejectButton);
|
retranslateRejectButton(rejectButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GroupInviteForm::retranslateAcceptButton(QPushButton *acceptButton)
|
void GroupInviteForm::retranslateAcceptButton(QPushButton* acceptButton)
|
||||||
{
|
{
|
||||||
acceptButton->setText(tr("Join"));
|
acceptButton->setText(tr("Join"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void GroupInviteForm::retranslateRejectButton(QPushButton *rejectButton)
|
void GroupInviteForm::retranslateRejectButton(QPushButton* rejectButton)
|
||||||
{
|
{
|
||||||
rejectButton->setText(tr("Decline"));
|
rejectButton->setText(tr("Decline"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,8 +20,10 @@
|
||||||
#ifndef GROUPINVITEFORM_H
|
#ifndef GROUPINVITEFORM_H
|
||||||
#define GROUPINVITEFORM_H
|
#define GROUPINVITEFORM_H
|
||||||
|
|
||||||
|
#include <QDateTime>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QSet>
|
#include <QSet>
|
||||||
|
#include <src/widget/tool/croppinglabel.h>
|
||||||
#include "src/widget/gui.h"
|
#include "src/widget/gui.h"
|
||||||
|
|
||||||
class QLabel;
|
class QLabel;
|
||||||
|
@ -61,6 +63,7 @@ private:
|
||||||
void retranslateUi();
|
void retranslateUi();
|
||||||
void retranslateAcceptButton(QPushButton* acceptButton);
|
void retranslateAcceptButton(QPushButton* acceptButton);
|
||||||
void retranslateRejectButton(QPushButton* rejectButton);
|
void retranslateRejectButton(QPushButton* rejectButton);
|
||||||
|
void deleteInviteButtons(QWidget* widget);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct GroupInvite
|
struct GroupInvite
|
||||||
|
@ -78,7 +81,6 @@ 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…
Reference in New Issue
Block a user