mirror-chatterino2/src/application.cpp

62 lines
1.6 KiB
C++
Raw Normal View History

#include "application.hpp"
2018-02-05 15:11:50 +01:00
#include "providers/twitch/twitchserver.hpp"
2017-12-31 00:50:07 +01:00
#include "singletons/accountmanager.hpp"
2018-01-04 02:50:36 +01:00
#include "singletons/commandmanager.hpp"
2017-12-31 00:50:07 +01:00
#include "singletons/emotemanager.hpp"
2018-02-05 15:11:50 +01:00
#include "singletons/loggingmanager.hpp"
2017-12-31 00:50:07 +01:00
#include "singletons/settingsmanager.hpp"
#include "singletons/thememanager.hpp"
#include "singletons/windowmanager.hpp"
2017-12-31 22:58:35 +01:00
using namespace chatterino::singletons;
namespace chatterino {
// this class is responsible for handling the workflow of Chatterino
// It will create the instances of the major classes, and connect their signals to each other
Application::Application()
{
2017-12-31 22:58:35 +01:00
singletons::WindowManager::getInstance();
singletons::LoggingManager::getInstance();
singletons::SettingManager::getInstance().init();
singletons::CommandManager::getInstance().loadCommands();
2017-12-31 22:58:35 +01:00
singletons::WindowManager::getInstance().initMainWindow();
2017-12-14 00:25:06 +01:00
// Initialize everything we need
2017-12-31 22:58:35 +01:00
singletons::EmoteManager::getInstance().loadGlobalEmotes();
2017-12-31 22:58:35 +01:00
singletons::AccountManager::getInstance().load();
// XXX
2017-12-31 22:58:35 +01:00
singletons::SettingManager::getInstance().updateWordTypeMask();
}
Application::~Application()
{
this->save();
}
int Application::run(QApplication &qtApp)
{
// Start connecting to the IRC Servers (Twitch only for now)
2018-02-05 15:11:50 +01:00
providers::twitch::TwitchServer::getInstance().connect();
// Show main window
2017-12-31 22:58:35 +01:00
singletons::WindowManager::getInstance().getMainWindow().show();
return qtApp.exec();
}
void Application::save()
{
2017-12-31 22:58:35 +01:00
singletons::WindowManager::getInstance().save();
singletons::CommandManager::getInstance().saveCommands();
}
} // namespace chatterino