Fix warnings that occured on linux using clang

This commit is contained in:
Rasmus Karlsson 2018-04-14 21:59:51 +02:00
parent 57e788422f
commit b7266b1640
21 changed files with 47 additions and 46 deletions

View file

@ -109,6 +109,7 @@ SOURCES += \
src/util/completionmodel.cpp \ src/util/completionmodel.cpp \
src/singletons/helper/loggingchannel.cpp \ src/singletons/helper/loggingchannel.cpp \
src/singletons/helper/moderationaction.cpp \ src/singletons/helper/moderationaction.cpp \
src/singletons/helper/chatterinosetting.cpp \
src/singletons/loggingmanager.cpp \ src/singletons/loggingmanager.cpp \
src/singletons/pathmanager.cpp \ src/singletons/pathmanager.cpp \
src/singletons/resourcemanager.cpp \ src/singletons/resourcemanager.cpp \

View file

@ -108,9 +108,9 @@ protected:
int getXFromIndex(int index) override; int getXFromIndex(int index) override;
private: private:
float scale;
QString line1; QString line1;
QString line2; QString line2;
float scale;
}; };
} // namespace layouts } // namespace layouts

View file

@ -10,8 +10,6 @@
#include "singletons/resourcemanager.hpp" #include "singletons/resourcemanager.hpp"
#include "singletons/windowmanager.hpp" #include "singletons/windowmanager.hpp"
#include <memory>
using namespace chatterino::singletons; using namespace chatterino::singletons;
using namespace chatterino::messages; using namespace chatterino::messages;
@ -19,14 +17,9 @@ namespace chatterino {
namespace providers { namespace providers {
namespace twitch { namespace twitch {
IrcMessageHandler::IrcMessageHandler(singletons::ResourceManager &_resourceManager)
: resourceManager(_resourceManager)
{
}
IrcMessageHandler &IrcMessageHandler::getInstance() IrcMessageHandler &IrcMessageHandler::getInstance()
{ {
static IrcMessageHandler instance(singletons::ResourceManager::getInstance()); static IrcMessageHandler instance;
return instance; return instance;
} }

View file

@ -3,19 +3,12 @@
#include <IrcMessage> #include <IrcMessage>
namespace chatterino { namespace chatterino {
namespace singletons {
class ChannelManager;
class ResourceManager;
} // namespace singletons
namespace providers { namespace providers {
namespace twitch { namespace twitch {
class IrcMessageHandler class IrcMessageHandler
{ {
IrcMessageHandler(singletons::ResourceManager &resourceManager); IrcMessageHandler() = default;
singletons::ResourceManager &resourceManager;
public: public:
static IrcMessageHandler &getInstance(); static IrcMessageHandler &getInstance();

View file

@ -254,7 +254,7 @@ CommandManager::Command::Command(QString _text)
int index = _text.indexOf(' '); int index = _text.indexOf(' ');
if (index == -1) { if (index == -1) {
this->name == _text; this->name = _text;
return; return;
} }

View file

@ -54,7 +54,8 @@ QString GetFFZEmoteLink(const QJsonObject &urls, const QString &emoteScale)
return "http:" + emote.toString(); 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 url1x = GetFFZEmoteLink(urls, "1");
QString url2x = GetFFZEmoteLink(urls, "2"); QString url2x = GetFFZEmoteLink(urls, "2");
@ -139,7 +140,7 @@ void EmoteManager::reloadBTTVChannelEmotes(const QString &channelName,
link = link.replace("{{id}}", id).replace("{{image}}", "1x"); 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 + "<br/>Channel BTTV Emote")); return util::EmoteData(new Image(link, 1, code, code + "<br/>Channel BTTV Emote"));
}); });
@ -186,8 +187,7 @@ void EmoteManager::reloadFFZChannelEmotes(const QString &channelName,
QJsonObject urls = emoteObject.value("urls").toObject(); QJsonObject urls = emoteObject.value("urls").toObject();
auto emote = auto emote = this->getFFZChannelEmoteFromCaches().getOrAdd(id, [&code, &urls] {
this->getFFZChannelEmoteFromCaches().getOrAdd(id, [this, &code, &urls] {
util::EmoteData emoteData; util::EmoteData emoteData;
FillInFFZEmoteData(urls, code, code + "<br/>Channel FFZ Emote", emoteData); FillInFFZEmoteData(urls, code, code + "<br/>Channel FFZ Emote", emoteData);

View file

@ -0,0 +1,14 @@
#include "singletons/helper/chatterinosetting.hpp"
#include "singletons/settingsmanager.hpp"
namespace chatterino {
namespace singletons {
void _registerSetting(std::weak_ptr<pajlada::Settings::ISettingData> setting)
{
_actuallyRegisterSetting(setting);
}
} // namespace singletons
} // namespace chatterino

View file

@ -3,7 +3,7 @@
namespace chatterino { namespace chatterino {
namespace singletons { namespace singletons {
static void _registerSetting(std::weak_ptr<pajlada::Settings::ISettingData> setting); void _registerSetting(std::weak_ptr<pajlada::Settings::ISettingData> setting);
template <typename Type> template <typename Type>
class ChatterinoSetting : public pajlada::Settings::Setting<Type> class ChatterinoSetting : public pajlada::Settings::Setting<Type>
@ -21,8 +21,6 @@ public:
_registerSetting(this->data); _registerSetting(this->data);
} }
void saveRecall();
ChatterinoSetting &operator=(const Type &newValue) ChatterinoSetting &operator=(const Type &newValue)
{ {
assert(this->data != nullptr); assert(this->data != nullptr);

View file

@ -88,6 +88,7 @@ QString LoggingChannel::generateClosingString(const QDateTime &now) const
void LoggingChannel::appendLine(const QString &line) void LoggingChannel::appendLine(const QString &line)
{ {
/*
auto a1 = line.toUtf8(); auto a1 = line.toUtf8();
auto a2 = line.toLatin1(); auto a2 = line.toLatin1();
auto a3 = line.toLocal8Bit(); auto a3 = line.toLocal8Bit();
@ -95,6 +96,7 @@ void LoggingChannel::appendLine(const QString &line)
auto a4 = line.data(); auto a4 = line.data();
auto a5 = line.toStdString(); auto a5 = line.toStdString();
*/
// this->fileHandle.write(a5.c_str(), a5.length()); // this->fileHandle.write(a5.c_str(), a5.length());
// this->fileHandle.write(a5.c_str(), a5.length()); // this->fileHandle.write(a5.c_str(), a5.length());

View file

@ -282,11 +282,11 @@ ResourceManager::ResourceManager()
, cheerBadge1000(lli(":/images/cheer1000")) , cheerBadge1000(lli(":/images/cheer1000"))
, cheerBadge100(lli(":/images/cheer100")) , cheerBadge100(lli(":/images/cheer100"))
, cheerBadge1(lli(":/images/cheer1")) , 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_enabled(lli(":/images/moderatormode_enabled"))
, moderationmode_disabled(lli(":/images/moderatormode_disabled")) , moderationmode_disabled(lli(":/images/moderatormode_disabled"))
, splitHeaderContext(lli(":/images/tool_moreCollapser_off16.png")) , 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(); this->loadDynamicTwitchBadges();

View file

@ -11,7 +11,7 @@ namespace singletons {
std::vector<std::weak_ptr<pajlada::Settings::ISettingData>> _settings; std::vector<std::weak_ptr<pajlada::Settings::ISettingData>> _settings;
void _registerSetting(std::weak_ptr<pajlada::Settings::ISettingData> setting) void _actuallyRegisterSetting(std::weak_ptr<pajlada::Settings::ISettingData> setting)
{ {
_settings.push_back(setting); _settings.push_back(setting);
} }

View file

@ -11,7 +11,7 @@
namespace chatterino { namespace chatterino {
namespace singletons { namespace singletons {
static void _registerSetting(std::weak_ptr<pajlada::Settings::ISettingData> setting); void _actuallyRegisterSetting(std::weak_ptr<pajlada::Settings::ISettingData> setting);
class SettingManager : public QObject class SettingManager : public QObject
{ {

View file

@ -52,6 +52,7 @@ public:
QString toString() QString toString()
{ {
return "";
} }
}; };

View file

@ -105,7 +105,7 @@ void EmotePopup::loadEmojis()
builder.getMessage()->flags &= Message::Centered; builder.getMessage()->flags &= Message::Centered;
builder.getMessage()->flags &= Message::DisableCompactEmotes; 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)) builder.append((new EmoteElement(value.emoteData, MessageElement::Flags::AlwaysShow))
->setLink(Link(Link::Type::InsertText, ":" + value.shortCode + ":"))); ->setLink(Link(Link::Type::InsertText, ":" + value.shortCode + ":")));
}); });

View file

@ -63,7 +63,7 @@ NotebookTab::NotebookTab(Notebook *_notebook)
this->menu.addAction(enableHighlightsOnNewMessageAction); 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); // debug::Log("New value is {}", newValue); //
}); });
} }

View file

@ -43,8 +43,6 @@ void QualityPopup::okButtonClicked()
{ {
QString channelURL = "twitch.tv/" + this->channelName; QString channelURL = "twitch.tv/" + this->channelName;
singletons::SettingManager &settings = singletons::SettingManager::getInstance();
try { try {
streamlink::OpenStreamlink(channelURL, this->ui.selector.currentText()); streamlink::OpenStreamlink(channelURL, this->ui.selector.currentText());
} catch (const streamlink::Exception &ex) { } catch (const streamlink::Exception &ex) {

View file

@ -1,17 +1,13 @@
#pragma once #pragma once
#include "basewindow.hpp"
#include <QComboBox> #include <QComboBox>
#include <QDialogButtonBox> #include <QDialogButtonBox>
#include <QHBoxLayout>
#include <QPushButton> #include <QPushButton>
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QWidget>
#include "basewindow.hpp"
#include "singletons/settingsmanager.hpp"
namespace chatterino { namespace chatterino {
namespace widgets { namespace widgets {
class QualityPopup : public BaseWindow class QualityPopup : public BaseWindow

View file

@ -24,7 +24,7 @@ AccountsPage::AccountsPage()
this->removeButton = buttons->addButton("Remove", QDialogButtonBox::NoRole); this->removeButton = buttons->addButton("Remove", QDialogButtonBox::NoRole);
} }
auto accountSwitch = layout.emplace<AccountSwitchWidget>(this).assign(&this->accSwitchWidget); layout.emplace<AccountSwitchWidget>(this).assign(&this->accSwitchWidget);
// ---- // ----
QObject::connect(this->addButton, &QPushButton::clicked, []() { QObject::connect(this->addButton, &QPushButton::clicked, []() {

View file

@ -45,10 +45,13 @@ IgnoreUsersPage::IgnoreUsersPage()
{ {
auto add = addremove.emplace<QPushButton>("Ignore user"); auto add = addremove.emplace<QPushButton>("Ignore user");
auto remove = addremove.emplace<QPushButton>("Unignore User"); auto remove = addremove.emplace<QPushButton>("Unignore User");
UNUSED(add); // TODO: Add on-clicked event
UNUSED(remove); // TODO: Add on-clicked event
addremove->addStretch(1); addremove->addStretch(1);
} }
auto userList = group.emplace<QListView>(); auto userList = group.emplace<QListView>();
UNUSED(userList); // TODO: Fill this list in with ignored users
} }
} }

View file

@ -19,7 +19,9 @@ public:
StreamView(std::shared_ptr<Channel> channel, const QUrl &url); StreamView(std::shared_ptr<Channel> channel, const QUrl &url);
private: private:
#ifdef USEWEBENGINE
QWebEngineView *stream; QWebEngineView *stream;
#endif
}; };
} // namespace widgets } // namespace widgets

View file

@ -37,11 +37,11 @@ Window::Window(singletons::ThemeManager &_themeManager, WindowType _type)
this->addTitleBarButton(TitleBarButton::Settings, [] { this->addTitleBarButton(TitleBarButton::Settings, [] {
singletons::WindowManager::getInstance().showSettingsDialog(); singletons::WindowManager::getInstance().showSettingsDialog();
}); });
auto user = this->addTitleBarLabel([this] { auto user = this->addTitleBarLabel([] {
singletons::WindowManager::getInstance().showAccountSelectPopup(QCursor::pos()); singletons::WindowManager::getInstance().showAccountSelectPopup(QCursor::pos());
}); });
singletons::AccountManager::getInstance().Twitch.userChanged.connect([this, user] { singletons::AccountManager::getInstance().Twitch.userChanged.connect([user] {
user->getLabel().setText( user->getLabel().setText(
singletons::AccountManager::getInstance().Twitch.getCurrent()->getUserName()); singletons::AccountManager::getInstance().Twitch.getCurrent()->getUserName());
}); });