From 24b28b1e5192adf073566098687d73801273ff18 Mon Sep 17 00:00:00 2001 From: Diadlo Date: Sun, 10 Apr 2016 13:57:52 +0300 Subject: [PATCH] style(groupinviteform): extracted few variables --- src/widget/form/groupinviteform.cpp | 10 ++++++---- src/widget/form/groupinviteform.h | 4 +++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/widget/form/groupinviteform.cpp b/src/widget/form/groupinviteform.cpp index 904487f56..f62435894 100644 --- a/src/widget/form/groupinviteform.cpp +++ b/src/widget/form/groupinviteform.cpp @@ -96,7 +96,9 @@ void GroupInviteForm::addGroupInvite(int32_t friendId, uint8_t type, QByteArray QHBoxLayout* groupLayout = new QHBoxLayout(groupWidget); CroppingLabel* groupLabel = new CroppingLabel(this); - groupLabel->setText(tr("Invited by %1 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 %1 on %2.").arg(name, time)); groupLayout->addWidget(groupLabel); QPushButton* acceptButton = new QPushButton(this); @@ -153,7 +155,7 @@ void GroupInviteForm::onGroupInviteRejected() deleteInviteButtons(groupWidget); } -void GroupInviteForm::deleteInviteButtons(QWidget *widget) +void GroupInviteForm::deleteInviteButtons(QWidget* widget) { QList buttons = widget->findChildren(); @@ -188,12 +190,12 @@ void GroupInviteForm::retranslateUi() retranslateRejectButton(rejectButton); } -void GroupInviteForm::retranslateAcceptButton(QPushButton *acceptButton) +void GroupInviteForm::retranslateAcceptButton(QPushButton* acceptButton) { acceptButton->setText(tr("Join")); } -void GroupInviteForm::retranslateRejectButton(QPushButton *rejectButton) +void GroupInviteForm::retranslateRejectButton(QPushButton* rejectButton) { rejectButton->setText(tr("Decline")); } diff --git a/src/widget/form/groupinviteform.h b/src/widget/form/groupinviteform.h index 406dcafa1..93993ffc7 100644 --- a/src/widget/form/groupinviteform.h +++ b/src/widget/form/groupinviteform.h @@ -20,8 +20,10 @@ #ifndef GROUPINVITEFORM_H #define GROUPINVITEFORM_H +#include #include #include +#include #include "src/widget/gui.h" class QLabel; @@ -61,6 +63,7 @@ private: void retranslateUi(); void retranslateAcceptButton(QPushButton* acceptButton); void retranslateRejectButton(QPushButton* rejectButton); + void deleteInviteButtons(QWidget* widget); private: struct GroupInvite @@ -78,7 +81,6 @@ private: QSet acceptButtons; QSet rejectButtons; QList groupInvites; - void deleteInviteButtons(QWidget *widget); }; #endif // GROUPINVITEFORM_H