From b7266b1640a8d0139e2a2263527387509f0a84f3 Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Sat, 14 Apr 2018 21:59:51 +0200 Subject: [PATCH] Fix warnings that occured on linux using clang --- chatterino.pro | 1 + src/messages/layouts/messagelayoutelement.hpp | 2 +- src/providers/twitch/ircmessagehandler.cpp | 9 +-------- src/providers/twitch/ircmessagehandler.hpp | 9 +-------- src/singletons/commandmanager.cpp | 2 +- src/singletons/emotemanager.cpp | 16 ++++++++-------- src/singletons/helper/chatterinosetting.cpp | 14 ++++++++++++++ src/singletons/helper/chatterinosetting.hpp | 4 +--- src/singletons/helper/loggingchannel.cpp | 2 ++ src/singletons/resourcemanager.cpp | 4 ++-- src/singletons/settingsmanager.cpp | 2 +- src/singletons/settingsmanager.hpp | 2 +- src/util/debugcount.hpp | 1 + src/widgets/emotepopup.cpp | 2 +- src/widgets/helper/notebooktab.cpp | 2 +- src/widgets/qualitypopup.cpp | 2 -- src/widgets/qualitypopup.hpp | 8 ++------ src/widgets/settingspages/accountspage.cpp | 2 +- src/widgets/settingspages/ignoreuserspage.cpp | 3 +++ src/widgets/streamview.hpp | 2 ++ src/widgets/window.cpp | 4 ++-- 21 files changed, 47 insertions(+), 46 deletions(-) create mode 100644 src/singletons/helper/chatterinosetting.cpp diff --git a/chatterino.pro b/chatterino.pro index 3e3ad2642..b25b9aa27 100644 --- a/chatterino.pro +++ b/chatterino.pro @@ -109,6 +109,7 @@ SOURCES += \ src/util/completionmodel.cpp \ src/singletons/helper/loggingchannel.cpp \ src/singletons/helper/moderationaction.cpp \ + src/singletons/helper/chatterinosetting.cpp \ src/singletons/loggingmanager.cpp \ src/singletons/pathmanager.cpp \ src/singletons/resourcemanager.cpp \ diff --git a/src/messages/layouts/messagelayoutelement.hpp b/src/messages/layouts/messagelayoutelement.hpp index 1f98b6cd1..5735e6fcc 100644 --- a/src/messages/layouts/messagelayoutelement.hpp +++ b/src/messages/layouts/messagelayoutelement.hpp @@ -108,9 +108,9 @@ protected: int getXFromIndex(int index) override; private: + float scale; QString line1; QString line2; - float scale; }; } // namespace layouts diff --git a/src/providers/twitch/ircmessagehandler.cpp b/src/providers/twitch/ircmessagehandler.cpp index 796f048d5..d5cebdd8d 100644 --- a/src/providers/twitch/ircmessagehandler.cpp +++ b/src/providers/twitch/ircmessagehandler.cpp @@ -10,8 +10,6 @@ #include "singletons/resourcemanager.hpp" #include "singletons/windowmanager.hpp" -#include - using namespace chatterino::singletons; using namespace chatterino::messages; @@ -19,14 +17,9 @@ namespace chatterino { namespace providers { namespace twitch { -IrcMessageHandler::IrcMessageHandler(singletons::ResourceManager &_resourceManager) - : resourceManager(_resourceManager) -{ -} - IrcMessageHandler &IrcMessageHandler::getInstance() { - static IrcMessageHandler instance(singletons::ResourceManager::getInstance()); + static IrcMessageHandler instance; return instance; } diff --git a/src/providers/twitch/ircmessagehandler.hpp b/src/providers/twitch/ircmessagehandler.hpp index 210f1b163..d79296a9d 100644 --- a/src/providers/twitch/ircmessagehandler.hpp +++ b/src/providers/twitch/ircmessagehandler.hpp @@ -3,19 +3,12 @@ #include namespace chatterino { -namespace singletons { -class ChannelManager; -class ResourceManager; -} // namespace singletons - namespace providers { namespace twitch { class IrcMessageHandler { - IrcMessageHandler(singletons::ResourceManager &resourceManager); - - singletons::ResourceManager &resourceManager; + IrcMessageHandler() = default; public: static IrcMessageHandler &getInstance(); diff --git a/src/singletons/commandmanager.cpp b/src/singletons/commandmanager.cpp index 1691de401..d509c7605 100644 --- a/src/singletons/commandmanager.cpp +++ b/src/singletons/commandmanager.cpp @@ -254,7 +254,7 @@ CommandManager::Command::Command(QString _text) int index = _text.indexOf(' '); if (index == -1) { - this->name == _text; + this->name = _text; return; } diff --git a/src/singletons/emotemanager.cpp b/src/singletons/emotemanager.cpp index 03ccee435..8710d59ea 100644 --- a/src/singletons/emotemanager.cpp +++ b/src/singletons/emotemanager.cpp @@ -54,7 +54,8 @@ QString GetFFZEmoteLink(const QJsonObject &urls, const QString &emoteScale) return "http:" + emote.toString(); } -void FillInFFZEmoteData(const QJsonObject &urls, const QString &code, const QString &tooltip, util::EmoteData &emoteData) +void FillInFFZEmoteData(const QJsonObject &urls, const QString &code, const QString &tooltip, + util::EmoteData &emoteData) { QString url1x = GetFFZEmoteLink(urls, "1"); QString url2x = GetFFZEmoteLink(urls, "2"); @@ -139,7 +140,7 @@ void EmoteManager::reloadBTTVChannelEmotes(const QString &channelName, link = link.replace("{{id}}", id).replace("{{image}}", "1x"); - auto emote = this->getBTTVChannelEmoteFromCaches().getOrAdd(id, [this, &code, &link] { + auto emote = this->getBTTVChannelEmoteFromCaches().getOrAdd(id, [&code, &link] { return util::EmoteData(new Image(link, 1, code, code + "
Channel BTTV Emote")); }); @@ -186,13 +187,12 @@ void EmoteManager::reloadFFZChannelEmotes(const QString &channelName, QJsonObject urls = emoteObject.value("urls").toObject(); - auto emote = - this->getFFZChannelEmoteFromCaches().getOrAdd(id, [this, &code, &urls] { - util::EmoteData emoteData; - FillInFFZEmoteData(urls, code, code + "
Channel FFZ Emote", emoteData); + auto emote = this->getFFZChannelEmoteFromCaches().getOrAdd(id, [&code, &urls] { + util::EmoteData emoteData; + FillInFFZEmoteData(urls, code, code + "
Channel FFZ Emote", emoteData); - return emoteData; - }); + return emoteData; + }); this->ffzChannelEmotes.insert(code, emote); map->insert(code, emote); diff --git a/src/singletons/helper/chatterinosetting.cpp b/src/singletons/helper/chatterinosetting.cpp new file mode 100644 index 000000000..12ea0f055 --- /dev/null +++ b/src/singletons/helper/chatterinosetting.cpp @@ -0,0 +1,14 @@ +#include "singletons/helper/chatterinosetting.hpp" + +#include "singletons/settingsmanager.hpp" + +namespace chatterino { +namespace singletons { + +void _registerSetting(std::weak_ptr setting) +{ + _actuallyRegisterSetting(setting); +} + +} // namespace singletons +} // namespace chatterino diff --git a/src/singletons/helper/chatterinosetting.hpp b/src/singletons/helper/chatterinosetting.hpp index ffa8f987d..9024dd2e7 100644 --- a/src/singletons/helper/chatterinosetting.hpp +++ b/src/singletons/helper/chatterinosetting.hpp @@ -3,7 +3,7 @@ namespace chatterino { namespace singletons { -static void _registerSetting(std::weak_ptr setting); +void _registerSetting(std::weak_ptr setting); template class ChatterinoSetting : public pajlada::Settings::Setting @@ -21,8 +21,6 @@ public: _registerSetting(this->data); } - void saveRecall(); - ChatterinoSetting &operator=(const Type &newValue) { assert(this->data != nullptr); diff --git a/src/singletons/helper/loggingchannel.cpp b/src/singletons/helper/loggingchannel.cpp index 96c5125b8..475690964 100644 --- a/src/singletons/helper/loggingchannel.cpp +++ b/src/singletons/helper/loggingchannel.cpp @@ -88,6 +88,7 @@ QString LoggingChannel::generateClosingString(const QDateTime &now) const void LoggingChannel::appendLine(const QString &line) { + /* auto a1 = line.toUtf8(); auto a2 = line.toLatin1(); auto a3 = line.toLocal8Bit(); @@ -95,6 +96,7 @@ void LoggingChannel::appendLine(const QString &line) auto a4 = line.data(); auto a5 = line.toStdString(); + */ // this->fileHandle.write(a5.c_str(), a5.length()); // this->fileHandle.write(a5.c_str(), a5.length()); diff --git a/src/singletons/resourcemanager.cpp b/src/singletons/resourcemanager.cpp index 6add6bc05..756f79339 100644 --- a/src/singletons/resourcemanager.cpp +++ b/src/singletons/resourcemanager.cpp @@ -282,11 +282,11 @@ ResourceManager::ResourceManager() , cheerBadge1000(lli(":/images/cheer1000")) , cheerBadge100(lli(":/images/cheer100")) , cheerBadge1(lli(":/images/cheer1")) - , buttonBan(lli(":/images/button_ban.png", 0.25)) - , buttonTimeout(lli(":/images/button_timeout.png", 0.25)) , moderationmode_enabled(lli(":/images/moderatormode_enabled")) , moderationmode_disabled(lli(":/images/moderatormode_disabled")) , splitHeaderContext(lli(":/images/tool_moreCollapser_off16.png")) + , buttonBan(lli(":/images/button_ban.png", 0.25)) + , buttonTimeout(lli(":/images/button_timeout.png", 0.25)) { this->loadDynamicTwitchBadges(); diff --git a/src/singletons/settingsmanager.cpp b/src/singletons/settingsmanager.cpp index 1c87499d8..647b84d81 100644 --- a/src/singletons/settingsmanager.cpp +++ b/src/singletons/settingsmanager.cpp @@ -11,7 +11,7 @@ namespace singletons { std::vector> _settings; -void _registerSetting(std::weak_ptr setting) +void _actuallyRegisterSetting(std::weak_ptr setting) { _settings.push_back(setting); } diff --git a/src/singletons/settingsmanager.hpp b/src/singletons/settingsmanager.hpp index 23b13b068..7f59d8fee 100644 --- a/src/singletons/settingsmanager.hpp +++ b/src/singletons/settingsmanager.hpp @@ -11,7 +11,7 @@ namespace chatterino { namespace singletons { -static void _registerSetting(std::weak_ptr setting); +void _actuallyRegisterSetting(std::weak_ptr setting); class SettingManager : public QObject { diff --git a/src/util/debugcount.hpp b/src/util/debugcount.hpp index 7aae6ebc1..275e5692c 100644 --- a/src/util/debugcount.hpp +++ b/src/util/debugcount.hpp @@ -52,6 +52,7 @@ public: QString toString() { + return ""; } }; diff --git a/src/widgets/emotepopup.cpp b/src/widgets/emotepopup.cpp index c4b5537a1..81e2c7e2a 100644 --- a/src/widgets/emotepopup.cpp +++ b/src/widgets/emotepopup.cpp @@ -105,7 +105,7 @@ void EmotePopup::loadEmojis() builder.getMessage()->flags &= Message::Centered; builder.getMessage()->flags &= Message::DisableCompactEmotes; - emojis.each([this, &builder](const QString &key, const auto &value) { + emojis.each([&builder](const QString &key, const auto &value) { builder.append((new EmoteElement(value.emoteData, MessageElement::Flags::AlwaysShow)) ->setLink(Link(Link::Type::InsertText, ":" + value.shortCode + ":"))); }); diff --git a/src/widgets/helper/notebooktab.cpp b/src/widgets/helper/notebooktab.cpp index 332fe9c2b..b5a3ed992 100644 --- a/src/widgets/helper/notebooktab.cpp +++ b/src/widgets/helper/notebooktab.cpp @@ -63,7 +63,7 @@ NotebookTab::NotebookTab(Notebook *_notebook) this->menu.addAction(enableHighlightsOnNewMessageAction); - QObject::connect(enableHighlightsOnNewMessageAction, &QAction::toggled, [this](bool newValue) { + QObject::connect(enableHighlightsOnNewMessageAction, &QAction::toggled, [](bool newValue) { debug::Log("New value is {}", newValue); // }); } diff --git a/src/widgets/qualitypopup.cpp b/src/widgets/qualitypopup.cpp index b92797827..fb77e268b 100644 --- a/src/widgets/qualitypopup.cpp +++ b/src/widgets/qualitypopup.cpp @@ -43,8 +43,6 @@ void QualityPopup::okButtonClicked() { QString channelURL = "twitch.tv/" + this->channelName; - singletons::SettingManager &settings = singletons::SettingManager::getInstance(); - try { streamlink::OpenStreamlink(channelURL, this->ui.selector.currentText()); } catch (const streamlink::Exception &ex) { diff --git a/src/widgets/qualitypopup.hpp b/src/widgets/qualitypopup.hpp index ccb57df28..0f498e62c 100644 --- a/src/widgets/qualitypopup.hpp +++ b/src/widgets/qualitypopup.hpp @@ -1,17 +1,13 @@ #pragma once +#include "basewindow.hpp" + #include #include -#include #include #include -#include - -#include "basewindow.hpp" -#include "singletons/settingsmanager.hpp" namespace chatterino { - namespace widgets { class QualityPopup : public BaseWindow diff --git a/src/widgets/settingspages/accountspage.cpp b/src/widgets/settingspages/accountspage.cpp index e3ef8da4a..28a9d71c9 100644 --- a/src/widgets/settingspages/accountspage.cpp +++ b/src/widgets/settingspages/accountspage.cpp @@ -24,7 +24,7 @@ AccountsPage::AccountsPage() this->removeButton = buttons->addButton("Remove", QDialogButtonBox::NoRole); } - auto accountSwitch = layout.emplace(this).assign(&this->accSwitchWidget); + layout.emplace(this).assign(&this->accSwitchWidget); // ---- QObject::connect(this->addButton, &QPushButton::clicked, []() { diff --git a/src/widgets/settingspages/ignoreuserspage.cpp b/src/widgets/settingspages/ignoreuserspage.cpp index 62cd72844..4ad63d7a1 100644 --- a/src/widgets/settingspages/ignoreuserspage.cpp +++ b/src/widgets/settingspages/ignoreuserspage.cpp @@ -45,10 +45,13 @@ IgnoreUsersPage::IgnoreUsersPage() { auto add = addremove.emplace("Ignore user"); auto remove = addremove.emplace("Unignore User"); + UNUSED(add); // TODO: Add on-clicked event + UNUSED(remove); // TODO: Add on-clicked event addremove->addStretch(1); } auto userList = group.emplace(); + UNUSED(userList); // TODO: Fill this list in with ignored users } } diff --git a/src/widgets/streamview.hpp b/src/widgets/streamview.hpp index 6013fd7f4..af54f4fe6 100644 --- a/src/widgets/streamview.hpp +++ b/src/widgets/streamview.hpp @@ -19,7 +19,9 @@ public: StreamView(std::shared_ptr channel, const QUrl &url); private: +#ifdef USEWEBENGINE QWebEngineView *stream; +#endif }; } // namespace widgets diff --git a/src/widgets/window.cpp b/src/widgets/window.cpp index 439bd3df3..0b9911f45 100644 --- a/src/widgets/window.cpp +++ b/src/widgets/window.cpp @@ -37,11 +37,11 @@ Window::Window(singletons::ThemeManager &_themeManager, WindowType _type) this->addTitleBarButton(TitleBarButton::Settings, [] { singletons::WindowManager::getInstance().showSettingsDialog(); }); - auto user = this->addTitleBarLabel([this] { + auto user = this->addTitleBarLabel([] { singletons::WindowManager::getInstance().showAccountSelectPopup(QCursor::pos()); }); - singletons::AccountManager::getInstance().Twitch.userChanged.connect([this, user] { + singletons::AccountManager::getInstance().Twitch.userChanged.connect([user] { user->getLabel().setText( singletons::AccountManager::getInstance().Twitch.getCurrent()->getUserName()); });