put singletons into their namespace
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#include "singletons/accountmanager.hpp"
|
||||
|
||||
namespace chatterino {
|
||||
namespace singletons {
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -43,3 +44,4 @@ void AccountManager::load()
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "twitch/twitchaccountmanager.hpp"
|
||||
|
||||
namespace chatterino {
|
||||
namespace singletons {
|
||||
|
||||
class AccountManager
|
||||
{
|
||||
@@ -17,3 +18,4 @@ public:
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
using namespace chatterino::twitch;
|
||||
|
||||
namespace chatterino {
|
||||
namespace singletons {
|
||||
|
||||
ChannelManager &ChannelManager::getInstance()
|
||||
{
|
||||
@@ -138,3 +139,4 @@ void ChannelManager::doOnAll(std::function<void(std::shared_ptr<Channel>)> func)
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
}
|
||||
|
||||
@@ -7,8 +7,7 @@
|
||||
#include <map>
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
class WindowManager;
|
||||
namespace singletons {
|
||||
class IrcManager;
|
||||
|
||||
class ChannelManager
|
||||
@@ -43,7 +42,8 @@ private:
|
||||
pajlada::Signals::Signal<const QString &> ircJoin;
|
||||
pajlada::Signals::Signal<const QString &> ircPart;
|
||||
|
||||
friend class IrcManager;
|
||||
friend class singletons::IrcManager;
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <QRegularExpression>
|
||||
|
||||
namespace chatterino {
|
||||
namespace singletons {
|
||||
CommandManager &CommandManager::getInstance()
|
||||
{
|
||||
static CommandManager instance;
|
||||
@@ -81,3 +82,4 @@ CommandManager &CommandManager::getInstance()
|
||||
// this->text = _text.mid(index + 1);
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <vector>
|
||||
|
||||
namespace chatterino {
|
||||
namespace singletons {
|
||||
|
||||
class CommandManager
|
||||
{
|
||||
@@ -36,3 +37,4 @@ public:
|
||||
// std::vector<Command> commands;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "singletons/emotemanager.hpp"
|
||||
|
||||
namespace chatterino {
|
||||
namespace singletons {
|
||||
|
||||
CompletionManager &CompletionManager::getInstance()
|
||||
{
|
||||
@@ -26,3 +27,4 @@ CompletionModel *CompletionManager::createModel(const std::string &channelName)
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "helper/completionmodel.hpp"
|
||||
|
||||
namespace chatterino {
|
||||
namespace singletons {
|
||||
class CompletionManager
|
||||
{
|
||||
CompletionManager() = default;
|
||||
@@ -22,3 +23,4 @@ private:
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
}
|
||||
|
||||
@@ -21,8 +21,9 @@
|
||||
using namespace chatterino::messages;
|
||||
|
||||
namespace chatterino {
|
||||
namespace singletons {
|
||||
|
||||
EmoteManager::EmoteManager(SettingsManager &_settingsManager, WindowManager &_windowManager)
|
||||
EmoteManager::EmoteManager(SettingManager &_settingsManager, WindowManager &_windowManager)
|
||||
: settingsManager(_settingsManager)
|
||||
, windowManager(_windowManager)
|
||||
, findShortCodesRegex(":([-+\\w]+):")
|
||||
@@ -38,7 +39,7 @@ EmoteManager::EmoteManager(SettingsManager &_settingsManager, WindowManager &_wi
|
||||
|
||||
EmoteManager &EmoteManager::getInstance()
|
||||
{
|
||||
static EmoteManager instance(SettingsManager::getInstance(), WindowManager::getInstance());
|
||||
static EmoteManager instance(SettingManager::getInstance(), WindowManager::getInstance());
|
||||
return instance;
|
||||
}
|
||||
|
||||
@@ -49,7 +50,8 @@ void EmoteManager::loadGlobalEmotes()
|
||||
this->loadFFZEmotes();
|
||||
}
|
||||
|
||||
void EmoteManager::reloadBTTVChannelEmotes(const QString &channelName, std::weak_ptr<EmoteMap> _map)
|
||||
void EmoteManager::reloadBTTVChannelEmotes(const QString &channelName,
|
||||
std::weak_ptr<util::EmoteMap> _map)
|
||||
{
|
||||
printf("[EmoteManager] Reload BTTV Channel Emotes for channel %s\n", qPrintable(channelName));
|
||||
|
||||
@@ -88,7 +90,7 @@ void EmoteManager::reloadBTTVChannelEmotes(const QString &channelName, std::weak
|
||||
link = link.replace("{{id}}", id).replace("{{image}}", "1x");
|
||||
|
||||
auto emote = this->getBTTVChannelEmoteFromCaches().getOrAdd(id, [this, &code, &link] {
|
||||
return EmoteData(
|
||||
return util::EmoteData(
|
||||
new LazyLoadedImage(link, 1, code, code + "<br/>Channel BTTV Emote"));
|
||||
});
|
||||
|
||||
@@ -101,7 +103,8 @@ void EmoteManager::reloadBTTVChannelEmotes(const QString &channelName, std::weak
|
||||
});
|
||||
}
|
||||
|
||||
void EmoteManager::reloadFFZChannelEmotes(const QString &channelName, std::weak_ptr<EmoteMap> _map)
|
||||
void EmoteManager::reloadFFZChannelEmotes(const QString &channelName,
|
||||
std::weak_ptr<util::EmoteMap> _map)
|
||||
{
|
||||
printf("[EmoteManager] Reload FFZ Channel Emotes for channel %s\n", qPrintable(channelName));
|
||||
|
||||
@@ -137,7 +140,7 @@ void EmoteManager::reloadFFZChannelEmotes(const QString &channelName, std::weak_
|
||||
|
||||
auto emote =
|
||||
this->getFFZChannelEmoteFromCaches().getOrAdd(id, [this, &code, &url1] {
|
||||
return EmoteData(
|
||||
return util::EmoteData(
|
||||
new LazyLoadedImage(url1, 1, code, code + "<br/>Channel FFZ Emote"));
|
||||
});
|
||||
|
||||
@@ -151,37 +154,37 @@ void EmoteManager::reloadFFZChannelEmotes(const QString &channelName, std::weak_
|
||||
});
|
||||
}
|
||||
|
||||
ConcurrentMap<QString, twitch::EmoteValue *> &EmoteManager::getTwitchEmotes()
|
||||
util::ConcurrentMap<QString, twitch::EmoteValue *> &EmoteManager::getTwitchEmotes()
|
||||
{
|
||||
return _twitchEmotes;
|
||||
}
|
||||
|
||||
EmoteMap &EmoteManager::getFFZEmotes()
|
||||
util::EmoteMap &EmoteManager::getFFZEmotes()
|
||||
{
|
||||
return ffzGlobalEmotes;
|
||||
}
|
||||
|
||||
EmoteMap &EmoteManager::getChatterinoEmotes()
|
||||
util::EmoteMap &EmoteManager::getChatterinoEmotes()
|
||||
{
|
||||
return _chatterinoEmotes;
|
||||
}
|
||||
|
||||
EmoteMap &EmoteManager::getBTTVChannelEmoteFromCaches()
|
||||
util::EmoteMap &EmoteManager::getBTTVChannelEmoteFromCaches()
|
||||
{
|
||||
return _bttvChannelEmoteFromCaches;
|
||||
}
|
||||
|
||||
EmoteMap &EmoteManager::getEmojis()
|
||||
util::EmoteMap &EmoteManager::getEmojis()
|
||||
{
|
||||
return this->emojis;
|
||||
}
|
||||
|
||||
ConcurrentMap<int, EmoteData> &EmoteManager::getFFZChannelEmoteFromCaches()
|
||||
util::ConcurrentMap<int, util::EmoteData> &EmoteManager::getFFZChannelEmoteFromCaches()
|
||||
{
|
||||
return _ffzChannelEmoteFromCaches;
|
||||
}
|
||||
|
||||
ConcurrentMap<long, EmoteData> &EmoteManager::getTwitchEmoteFromCache()
|
||||
util::ConcurrentMap<long, util::EmoteData> &EmoteManager::getTwitchEmoteFromCache()
|
||||
{
|
||||
return _twitchEmoteFromCache;
|
||||
}
|
||||
@@ -237,7 +240,8 @@ void EmoteManager::loadEmojis()
|
||||
"emojione/2.2.6/assets/png/" +
|
||||
code + ".png";
|
||||
|
||||
this->emojis.insert(code, EmoteData(new LazyLoadedImage(url, 0.35, ":" + shortCode + ":",
|
||||
this->emojis.insert(code,
|
||||
util::EmoteData(new LazyLoadedImage(url, 0.35, ":" + shortCode + ":",
|
||||
":" + shortCode + ":<br/>Emoji")));
|
||||
|
||||
// TODO(pajlada): The vectors in emojiFirstByte need to be sorted by
|
||||
@@ -245,7 +249,7 @@ void EmoteManager::loadEmojis()
|
||||
}
|
||||
}
|
||||
|
||||
void EmoteManager::parseEmojis(std::vector<std::tuple<EmoteData, QString>> &parsedWords,
|
||||
void EmoteManager::parseEmojis(std::vector<std::tuple<util::EmoteData, QString>> &parsedWords,
|
||||
const QString &text)
|
||||
{
|
||||
int lastParsedEmojiEndIndex = 0;
|
||||
@@ -316,11 +320,12 @@ void EmoteManager::parseEmojis(std::vector<std::tuple<EmoteData, QString>> &pars
|
||||
|
||||
// Create or fetch cached emoji image
|
||||
auto emojiImage = this->emojis.getOrAdd(matchedEmoji.code, [this, &url] {
|
||||
return EmoteData(new LazyLoadedImage(url, 0.35, "?????????", "???????????????")); //
|
||||
return util::EmoteData(
|
||||
new LazyLoadedImage(url, 0.35, "?????????", "???????????????")); //
|
||||
});
|
||||
|
||||
// Push the emoji as a word to parsedWords
|
||||
parsedWords.push_back(std::tuple<EmoteData, QString>(emojiImage, QString()));
|
||||
parsedWords.push_back(std::tuple<util::EmoteData, QString>(emojiImage, QString()));
|
||||
|
||||
lastParsedEmojiEndIndex = currentParsedEmojiEndIndex;
|
||||
|
||||
@@ -482,7 +487,7 @@ void EmoteManager::loadFFZEmotes()
|
||||
|
||||
// id is used for lookup
|
||||
// emoteName is used for giving a name to the emote in case it doesn't exist
|
||||
EmoteData EmoteManager::getTwitchEmoteById(long id, const QString &emoteName)
|
||||
util::EmoteData EmoteManager::getTwitchEmoteById(long id, const QString &emoteName)
|
||||
{
|
||||
return _twitchEmoteFromCache.getOrAdd(id, [this, &emoteName, &id] {
|
||||
qreal scale;
|
||||
@@ -502,10 +507,10 @@ QString EmoteManager::getTwitchEmoteLink(long id, qreal &scale)
|
||||
return value.replace("{id}", QString::number(id)).replace("{scale}", "2");
|
||||
}
|
||||
|
||||
EmoteData EmoteManager::getCheerImage(long long amount, bool animated)
|
||||
util::EmoteData EmoteManager::getCheerImage(long long amount, bool animated)
|
||||
{
|
||||
// TODO: fix this xD
|
||||
return EmoteData();
|
||||
return util::EmoteData();
|
||||
}
|
||||
|
||||
boost::signals2::signal<void()> &EmoteManager::getGifUpdateSignal()
|
||||
@@ -535,3 +540,4 @@ boost::signals2::signal<void()> &EmoteManager::getGifUpdateSignal()
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
}
|
||||
|
||||
@@ -2,12 +2,13 @@
|
||||
|
||||
#define GIF_FRAME_LENGTH 33
|
||||
|
||||
#include "concurrentmap.hpp"
|
||||
#include "emojis.hpp"
|
||||
#include "messages/lazyloadedimage.hpp"
|
||||
#include "signalvector.hpp"
|
||||
#include "twitch/emotevalue.hpp"
|
||||
#include "twitch/twitchuser.hpp"
|
||||
#include "util/concurrentmap.hpp"
|
||||
#include "util/emotemap.hpp"
|
||||
|
||||
#include <QMap>
|
||||
#include <QMutex>
|
||||
@@ -17,28 +18,15 @@
|
||||
#include <boost/signals2.hpp>
|
||||
|
||||
namespace chatterino {
|
||||
namespace singletons {
|
||||
|
||||
class SettingsManager;
|
||||
class SettingManager;
|
||||
class WindowManager;
|
||||
|
||||
struct EmoteData {
|
||||
EmoteData()
|
||||
{
|
||||
}
|
||||
|
||||
EmoteData(messages::LazyLoadedImage *_image)
|
||||
: image(_image)
|
||||
{
|
||||
}
|
||||
|
||||
messages::LazyLoadedImage *image = nullptr;
|
||||
};
|
||||
|
||||
typedef ConcurrentMap<QString, EmoteData> EmoteMap;
|
||||
|
||||
class EmoteManager
|
||||
{
|
||||
explicit EmoteManager(SettingsManager &manager, WindowManager &windowManager);
|
||||
explicit EmoteManager(singletons::SettingManager &manager,
|
||||
singletons::WindowManager &windowManager);
|
||||
|
||||
public:
|
||||
static EmoteManager &getInstance();
|
||||
@@ -46,21 +34,21 @@ public:
|
||||
void loadGlobalEmotes();
|
||||
|
||||
void reloadBTTVChannelEmotes(const QString &channelName,
|
||||
std::weak_ptr<EmoteMap> channelEmoteMap);
|
||||
std::weak_ptr<util::EmoteMap> channelEmoteMap);
|
||||
void reloadFFZChannelEmotes(const QString &channelName,
|
||||
std::weak_ptr<EmoteMap> channelEmoteMap);
|
||||
std::weak_ptr<util::EmoteMap> channelEmoteMap);
|
||||
|
||||
ConcurrentMap<QString, twitch::EmoteValue *> &getTwitchEmotes();
|
||||
EmoteMap &getFFZEmotes();
|
||||
EmoteMap &getChatterinoEmotes();
|
||||
EmoteMap &getBTTVChannelEmoteFromCaches();
|
||||
EmoteMap &getEmojis();
|
||||
ConcurrentMap<int, EmoteData> &getFFZChannelEmoteFromCaches();
|
||||
ConcurrentMap<long, EmoteData> &getTwitchEmoteFromCache();
|
||||
util::ConcurrentMap<QString, twitch::EmoteValue *> &getTwitchEmotes();
|
||||
util::EmoteMap &getFFZEmotes();
|
||||
util::EmoteMap &getChatterinoEmotes();
|
||||
util::EmoteMap &getBTTVChannelEmoteFromCaches();
|
||||
util::EmoteMap &getEmojis();
|
||||
util::ConcurrentMap<int, util::EmoteData> &getFFZChannelEmoteFromCaches();
|
||||
util::ConcurrentMap<long, util::EmoteData> &getTwitchEmoteFromCache();
|
||||
|
||||
EmoteData getCheerImage(long long int amount, bool animated);
|
||||
util::EmoteData getCheerImage(long long int amount, bool animated);
|
||||
|
||||
EmoteData getTwitchEmoteById(long int id, const QString &emoteName);
|
||||
util::EmoteData getTwitchEmoteById(long int id, const QString &emoteName);
|
||||
|
||||
int getGeneration()
|
||||
{
|
||||
@@ -75,10 +63,10 @@ public:
|
||||
boost::signals2::signal<void()> &getGifUpdateSignal();
|
||||
|
||||
// Bit badge/emotes?
|
||||
ConcurrentMap<QString, messages::LazyLoadedImage *> miscImageCache;
|
||||
util::ConcurrentMap<QString, messages::LazyLoadedImage *> miscImageCache;
|
||||
|
||||
private:
|
||||
SettingsManager &settingsManager;
|
||||
SettingManager &settingsManager;
|
||||
WindowManager &windowManager;
|
||||
|
||||
/// Emojis
|
||||
@@ -91,12 +79,13 @@ private:
|
||||
QMap<QChar, QVector<EmojiData>> emojiFirstByte;
|
||||
|
||||
// url Emoji-one image
|
||||
EmoteMap emojis;
|
||||
util::EmoteMap emojis;
|
||||
|
||||
void loadEmojis();
|
||||
|
||||
public:
|
||||
void parseEmojis(std::vector<std::tuple<EmoteData, QString>> &parsedWords, const QString &text);
|
||||
void parseEmojis(std::vector<std::tuple<util::EmoteData, QString>> &parsedWords,
|
||||
const QString &text);
|
||||
|
||||
QString replaceShortCodes(const QString &text);
|
||||
|
||||
@@ -123,41 +112,41 @@ public:
|
||||
|
||||
private:
|
||||
// emote code
|
||||
ConcurrentMap<QString, twitch::EmoteValue *> _twitchEmotes;
|
||||
util::ConcurrentMap<QString, twitch::EmoteValue *> _twitchEmotes;
|
||||
|
||||
// emote id
|
||||
ConcurrentMap<long, EmoteData> _twitchEmoteFromCache;
|
||||
util::ConcurrentMap<long, util::EmoteData> _twitchEmoteFromCache;
|
||||
|
||||
/// BTTV emotes
|
||||
EmoteMap bttvChannelEmotes;
|
||||
util::EmoteMap bttvChannelEmotes;
|
||||
|
||||
public:
|
||||
ConcurrentMap<QString, EmoteMap> bttvChannels;
|
||||
EmoteMap bttvGlobalEmotes;
|
||||
util::ConcurrentMap<QString, util::EmoteMap> bttvChannels;
|
||||
util::EmoteMap bttvGlobalEmotes;
|
||||
SignalVector<std::string> bttvGlobalEmoteCodes;
|
||||
// roomID
|
||||
std::map<std::string, SignalVector<std::string>> bttvChannelEmoteCodes;
|
||||
EmoteMap _bttvChannelEmoteFromCaches;
|
||||
util::EmoteMap _bttvChannelEmoteFromCaches;
|
||||
|
||||
private:
|
||||
void loadBTTVEmotes();
|
||||
|
||||
/// FFZ emotes
|
||||
EmoteMap ffzChannelEmotes;
|
||||
util::EmoteMap ffzChannelEmotes;
|
||||
|
||||
public:
|
||||
ConcurrentMap<QString, EmoteMap> ffzChannels;
|
||||
EmoteMap ffzGlobalEmotes;
|
||||
util::ConcurrentMap<QString, util::EmoteMap> ffzChannels;
|
||||
util::EmoteMap ffzGlobalEmotes;
|
||||
SignalVector<std::string> ffzGlobalEmoteCodes;
|
||||
std::map<std::string, SignalVector<std::string>> ffzChannelEmoteCodes;
|
||||
|
||||
private:
|
||||
ConcurrentMap<int, EmoteData> _ffzChannelEmoteFromCaches;
|
||||
util::ConcurrentMap<int, util::EmoteData> _ffzChannelEmoteFromCaches;
|
||||
|
||||
void loadFFZEmotes();
|
||||
|
||||
/// Chatterino emotes
|
||||
EmoteMap _chatterinoEmotes;
|
||||
util::EmoteMap _chatterinoEmotes;
|
||||
|
||||
boost::signals2::signal<void()> gifUpdateTimerSignal;
|
||||
QTimer gifUpdateTimer;
|
||||
@@ -170,3 +159,4 @@ private:
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <QDebug>
|
||||
|
||||
namespace chatterino {
|
||||
namespace singletons {
|
||||
|
||||
FontManager::FontManager()
|
||||
: currentFontFamily("/appearance/currentFontFamily", "Arial")
|
||||
@@ -89,3 +90,4 @@ FontManager::Font &FontManager::getCurrentFont(float dpi)
|
||||
return this->currentFontByDpi.back().second;
|
||||
}
|
||||
} // namespace chatterino
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <pajlada/signals/signal.hpp>
|
||||
|
||||
namespace chatterino {
|
||||
namespace singletons {
|
||||
|
||||
class FontManager
|
||||
{
|
||||
@@ -133,3 +134,4 @@ private:
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
namespace chatterino {
|
||||
namespace singletons {
|
||||
static void _registerSetting(std::weak_ptr<pajlada::Settings::ISettingData> setting);
|
||||
|
||||
template <typename Type>
|
||||
@@ -65,3 +66,4 @@ public:
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "singletons/emotemanager.hpp"
|
||||
|
||||
namespace chatterino {
|
||||
namespace singletons {
|
||||
CompletionModel::CompletionModel(const QString &_channelName)
|
||||
: channelName(_channelName)
|
||||
{
|
||||
@@ -16,7 +17,7 @@ void CompletionModel::refresh()
|
||||
{
|
||||
// debug::Log("[CompletionModel:{}] Refreshing...]", this->channelName);
|
||||
|
||||
auto &emoteManager = EmoteManager::getInstance();
|
||||
auto &emoteManager = singletons::EmoteManager::getInstance();
|
||||
this->emotes.clear();
|
||||
|
||||
// User-specific: Twitch Emotes
|
||||
@@ -60,7 +61,7 @@ void CompletionModel::refresh()
|
||||
}
|
||||
|
||||
// Channel-specific: Usernames
|
||||
auto c = ChannelManager::getInstance().getTwitchChannel(this->channelName);
|
||||
auto c = singletons::ChannelManager::getInstance().getTwitchChannel(this->channelName);
|
||||
auto usernames = c->getUsernamesForCompletions();
|
||||
for (const auto &name : usernames) {
|
||||
assert(!name.displayName.isEmpty());
|
||||
@@ -86,3 +87,4 @@ void CompletionModel::addString(const QString &str)
|
||||
this->emotes.push_back(str + " ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <string>
|
||||
|
||||
namespace chatterino {
|
||||
namespace singletons {
|
||||
class CompletionModel : public QAbstractListModel
|
||||
{
|
||||
public:
|
||||
@@ -39,3 +40,4 @@ private:
|
||||
QString channelName;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
using namespace chatterino::messages;
|
||||
|
||||
namespace chatterino {
|
||||
namespace singletons {
|
||||
|
||||
IrcManager::IrcManager(ChannelManager &_channelManager, ResourceManager &_resources,
|
||||
AccountManager &_accountManager)
|
||||
@@ -70,7 +71,8 @@ IrcManager::IrcManager(ChannelManager &_channelManager, ResourceManager &_resour
|
||||
|
||||
IrcManager &IrcManager::getInstance()
|
||||
{
|
||||
static IrcManager instance(ChannelManager::getInstance(), ResourceManager::getInstance(),
|
||||
static IrcManager instance(ChannelManager::getInstance(),
|
||||
singletons::ResourceManager::getInstance(),
|
||||
AccountManager::getInstance());
|
||||
return instance;
|
||||
}
|
||||
@@ -196,7 +198,7 @@ void IrcManager::sendMessage(const QString &channelName, QString message)
|
||||
static int i = 0;
|
||||
|
||||
if (this->writeConnection) {
|
||||
if (SettingsManager::getInstance().allowDuplicateMessages && (++i % 2) == 0) {
|
||||
if (singletons::SettingManager::getInstance().allowDuplicateMessages && (++i % 2) == 0) {
|
||||
message.append(this->messageSuffix);
|
||||
}
|
||||
this->writeConnection->sendRaw("PRIVMSG #" + channelName + " :" + message);
|
||||
@@ -528,3 +530,4 @@ Communi::IrcConnection *IrcManager::getReadConnection()
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
}
|
||||
|
||||
@@ -17,10 +17,12 @@
|
||||
#include <mutex>
|
||||
|
||||
namespace chatterino {
|
||||
namespace singletons {
|
||||
|
||||
class ChannelManager;
|
||||
class ResourceManager;
|
||||
class AccountManager;
|
||||
class WindowManager;
|
||||
|
||||
class IrcManager : public QObject
|
||||
{
|
||||
@@ -100,3 +102,4 @@ private:
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <QPixmap>
|
||||
|
||||
namespace chatterino {
|
||||
namespace singletons {
|
||||
|
||||
namespace {
|
||||
|
||||
@@ -153,3 +154,4 @@ void ResourceManager::loadChatterinoBadges()
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <mutex>
|
||||
|
||||
namespace chatterino {
|
||||
namespace singletons {
|
||||
|
||||
class ResourceManager
|
||||
{
|
||||
@@ -90,3 +91,4 @@ public:
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
using namespace chatterino::messages;
|
||||
|
||||
namespace chatterino {
|
||||
namespace singletons {
|
||||
|
||||
std::vector<std::weak_ptr<pajlada::Settings::ISettingData>> _settings;
|
||||
|
||||
@@ -16,7 +17,7 @@ void _registerSetting(std::weak_ptr<pajlada::Settings::ISettingData> setting)
|
||||
_settings.push_back(setting);
|
||||
}
|
||||
|
||||
SettingsManager::SettingsManager()
|
||||
SettingManager::SettingManager()
|
||||
: streamlinkPath("/behaviour/streamlink/path", "")
|
||||
, preferredQuality("/behaviour/streamlink/quality", "Choose")
|
||||
, emoteScale(this->settingsItems, "emoteScale", 1.0)
|
||||
@@ -39,7 +40,7 @@ SettingsManager::SettingsManager()
|
||||
};
|
||||
}
|
||||
|
||||
void SettingsManager::save()
|
||||
void SettingManager::save()
|
||||
{
|
||||
for (auto &item : this->settingsItems) {
|
||||
if (item.get().getName() != "highlightProperties") {
|
||||
@@ -62,7 +63,7 @@ void SettingsManager::save()
|
||||
}
|
||||
}
|
||||
|
||||
void SettingsManager::load()
|
||||
void SettingManager::load()
|
||||
{
|
||||
for (auto &item : this->settingsItems) {
|
||||
if (item.get().getName() != "highlightProperties") {
|
||||
@@ -82,22 +83,22 @@ void SettingsManager::load()
|
||||
}
|
||||
}
|
||||
|
||||
Word::Flags SettingsManager::getWordTypeMask()
|
||||
Word::Flags SettingManager::getWordTypeMask()
|
||||
{
|
||||
return this->wordTypeMask;
|
||||
}
|
||||
|
||||
bool SettingsManager::isIgnoredEmote(const QString &)
|
||||
bool SettingManager::isIgnoredEmote(const QString &)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
QSettings &SettingsManager::getQSettings()
|
||||
QSettings &SettingManager::getQSettings()
|
||||
{
|
||||
return this->settings;
|
||||
}
|
||||
|
||||
void SettingsManager::updateWordTypeMask()
|
||||
void SettingManager::updateWordTypeMask()
|
||||
{
|
||||
uint32_t newMaskUint = Word::Text;
|
||||
|
||||
@@ -136,7 +137,7 @@ void SettingsManager::updateWordTypeMask()
|
||||
}
|
||||
}
|
||||
|
||||
void SettingsManager::saveSnapshot()
|
||||
void SettingManager::saveSnapshot()
|
||||
{
|
||||
rapidjson::Document *d = new rapidjson::Document(rapidjson::kObjectType);
|
||||
rapidjson::Document::AllocatorType &a = d->GetAllocator();
|
||||
@@ -157,7 +158,7 @@ void SettingsManager::saveSnapshot()
|
||||
debug::Log("hehe: {}", pajlada::Settings::SettingManager::stringify(*d));
|
||||
}
|
||||
|
||||
void SettingsManager::recallSnapshot()
|
||||
void SettingManager::recallSnapshot()
|
||||
{
|
||||
if (!this->snapshot) {
|
||||
return;
|
||||
@@ -184,3 +185,4 @@ void SettingsManager::recallSnapshot()
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
}
|
||||
|
||||
@@ -9,10 +9,11 @@
|
||||
#include <pajlada/settings/settinglistener.hpp>
|
||||
|
||||
namespace chatterino {
|
||||
namespace singletons {
|
||||
|
||||
static void _registerSetting(std::weak_ptr<pajlada::Settings::ISettingData> setting);
|
||||
|
||||
class SettingsManager : public QObject
|
||||
class SettingManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@@ -81,9 +82,9 @@ public:
|
||||
|
||||
BoolSetting inlineWhispers = {"/whispers/enableInlineWhispers", true};
|
||||
|
||||
static SettingsManager &getInstance()
|
||||
static SettingManager &getInstance()
|
||||
{
|
||||
static SettingsManager instance;
|
||||
static SettingManager instance;
|
||||
return instance;
|
||||
}
|
||||
void updateWordTypeMask();
|
||||
@@ -97,7 +98,7 @@ signals:
|
||||
private:
|
||||
std::unique_ptr<rapidjson::Document> snapshot;
|
||||
|
||||
SettingsManager();
|
||||
SettingManager();
|
||||
|
||||
QSettings settings;
|
||||
std::vector<std::reference_wrapper<BaseSetting>> settingsItems;
|
||||
@@ -107,3 +108,4 @@ private:
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <math.h>
|
||||
|
||||
namespace chatterino {
|
||||
namespace singletons {
|
||||
|
||||
namespace detail {
|
||||
|
||||
@@ -160,3 +161,4 @@ void ThemeManager::normalizeColor(QColor &color)
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <pajlada/settings/setting.hpp>
|
||||
|
||||
namespace chatterino {
|
||||
namespace singletons {
|
||||
|
||||
class WindowManager;
|
||||
|
||||
@@ -107,3 +108,4 @@ private:
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#include "windowmanager.hpp"
|
||||
#include "appdatapath.hpp"
|
||||
#include "singletons/fontmanager.hpp"
|
||||
#include "singletons/thememanager.hpp"
|
||||
|
||||
#include <QDebug>
|
||||
@@ -7,6 +8,7 @@
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
namespace chatterino {
|
||||
namespace singletons {
|
||||
WindowManager &WindowManager::getInstance()
|
||||
{
|
||||
static WindowManager instance(ThemeManager::getInstance());
|
||||
@@ -102,3 +104,4 @@ void WindowManager::save()
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "widgets/window.hpp"
|
||||
|
||||
namespace chatterino {
|
||||
namespace singletons {
|
||||
|
||||
class ThemeManager;
|
||||
|
||||
@@ -41,3 +42,4 @@ private:
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user