1
0
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:
Diadlo 2016-04-10 13:57:52 +03:00
parent f137ba710c
commit 24b28b1e51
2 changed files with 9 additions and 5 deletions

View File

@ -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 <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);
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<QPushButton*> buttons = widget->findChildren<QPushButton*>();
@ -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"));
}

View File

@ -20,8 +20,10 @@
#ifndef GROUPINVITEFORM_H
#define GROUPINVITEFORM_H
#include <QDateTime>
#include <QWidget>
#include <QSet>
#include <src/widget/tool/croppinglabel.h>
#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<QPushButton*> acceptButtons;
QSet<QPushButton*> rejectButtons;
QList<GroupInvite> groupInvites;
void deleteInviteButtons(QWidget *widget);
};
#endif // GROUPINVITEFORM_H