mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
refactor(groupinvite): remove HTML from translation and simplify function
This commit is contained in:
parent
b55933281f
commit
12df069eaa
|
@ -105,14 +105,18 @@ void GroupInviteForm::addGroupInvite(int32_t friendId, uint8_t type, QByteArray
|
|||
QWidget* groupWidget = new QWidget(this);
|
||||
QHBoxLayout* groupLayout = new QHBoxLayout(groupWidget);
|
||||
|
||||
GroupInvite group;
|
||||
group.friendId = friendId;
|
||||
group.type = type;
|
||||
group.invite = invite;
|
||||
group.time = QDateTime::currentDateTime();
|
||||
groupInvites.push_front(group);
|
||||
|
||||
CroppingLabel* groupLabel = new CroppingLabel(this);
|
||||
groupLabels.insert(groupLabel);
|
||||
QString name = Nexus::getCore()->getFriendUsername(friendId);
|
||||
QDateTime currentDateTime = QDateTime::currentDateTime();
|
||||
QString date = currentDateTime.toString(Settings::getInstance().getDateFormat());
|
||||
QString time = currentDateTime.toString(Settings::getInstance().getTimestampFormat());
|
||||
groupLabel->setText(tr("Invited by <b>%1</b> on %2 at %3.").arg(name.toHtmlEscaped(), date, time));
|
||||
groupLayout->addWidget(groupLabel);
|
||||
scroll->widget()->layout()->addWidget(groupWidget);
|
||||
retranslateGroupLabel(groupLabel);
|
||||
|
||||
QPushButton* acceptButton = new QPushButton(this);
|
||||
acceptButtons.insert(acceptButton);
|
||||
|
@ -126,15 +130,6 @@ void GroupInviteForm::addGroupInvite(int32_t friendId, uint8_t type, QByteArray
|
|||
groupLayout->addWidget(rejectButton);
|
||||
retranslateRejectButton(rejectButton);
|
||||
|
||||
scroll->widget()->layout()->addWidget(groupWidget);
|
||||
|
||||
GroupInvite group;
|
||||
group.friendId = friendId;
|
||||
group.type = type;
|
||||
group.invite = invite;
|
||||
group.time = QDateTime::currentDateTime();
|
||||
groupInvites.push_front(group);
|
||||
|
||||
if (isVisible())
|
||||
emit groupInvitesSeen();
|
||||
}
|
||||
|
@ -212,7 +207,7 @@ void GroupInviteForm::retranslateGroupLabel(CroppingLabel* label)
|
|||
QString date = invite.time.toString(Settings::getInstance().getDateFormat());
|
||||
QString time = invite.time.toString(Settings::getInstance().getTimestampFormat());
|
||||
|
||||
label->setText(tr("Invited by <b>%1</b> on %2 at %3.").arg(name.toHtmlEscaped(), date, time));
|
||||
label->setText(tr("Invited by %1 on %2 at %3.").arg("<b>" + name.toHtmlEscaped() + "</b>", date, time));
|
||||
}
|
||||
|
||||
void GroupInviteForm::retranslateAcceptButton(QPushButton* acceptButton)
|
||||
|
|
Loading…
Reference in New Issue
Block a user