2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

all deinit moved to Application::aboutToQuit(), mtproto connection thread management refactored, disabled -style=0 fake argument for Application, beta 9028002

This commit is contained in:
John Preston
2016-02-29 19:53:26 +03:00
parent 08072346fd
commit 99b52d4cc1
21 changed files with 300 additions and 270 deletions

View File

@@ -25,8 +25,6 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
#include "localstorage.h"
int main(int argc, char *argv[]) {
int result = 0;
settingsParseArgs(argc, argv);
if (cLaunchMode() == LaunchModeFixPrevious) {
return psFixPrevious();
@@ -36,34 +34,15 @@ int main(int argc, char *argv[]) {
return showCrashReportWindow(QFileInfo(cStartUrl()).absoluteFilePath());
}
Logs::Initializer _logs;
{
PlatformSpecific::Initializer _ps;
// both are finished in Application::closeApplication
Logs::start(); // must be started before PlatformSpecific is started
PlatformSpecific::start(); // must be started before QApplication is created
QByteArray args[] = { "-style=0" }; // prepare fake args to disable QT_STYLE_OVERRIDE env variable
static const int a_cnt = sizeof(args) / sizeof(args[0]);
int a_argc = a_cnt + 1;
char *a_argv[a_cnt + 1] = { argv[0], args[0].data() };
//QByteArray args[] = { "-style=0" }; // prepare fake args to disable QT_STYLE_OVERRIDE env variable
//static const int a_cnt = sizeof(args) / sizeof(args[0]);
//int a_argc = a_cnt + 1;
//char *a_argv[a_cnt + 1] = { argv[0], args[0].data() };
Application app(a_argc, a_argv);
if (!App::quiting()) {
result = app.exec();
}
}
DEBUG_LOG(("Telegram finished, result: %1").arg(result));
#ifndef TDESKTOP_DISABLE_AUTOUPDATE
if (cRestartingUpdate()) {
DEBUG_LOG(("Application Info: executing updater to install update.."));
psExecUpdater();
} else
#endif
if (cRestarting()) {
DEBUG_LOG(("Application Info: executing Telegram, because of restart.."));
psExecTelegram();
}
SignalHandlers::finish();
return result;
Application app(argc, argv);
return app.exec();
}