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