2017-06-13 21:13:58 +02:00
|
|
|
#include "application.hpp"
|
2017-06-26 16:41:20 +02:00
|
|
|
#include "logging/loggingmanager.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"
|
|
|
|
#include "singletons/settingsmanager.hpp"
|
|
|
|
#include "singletons/thememanager.hpp"
|
|
|
|
#include "singletons/windowmanager.hpp"
|
2017-06-13 21:13:58 +02:00
|
|
|
|
2017-12-31 22:58:35 +01:00
|
|
|
using namespace chatterino::singletons;
|
|
|
|
|
2017-06-13 21:13:58 +02:00
|
|
|
namespace chatterino {
|
|
|
|
|
2017-06-26 16:41:20 +02:00
|
|
|
// 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
|
|
|
|
|
2017-06-13 21:13:58 +02:00
|
|
|
Application::Application()
|
|
|
|
{
|
2017-12-31 22:58:35 +01:00
|
|
|
singletons::WindowManager::getInstance();
|
|
|
|
|
2017-06-26 16:41:20 +02:00
|
|
|
logging::init();
|
2017-06-13 21:13:58 +02:00
|
|
|
|
2017-12-31 22:58:35 +01:00
|
|
|
singletons::WindowManager::getInstance().initMainWindow();
|
2017-12-14 00:25:06 +01:00
|
|
|
|
2017-06-13 21:13:58 +02:00
|
|
|
// Initialize everything we need
|
2017-12-31 22:58:35 +01:00
|
|
|
singletons::EmoteManager::getInstance().loadGlobalEmotes();
|
2017-06-13 21:13:58 +02:00
|
|
|
|
2017-12-31 22:58:35 +01:00
|
|
|
singletons::AccountManager::getInstance().load();
|
2017-07-28 19:46:53 +02:00
|
|
|
|
2017-06-13 21:13:58 +02:00
|
|
|
// XXX
|
2017-12-31 22:58:35 +01:00
|
|
|
singletons::SettingManager::getInstance().updateWordTypeMask();
|
2017-06-13 21:13:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
Application::~Application()
|
|
|
|
{
|
2017-12-22 14:44:31 +01:00
|
|
|
this->save();
|
2017-06-13 21:13:58 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int Application::run(QApplication &qtApp)
|
|
|
|
{
|
|
|
|
// Start connecting to the IRC Servers (Twitch only for now)
|
2017-12-31 22:58:35 +01:00
|
|
|
singletons::IrcManager::getInstance().connect();
|
2017-06-13 21:13:58 +02:00
|
|
|
|
|
|
|
// Show main window
|
2017-12-31 22:58:35 +01:00
|
|
|
singletons::WindowManager::getInstance().getMainWindow().show();
|
2017-06-13 21:13:58 +02:00
|
|
|
|
|
|
|
return qtApp.exec();
|
|
|
|
}
|
|
|
|
|
2017-12-22 14:44:31 +01:00
|
|
|
void Application::save()
|
|
|
|
{
|
2017-12-31 22:58:35 +01:00
|
|
|
singletons::WindowManager::getInstance().save();
|
2017-12-22 14:44:31 +01:00
|
|
|
}
|
|
|
|
|
2017-06-13 21:13:58 +02:00
|
|
|
} // namespace chatterino
|