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:
parent
bdbf2b461b
commit
456e429cac
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user