From ec4a5d08efb3d1132786a73f68e19ef43d18b332 Mon Sep 17 00:00:00 2001 From: Nils Fenner Date: Sat, 30 Jul 2016 16:45:01 +0200 Subject: [PATCH] refactor(widget): fix static analyzer warning and some cleanup --- src/widget/widget.cpp | 11 +++++------ src/widget/widget.h | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/widget/widget.cpp b/src/widget/widget.cpp index 7b5844e8f..cee01562d 100644 --- a/src/widget/widget.cpp +++ b/src/widget/widget.cpp @@ -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 diff --git a/src/widget/widget.h b/src/widget/widget.h index 3b6ac3d6e..8e934a0b4 100644 --- a/src/widget/widget.h +++ b/src/widget/widget.h @@ -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);