2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Move some code around.

Move logs:SignalHandlers to core/crash_reports:CrashReports.
Move all pre-launch windows to core/crash_report_window module.
Move some global code to core/launcher:Launcher.
It should replace settings / platform_specific module in some way.
This commit is contained in:
John Preston
2017-12-11 18:45:29 +04:00
parent 9d4558de2b
commit 97c15865a5
48 changed files with 2873 additions and 2373 deletions

View File

@@ -18,49 +18,9 @@ to link the code of portions of this program with the OpenSSL library.
Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE
Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
*/
#include "application.h"
#include "platform/platform_specific.h"
#include "storage/localstorage.h"
#include "core/launcher.h"
int main(int argc, char *argv[]) {
#ifndef Q_OS_MAC // Retina display support is working fine, others are not.
QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling, true);
#endif // Q_OS_MAC
QCoreApplication::setApplicationName(qsl("TelegramDesktop"));
InitFromCommandLine(argc, argv);
if (cLaunchMode() == LaunchModeFixPrevious) {
return psFixPrevious();
} else if (cLaunchMode() == LaunchModeCleanup) {
return psCleanup();
}
// both are finished in Application::closeApplication
Logs::start(); // must be started before Platform is started
Platform::start(); // must be started before QApplication is created
int result = 0;
{
Application app(argc, argv);
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 // !TDESKTOP_DISABLE_AUTOUPDATE
if (cRestarting()) {
DEBUG_LOG(("Application Info: executing Telegram, because of restart..."));
psExecTelegram();
}
SignalHandlers::finish();
Platform::finish();
Logs::finish();
return result;
const auto launcher = Core::Launcher::Create(argc, argv);
return launcher ? launcher->exec() : 1;
}