Perform initial refactoring work

Things that were once singletons are no longer singletons, but are
instead stored in the "Application" singleton

Some singletons still remain, and some renaming/renamespacing is left
This commit is contained in:
Rasmus Karlsson
2018-04-27 22:11:19 +02:00
parent 32b6417a55
commit ae26b835b6
78 changed files with 850 additions and 773 deletions
+5 -13
View File
@@ -1,4 +1,6 @@
#include "singletons/commandmanager.hpp"
#include "application.hpp"
#include "debug/log.hpp"
#include "messages/messagebuilder.hpp"
#include "providers/twitch/twitchserver.hpp"
@@ -17,20 +19,10 @@ using namespace chatterino::providers::twitch;
namespace chatterino {
namespace singletons {
CommandManager::CommandManager()
{
qDebug() << "init CommandManager";
}
CommandManager &CommandManager::getInstance()
{
static CommandManager instance;
return instance;
}
void CommandManager::loadCommands()
{
this->filePath = PathManager::getInstance().customFolderPath + "/Commands.txt";
auto app = getApp();
this->filePath = app->paths->customFolderPath + "/Commands.txt";
QFile textFile(this->filePath);
if (!textFile.open(QIODevice::ReadOnly)) {
@@ -162,7 +154,7 @@ QString CommandManager::execCommand(const QString &text, ChannelPtr channel, boo
messages::MessageBuilder b;
b.emplace<messages::TextElement>(
singletons::AccountManager::getInstance().Twitch.getCurrent()->getUserName(),
getApp()->accounts->Twitch.getCurrent()->getUserName(),
messages::MessageElement::Text);
b.emplace<messages::TextElement>("->", messages::MessageElement::Text);
b.emplace<messages::TextElement>(words[1], messages::MessageElement::Text);