From a1e228e60d902f934c6194d4a1be5a85a073a97b Mon Sep 17 00:00:00 2001 From: zero-one Date: Mon, 23 Mar 2015 02:38:24 -0700 Subject: [PATCH] style fixes to conform to Allman style --- src/widget/form/settings/generalsettings.ui | 4 ++-- src/widget/friendlistwidget.cpp | 23 ++++++++++++++------- src/widget/widget.cpp | 9 +++++--- 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/src/widget/form/settings/generalsettings.ui b/src/widget/form/settings/generalsettings.ui index 33455d886..56d72f191 100644 --- a/src/widget/form/settings/generalsettings.ui +++ b/src/widget/form/settings/generalsettings.ui @@ -373,7 +373,7 @@ instead of system taskbar. - Messages you are trying to send your friends when they are not online + Messages you are trying to send to your friends when they are not online will be sent to them when they appear online to you. @@ -394,7 +394,7 @@ will be sent to them when they appear online to you. - If checked, groupchats will be placed at the top of the friends list, otherwise, they'll be placed at the bottom. + If checked, groupchats will be placed at the top of the friends list, otherwise, they'll be placed below online friends. Place groupchats at top of friend list diff --git a/src/widget/friendlistwidget.cpp b/src/widget/friendlistwidget.cpp index 128bc2fcc..5ba9f2598 100644 --- a/src/widget/friendlistwidget.cpp +++ b/src/widget/friendlistwidget.cpp @@ -42,12 +42,14 @@ FriendListWidget::FriendListWidget(QWidget *parent, bool groupchatPosition) : layouts[static_cast(s)] = l; } - if(groupchatPosition){ + if(groupchatPosition) + { mainLayout->addLayout(groupLayout, 0, 0); mainLayout->addLayout(layouts[static_cast(Status::Online)], 1, 0); mainLayout->addLayout(layouts[static_cast(Status::Offline)], 2, 0); } - else{ + else + { mainLayout->addLayout(layouts[static_cast(Status::Online)], 0, 0); mainLayout->addLayout(groupLayout, 1, 0); mainLayout->addLayout(layouts[static_cast(Status::Offline)], 2, 0); @@ -73,11 +75,13 @@ void FriendListWidget::onGroupchatPositionChanged(bool top) { mainLayout->removeItem(groupLayout); mainLayout->removeItem(getFriendLayout(Status::Online)); - if(top){ + if(top) + { mainLayout->addLayout(groupLayout, 0, 0); mainLayout->addLayout(layouts[static_cast(Status::Online)], 1, 0); } - else{ + else + { mainLayout->addLayout(layouts[static_cast(Status::Online)], 0, 0); mainLayout->addLayout(groupLayout, 1, 0); } @@ -85,14 +89,17 @@ void FriendListWidget::onGroupchatPositionChanged(bool top) void FriendListWidget::moveWidget(QWidget *w, Status s, int hasNewEvents) { - getFriendLayout(s)->removeWidget(w); QVBoxLayout* l = getFriendLayout(s); + l->removeWidget(w); Friend* g = FriendList::findFriend(dynamic_cast(w)->friendId); - for(int i = 0; i < l->count(); i++){ + for(int i = 0; i < l->count(); i++) + { FriendWidget* w1 = dynamic_cast(l->itemAt(i)->widget()); - if(w1 != NULL){ + if(w1 != NULL) + { Friend* f = FriendList::findFriend(w1->friendId); - if(f->getDisplayedName().localeAwareCompare(g->getDisplayedName()) > 0){ + if(f->getDisplayedName().localeAwareCompare(g->getDisplayedName()) > 0) + { l->insertWidget(i,w); return; } diff --git a/src/widget/widget.cpp b/src/widget/widget.cpp index fc692fc76..1d4b3f5c8 100644 --- a/src/widget/widget.cpp +++ b/src/widget/widget.cpp @@ -629,11 +629,14 @@ void Widget::onFriendStatusChanged(int friendId, Status status) bool isActualChange = f->getStatus() != status; - if(isActualChange){ - if(f->getStatus() == Status::Offline){ + if(isActualChange) + { + if(f->getStatus() == Status::Offline) + { contactListWidget->moveWidget(f->getFriendWidget(), Status::Online, f->getEventFlag()); } - else if(status == Status::Offline){ + else if(status == Status::Offline) + { contactListWidget->moveWidget(f->getFriendWidget(), Status::Offline, f->getEventFlag()); } }