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

Moved AppClass to messenger.cpp:Messenger.

This commit is contained in:
John Preston
2017-02-23 13:59:19 +03:00
parent 63c61637f8
commit c3b3819d9f
40 changed files with 940 additions and 962 deletions

View File

@@ -37,8 +37,10 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
#include "history/history_media_types.h"
#include "media/media_audio.h"
#include "inline_bots/inline_bot_layout_item.h"
#include "messenger.h"
#include "application.h"
#include "fileuploader.h"
#include "mainwindow.h"
#include "mainwidget.h"
#include "localstorage.h"
#include "apiwrap.h"
@@ -160,24 +162,27 @@ namespace App {
return result;
}
AppClass *app() {
return AppClass::app();
Messenger *app() {
return Messenger::InstancePointer();
}
MainWindow *wnd() {
return AppClass::wnd();
if (auto instance = app()) {
return instance->mainWindow();
}
return nullptr;
}
MainWidget *main() {
if (auto w = wnd()) {
return w->mainWidget();
if (auto window = wnd()) {
return window->mainWidget();
}
return nullptr;
}
bool passcoded() {
if (auto w = wnd()) {
return w->passcodeWidget();
if (auto window = wnd()) {
return window->passcodeWidget();
}
return false;
}
@@ -202,7 +207,7 @@ namespace {
w->notifyClearFast();
w->setupIntro();
}
AppClass::Instance().authSessionDestroy();
Messenger::Instance().authSessionDestroy();
Local::reset();
Window::Theme::Background()->reset();
@@ -2460,11 +2465,11 @@ namespace {
if (auto apiwrap = api()) {
if (apiwrap->hasUnsavedDrafts()) {
apiwrap->saveDraftsToCloud();
QTimer::singleShot(SaveDraftBeforeQuitTimeout, Application::instance(), SLOT(quit()));
QTimer::singleShot(SaveDraftBeforeQuitTimeout, QCoreApplication::instance(), SLOT(quit()));
return;
}
}
Application::quit();
QCoreApplication::quit();
}
bool quitting() {
@@ -2473,7 +2478,7 @@ namespace {
void allDraftsSaved() {
if (quitting()) {
Application::quit();
QCoreApplication::quit();
}
}