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

Merges Away, Busy, and Online friend list layouts into a single layout.

Also comments out the debug output in
FriendListWidget::getFriendLayout() because hitting the default return
statement is no longer anomalous behavior.
This commit is contained in:
zero-one 2015-03-11 17:30:01 -07:00
parent fdb4fef374
commit 4a875ce8f5
2 changed files with 12 additions and 5 deletions

View File

@ -33,7 +33,7 @@ FriendListWidget::FriendListWidget(QWidget *parent) :
groupLayout->setSpacing(0);
groupLayout->setMargin(0);
for (Status s : {Status::Online, Status::Away, Status::Busy, Status::Offline})
for (Status s : {Status::Online, Status::Offline})
{
QVBoxLayout *l = new QVBoxLayout();
l->setSpacing(0);
@ -60,7 +60,7 @@ QVBoxLayout* FriendListWidget::getFriendLayout(Status s)
if (res != layouts.end())
return res.value();
qDebug() << "Friend Status: " << static_cast<int>(s) << " not found!";
//qDebug() << "Friend Status: " << static_cast<int>(s) << " not found!";
return layouts[static_cast<int>(Status::Online)];
}

View File

@ -623,11 +623,18 @@ void Widget::onFriendStatusChanged(int friendId, Status status)
Friend* f = FriendList::findFriend(friendId);
if (!f)
return;
contactListWidget->moveWidget(f->getFriendWidget(), status, f->getEventFlag());
bool isActualChange = f->getStatus() != status;
if(isActualChange){
if(f->getStatus() == Status::Offline){
contactListWidget->moveWidget(f->getFriendWidget(), Status::Online, f->getEventFlag());
}
else if(status == Status::Offline){
contactListWidget->moveWidget(f->getFriendWidget(), Status::Offline, f->getEventFlag());
}
}
f->setStatus(status);
f->getFriendWidget()->updateStatusLight();