mirror-chatterino2/src/application.cpp

56 lines
1.3 KiB
C++
Raw Normal View History

#include "application.hpp"
#include "accountmanager.hpp"
#include "colorscheme.hpp"
#include "logging/loggingmanager.hpp"
#include "settingsmanager.hpp"
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-17 02:18:13 +01:00
: windowManager(this->channelManager, this->colorScheme)
, colorScheme(this->windowManager)
2017-12-17 02:18:13 +01:00
, channelManager(this->windowManager, this->ircManager)
, ircManager(this->channelManager, this->resources, this->windowManager)
{
logging::init();
SettingsManager::getInstance().load();
2017-12-14 00:25:06 +01:00
this->windowManager.initMainWindow();
// Initialize everything we need
2017-12-17 02:18:13 +01:00
EmoteManager::getInstance().loadGlobalEmotes();
AccountManager::getInstance().load();
// XXX
SettingsManager::getInstance().updateWordTypeMask();
}
Application::~Application()
{
this->save();
chatterino::SettingsManager::getInstance().save();
}
int Application::run(QApplication &qtApp)
{
// Start connecting to the IRC Servers (Twitch only for now)
this->ircManager.connect();
// Show main window
this->windowManager.getMainWindow().show();
return qtApp.exec();
}
void Application::save()
{
this->windowManager.save();
}
} // namespace chatterino