diff options
author | Tobias Markmann <tm@ayena.de> | 2018-05-03 19:03:38 (GMT) |
---|---|---|
committer | Kevin Smith <kevin.smith@isode.com> | 2018-05-04 09:01:08 (GMT) |
commit | 202c114d6b1daa1ea1d4693c434bd8daabd41ad1 (patch) | |
tree | f00855f5d3bb2aee0e420b0b848b31ec69dbed44 /Swift/QtUI | |
parent | a74aa7d27f6f5b1ddcb152fb69d00044594374af (diff) | |
download | swift-202c114d6b1daa1ea1d4693c434bd8daabd41ad1.zip swift-202c114d6b1daa1ea1d4693c434bd8daabd41ad1.tar.bz2 |
Fix issues raised by some warnings and reenable them in Swift
Test-Information:
Builds and test pass on macOS 10.13.4 with clang trunk.
Change-Id: Ib4826c38a85fd2097137c09014ba4da6c98879da
Diffstat (limited to 'Swift/QtUI')
-rw-r--r-- | Swift/QtUI/FlowLayout.cpp | 7 | ||||
-rw-r--r-- | Swift/QtUI/QtEmojisScroll.h | 4 | ||||
-rw-r--r-- | Swift/QtUI/QtEmojisSelector.h | 4 | ||||
-rw-r--r-- | Swift/QtUI/QtHighlightNotificationConfigDialog.cpp | 6 | ||||
-rw-r--r-- | Swift/QtUI/QtPlainChatView.cpp | 4 | ||||
-rw-r--r-- | Swift/QtUI/QtVCardWidget/QtVCardFieldInfo.h | 4 | ||||
-rw-r--r-- | Swift/QtUI/QtVCardWidget/QtVCardWidget.cpp | 4 | ||||
-rw-r--r-- | Swift/QtUI/SConscript | 2 | ||||
-rw-r--r-- | Swift/QtUI/Trellis/QtGridSelectionDialog.cpp | 6 | ||||
-rw-r--r-- | Swift/QtUI/UserSearch/ContactListModel.cpp | 28 |
10 files changed, 21 insertions, 48 deletions
diff --git a/Swift/QtUI/FlowLayout.cpp b/Swift/QtUI/FlowLayout.cpp index c42b7e1..8a12841 100644 --- a/Swift/QtUI/FlowLayout.cpp +++ b/Swift/QtUI/FlowLayout.cpp @@ -49,7 +49,6 @@ ****************************************************************************/ #include <QtWidgets> - #include "FlowLayout.h" FlowLayout::FlowLayout(QWidget *parent, int margin, int hSpacing, int vSpacing) : QLayout(parent), m_hSpace(hSpacing), m_vSpace(vSpacing) @@ -108,12 +107,12 @@ QLayoutItem *FlowLayout::takeAt(int index) if (index >= 0 && index < itemList.size()) return itemList.takeAt(index); else - return 0; + return nullptr; } Qt::Orientations FlowLayout::expandingDirections() const { - return 0; + return nullptr; } bool FlowLayout::hasHeightForWidth() const @@ -192,7 +191,7 @@ int FlowLayout::smartSpacing(QStyle::PixelMetric pm) const return -1; } else if (parent->isWidgetType()) { QWidget *pw = static_cast<QWidget *>(parent); - return pw->style()->pixelMetric(pm, 0, pw); + return pw->style()->pixelMetric(pm, nullptr, pw); } else { return static_cast<QLayout *>(parent)->spacing(); } diff --git a/Swift/QtUI/QtEmojisScroll.h b/Swift/QtUI/QtEmojisScroll.h index 959ab5f..f954c2d 100644 --- a/Swift/QtUI/QtEmojisScroll.h +++ b/Swift/QtUI/QtEmojisScroll.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017 Isode Limited. + * Copyright (c) 2016-2018 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -13,6 +13,6 @@ namespace Swift { class QtEmojisScroll : public QWidget { Q_OBJECT public: - QtEmojisScroll(QLayout* emojiLayout, QWidget *parent = 0); + QtEmojisScroll(QLayout* emojiLayout, QWidget* parent = nullptr); }; } diff --git a/Swift/QtUI/QtEmojisSelector.h b/Swift/QtUI/QtEmojisSelector.h index 7ac11d0..1a64cf4 100644 --- a/Swift/QtUI/QtEmojisSelector.h +++ b/Swift/QtUI/QtEmojisSelector.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017 Isode Limited. + * Copyright (c) 2016-2018 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -20,7 +20,7 @@ namespace Swift { class QtEmojisSelector : public QTabWidget { Q_OBJECT public: - QtEmojisSelector(QSettings* settings, const std::map<std::string, std::string>& emoticonsMap, QWidget * parent = 0); + QtEmojisSelector(QSettings* settings, const std::map<std::string, std::string>& emoticonsMap, QWidget* parent = nullptr); ~QtEmojisSelector(); public slots: diff --git a/Swift/QtUI/QtHighlightNotificationConfigDialog.cpp b/Swift/QtUI/QtHighlightNotificationConfigDialog.cpp index 19274a2..0521a2d 100644 --- a/Swift/QtUI/QtHighlightNotificationConfigDialog.cpp +++ b/Swift/QtUI/QtHighlightNotificationConfigDialog.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017 Isode Limited. + * Copyright (c) 2016-2018 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -50,7 +50,7 @@ QtHighlightNotificationConfigDialog::QtHighlightNotificationConfigDialog(QtSetti } }); connect(ui_.userHighlightTreeWidget, &QTreeWidget::currentItemChanged, [&](QTreeWidgetItem* current, QTreeWidgetItem* ) { - ui_.removeUserHighlightPushButton->setEnabled(current != 0); + ui_.removeUserHighlightPushButton->setEnabled(current != nullptr); }); // keyword highlight edit slots @@ -72,7 +72,7 @@ QtHighlightNotificationConfigDialog::QtHighlightNotificationConfigDialog(QtSetti } }); connect(ui_.keywordHighlightTreeWidget, &QTreeWidget::currentItemChanged, [&](QTreeWidgetItem* current, QTreeWidgetItem* ) { - ui_.removeKeywordHighlightPushButton->setEnabled(current != 0); + ui_.removeKeywordHighlightPushButton->setEnabled(current != nullptr); }); // setup slots for main dialog buttons diff --git a/Swift/QtUI/QtPlainChatView.cpp b/Swift/QtUI/QtPlainChatView.cpp index 7e9c857..5d23923 100644 --- a/Swift/QtUI/QtPlainChatView.cpp +++ b/Swift/QtUI/QtPlainChatView.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013-2017 Isode Limited. + * Copyright (c) 2013-2018 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -42,7 +42,7 @@ QtPlainChatView::QtPlainChatView(QtChatWindow *window, UIEventStream* eventStrea QtPlainChatView::~QtPlainChatView() { } -QString chatMessageToString(const ChatWindow::ChatMessage& message) { +static QString chatMessageToString(const ChatWindow::ChatMessage& message) { QString result; for (auto&& part : message.getParts()) { std::shared_ptr<ChatWindow::ChatTextMessagePart> textPart; diff --git a/Swift/QtUI/QtVCardWidget/QtVCardFieldInfo.h b/Swift/QtUI/QtVCardWidget/QtVCardFieldInfo.h index 093357a..fa42c49 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardFieldInfo.h +++ b/Swift/QtUI/QtVCardWidget/QtVCardFieldInfo.h @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2016 Isode Limited. + * Copyright (c) 2016-2018 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -36,7 +36,7 @@ } \ \ virtual bool testInstance(QWidget* widget) const { \ - return dynamic_cast<FIELD_CLASS*>(widget) != 0; \ + return dynamic_cast<FIELD_CLASS*>(widget) != nullptr; \ } \ }; diff --git a/Swift/QtUI/QtVCardWidget/QtVCardWidget.cpp b/Swift/QtUI/QtVCardWidget/QtVCardWidget.cpp index 290feca..1cd5505 100644 --- a/Swift/QtUI/QtVCardWidget/QtVCardWidget.cpp +++ b/Swift/QtUI/QtVCardWidget/QtVCardWidget.cpp @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2014-2016 Isode Limited. + * Copyright (c) 2014-2018 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -358,7 +358,7 @@ int QtVCardWidget::fieldTypeInstances(std::shared_ptr<QtVCardFieldInfo> fieldTyp return instances; } -void layoutDeleteChildren(QLayout *layout) { +static void layoutDeleteChildren(QLayout *layout) { while(layout->count() > 0) { QLayoutItem* child; if ((child = layout->takeAt(0)) != nullptr) { diff --git a/Swift/QtUI/SConscript b/Swift/QtUI/SConscript index a61cbbf..e61bdcf 100644 --- a/Swift/QtUI/SConscript +++ b/Swift/QtUI/SConscript @@ -24,7 +24,7 @@ myenv = env.Clone() # Disable warnings that affect Qt myenv["CXXFLAGS"] = filter(lambda x : x != "-Wfloat-equal", myenv["CXXFLAGS"]) if "clang" in env["CC"] : - myenv.Append(CXXFLAGS = ["-Wno-float-equal", "-Wno-shorten-64-to-32", "-Wno-missing-prototypes", "-Wno-unreachable-code", "-Wno-disabled-macro-expansion", "-Wno-unused-private-field", "-Wno-extra-semi", "-Wno-duplicate-enum", "-Wno-missing-variable-declarations", "-Wno-conversion", "-Wno-undefined-reinterpret-cast", "-Wno-zero-as-null-pointer-constant"]) + myenv.Append(CXXFLAGS = ["-Wno-float-equal", "-Wno-shorten-64-to-32", "-Wno-conversion"]) myenv.UseFlags(env["SWIFT_CONTROLLERS_FLAGS"]) myenv.UseFlags(env["SWIFTOOLS_FLAGS"]) diff --git a/Swift/QtUI/Trellis/QtGridSelectionDialog.cpp b/Swift/QtUI/Trellis/QtGridSelectionDialog.cpp index 0533edf..e922e07 100644 --- a/Swift/QtUI/Trellis/QtGridSelectionDialog.cpp +++ b/Swift/QtUI/Trellis/QtGridSelectionDialog.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014-2016 Isode Limited. + * Copyright (c) 2014-2018 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -76,7 +76,7 @@ int QtGridSelectionDialog::getDescriptionTextHeight() const { int QtGridSelectionDialog::getDescriptionTextHeight(int width) const { // Height of descriptive centered text below trellis auto fontMetrics = QFontMetrics(QApplication::font()); - auto descriptionBB = fontMetrics.boundingRect(QRect(0, 0, width - 2 * horizontalMargin, 1000), Qt::TextWordWrap, descriptionText, 0, 0); + auto descriptionBB = fontMetrics.boundingRect(QRect(0, 0, width - 2 * horizontalMargin, 1000), Qt::TextWordWrap, descriptionText, 0, nullptr); return (descriptionBB.height() + descriptionBB.y()); } @@ -136,7 +136,7 @@ void QtGridSelectionDialog::paintEvent(QPaintEvent*) { // draw description text auto fontMetrics = QFontMetrics(QApplication::font()); - auto descriptionBB = fontMetrics.boundingRect(QRect(0,0, width() - 2 * horizontalMargin,0), Qt::AlignHCenter | Qt::AlignTop | Qt::TextWordWrap, descriptionText, 0, 0); + auto descriptionBB = fontMetrics.boundingRect(QRect(0,0, width() - 2 * horizontalMargin,0), Qt::AlignHCenter | Qt::AlignTop | Qt::TextWordWrap, descriptionText, 0, nullptr); QStyleOption opt; opt.initFrom(this); diff --git a/Swift/QtUI/UserSearch/ContactListModel.cpp b/Swift/QtUI/UserSearch/ContactListModel.cpp index 6ef85d7..5d8aa6c 100644 --- a/Swift/QtUI/UserSearch/ContactListModel.cpp +++ b/Swift/QtUI/UserSearch/ContactListModel.cpp @@ -5,7 +5,7 @@ */ /* - * Copyright (c) 2014-2016 Isode Limited. + * Copyright (c) 2014-2018 Isode Limited. * All rights reserved. * See the COPYING file for more information. */ @@ -22,32 +22,6 @@ namespace Swift { -QDataStream& operator >>(QDataStream& in, StatusShow::Type& e){ - quint32 buffer; - in >> buffer; - switch(buffer) { - case StatusShow::Online: - e = StatusShow::Online; - break; - case StatusShow::Away: - e = StatusShow::Away; - break; - case StatusShow::FFC: - e = StatusShow::FFC; - break; - case StatusShow::XA: - e = StatusShow::XA; - break; - case StatusShow::DND: - e = StatusShow::DND; - break; - default: - e = StatusShow::None; - break; - } - return in; -} - ContactListModel::ContactListModel(bool editable) : QAbstractItemModel(), editable_(editable) { } |