mirror-chatterino2/src/main.cpp

58 lines
1.4 KiB
C++
Raw Normal View History

#include "application.hpp"
#include "singletons/pathmanager.hpp"
2017-01-11 01:08:20 +01:00
#include <QAbstractNativeEventFilter>
2017-01-11 01:08:20 +01:00
#include <QApplication>
#include <QLibrary>
2016-12-29 17:31:07 +01:00
#include "util/networkmanager.hpp"
#ifdef USEWINSDK
#include "util/nativeeventhelper.hpp"
#endif
int main(int argc, char *argv[])
2016-12-29 17:31:07 +01:00
{
QApplication::setAttribute(Qt::AA_Use96Dpi, true);
#ifdef Q_OS_WIN32
QApplication::setAttribute(Qt::AA_DisableHighDpiScaling, true);
#endif
2018-01-19 14:48:17 +01:00
// QApplication::setAttribute(Qt::AA_UseSoftwareOpenGL, true);
2016-12-29 17:31:07 +01:00
QApplication a(argc, argv);
2016-12-30 19:20:04 +01:00
// Install native event handler for hidpi on windows
#ifdef USEWINSDK
a.installNativeEventFilter(new chatterino::util::DpiNativeEventFilter);
#endif
// Initialize settings
bool success = chatterino::singletons::PathManager::getInstance().init(argc, argv);
if (!success) {
printf("Error initializing paths\n");
return 1;
}
// Initialize NetworkManager
chatterino::util::NetworkManager::init();
int ret = 0;
{
// Initialize application
chatterino::Application app;
2016-12-29 17:31:07 +01:00
// Start the application
ret = app.run(a);
2017-01-03 21:19:33 +01:00
// Application will go out of scope here and deinitialize itself
}
2017-01-23 09:49:30 +01:00
// Save settings
pajlada::Settings::SettingManager::save();
// Deinitialize NetworkManager (stop thread and wait for finish, should be instant)
chatterino::util::NetworkManager::deinit();
2018-01-18 07:56:02 +01:00
_exit(0);
2016-12-29 17:31:07 +01:00
}