From 456e429cacf97233e71df86fc36dde50cd0fa34f Mon Sep 17 00:00:00 2001 From: Nils Fenner Date: Wed, 17 Aug 2016 10:20:06 +0200 Subject: [PATCH] refactor: minor cleanup in Widget and Friend --- src/friend.cpp | 7 ++----- src/widget/widget.cpp | 6 +++--- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/src/friend.cpp b/src/friend.cpp index cba8b33a8..167419dfe 100644 --- a/src/friend.cpp +++ b/src/friend.cpp @@ -86,7 +86,7 @@ void Friend::setName(QString name) void Friend::setAlias(QString name) { userAlias = name; - QString dispName = userAlias.size() == 0 ? userName : userAlias; + QString dispName = userAlias.isEmpty() ? userName : userAlias; widget->setName(dispName); chatForm->setName(dispName); @@ -116,10 +116,7 @@ QString Friend::getStatusMessage() QString Friend::getDisplayedName() const { - if (userAlias.size() == 0) - return userName; - - return userAlias; + return userAlias.isEmpty() ? userName : userAlias; } bool Friend::hasAlias() const diff --git a/src/widget/widget.cpp b/src/widget/widget.cpp index 318fb0600..7b5844e8f 100644 --- a/src/widget/widget.cpp +++ b/src/widget/widget.cpp @@ -413,14 +413,14 @@ bool Widget::eventFilter(QObject *obj, QEvent *event) { case QEvent::Close: // It's needed if user enable `Close to tray` - wasMaximized = state & Qt::WindowMaximized; + wasMaximized = state.testFlag(Qt::WindowMaximized); break; case QEvent::WindowStateChange: ce = static_cast(event); - if (state & Qt::WindowMinimized && obj) + if (state.testFlag(Qt::WindowMinimized) && obj) { - wasMaximized = ce->oldState() & Qt::WindowMaximized; + wasMaximized = ce->oldState().testFlag(Qt::WindowMaximized); } #ifdef Q_OS_MAC