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

refactor: minor cleanup in Widget and Friend

This commit is contained in:
Nils Fenner 2016-08-17 10:20:06 +02:00 committed by Diadlo
parent bdbf2b461b
commit 456e429cac
No known key found for this signature in database
GPG Key ID: 5AF9F2E29107C727
2 changed files with 5 additions and 8 deletions

View File

@ -86,7 +86,7 @@ void Friend::setName(QString name)
void Friend::setAlias(QString name) void Friend::setAlias(QString name)
{ {
userAlias = name; userAlias = name;
QString dispName = userAlias.size() == 0 ? userName : userAlias; QString dispName = userAlias.isEmpty() ? userName : userAlias;
widget->setName(dispName); widget->setName(dispName);
chatForm->setName(dispName); chatForm->setName(dispName);
@ -116,10 +116,7 @@ QString Friend::getStatusMessage()
QString Friend::getDisplayedName() const QString Friend::getDisplayedName() const
{ {
if (userAlias.size() == 0) return userAlias.isEmpty() ? userName : userAlias;
return userName;
return userAlias;
} }
bool Friend::hasAlias() const bool Friend::hasAlias() const

View File

@ -413,14 +413,14 @@ bool Widget::eventFilter(QObject *obj, QEvent *event)
{ {
case QEvent::Close: case QEvent::Close:
// It's needed if user enable `Close to tray` // It's needed if user enable `Close to tray`
wasMaximized = state & Qt::WindowMaximized; wasMaximized = state.testFlag(Qt::WindowMaximized);
break; break;
case QEvent::WindowStateChange: case QEvent::WindowStateChange:
ce = static_cast<QWindowStateChangeEvent*>(event); ce = static_cast<QWindowStateChangeEvent*>(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 #ifdef Q_OS_MAC