changed .clang-format

This commit is contained in:
fourtf 2018-08-15 22:46:20 +02:00
parent 44c16f1b3a
commit af7b742a23
46 changed files with 1636 additions and 1611 deletions

View file

@ -25,6 +25,9 @@ DerivePointerBinding: false
FixNamespaceComments: true FixNamespaceComments: true
IndentCaseLabels: true IndentCaseLabels: true
IndentWidth: 4 IndentWidth: 4
IndentWrappedFunctionNames: true
IndentPPDirectives: AfterHash
NamespaceIndentation: Inner
PointerBindsToType: false PointerBindsToType: false
SpacesBeforeTrailingComments: 2 SpacesBeforeTrailingComments: 2
Standard: Auto Standard: Auto

View file

@ -52,8 +52,8 @@ void runLoop(NativeMessagingClient &client)
std::cin.read(buffer.get(), size); std::cin.read(buffer.get(), size);
*(buffer.get() + size) = '\0'; *(buffer.get() + size) = '\0';
client.sendMessage( client.sendMessage(QByteArray::fromRawData(
QByteArray::fromRawData(buffer.get(), static_cast<int32_t>(size))); buffer.get(), static_cast<int32_t>(size)));
} }
} }
} // namespace } // namespace

View file

@ -38,7 +38,8 @@ void installCustomPalette()
dark.setColor(QPalette::AlternateBase, QColor("#444")); dark.setColor(QPalette::AlternateBase, QColor("#444"));
dark.setColor(QPalette::ToolTipBase, Qt::white); dark.setColor(QPalette::ToolTipBase, Qt::white);
dark.setColor(QPalette::ToolTipText, Qt::white); dark.setColor(QPalette::ToolTipText, Qt::white);
dark.setColor(QPalette::Disabled, QPalette::Text, QColor(127, 127, 127)); dark.setColor(QPalette::Disabled, QPalette::Text,
QColor(127, 127, 127));
dark.setColor(QPalette::Dark, QColor(35, 35, 35)); dark.setColor(QPalette::Dark, QColor(35, 35, 35));
dark.setColor(QPalette::Shadow, QColor(20, 20, 20)); dark.setColor(QPalette::Shadow, QColor(20, 20, 20));
dark.setColor(QPalette::Button, QColor(70, 70, 70)); dark.setColor(QPalette::Button, QColor(70, 70, 70));
@ -48,7 +49,8 @@ void installCustomPalette()
dark.setColor(QPalette::BrightText, Qt::red); dark.setColor(QPalette::BrightText, Qt::red);
dark.setColor(QPalette::Link, QColor(42, 130, 218)); dark.setColor(QPalette::Link, QColor(42, 130, 218));
dark.setColor(QPalette::Highlight, QColor(42, 130, 218)); dark.setColor(QPalette::Highlight, QColor(42, 130, 218));
dark.setColor(QPalette::Disabled, QPalette::Highlight, QColor(80, 80, 80)); dark.setColor(QPalette::Disabled, QPalette::Highlight,
QColor(80, 80, 80));
dark.setColor(QPalette::HighlightedText, Qt::white); dark.setColor(QPalette::HighlightedText, Qt::white);
dark.setColor(QPalette::Disabled, QPalette::HighlightedText, dark.setColor(QPalette::Disabled, QPalette::HighlightedText,
QColor(127, 127, 127)); QColor(127, 127, 127));

View file

@ -70,7 +70,8 @@ namespace Settings {
template <> template <>
struct Serialize<chatterino::HighlightBlacklistUser> { struct Serialize<chatterino::HighlightBlacklistUser> {
static rapidjson::Value get(const chatterino::HighlightBlacklistUser &value, static rapidjson::Value get(
const chatterino::HighlightBlacklistUser &value,
rapidjson::Document::AllocatorType &a) rapidjson::Document::AllocatorType &a)
{ {
rapidjson::Value ret(rapidjson::kObjectType); rapidjson::Value ret(rapidjson::kObjectType);
@ -84,7 +85,8 @@ struct Serialize<chatterino::HighlightBlacklistUser> {
template <> template <>
struct Deserialize<chatterino::HighlightBlacklistUser> { struct Deserialize<chatterino::HighlightBlacklistUser> {
static chatterino::HighlightBlacklistUser get(const rapidjson::Value &value) static chatterino::HighlightBlacklistUser get(
const rapidjson::Value &value)
{ {
QString pattern; QString pattern;
bool isRegex = false; bool isRegex = false;

View file

@ -93,7 +93,8 @@ struct Deserialize<chatterino::HighlightPhrase> {
static chatterino::HighlightPhrase get(const rapidjson::Value &value) static chatterino::HighlightPhrase get(const rapidjson::Value &value)
{ {
if (!value.IsObject()) { if (!value.IsObject()) {
return chatterino::HighlightPhrase(QString(), true, false, false); return chatterino::HighlightPhrase(QString(), true, false,
false);
} }
QString _pattern; QString _pattern;
@ -106,7 +107,8 @@ struct Deserialize<chatterino::HighlightPhrase> {
chatterino::rj::getSafe(value, "sound", _sound); chatterino::rj::getSafe(value, "sound", _sound);
chatterino::rj::getSafe(value, "regex", _isRegex); chatterino::rj::getSafe(value, "regex", _isRegex);
return chatterino::HighlightPhrase(_pattern, _alert, _sound, _isRegex); return chatterino::HighlightPhrase(_pattern, _alert, _sound,
_isRegex);
} }
}; };

View file

@ -37,7 +37,8 @@ Frames::Frames(const QVector<Frame<QPixmap>> &frames)
if (this->animated()) { if (this->animated()) {
DebugCount::increase("animated images"); DebugCount::increase("animated images");
this->gifTimerConnection_ = getApp()->emotes->gifTimer.signal.connect( this->gifTimerConnection_ =
getApp()->emotes->gifTimer.signal.connect(
[this] { this->advance(); }); [this] { this->advance(); });
} }
} }
@ -134,8 +135,9 @@ void assignDelayed(
queued.pop(); queued.pop();
if (++i > 50) { if (++i > 50) {
QTimer::singleShot( QTimer::singleShot(3, [&] {
3, [&] { assignDelayed(queued, mutex, loadedEventQueued); }); assignDelayed(queued, mutex, loadedEventQueued);
});
return; return;
} }
} }
@ -145,19 +147,22 @@ void assignDelayed(
} }
template <typename Assign> template <typename Assign>
auto makeConvertCallback(const QVector<Frame<QImage>> &parsed, Assign assign) auto makeConvertCallback(const QVector<Frame<QImage>> &parsed,
Assign assign)
{ {
return [parsed, assign] { return [parsed, assign] {
// convert to pixmap // convert to pixmap
auto frames = QVector<Frame<QPixmap>>(); auto frames = QVector<Frame<QPixmap>>();
std::transform(parsed.begin(), parsed.end(), std::back_inserter(frames), std::transform(parsed.begin(), parsed.end(),
[](auto &frame) { std::back_inserter(frames), [](auto &frame) {
return Frame<QPixmap>{ return Frame<QPixmap>{
QPixmap::fromImage(frame.image), frame.duration}; QPixmap::fromImage(frame.image),
frame.duration};
}); });
// put into stack // put into stack
static std::queue<std::pair<Assign, QVector<Frame<QPixmap>>>> queued; static std::queue<std::pair<Assign, QVector<Frame<QPixmap>>>>
queued;
static std::mutex mutex; static std::mutex mutex;
std::lock_guard<std::mutex> lock(mutex); std::lock_guard<std::mutex> lock(mutex);
@ -168,8 +173,9 @@ auto makeConvertCallback(const QVector<Frame<QImage>> &parsed, Assign assign)
if (!loadedEventQueued) { if (!loadedEventQueued) {
loadedEventQueued = true; loadedEventQueued = true;
QTimer::singleShot( QTimer::singleShot(100, [=] {
100, [=] { assignDelayed(queued, mutex, loadedEventQueued); }); assignDelayed(queued, mutex, loadedEventQueued);
});
} }
}; };
} }

View file

@ -2,5 +2,4 @@
namespace chatterino { namespace chatterino {
} // namespace chatterino } // namespace chatterino

View file

@ -21,16 +21,18 @@ Url getEmoteLink(QString urlTemplate, const EmoteId &id,
return {urlTemplate.replace("{{id}}", id.string) return {urlTemplate.replace("{{id}}", id.string)
.replace("{{image}}", emoteScale)}; .replace("{{image}}", emoteScale)};
} }
std::pair<Outcome, EmoteMap> parseGlobalEmotes(const QJsonObject &jsonRoot, std::pair<Outcome, EmoteMap> parseGlobalEmotes(
const EmoteMap &currentEmotes) const QJsonObject &jsonRoot, const EmoteMap &currentEmotes)
{ {
auto emotes = EmoteMap(); auto emotes = EmoteMap();
auto jsonEmotes = jsonRoot.value("emotes").toArray(); auto jsonEmotes = jsonRoot.value("emotes").toArray();
auto urlTemplate = qS("https:") + jsonRoot.value("urlTemplate").toString(); auto urlTemplate =
qS("https:") + jsonRoot.value("urlTemplate").toString();
for (auto jsonEmote : jsonEmotes) { for (auto jsonEmote : jsonEmotes) {
auto id = EmoteId{jsonEmote.toObject().value("id").toString()}; auto id = EmoteId{jsonEmote.toObject().value("id").toString()};
auto name = EmoteName{jsonEmote.toObject().value("code").toString()}; auto name =
EmoteName{jsonEmote.toObject().value("code").toString()};
auto emote = Emote( auto emote = Emote(
{name, {name,
@ -41,7 +43,8 @@ std::pair<Outcome, EmoteMap> parseGlobalEmotes(const QJsonObject &jsonRoot,
Tooltip{name.string + "<br />Global Bttv Emote"}, Tooltip{name.string + "<br />Global Bttv Emote"},
Url{"https://manage.betterttv.net/emotes/" + id.string}}); Url{"https://manage.betterttv.net/emotes/" + id.string}});
emotes[name] = cachedOrMakeEmotePtr(std::move(emote), currentEmotes); emotes[name] =
cachedOrMakeEmotePtr(std::move(emote), currentEmotes);
} }
return {Success, std::move(emotes)}; return {Success, std::move(emotes)};

View file

@ -13,9 +13,7 @@
#include <memory> #include <memory>
namespace chatterino { namespace chatterino {
namespace { namespace {
void parseEmoji(const std::shared_ptr<EmojiData> &emojiData, void parseEmoji(const std::shared_ptr<EmojiData> &emojiData,
const rapidjson::Value &unparsedEmoji, const rapidjson::Value &unparsedEmoji,
QString shortCode = QString()) QString shortCode = QString())
@ -40,7 +38,8 @@ void parseEmoji(const std::shared_ptr<EmojiData> &emojiData,
} }
} }
rj::getSafe(unparsedEmoji, "non_qualified", emojiData->nonQualifiedCode); rj::getSafe(unparsedEmoji, "non_qualified",
emojiData->nonQualifiedCode);
rj::getSafe(unparsedEmoji, "unified", emojiData->unifiedCode); rj::getSafe(unparsedEmoji, "unified", emojiData->unifiedCode);
rj::getSafe(unparsedEmoji, "has_img_apple", capabilities.apple); rj::getSafe(unparsedEmoji, "has_img_apple", capabilities.apple);
@ -71,7 +70,8 @@ void parseEmoji(const std::shared_ptr<EmojiData> &emojiData,
QStringList unicodeCharacters; QStringList unicodeCharacters;
if (!emojiData->nonQualifiedCode.isEmpty()) { if (!emojiData->nonQualifiedCode.isEmpty()) {
unicodeCharacters = emojiData->nonQualifiedCode.toLower().split('-'); unicodeCharacters =
emojiData->nonQualifiedCode.toLower().split('-');
} else { } else {
unicodeCharacters = emojiData->unifiedCode.toLower().split('-'); unicodeCharacters = emojiData->unifiedCode.toLower().split('-');
} }
@ -88,7 +88,6 @@ void parseEmoji(const std::shared_ptr<EmojiData> &emojiData,
emojiData->value = QString::fromUcs4(unicodeBytes, numUnicodeBytes); emojiData->value = QString::fromUcs4(unicodeBytes, numUnicodeBytes);
} }
} // namespace } // namespace
void Emojis::load() void Emojis::load()

View file

@ -42,8 +42,8 @@ EmotePtr cachedOrMake(Emote &&emote, const EmoteId &id)
return cachedOrMakeEmotePtr(std::move(emote), cache, mutex, id); return cachedOrMakeEmotePtr(std::move(emote), cache, mutex, id);
} }
std::pair<Outcome, EmoteMap> parseGlobalEmotes(const QJsonObject &jsonRoot, std::pair<Outcome, EmoteMap> parseGlobalEmotes(
const EmoteMap &currentEmotes) const QJsonObject &jsonRoot, const EmoteMap &currentEmotes)
{ {
auto jsonSets = jsonRoot.value("sets").toObject(); auto jsonSets = jsonRoot.value("sets").toObject();
auto emotes = EmoteMap(); auto emotes = EmoteMap();
@ -59,8 +59,8 @@ std::pair<Outcome, EmoteMap> parseGlobalEmotes(const QJsonObject &jsonRoot,
auto urls = jsonEmote.value("urls").toObject(); auto urls = jsonEmote.value("urls").toObject();
auto emote = Emote(); auto emote = Emote();
fillInEmoteData(urls, name, name.string + "<br/>Global FFZ Emote", fillInEmoteData(urls, name,
emote); name.string + "<br/>Global FFZ Emote", emote);
emote.homePage = emote.homePage =
Url{QString("https://www.frankerfacez.com/emoticon/%1-%2") Url{QString("https://www.frankerfacez.com/emoticon/%1-%2")
.arg(id.string) .arg(id.string)
@ -85,13 +85,14 @@ std::pair<Outcome, EmoteMap> parseChannelEmotes(const QJsonObject &jsonRoot)
auto jsonEmote = _jsonEmote.toObject(); auto jsonEmote = _jsonEmote.toObject();
// margins // margins
auto id = EmoteId{QString::number(jsonEmote.value("id").toInt())}; auto id =
EmoteId{QString::number(jsonEmote.value("id").toInt())};
auto name = EmoteName{jsonEmote.value("name").toString()}; auto name = EmoteName{jsonEmote.value("name").toString()};
auto urls = jsonEmote.value("urls").toObject(); auto urls = jsonEmote.value("urls").toObject();
Emote emote; Emote emote;
fillInEmoteData(urls, name, name.string + "<br/>Channel FFZ Emote", fillInEmoteData(urls, name,
emote); name.string + "<br/>Channel FFZ Emote", emote);
emote.homePage = emote.homePage =
Url{QString("https://www.frankerfacez.com/emoticon/%1-%2") Url{QString("https://www.frankerfacez.com/emoticon/%1-%2")
.arg(id.string) .arg(id.string)

View file

@ -79,7 +79,8 @@ void PubSubClient::unlistenPrefix(const std::string &prefix)
{ {
std::vector<std::string> topics; std::vector<std::string> topics;
for (auto it = this->listeners_.begin(); it != this->listeners_.end();) { for (auto it = this->listeners_.begin();
it != this->listeners_.end();) {
const auto &listener = *it; const auto &listener = *it;
if (listener.topic.find(prefix) == 0) { if (listener.topic.find(prefix) == 0) {
topics.push_back(listener.topic); topics.push_back(listener.topic);
@ -137,20 +138,21 @@ void PubSubClient::ping()
auto self = this->shared_from_this(); auto self = this->shared_from_this();
runAfter(this->websocketClient_.get_io_service(), std::chrono::seconds(15), runAfter(this->websocketClient_.get_io_service(),
[self](auto timer) { std::chrono::seconds(15), [self](auto timer) {
if (!self->started_) { if (!self->started_) {
return; return;
} }
if (self->awaitingPong_) { if (self->awaitingPong_) {
log("No pong respnose, disconnect!"); log("No pong respnose, disconnect!");
// TODO(pajlada): Label this connection as "disconnect me" // TODO(pajlada): Label this connection as "disconnect
// me"
} }
}); });
runAfter(this->websocketClient_.get_io_service(), std::chrono::minutes(5), runAfter(this->websocketClient_.get_io_service(),
[self](auto timer) { std::chrono::minutes(5), [self](auto timer) {
if (!self->started_) { if (!self->started_) {
return; return;
} }
@ -167,8 +169,8 @@ bool PubSubClient::send(const char *payload)
if (ec) { if (ec) {
log("Error sending message {}: {}", payload, ec.message()); log("Error sending message {}: {}", payload, ec.message());
// TODO(pajlada): Check which error code happened and maybe gracefully // TODO(pajlada): Check which error code happened and maybe
// handle it // gracefully handle it
return false; return false;
} }

View file

@ -42,7 +42,8 @@ struct Listener {
class PubSubClient : public std::enable_shared_from_this<PubSubClient> class PubSubClient : public std::enable_shared_from_this<PubSubClient>
{ {
public: public:
PubSubClient(WebsocketClient &_websocketClient, WebsocketHandle _handle); PubSubClient(WebsocketClient &_websocketClient,
WebsocketHandle _handle);
void start(); void start();
void stop(); void stop();

View file

@ -1,11 +1,10 @@
#pragma once #pragma once
#include "debug/Log.hpp"
#include "util/RapidjsonHelpers.hpp"
#include "debug/Log.hpp"
#include <boost/asio.hpp> #include <boost/asio.hpp>
#include <boost/asio/steady_timer.hpp> #include <boost/asio/steady_timer.hpp>
#include <memory> #include <memory>
#include "debug/Log.hpp"
#include "util/RapidjsonHelpers.hpp"
namespace chatterino { namespace chatterino {

View file

@ -25,7 +25,8 @@
namespace chatterino { namespace chatterino {
namespace { namespace {
auto parseRecentMessages(const QJsonObject &jsonRoot, TwitchChannel &channel) auto parseRecentMessages(const QJsonObject &jsonRoot,
TwitchChannel &channel)
{ {
QJsonArray jsonMessages = jsonRoot.value("messages").toArray(); QJsonArray jsonMessages = jsonRoot.value("messages").toArray();
std::vector<MessagePtr> messages; std::vector<MessagePtr> messages;
@ -34,8 +35,8 @@ auto parseRecentMessages(const QJsonObject &jsonRoot, TwitchChannel &channel)
for (const auto jsonMessage : jsonMessages) { for (const auto jsonMessage : jsonMessages) {
auto content = jsonMessage.toString().toUtf8(); auto content = jsonMessage.toString().toUtf8();
// passing nullptr as the channel makes the message invalid but we don't // passing nullptr as the channel makes the message invalid but we
// check for that anyways // don't check for that anyways
auto message = Communi::IrcMessage::fromData(content, nullptr); auto message = Communi::IrcMessage::fromData(content, nullptr);
auto privMsg = dynamic_cast<Communi::IrcPrivateMessage *>(message); auto privMsg = dynamic_cast<Communi::IrcPrivateMessage *>(message);
assert(privMsg); assert(privMsg);

View file

@ -28,8 +28,8 @@ inline bool ReadValue(const rapidjson::Value &object, const char *key,
} }
template <> template <>
inline bool ReadValue<QString>(const rapidjson::Value &object, const char *key, inline bool ReadValue<QString>(const rapidjson::Value &object,
QString &out) const char *key, QString &out)
{ {
if (!object.HasMember(key)) { if (!object.HasMember(key)) {
return false; return false;

View file

@ -104,8 +104,7 @@ Fonts::FontData Fonts::createFontData(FontStyle type, float scale)
{FontStyle::ChatMediumSmall, {0.8f, false, QFont::Normal}}, {FontStyle::ChatMediumSmall, {0.8f, false, QFont::Normal}},
{FontStyle::ChatMedium, {1, false, QFont::Normal}}, {FontStyle::ChatMedium, {1, false, QFont::Normal}},
{FontStyle::ChatMediumBold, {FontStyle::ChatMediumBold,
{1, false, {1, false, QFont::Weight(getSettings()->boldScale.getValue())}},
QFont::Weight(getSettings()->boldScale.getValue())}},
{FontStyle::ChatMediumItalic, {1, true, QFont::Normal}}, {FontStyle::ChatMediumItalic, {1, true, QFont::Normal}},
{FontStyle::ChatLarge, {1.2f, false, QFont::Normal}}, {FontStyle::ChatLarge, {1.2f, false, QFont::Normal}},
{FontStyle::ChatVeryLarge, {1.4f, false, QFont::Normal}}, {FontStyle::ChatVeryLarge, {1.4f, false, QFont::Normal}},

View file

@ -5,13 +5,15 @@
namespace chatterino { namespace chatterino {
namespace rj { namespace rj {
void addMember(rapidjson::Value &obj, const char *key, rapidjson::Value &&value, void addMember(rapidjson::Value &obj, const char *key,
rapidjson::Value &&value,
rapidjson::Document::AllocatorType &a) rapidjson::Document::AllocatorType &a)
{ {
obj.AddMember(rapidjson::Value(key, a).Move(), value, a); obj.AddMember(rapidjson::Value(key, a).Move(), value, a);
} }
void addMember(rapidjson::Value &obj, const char *key, rapidjson::Value &value, void addMember(rapidjson::Value &obj, const char *key,
rapidjson::Value &value,
rapidjson::Document::AllocatorType &a) rapidjson::Document::AllocatorType &a)
{ {
obj.AddMember(rapidjson::Value(key, a).Move(), value.Move(), a); obj.AddMember(rapidjson::Value(key, a).Move(), value.Move(), a);

View file

@ -11,9 +11,11 @@
namespace chatterino { namespace chatterino {
namespace rj { namespace rj {
void addMember(rapidjson::Value &obj, const char *key, rapidjson::Value &&value, void addMember(rapidjson::Value &obj, const char *key,
rapidjson::Value &&value,
rapidjson::Document::AllocatorType &a); rapidjson::Document::AllocatorType &a);
void addMember(rapidjson::Value &obj, const char *key, rapidjson::Value &value, void addMember(rapidjson::Value &obj, const char *key,
rapidjson::Value &value,
rapidjson::Document::AllocatorType &a); rapidjson::Document::AllocatorType &a);
template <typename Type> template <typename Type>
@ -22,7 +24,8 @@ void set(rapidjson::Value &obj, const char *key, const Type &value,
{ {
assert(obj.IsObject()); assert(obj.IsObject());
addMember(obj, key, pajlada::Settings::Serialize<Type>::get(value, a), a); addMember(obj, key, pajlada::Settings::Serialize<Type>::get(value, a),
a);
} }
template <> template <>
@ -42,7 +45,8 @@ void set(rapidjson::Document &obj, const char *key, const Type &value)
auto &a = obj.GetAllocator(); auto &a = obj.GetAllocator();
addMember(obj, key, pajlada::Settings::Serialize<Type>::get(value, a), a); addMember(obj, key, pajlada::Settings::Serialize<Type>::get(value, a),
a);
} }
template <> template <>

View file

@ -2,9 +2,9 @@
#include "Application.hpp" #include "Application.hpp"
#include "Helpers.hpp" #include "Helpers.hpp"
#include "debug/Log.hpp"
#include "singletons/Settings.hpp" #include "singletons/Settings.hpp"
#include "widgets/dialogs/QualityPopup.hpp" #include "widgets/dialogs/QualityPopup.hpp"
#include "debug/Log.hpp"
#include <QErrorMessage> #include <QErrorMessage>
#include <QFileInfo> #include <QFileInfo>
@ -51,8 +51,8 @@ bool checkStreamlinkPath(const QString &path)
if (!fileinfo.exists()) { if (!fileinfo.exists()) {
return false; return false;
// throw Exception(fS("Streamlink path ({}) is invalid, file does not // throw Exception(fS("Streamlink path ({}) is invalid, file does
// exist", path)); // not exist", path));
} }
return fileinfo.isExecutable(); return fileinfo.isExecutable();
@ -65,7 +65,8 @@ void showStreamlinkNotFoundError()
auto app = getApp(); auto app = getApp();
if (getSettings()->streamlinkUseCustomPath) { if (getSettings()->streamlinkUseCustomPath) {
msg->showMessage( msg->showMessage(
"Unable to find Streamlink executable\nMake sure your custom path " "Unable to find Streamlink executable\nMake sure your custom "
"path "
"is pointing " "is pointing "
"to the DIRECTORY where the streamlink executable is located"); "to the DIRECTORY where the streamlink executable is located");
} else { } else {
@ -90,8 +91,8 @@ QProcess *createStreamlinkProcess()
p->deleteLater(); p->deleteLater();
}); });
QObject::connect(p, QObject::connect(
static_cast<void (QProcess::*)(int)>(&QProcess::finished), p, static_cast<void (QProcess::*)(int)>(&QProcess::finished),
[=](int res) { [=](int res) {
p->deleteLater(); // p->deleteLater(); //
}); });

View file

@ -433,8 +433,7 @@ void SplitNotebook::addCustomButtons()
// settings // settings
auto settingsBtn = this->addCustomButton(); auto settingsBtn = this->addCustomButton();
settingsBtn->setVisible( settingsBtn->setVisible(!getSettings()->hidePreferencesButton.getValue());
!getSettings()->hidePreferencesButton.getValue());
getSettings()->hidePreferencesButton.connect( getSettings()->hidePreferencesButton.connect(
[settingsBtn](bool hide, auto) { settingsBtn->setVisible(!hide); }, [settingsBtn](bool hide, auto) { settingsBtn->setVisible(!hide); },

View file

@ -31,13 +31,15 @@ auto makeEmoteMessage(const EmoteMap &map)
for (const auto &emote : map) { for (const auto &emote : map) {
builder builder
.emplace<EmoteElement>(emote.second, MessageElementFlag::AlwaysShow) .emplace<EmoteElement>(emote.second,
MessageElementFlag::AlwaysShow)
->setLink(Link(Link::InsertText, emote.first.string)); ->setLink(Link(Link::InsertText, emote.first.string));
} }
return builder.release(); return builder.release();
} }
void addEmoteSets(std::vector<std::shared_ptr<TwitchAccount::EmoteSet>> sets, void addEmoteSets(
std::vector<std::shared_ptr<TwitchAccount::EmoteSet>> sets,
Channel &globalChannel, Channel &subChannel) Channel &globalChannel, Channel &subChannel)
{ {
for (const auto &set : sets) { for (const auto &set : sets) {

View file

@ -63,8 +63,8 @@ void addEmoteContextMenuItems(const Emote &emote,
QString(scale) + "x link", [url = image->url()] { QString(scale) + "x link", [url = image->url()] {
QApplication::clipboard()->setText(url.string); QApplication::clipboard()->setText(url.string);
}); });
openMenu->addAction(QString(scale) + "x link", openMenu->addAction(
[url = image->url()] { QString(scale) + "x link", [url = image->url()] {
QDesktopServices::openUrl(QUrl(url.string)); QDesktopServices::openUrl(QUrl(url.string));
}); });
} }
@ -83,8 +83,8 @@ void addEmoteContextMenuItems(const Emote &emote,
"Copy " + name + " emote link", [url = emote.homePage] { "Copy " + name + " emote link", [url = emote.homePage] {
QApplication::clipboard()->setText(url.string); // QApplication::clipboard()->setText(url.string); //
}); });
openMenu->addAction("Open " + name + " emote link", openMenu->addAction(
[url = emote.homePage] { "Open " + name + " emote link", [url = emote.homePage] {
QDesktopServices::openUrl(QUrl(url.string)); // QDesktopServices::openUrl(QUrl(url.string)); //
}); });
}; };

View file

@ -9,15 +9,13 @@
"Choose", "Source", "High", "Medium", "Low", "Audio only" "Choose", "Source", "High", "Medium", "Low", "Audio only"
namespace chatterino { namespace chatterino {
namespace { namespace {
QString createLink(const QString &url, const QString &name)
QString CreateLink(const QString &url, const QString &name)
{ {
return QString("<a href=\"" + url + "\"><span style=\"color: white;\">" + return QString("<a href=\"" + url +
name + "</span></a>"); "\"><span style=\"color: white;\">" + name +
"</span></a>");
} }
} // namespace } // namespace
ExternalToolsPage::ExternalToolsPage() ExternalToolsPage::ExternalToolsPage()
@ -41,8 +39,8 @@ ExternalToolsPage::ExternalToolsPage()
description->setStyleSheet("color: #bbb"); description->setStyleSheet("color: #bbb");
auto links = new QLabel( auto links = new QLabel(
CreateLink("https://streamlink.github.io/", "Website") + " " + createLink("https://streamlink.github.io/", "Website") + " " +
CreateLink( createLink(
"https://github.com/streamlink/streamlink/releases/latest", "https://github.com/streamlink/streamlink/releases/latest",
"Download")); "Download"));
links->setTextFormat(Qt::RichText); links->setTextFormat(Qt::RichText);

View file

@ -69,8 +69,7 @@ void addPhrasesTab(LayoutCreator<QVBoxLayout> layout)
void addUsersTab(IgnoresPage &page, LayoutCreator<QVBoxLayout> users, void addUsersTab(IgnoresPage &page, LayoutCreator<QVBoxLayout> users,
QStringListModel &userModel) QStringListModel &userModel)
{ {
users.append( users.append(page.createCheckBox("Enable twitch ignored users",
page.createCheckBox("Enable twitch ignored users",
getSettings()->enableTwitchIgnoredUsers)); getSettings()->enableTwitchIgnoredUsers));
auto anyways = users.emplace<QHBoxLayout>().withoutMargin(); auto anyways = users.emplace<QHBoxLayout>().withoutMargin();

View file

@ -25,7 +25,7 @@
namespace chatterino { namespace chatterino {
inline QString CreateLink(const QString &url, bool file = false) inline QString createLink(const QString &url, bool file = false)
{ {
if (file) { if (file) {
return QString("<a href=\"file:///" + url + return QString("<a href=\"file:///" + url +

View file

@ -40,7 +40,8 @@ auto formatRoomMode(TwitchChannel &channel) -> QString
if (modes->r9k) text += "r9k, "; if (modes->r9k) text += "r9k, ";
if (modes->slowMode) if (modes->slowMode)
text += QString("slow(%1), ").arg(QString::number(modes->slowMode)); text +=
QString("slow(%1), ").arg(QString::number(modes->slowMode));
if (modes->emoteOnly) text += "emote, "; if (modes->emoteOnly) text += "emote, ";
if (modes->submode) text += "sub, "; if (modes->submode) text += "sub, ";
} }