1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

feat(i18n): Make activity by time labels translated by locale

This commit is contained in:
agilob 2016-05-10 15:33:15 +01:00 committed by Zetok Zalbavar
parent 3e22593ae7
commit f2aada8f4f
No known key found for this signature in database
GPG Key ID: C953D3880212068A

View File

@ -254,28 +254,30 @@ void FriendListWidget::setMode(Mode mode)
currentDate = currentDate.addMonths(-1); currentDate = currentDate.addMonths(-1);
} }
QLocale *ql = new QLocale(Settings::getInstance().getTranslation());
CategoryWidget* categoryLast1Month = new CategoryWidget(this); CategoryWidget* categoryLast1Month = new CategoryWidget(this);
categoryLast1Month->setName(QDate::longMonthName(currentDate.month())); categoryLast1Month->setName(ql->monthName(currentDate.month()));
activityLayout->addWidget(categoryLast1Month); activityLayout->addWidget(categoryLast1Month);
currentDate = currentDate.addMonths(-1); currentDate = currentDate.addMonths(-1);
CategoryWidget* categoryLast2Month = new CategoryWidget(this); CategoryWidget* categoryLast2Month = new CategoryWidget(this);
categoryLast2Month->setName(QDate::longMonthName(currentDate.month())); categoryLast2Month->setName(ql->monthName(currentDate.month()));
activityLayout->addWidget(categoryLast2Month); activityLayout->addWidget(categoryLast2Month);
currentDate = currentDate.addMonths(-1); currentDate = currentDate.addMonths(-1);
CategoryWidget* categoryLast3Month = new CategoryWidget(this); CategoryWidget* categoryLast3Month = new CategoryWidget(this);
categoryLast3Month->setName(QDate::longMonthName(currentDate.month())); categoryLast3Month->setName(ql->monthName(currentDate.month()));
activityLayout->addWidget(categoryLast3Month); activityLayout->addWidget(categoryLast3Month);
currentDate = currentDate.addMonths(-1); currentDate = currentDate.addMonths(-1);
CategoryWidget* categoryLast4Month = new CategoryWidget(this); CategoryWidget* categoryLast4Month = new CategoryWidget(this);
categoryLast4Month->setName(QDate::longMonthName(currentDate.month())); categoryLast4Month->setName(ql->monthName(currentDate.month()));
activityLayout->addWidget(categoryLast4Month); activityLayout->addWidget(categoryLast4Month);
currentDate = currentDate.addMonths(-1); currentDate = currentDate.addMonths(-1);
CategoryWidget* categoryLast5Month = new CategoryWidget(this); CategoryWidget* categoryLast5Month = new CategoryWidget(this);
categoryLast5Month->setName(QDate::longMonthName(currentDate.month())); categoryLast5Month->setName(ql->monthName(currentDate.month()));
activityLayout->addWidget(categoryLast5Month); activityLayout->addWidget(categoryLast5Month);
CategoryWidget* categoryOlder = new CategoryWidget(this); CategoryWidget* categoryOlder = new CategoryWidget(this);
@ -286,6 +288,9 @@ void FriendListWidget::setMode(Mode mode)
categoryNever->setName(tr("Unknown", "Category for sorting friends by activity")); categoryNever->setName(tr("Unknown", "Category for sorting friends by activity"));
activityLayout->addWidget(categoryNever); activityLayout->addWidget(categoryNever);
delete ql;
ql = 0;
QList<Friend*> friendList = FriendList::getAllFriends(); QList<Friend*> friendList = FriendList::getAllFriends();
for (Friend* contact : friendList) for (Friend* contact : friendList)
{ {