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

refactor(widget): fix static analyzer warning and some cleanup

This commit is contained in:
Nils Fenner 2016-07-30 16:45:01 +02:00 committed by Diadlo
parent 456e429cac
commit ec4a5d08ef
No known key found for this signature in database
GPG Key ID: 5AF9F2E29107C727
2 changed files with 6 additions and 7 deletions

View File

@ -354,7 +354,7 @@ void Widget::init()
ui->transferButton->setCheckable(true);
ui->settingsButton->setCheckable(true);
if (contentLayout != nullptr)
if (contentLayout)
{
onAddClicked();
}
@ -707,7 +707,7 @@ void Widget::onSeparateWindowChanged(bool separate, bool clicked)
size = ui->mainSplitter->widget(1)->size();
}
if (contentLayout != nullptr)
if (contentLayout)
{
contentLayout->clear();
contentLayout->parentWidget()->setParent(0); // Remove from splitter.
@ -1526,7 +1526,7 @@ void Widget::removeFriend(Friend* f, bool fake)
Nexus::getCore()->removeFriend(f->getFriendId(), fake);
delete f;
if (contentLayout != nullptr && contentLayout->mainHead->layout()->isEmpty())
if (contentLayout && contentLayout->mainHead->layout()->isEmpty())
{
onAddClicked();
}
@ -1814,7 +1814,7 @@ void Widget::removeGroup(Group* g, bool fake)
Nexus::getCore()->removeGroup(groupId, fake);
delete g;
if (contentLayout != nullptr && contentLayout->mainHead->layout()->isEmpty())
if (contentLayout && contentLayout->mainHead->layout()->isEmpty())
{
onAddClicked();
}
@ -2232,12 +2232,11 @@ QString Widget::getStatusIconPath(Status status)
case Status::Busy:
return ":/img/status/dot_busy.svg";
case Status::Offline:
default:
return ":/img/status/dot_offline.svg";
}
}
inline QIcon Widget::prepareIcon(QString path, uint32_t w, uint32_t h)
inline QIcon Widget::prepareIcon(QString path, int w, int h)
{
#ifdef Q_OS_LINUX

View File

@ -101,7 +101,7 @@ public:
void reloadTheme();
static QString getStatusIconPath(Status status);
static inline QIcon prepareIcon(QString path, uint32_t w=0, uint32_t h=0);
static inline QIcon prepareIcon(QString path, int w = 0, int h = 0);
static QPixmap getStatusIconPixmap(QString path, uint32_t w, uint32_t h);
static QString getStatusTitle(Status status);
static Status getStatusFromString(QString status);