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

fix sorting "by activity" #1948

fix spaces
This commit is contained in:
PKev 2015-07-01 14:07:34 +03:00
parent 1cbc9f51ed
commit efe05a3ca5

View File

@ -234,33 +234,33 @@ void FriendListWidget::setMode(Mode mode)
if (last7DaysWasLastMonth()) if (last7DaysWasLastMonth())
{ {
CategoryWidget* categoryThisMonth = new CategoryWidget(this); CategoryWidget* categoryThisMonth = new CategoryWidget(this);
categoryThisMonth ->setName(tr("This month", "Category for sorting friends by activity")); categoryThisMonth->setName(tr("This month", "Category for sorting friends by activity"));
activityLayout->addWidget(categoryThisMonth); activityLayout->addWidget(categoryThisMonth);
currentDate = currentDate.addMonths(-1); currentDate = currentDate.addMonths(-1);
} }
CategoryWidget* categoryLast1Month = new CategoryWidget(this); CategoryWidget* categoryLast1Month = new CategoryWidget(this);
categoryLast1Month ->setName(QDate::longMonthName(currentDate.month())); categoryLast1Month->setName(QDate::longMonthName(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(QDate::longMonthName(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(QDate::longMonthName(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(QDate::longMonthName(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(QDate::longMonthName(currentDate.month()));
activityLayout->addWidget(categoryLast5Month); activityLayout->addWidget(categoryLast5Month);
CategoryWidget* categoryOlder = new CategoryWidget(this); CategoryWidget* categoryOlder = new CategoryWidget(this);
@ -276,6 +276,8 @@ void FriendListWidget::setMode(Mode mode)
{ {
QDate activityDate = getDateFriend(contact); QDate activityDate = getDateFriend(contact);
Time time = getTime(activityDate); Time time = getTime(activityDate);
if (!last7DaysWasLastMonth())
time = (Time)(time-1);
CategoryWidget* categoryWidget = dynamic_cast<CategoryWidget*>(activityLayout->itemAt(time)->widget()); CategoryWidget* categoryWidget = dynamic_cast<CategoryWidget*>(activityLayout->itemAt(time)->widget());
categoryWidget->addFriendWidget(contact->getFriendWidget(), contact->getStatus()); categoryWidget->addFriendWidget(contact->getFriendWidget(), contact->getStatus());
} }