mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
renamed *Manager classes
This commit is contained in:
parent
2df142bd50
commit
8ced5a1e25
|
@ -45,19 +45,19 @@ void Application::construct()
|
|||
|
||||
// 1. Instantiate all classes
|
||||
this->settings = getSettings();
|
||||
this->paths = PathManager::getInstance();
|
||||
this->paths = Paths::getInstance();
|
||||
|
||||
this->themes = new ThemeManager;
|
||||
this->themes = new Themes;
|
||||
this->windows = new WindowManager;
|
||||
this->logging = new LoggingManager;
|
||||
this->logging = new Logging;
|
||||
this->commands = new CommandController;
|
||||
this->highlights = new HighlightController;
|
||||
this->ignores = new IgnoreController;
|
||||
this->taggedUsers = new TaggedUsersController;
|
||||
this->accounts = new AccountController;
|
||||
this->emotes = new EmoteManager;
|
||||
this->fonts = new FontManager;
|
||||
this->resources = new ResourceManager;
|
||||
this->emotes = new Emotes;
|
||||
this->fonts = new Fonts;
|
||||
this->resources = new Resources;
|
||||
this->moderationActions = new ModerationActions;
|
||||
|
||||
this->twitch.server = new TwitchServer;
|
||||
|
|
|
@ -17,16 +17,16 @@ class TaggedUsersController;
|
|||
class AccountController;
|
||||
class ModerationActions;
|
||||
|
||||
class ThemeManager;
|
||||
class Themes;
|
||||
class WindowManager;
|
||||
class LoggingManager;
|
||||
class PathManager;
|
||||
class Logging;
|
||||
class Paths;
|
||||
class AccountManager;
|
||||
class EmoteManager;
|
||||
class NativeMessagingManager;
|
||||
class SettingManager;
|
||||
class FontManager;
|
||||
class ResourceManager;
|
||||
class Emotes;
|
||||
class NativeMessaging;
|
||||
class Settings;
|
||||
class Fonts;
|
||||
class Resources;
|
||||
|
||||
class Application
|
||||
{
|
||||
|
@ -45,20 +45,20 @@ public:
|
|||
|
||||
friend void test();
|
||||
|
||||
PathManager *paths = nullptr;
|
||||
ThemeManager *themes = nullptr;
|
||||
Paths *paths = nullptr;
|
||||
Themes *themes = nullptr;
|
||||
WindowManager *windows = nullptr;
|
||||
LoggingManager *logging = nullptr;
|
||||
Logging *logging = nullptr;
|
||||
CommandController *commands = nullptr;
|
||||
HighlightController *highlights = nullptr;
|
||||
IgnoreController *ignores = nullptr;
|
||||
TaggedUsersController *taggedUsers = nullptr;
|
||||
AccountController *accounts = nullptr;
|
||||
EmoteManager *emotes = nullptr;
|
||||
NativeMessagingManager *nativeMessaging = nullptr;
|
||||
SettingManager *settings = nullptr;
|
||||
FontManager *fonts = nullptr;
|
||||
ResourceManager *resources = nullptr;
|
||||
Emotes *emotes = nullptr;
|
||||
NativeMessaging *nativeMessaging = nullptr;
|
||||
Settings *settings = nullptr;
|
||||
Fonts *fonts = nullptr;
|
||||
Resources *resources = nullptr;
|
||||
ModerationActions *moderationActions = nullptr;
|
||||
|
||||
/// Provider-specific
|
||||
|
|
|
@ -49,7 +49,7 @@ int main(int argc, char *argv[])
|
|||
QApplication a(argc, argv);
|
||||
|
||||
// FOURTF: might get arguments from the commandline passed in the future
|
||||
chatterino::PathManager::initInstance();
|
||||
chatterino::Paths::initInstance();
|
||||
|
||||
// read args
|
||||
QStringList args;
|
||||
|
@ -79,7 +79,7 @@ int runGui(QApplication &a, int argc, char *argv[])
|
|||
chatterino::NetworkManager::init();
|
||||
|
||||
// Check for upates
|
||||
chatterino::UpdateManager::getInstance().checkForUpdates();
|
||||
chatterino::Updates::getInstance().checkForUpdates();
|
||||
|
||||
// Initialize application
|
||||
chatterino::Application::instantiate(argc, argv);
|
||||
|
@ -139,7 +139,7 @@ int runGui(QApplication &a, int argc, char *argv[])
|
|||
|
||||
void runNativeMessagingHost()
|
||||
{
|
||||
auto *nm = new chatterino::NativeMessagingManager;
|
||||
auto *nm = new chatterino::NativeMessaging;
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
_setmode(_fileno(stdin), _O_BINARY);
|
||||
|
|
|
@ -13,7 +13,7 @@ MessageColor::MessageColor(Type _type)
|
|||
{
|
||||
}
|
||||
|
||||
const QColor &MessageColor::getColor(ThemeManager &themeManager) const
|
||||
const QColor &MessageColor::getColor(Themes &themeManager) const
|
||||
{
|
||||
switch (this->type) {
|
||||
case Type::Custom:
|
||||
|
|
|
@ -12,7 +12,7 @@ struct MessageColor {
|
|||
MessageColor(const QColor &color);
|
||||
MessageColor(Type type = Text);
|
||||
|
||||
const QColor &getColor(ThemeManager &themeManager) const;
|
||||
const QColor &getColor(Themes &themeManager) const;
|
||||
|
||||
private:
|
||||
Type type;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
namespace chatterino {
|
||||
|
||||
void EmoteManager::initialize()
|
||||
void Emotes::initialize()
|
||||
{
|
||||
getApp()->accounts->twitch.currentUserChanged.connect([this] {
|
||||
auto currentUser = getApp()->accounts->twitch.getCurrent();
|
||||
|
@ -20,7 +20,7 @@ void EmoteManager::initialize()
|
|||
this->gifTimer.initialize();
|
||||
}
|
||||
|
||||
bool EmoteManager::isIgnoredEmote(const QString &)
|
||||
bool Emotes::isIgnoredEmote(const QString &)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -10,10 +10,10 @@
|
|||
|
||||
namespace chatterino {
|
||||
|
||||
class EmoteManager
|
||||
class Emotes
|
||||
{
|
||||
public:
|
||||
~EmoteManager() = delete;
|
||||
~Emotes() = delete;
|
||||
|
||||
void initialize();
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
namespace chatterino {
|
||||
|
||||
FontManager::FontManager()
|
||||
Fonts::Fonts()
|
||||
: chatFontFamily("/appearance/currentFontFamily", DEFAULT_FONT_FAMILY)
|
||||
, chatFontSize("/appearance/currentFontSize", DEFAULT_FONT_SIZE)
|
||||
{
|
||||
|
@ -57,17 +57,17 @@ FontManager::FontManager()
|
|||
this->fontsByType.resize(size_t(EndType));
|
||||
}
|
||||
|
||||
QFont FontManager::getFont(FontManager::Type type, float scale)
|
||||
QFont Fonts::getFont(Fonts::Type type, float scale)
|
||||
{
|
||||
return this->getOrCreateFontData(type, scale).font;
|
||||
}
|
||||
|
||||
QFontMetrics FontManager::getFontMetrics(FontManager::Type type, float scale)
|
||||
QFontMetrics Fonts::getFontMetrics(Fonts::Type type, float scale)
|
||||
{
|
||||
return this->getOrCreateFontData(type, scale).metrics;
|
||||
}
|
||||
|
||||
FontManager::FontData &FontManager::getOrCreateFontData(Type type, float scale)
|
||||
Fonts::FontData &Fonts::getOrCreateFontData(Type type, float scale)
|
||||
{
|
||||
assertInGuiThread();
|
||||
|
||||
|
@ -90,7 +90,7 @@ FontManager::FontData &FontManager::getOrCreateFontData(Type type, float scale)
|
|||
return result.first->second;
|
||||
}
|
||||
|
||||
FontManager::FontData FontManager::createFontData(Type type, float scale)
|
||||
Fonts::FontData Fonts::createFontData(Type type, float scale)
|
||||
{
|
||||
// check if it's a chat (scale the setting)
|
||||
if (type >= ChatStart && type <= ChatEnd) {
|
||||
|
|
|
@ -11,10 +11,10 @@
|
|||
|
||||
namespace chatterino {
|
||||
|
||||
class FontManager : boost::noncopyable
|
||||
class Fonts : boost::noncopyable
|
||||
{
|
||||
public:
|
||||
FontManager();
|
||||
Fonts();
|
||||
|
||||
// font data gets set in createFontData(...)
|
||||
enum Type : uint8_t {
|
||||
|
@ -77,6 +77,6 @@ private:
|
|||
std::vector<std::unordered_map<float, FontData>> fontsByType;
|
||||
};
|
||||
|
||||
using FontStyle = FontManager::Type;
|
||||
using FontStyle = Fonts::Type;
|
||||
|
||||
} // namespace chatterino
|
||||
|
|
|
@ -12,12 +12,12 @@
|
|||
|
||||
namespace chatterino {
|
||||
|
||||
void LoggingManager::initialize()
|
||||
void Logging::initialize()
|
||||
{
|
||||
this->pathManager = getApp()->paths;
|
||||
}
|
||||
|
||||
void LoggingManager::addMessage(const QString &channelName, MessagePtr message)
|
||||
void Logging::addMessage(const QString &channelName, MessagePtr message)
|
||||
{
|
||||
auto app = getApp();
|
||||
|
||||
|
|
|
@ -7,16 +7,16 @@
|
|||
|
||||
namespace chatterino {
|
||||
|
||||
class PathManager;
|
||||
class Paths;
|
||||
|
||||
class LoggingManager
|
||||
class Logging
|
||||
{
|
||||
PathManager *pathManager = nullptr;
|
||||
Paths *pathManager = nullptr;
|
||||
|
||||
public:
|
||||
LoggingManager() = default;
|
||||
Logging() = default;
|
||||
|
||||
~LoggingManager() = delete;
|
||||
~Logging() = delete;
|
||||
|
||||
void initialize();
|
||||
|
||||
|
|
|
@ -32,12 +32,12 @@ namespace ipc = boost::interprocess;
|
|||
namespace chatterino {
|
||||
|
||||
// fourtf: don't add this class to the application class
|
||||
NativeMessagingManager::NativeMessagingManager()
|
||||
NativeMessaging::NativeMessaging()
|
||||
{
|
||||
qDebug() << "init NativeMessagingManager";
|
||||
}
|
||||
|
||||
void NativeMessagingManager::writeByteArray(QByteArray a)
|
||||
void NativeMessaging::writeByteArray(QByteArray a)
|
||||
{
|
||||
char *data = a.data();
|
||||
uint32_t size;
|
||||
|
@ -47,7 +47,7 @@ void NativeMessagingManager::writeByteArray(QByteArray a)
|
|||
std::cout.flush();
|
||||
}
|
||||
|
||||
void NativeMessagingManager::registerHost()
|
||||
void NativeMessaging::registerHost()
|
||||
{
|
||||
auto app = getApp();
|
||||
|
||||
|
@ -111,7 +111,7 @@ void NativeMessagingManager::registerHost()
|
|||
}
|
||||
}
|
||||
|
||||
void NativeMessagingManager::openGuiMessageQueue()
|
||||
void NativeMessaging::openGuiMessageQueue()
|
||||
{
|
||||
static ReceiverThread thread;
|
||||
|
||||
|
@ -122,7 +122,7 @@ void NativeMessagingManager::openGuiMessageQueue()
|
|||
thread.start();
|
||||
}
|
||||
|
||||
void NativeMessagingManager::sendToGuiProcess(const QByteArray &array)
|
||||
void NativeMessaging::sendToGuiProcess(const QByteArray &array)
|
||||
{
|
||||
try {
|
||||
ipc::message_queue messageQueue(ipc::open_only, "chatterino_gui");
|
||||
|
@ -133,7 +133,7 @@ void NativeMessagingManager::sendToGuiProcess(const QByteArray &array)
|
|||
}
|
||||
}
|
||||
|
||||
void NativeMessagingManager::ReceiverThread::run()
|
||||
void NativeMessaging::ReceiverThread::run()
|
||||
{
|
||||
ipc::message_queue::remove("chatterino_gui");
|
||||
|
||||
|
@ -157,7 +157,7 @@ void NativeMessagingManager::ReceiverThread::run()
|
|||
}
|
||||
}
|
||||
|
||||
void NativeMessagingManager::ReceiverThread::handleMessage(const QJsonObject &root)
|
||||
void NativeMessaging::ReceiverThread::handleMessage(const QJsonObject &root)
|
||||
{
|
||||
auto app = getApp();
|
||||
|
||||
|
@ -231,10 +231,10 @@ void NativeMessagingManager::ReceiverThread::handleMessage(const QJsonObject &ro
|
|||
}
|
||||
}
|
||||
|
||||
std::string &NativeMessagingManager::getGuiMessageQueueName()
|
||||
std::string &NativeMessaging::getGuiMessageQueueName()
|
||||
{
|
||||
static std::string name =
|
||||
"chatterino_gui" + PathManager::getInstance()->applicationFilePathHash.toStdString();
|
||||
"chatterino_gui" + Paths::getInstance()->applicationFilePathHash.toStdString();
|
||||
return name;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,13 +4,13 @@
|
|||
|
||||
namespace chatterino {
|
||||
|
||||
class NativeMessagingManager
|
||||
class NativeMessaging
|
||||
{
|
||||
public:
|
||||
// fourtf: don't add this class to the application class
|
||||
NativeMessagingManager();
|
||||
NativeMessaging();
|
||||
|
||||
~NativeMessagingManager() = delete;
|
||||
~NativeMessaging() = delete;
|
||||
|
||||
class ReceiverThread : public QThread
|
||||
{
|
||||
|
|
|
@ -10,9 +10,9 @@
|
|||
|
||||
namespace chatterino {
|
||||
|
||||
PathManager *PathManager::instance = nullptr;
|
||||
Paths *Paths::instance = nullptr;
|
||||
|
||||
PathManager::PathManager()
|
||||
Paths::Paths()
|
||||
{
|
||||
this->initAppFilePathHash();
|
||||
|
||||
|
@ -21,31 +21,31 @@ PathManager::PathManager()
|
|||
this->initSubDirectories();
|
||||
}
|
||||
|
||||
void PathManager::initInstance()
|
||||
void Paths::initInstance()
|
||||
{
|
||||
assert(!instance);
|
||||
|
||||
instance = new PathManager();
|
||||
instance = new Paths();
|
||||
}
|
||||
|
||||
PathManager *PathManager::getInstance()
|
||||
Paths *Paths::getInstance()
|
||||
{
|
||||
assert(instance);
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
bool PathManager::createFolder(const QString &folderPath)
|
||||
bool Paths::createFolder(const QString &folderPath)
|
||||
{
|
||||
return QDir().mkpath(folderPath);
|
||||
}
|
||||
|
||||
bool PathManager::isPortable()
|
||||
bool Paths::isPortable()
|
||||
{
|
||||
return this->portable.get();
|
||||
}
|
||||
|
||||
void PathManager::initAppFilePathHash()
|
||||
void Paths::initAppFilePathHash()
|
||||
{
|
||||
this->applicationFilePathHash =
|
||||
QCryptographicHash::hash(QCoreApplication::applicationFilePath().toUtf8(),
|
||||
|
@ -56,13 +56,13 @@ void PathManager::initAppFilePathHash()
|
|||
.replace("/", "x");
|
||||
}
|
||||
|
||||
void PathManager::initCheckPortable()
|
||||
void Paths::initCheckPortable()
|
||||
{
|
||||
this->portable =
|
||||
QFileInfo::exists(combinePath(QCoreApplication::applicationDirPath(), "portable"));
|
||||
}
|
||||
|
||||
void PathManager::initAppDataDirectory()
|
||||
void Paths::initAppDataDirectory()
|
||||
{
|
||||
assert(this->portable.is_initialized());
|
||||
|
||||
|
@ -91,7 +91,7 @@ void PathManager::initAppDataDirectory()
|
|||
}();
|
||||
}
|
||||
|
||||
void PathManager::initSubDirectories()
|
||||
void Paths::initSubDirectories()
|
||||
{
|
||||
// required the app data directory to be set first
|
||||
assert(!this->rootAppDataDirectory.isEmpty());
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
|
||||
namespace chatterino {
|
||||
|
||||
class PathManager
|
||||
class Paths
|
||||
{
|
||||
PathManager();
|
||||
Paths();
|
||||
|
||||
public:
|
||||
static void initInstance();
|
||||
static PathManager *getInstance();
|
||||
static Paths *getInstance();
|
||||
|
||||
// Root directory for the configuration files. %APPDATA%/chatterino or ExecutablePath for
|
||||
// portable mode
|
||||
|
@ -36,7 +36,7 @@ public:
|
|||
bool isPortable();
|
||||
|
||||
private:
|
||||
static PathManager *instance;
|
||||
static Paths *instance;
|
||||
boost::optional<bool> portable;
|
||||
|
||||
void initAppFilePathHash();
|
||||
|
|
|
@ -75,7 +75,7 @@ inline bool ReadValue<std::vector<QString>>(const rapidjson::Value &object, cons
|
|||
}
|
||||
|
||||
// Parse a single cheermote set (or "action") from the twitch api
|
||||
inline bool ParseSingleCheermoteSet(ResourceManager::JSONCheermoteSet &set,
|
||||
inline bool ParseSingleCheermoteSet(Resources::JSONCheermoteSet &set,
|
||||
const rapidjson::Value &action)
|
||||
{
|
||||
if (!action.IsObject()) {
|
||||
|
@ -122,7 +122,7 @@ inline bool ParseSingleCheermoteSet(ResourceManager::JSONCheermoteSet &set,
|
|||
}
|
||||
|
||||
for (const rapidjson::Value &tierValue : tiersValue.GetArray()) {
|
||||
ResourceManager::JSONCheermoteSet::CheermoteTier tier;
|
||||
Resources::JSONCheermoteSet::CheermoteTier tier;
|
||||
|
||||
if (!tierValue.IsObject()) {
|
||||
return false;
|
||||
|
@ -237,7 +237,7 @@ inline bool ParseSingleCheermoteSet(ResourceManager::JSONCheermoteSet &set,
|
|||
|
||||
// Look through the results of https://api.twitch.tv/kraken/bits/actions?channel_id=11148817 for
|
||||
// cheermote sets or "Actions" as they are called in the API
|
||||
inline void ParseCheermoteSets(std::vector<ResourceManager::JSONCheermoteSet> &sets,
|
||||
inline void ParseCheermoteSets(std::vector<Resources::JSONCheermoteSet> &sets,
|
||||
const rapidjson::Document &d)
|
||||
{
|
||||
if (!d.IsObject()) {
|
||||
|
@ -255,7 +255,7 @@ inline void ParseCheermoteSets(std::vector<ResourceManager::JSONCheermoteSet> &s
|
|||
}
|
||||
|
||||
for (const auto &action : actionsValue.GetArray()) {
|
||||
ResourceManager::JSONCheermoteSet set;
|
||||
Resources::JSONCheermoteSet set;
|
||||
bool res = ParseSingleCheermoteSet(set, action);
|
||||
|
||||
if (res) {
|
||||
|
@ -265,7 +265,7 @@ inline void ParseCheermoteSets(std::vector<ResourceManager::JSONCheermoteSet> &s
|
|||
}
|
||||
|
||||
} // namespace
|
||||
ResourceManager::ResourceManager()
|
||||
Resources::Resources()
|
||||
: badgeStaff(lli(":/images/staff_bg.png"))
|
||||
, badgeAdmin(lli(":/images/admin_bg.png"))
|
||||
, badgeGlobalModerator(lli(":/images/globalmod_bg.png"))
|
||||
|
@ -302,14 +302,14 @@ ResourceManager::ResourceManager()
|
|||
qDebug() << "init ResourceManager";
|
||||
}
|
||||
|
||||
void ResourceManager::initialize()
|
||||
void Resources::initialize()
|
||||
{
|
||||
this->loadDynamicTwitchBadges();
|
||||
|
||||
this->loadChatterinoBadges();
|
||||
}
|
||||
|
||||
ResourceManager::BadgeVersion::BadgeVersion(QJsonObject &&root)
|
||||
Resources::BadgeVersion::BadgeVersion(QJsonObject &&root)
|
||||
: badgeImage1x(new Image(root.value("image_url_1x").toString()))
|
||||
, badgeImage2x(new Image(root.value("image_url_2x").toString()))
|
||||
, badgeImage4x(new Image(root.value("image_url_4x").toString()))
|
||||
|
@ -320,7 +320,7 @@ ResourceManager::BadgeVersion::BadgeVersion(QJsonObject &&root)
|
|||
{
|
||||
}
|
||||
|
||||
void ResourceManager::loadChannelData(const QString &roomID, bool bypassCache)
|
||||
void Resources::loadChannelData(const QString &roomID, bool bypassCache)
|
||||
{
|
||||
QString url = "https://badges.twitch.tv/v1/badges/channels/" + roomID + "/display?language=en";
|
||||
|
||||
|
@ -330,7 +330,7 @@ void ResourceManager::loadChannelData(const QString &roomID, bool bypassCache)
|
|||
req.getJSON([this, roomID](QJsonObject &root) {
|
||||
QJsonObject sets = root.value("badge_sets").toObject();
|
||||
|
||||
ResourceManager::Channel &ch = this->channels[roomID];
|
||||
Resources::Channel &ch = this->channels[roomID];
|
||||
|
||||
for (QJsonObject::iterator it = sets.begin(); it != sets.end(); ++it) {
|
||||
QJsonObject versions = it.value().toObject().value("versions").toObject();
|
||||
|
@ -354,7 +354,7 @@ void ResourceManager::loadChannelData(const QString &roomID, bool bypassCache)
|
|||
|
||||
twitchApiGet2(
|
||||
cheermoteURL, QThread::currentThread(), true, [this, roomID](const rapidjson::Document &d) {
|
||||
ResourceManager::Channel &ch = this->channels[roomID];
|
||||
Resources::Channel &ch = this->channels[roomID];
|
||||
|
||||
ParseCheermoteSets(ch.jsonCheermoteSets, d);
|
||||
|
||||
|
@ -393,7 +393,7 @@ void ResourceManager::loadChannelData(const QString &roomID, bool bypassCache)
|
|||
});
|
||||
}
|
||||
|
||||
void ResourceManager::loadDynamicTwitchBadges()
|
||||
void Resources::loadDynamicTwitchBadges()
|
||||
{
|
||||
static QString url("https://badges.twitch.tv/v1/badges/global/display?language=en");
|
||||
|
||||
|
@ -420,7 +420,7 @@ void ResourceManager::loadDynamicTwitchBadges()
|
|||
});
|
||||
}
|
||||
|
||||
void ResourceManager::loadChatterinoBadges()
|
||||
void Resources::loadChatterinoBadges()
|
||||
{
|
||||
this->chatterinoBadges.clear();
|
||||
|
||||
|
|
|
@ -11,12 +11,12 @@
|
|||
|
||||
namespace chatterino {
|
||||
|
||||
class ResourceManager
|
||||
class Resources
|
||||
{
|
||||
public:
|
||||
ResourceManager();
|
||||
Resources();
|
||||
|
||||
~ResourceManager() = delete;
|
||||
~Resources() = delete;
|
||||
|
||||
void initialize();
|
||||
|
||||
|
|
|
@ -15,19 +15,19 @@ void _actuallyRegisterSetting(std::weak_ptr<pajlada::Settings::ISettingData> set
|
|||
_settings.push_back(setting);
|
||||
}
|
||||
|
||||
SettingManager::SettingManager()
|
||||
Settings::Settings()
|
||||
{
|
||||
qDebug() << "init SettingManager";
|
||||
}
|
||||
|
||||
SettingManager &SettingManager::getInstance()
|
||||
Settings &Settings::getInstance()
|
||||
{
|
||||
static SettingManager instance;
|
||||
static Settings instance;
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
void SettingManager::initialize()
|
||||
void Settings::initialize()
|
||||
{
|
||||
this->timestampFormat.connect([](auto, auto) {
|
||||
auto app = getApp();
|
||||
|
@ -45,7 +45,7 @@ void SettingManager::initialize()
|
|||
[](auto, auto) { getApp()->windows->forceLayoutChannelViews(); });
|
||||
}
|
||||
|
||||
void SettingManager::load()
|
||||
void Settings::load()
|
||||
{
|
||||
auto app = getApp();
|
||||
QString settingsPath = app->paths->settingsDirectory + "/settings.json";
|
||||
|
@ -53,7 +53,7 @@ void SettingManager::load()
|
|||
pajlada::Settings::SettingManager::load(qPrintable(settingsPath));
|
||||
}
|
||||
|
||||
void SettingManager::saveSnapshot()
|
||||
void Settings::saveSnapshot()
|
||||
{
|
||||
rapidjson::Document *d = new rapidjson::Document(rapidjson::kObjectType);
|
||||
rapidjson::Document::AllocatorType &a = d->GetAllocator();
|
||||
|
@ -74,7 +74,7 @@ void SettingManager::saveSnapshot()
|
|||
Log("hehe: {}", pajlada::Settings::SettingManager::stringify(*d));
|
||||
}
|
||||
|
||||
void SettingManager::restoreSnapshot()
|
||||
void Settings::restoreSnapshot()
|
||||
{
|
||||
if (!this->snapshot) {
|
||||
return;
|
||||
|
@ -100,9 +100,9 @@ void SettingManager::restoreSnapshot()
|
|||
}
|
||||
}
|
||||
|
||||
SettingManager *getSettings()
|
||||
Settings *getSettings()
|
||||
{
|
||||
return &SettingManager::getInstance();
|
||||
return &Settings::getInstance();
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
|
|
|
@ -12,12 +12,12 @@ namespace chatterino {
|
|||
|
||||
void _actuallyRegisterSetting(std::weak_ptr<pajlada::Settings::ISettingData> setting);
|
||||
|
||||
class SettingManager
|
||||
class Settings
|
||||
{
|
||||
SettingManager();
|
||||
Settings();
|
||||
|
||||
public:
|
||||
static SettingManager &getInstance();
|
||||
static Settings &getInstance();
|
||||
|
||||
void initialize();
|
||||
void load();
|
||||
|
@ -127,6 +127,6 @@ private:
|
|||
void updateModerationActions();
|
||||
};
|
||||
|
||||
SettingManager *getSettings();
|
||||
Settings *getSettings();
|
||||
|
||||
} // namespace chatterino
|
||||
|
|
|
@ -27,7 +27,7 @@ double getMultiplierByTheme(const QString &themeName)
|
|||
|
||||
} // namespace detail
|
||||
|
||||
ThemeManager::ThemeManager()
|
||||
Themes::Themes()
|
||||
: themeName("/appearance/theme/name", "Dark")
|
||||
, themeHue("/appearance/theme/hue", 0.0)
|
||||
{
|
||||
|
@ -37,14 +37,14 @@ ThemeManager::ThemeManager()
|
|||
this->themeHue.connectSimple([this](auto) { this->update(); }, false);
|
||||
}
|
||||
|
||||
void ThemeManager::update()
|
||||
void Themes::update()
|
||||
{
|
||||
this->actuallyUpdate(this->themeHue, detail::getMultiplierByTheme(this->themeName.getValue()));
|
||||
}
|
||||
|
||||
// hue: theme color (0 - 1)
|
||||
// multiplier: 1 = white, 0.8 = light, -0.8 dark, -1 black
|
||||
void ThemeManager::actuallyUpdate(double hue, double multiplier)
|
||||
void Themes::actuallyUpdate(double hue, double multiplier)
|
||||
{
|
||||
isLight = multiplier > 0;
|
||||
bool lightWin = isLight;
|
||||
|
@ -217,7 +217,7 @@ void ThemeManager::actuallyUpdate(double hue, double multiplier)
|
|||
this->updated.invoke();
|
||||
}
|
||||
|
||||
QColor ThemeManager::blendColors(const QColor &color1, const QColor &color2, qreal ratio)
|
||||
QColor Themes::blendColors(const QColor &color1, const QColor &color2, qreal ratio)
|
||||
{
|
||||
int r = int(color1.red() * (1 - ratio) + color2.red() * ratio);
|
||||
int g = int(color1.green() * (1 - ratio) + color2.green() * ratio);
|
||||
|
@ -226,7 +226,7 @@ QColor ThemeManager::blendColors(const QColor &color1, const QColor &color2, qre
|
|||
return QColor(r, g, b, 255);
|
||||
}
|
||||
|
||||
void ThemeManager::normalizeColor(QColor &color)
|
||||
void Themes::normalizeColor(QColor &color)
|
||||
{
|
||||
if (this->isLight) {
|
||||
if (color.lightnessF() > 0.5) {
|
||||
|
|
|
@ -10,12 +10,12 @@ namespace chatterino {
|
|||
|
||||
class WindowManager;
|
||||
|
||||
class ThemeManager
|
||||
class Themes
|
||||
{
|
||||
public:
|
||||
ThemeManager();
|
||||
Themes();
|
||||
|
||||
~ThemeManager() = delete;
|
||||
~Themes() = delete;
|
||||
|
||||
inline bool isLightTheme() const
|
||||
{
|
||||
|
|
|
@ -10,31 +10,31 @@
|
|||
|
||||
namespace chatterino {
|
||||
|
||||
UpdateManager::UpdateManager()
|
||||
Updates::Updates()
|
||||
: currentVersion_(CHATTERINO_VERSION)
|
||||
{
|
||||
qDebug() << "init UpdateManager";
|
||||
}
|
||||
|
||||
UpdateManager &UpdateManager::getInstance()
|
||||
Updates &Updates::getInstance()
|
||||
{
|
||||
// fourtf: don't add this class to the application class
|
||||
static UpdateManager instance;
|
||||
static Updates instance;
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
const QString &UpdateManager::getCurrentVersion() const
|
||||
const QString &Updates::getCurrentVersion() const
|
||||
{
|
||||
return currentVersion_;
|
||||
}
|
||||
|
||||
const QString &UpdateManager::getOnlineVersion() const
|
||||
const QString &Updates::getOnlineVersion() const
|
||||
{
|
||||
return onlineVersion_;
|
||||
}
|
||||
|
||||
void UpdateManager::installUpdates()
|
||||
void Updates::installUpdates()
|
||||
{
|
||||
if (this->status_ != UpdateAvailable) {
|
||||
assert(false);
|
||||
|
@ -87,7 +87,7 @@ void UpdateManager::installUpdates()
|
|||
#endif
|
||||
}
|
||||
|
||||
void UpdateManager::checkForUpdates()
|
||||
void Updates::checkForUpdates()
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
QString url = "https://notitia.chatterino.com/version/chatterino/" CHATTERINO_OS "/stable";
|
||||
|
@ -141,12 +141,12 @@ void UpdateManager::checkForUpdates()
|
|||
#endif
|
||||
}
|
||||
|
||||
UpdateManager::UpdateStatus UpdateManager::getStatus() const
|
||||
Updates::UpdateStatus Updates::getStatus() const
|
||||
{
|
||||
return this->status_;
|
||||
}
|
||||
|
||||
void UpdateManager::setStatus_(UpdateStatus status)
|
||||
void Updates::setStatus_(UpdateStatus status)
|
||||
{
|
||||
if (this->status_ != status) {
|
||||
this->status_ = status;
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
|
||||
namespace chatterino {
|
||||
|
||||
class UpdateManager
|
||||
class Updates
|
||||
{
|
||||
UpdateManager();
|
||||
Updates();
|
||||
|
||||
public:
|
||||
enum UpdateStatus {
|
||||
|
@ -22,7 +22,7 @@ public:
|
|||
};
|
||||
|
||||
// fourtf: don't add this class to the application class
|
||||
static UpdateManager &getInstance();
|
||||
static Updates &getInstance();
|
||||
|
||||
void checkForUpdates();
|
||||
const QString &getCurrentVersion() const;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
namespace chatterino {
|
||||
|
||||
class ThemeManager;
|
||||
class Themes;
|
||||
class BaseWindow;
|
||||
|
||||
class BaseWidget : public QWidget
|
||||
|
@ -41,7 +41,7 @@ protected:
|
|||
|
||||
void setScale(float value);
|
||||
|
||||
ThemeManager *themeManager;
|
||||
Themes *themeManager;
|
||||
|
||||
private:
|
||||
void init();
|
||||
|
|
|
@ -77,7 +77,7 @@ void TooltipWidget::updateFont()
|
|||
auto app = getApp();
|
||||
|
||||
this->setFont(
|
||||
app->fonts->getFont(FontManager::Type::ChatMediumSmall, this->getScale()));
|
||||
app->fonts->getFont(Fonts::Type::ChatMediumSmall, this->getScale()));
|
||||
}
|
||||
|
||||
void TooltipWidget::setText(QString text)
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
namespace chatterino {
|
||||
|
||||
class ThemeManager;
|
||||
class Themes;
|
||||
|
||||
class Window : public BaseWindow
|
||||
{
|
||||
|
|
|
@ -16,7 +16,7 @@ LastRunCrashDialog::LastRunCrashDialog()
|
|||
this->setWindowFlag(Qt::WindowContextHelpButtonHint, false);
|
||||
this->setWindowTitle("Chatterino");
|
||||
|
||||
auto &updateManager = UpdateManager::getInstance();
|
||||
auto &updateManager = Updates::getInstance();
|
||||
|
||||
auto layout = LayoutCreator<LastRunCrashDialog>(this).setLayoutType<QVBoxLayout>();
|
||||
|
||||
|
|
|
@ -221,8 +221,8 @@ void NotebookTab::paintEvent(QPaintEvent *)
|
|||
// int fullHeight = (int)(scale * 48);
|
||||
|
||||
// select the right tab colors
|
||||
ThemeManager::TabColors colors;
|
||||
ThemeManager::TabColors regular = this->themeManager->tabs.regular;
|
||||
Themes::TabColors colors;
|
||||
Themes::TabColors regular = this->themeManager->tabs.regular;
|
||||
|
||||
if (this->selected_) {
|
||||
colors = this->themeManager->tabs.selected;
|
||||
|
|
|
@ -226,7 +226,7 @@ QLayout *AppearancePage::createFontChanger()
|
|||
button->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Policy::Fixed);
|
||||
|
||||
QObject::connect(button, &QPushButton::clicked, [=]() {
|
||||
QFontDialog dialog(app->fonts->getFont(FontManager::ChatMedium, 1.));
|
||||
QFontDialog dialog(app->fonts->getFont(Fonts::ChatMedium, 1.));
|
||||
|
||||
dialog.setWindowFlag(Qt::WindowStaysOnTopHint);
|
||||
|
||||
|
|
|
@ -67,11 +67,11 @@ void SplitInput::initLayout()
|
|||
|
||||
// set edit font
|
||||
this->ui_.textEdit->setFont(
|
||||
app->fonts->getFont(FontManager::Type::ChatMedium, this->getScale()));
|
||||
app->fonts->getFont(Fonts::Type::ChatMedium, this->getScale()));
|
||||
|
||||
this->managedConnections_.push_back(app->fonts->fontChanged.connect([=]() {
|
||||
this->ui_.textEdit->setFont(
|
||||
app->fonts->getFont(FontManager::Type::ChatMedium, this->getScale()));
|
||||
app->fonts->getFont(Fonts::Type::ChatMedium, this->getScale()));
|
||||
}));
|
||||
|
||||
// open emote popup
|
||||
|
|
Loading…
Reference in a new issue