refactor(groupinvite): remove HTML from translation and simplify function

pull/3596/head
sudden6 2016-08-06 12:48:42 +02:00
parent b55933281f
commit 12df069eaa
No known key found for this signature in database
GPG Key ID: 279509B499E032B9
1 changed files with 10 additions and 15 deletions

View File

@ -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)