mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 06:07:06 +02:00
Remove app module. Support delayed quit by Cmd+Q on macOS.
This commit is contained in:
parent
b8f1cebeb6
commit
28f2c213f7
38 changed files with 319 additions and 350 deletions
|
@ -1193,8 +1193,6 @@ PRIVATE
|
|||
window/themes/window_themes_generate_name.h
|
||||
apiwrap.cpp
|
||||
apiwrap.h
|
||||
app.cpp
|
||||
app.h
|
||||
config.h
|
||||
facades.cpp
|
||||
facades.h
|
||||
|
|
|
@ -3087,4 +3087,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
|
||||
"lng_mac_touchbar_favorite_stickers" = "Favorite stickers";
|
||||
|
||||
"lng_mac_hold_to_quit" = "Hold {text} to Quit";
|
||||
|
||||
// Keys finished
|
||||
|
|
|
@ -46,7 +46,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "ui/boxes/confirm_box.h"
|
||||
#include "apiwrap.h"
|
||||
#include "ui/text/format_values.h" // Ui::FormatPhone
|
||||
#include "app.h" // App::quitting
|
||||
|
||||
namespace Api {
|
||||
namespace {
|
||||
|
@ -912,7 +911,7 @@ void Updates::updateOnline(crl::time lastNonIdleTime, bool gotOtherOffline) {
|
|||
|
||||
_lastWasOnline = isOnline;
|
||||
_lastSetOnline = ms;
|
||||
if (!App::quitting()) {
|
||||
if (!Core::Quitting()) {
|
||||
_onlineRequest = api().request(MTPaccount_UpdateStatus(
|
||||
MTP_bool(!isOnline)
|
||||
)).send();
|
||||
|
|
|
@ -87,7 +87,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "storage/storage_media_prepare.h"
|
||||
#include "storage/storage_account.h"
|
||||
#include "facades.h"
|
||||
#include "app.h" // App::quitting
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -2127,7 +2126,7 @@ bool ApiWrap::isQuitPrevent() {
|
|||
|
||||
void ApiWrap::checkQuitPreventFinished() {
|
||||
if (_draftsSaveRequestIds.empty()) {
|
||||
if (App::quitting()) {
|
||||
if (Core::Quitting()) {
|
||||
LOG(("ApiWrap doesn't prevent quit any more."));
|
||||
}
|
||||
Core::App().quitPreventFinished();
|
||||
|
|
|
@ -1,123 +0,0 @@
|
|||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
the official desktop application for the Telegram messaging service.
|
||||
|
||||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "app.h"
|
||||
|
||||
#include "history/view/history_view_element.h"
|
||||
#include "core/update_checker.h"
|
||||
#include "core/sandbox.h"
|
||||
#include "core/application.h"
|
||||
#include "mainwindow.h"
|
||||
|
||||
#include <QtCore/QBuffer>
|
||||
#include <QtGui/QFontDatabase>
|
||||
|
||||
namespace {
|
||||
|
||||
App::LaunchState _launchState = App::Launched;
|
||||
|
||||
HistoryView::Element *hoveredItem = nullptr,
|
||||
*pressedItem = nullptr,
|
||||
*hoveredLinkItem = nullptr,
|
||||
*pressedLinkItem = nullptr,
|
||||
*mousedItem = nullptr;
|
||||
|
||||
} // namespace
|
||||
|
||||
namespace App {
|
||||
|
||||
void hoveredItem(HistoryView::Element *item) {
|
||||
::hoveredItem = item;
|
||||
}
|
||||
|
||||
HistoryView::Element *hoveredItem() {
|
||||
return ::hoveredItem;
|
||||
}
|
||||
|
||||
void pressedItem(HistoryView::Element *item) {
|
||||
::pressedItem = item;
|
||||
}
|
||||
|
||||
HistoryView::Element *pressedItem() {
|
||||
return ::pressedItem;
|
||||
}
|
||||
|
||||
void hoveredLinkItem(HistoryView::Element *item) {
|
||||
::hoveredLinkItem = item;
|
||||
}
|
||||
|
||||
HistoryView::Element *hoveredLinkItem() {
|
||||
return ::hoveredLinkItem;
|
||||
}
|
||||
|
||||
void pressedLinkItem(HistoryView::Element *item) {
|
||||
::pressedLinkItem = item;
|
||||
}
|
||||
|
||||
HistoryView::Element *pressedLinkItem() {
|
||||
return ::pressedLinkItem;
|
||||
}
|
||||
|
||||
void mousedItem(HistoryView::Element *item) {
|
||||
::mousedItem = item;
|
||||
}
|
||||
|
||||
HistoryView::Element *mousedItem() {
|
||||
return ::mousedItem;
|
||||
}
|
||||
|
||||
void clearMousedItems() {
|
||||
hoveredItem(nullptr);
|
||||
pressedItem(nullptr);
|
||||
hoveredLinkItem(nullptr);
|
||||
pressedLinkItem(nullptr);
|
||||
mousedItem(nullptr);
|
||||
}
|
||||
|
||||
void quit() {
|
||||
if (quitting()) {
|
||||
return;
|
||||
} else if (Core::IsAppLaunched()
|
||||
&& Core::App().preventsQuit()) {
|
||||
return;
|
||||
}
|
||||
setLaunchState(QuitRequested);
|
||||
|
||||
if (auto window = App::wnd()) {
|
||||
if (!Core::Sandbox::Instance().isSavingSession()) {
|
||||
window->hide();
|
||||
}
|
||||
}
|
||||
Core::Application::QuitAttempt();
|
||||
}
|
||||
|
||||
bool quitting() {
|
||||
return _launchState != Launched;
|
||||
}
|
||||
|
||||
LaunchState launchState() {
|
||||
return _launchState;
|
||||
}
|
||||
|
||||
void setLaunchState(LaunchState state) {
|
||||
_launchState = state;
|
||||
}
|
||||
|
||||
void restart() {
|
||||
using namespace Core;
|
||||
const auto updateReady = !UpdaterDisabled()
|
||||
&& (UpdateChecker().state() == UpdateChecker::State::Ready);
|
||||
if (updateReady) {
|
||||
cSetRestartingUpdate(true);
|
||||
} else {
|
||||
cSetRestarting(true);
|
||||
cSetRestartingToSettings(true);
|
||||
}
|
||||
App::quit();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,38 +0,0 @@
|
|||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
the official desktop application for the Telegram messaging service.
|
||||
|
||||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
namespace HistoryView {
|
||||
class Element;
|
||||
} // namespace HistoryView
|
||||
|
||||
namespace App {
|
||||
void hoveredItem(HistoryView::Element *item);
|
||||
HistoryView::Element *hoveredItem();
|
||||
void pressedItem(HistoryView::Element *item);
|
||||
HistoryView::Element *pressedItem();
|
||||
void hoveredLinkItem(HistoryView::Element *item);
|
||||
HistoryView::Element *hoveredLinkItem();
|
||||
void pressedLinkItem(HistoryView::Element *item);
|
||||
HistoryView::Element *pressedLinkItem();
|
||||
void mousedItem(HistoryView::Element *item);
|
||||
HistoryView::Element *mousedItem();
|
||||
void clearMousedItems();
|
||||
|
||||
enum LaunchState {
|
||||
Launched = 0,
|
||||
QuitRequested = 1,
|
||||
QuitProcessed = 2,
|
||||
};
|
||||
void quit();
|
||||
bool quitting();
|
||||
LaunchState launchState();
|
||||
void setLaunchState(LaunchState state);
|
||||
void restart();
|
||||
|
||||
};
|
|
@ -32,7 +32,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "ui/toast/toast.h"
|
||||
#include "base/unixtime.h"
|
||||
#include "mtproto/mtproto_config.h"
|
||||
#include "app.h" // App::quitting
|
||||
|
||||
#include <tgcalls/VideoCaptureInterface.h>
|
||||
#include <tgcalls/StaticThreads.h>
|
||||
|
@ -247,7 +246,7 @@ void Instance::destroyCall(not_null<Call*> call) {
|
|||
_currentCallChanges.fire(nullptr);
|
||||
taken.reset();
|
||||
|
||||
if (App::quitting()) {
|
||||
if (Core::Quitting()) {
|
||||
LOG(("Calls::Instance doesn't prevent quit any more."));
|
||||
}
|
||||
Core::App().quitPreventFinished();
|
||||
|
@ -285,7 +284,7 @@ void Instance::destroyGroupCall(not_null<GroupCall*> call) {
|
|||
_currentGroupCallChanges.fire(nullptr);
|
||||
taken.reset();
|
||||
|
||||
if (App::quitting()) {
|
||||
if (Core::Quitting()) {
|
||||
LOG(("Calls::Instance doesn't prevent quit any more."));
|
||||
}
|
||||
Core::App().quitPreventFinished();
|
||||
|
|
|
@ -83,7 +83,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "boxes/connection_box.h"
|
||||
#include "ui/boxes/confirm_box.h"
|
||||
#include "boxes/share_box.h"
|
||||
#include "app.h"
|
||||
|
||||
#include <QtCore/QMimeDatabase>
|
||||
#include <QtGui/QGuiApplication>
|
||||
|
@ -96,6 +95,8 @@ constexpr auto kQuitPreventTimeoutMs = crl::time(1500);
|
|||
constexpr auto kAutoLockTimeoutLateMs = crl::time(3000);
|
||||
constexpr auto kClearEmojiImageSourceTimeout = 10 * crl::time(1000);
|
||||
|
||||
LaunchState GlobalLaunchState/* = LaunchState::Running*/;
|
||||
|
||||
void SetCrashAnnotationsGL() {
|
||||
#ifdef Q_OS_WIN
|
||||
CrashReports::SetAnnotation("OpenGL ANGLE", [] {
|
||||
|
@ -235,7 +236,7 @@ void Application::run() {
|
|||
|
||||
if (cLaunchMode() == LaunchModeAutoStart && Platform::AutostartSkip()) {
|
||||
Platform::AutostartToggle(false);
|
||||
App::quit();
|
||||
Quit();
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -340,7 +341,7 @@ void Application::showOpenGLCrashNotification() {
|
|||
Ui::GL::CrashCheckFinish();
|
||||
Core::App().settings().setDisableOpenGL(false);
|
||||
Local::writeSettings();
|
||||
App::restart();
|
||||
Restart();
|
||||
};
|
||||
const auto keepDisabled = [=] {
|
||||
Ui::GL::ForceDisable(true);
|
||||
|
@ -721,7 +722,7 @@ void Application::switchDebugMode() {
|
|||
if (Logs::DebugEnabled()) {
|
||||
Logs::SetDebugEnabled(false);
|
||||
_launcher->writeDebugModeSetting();
|
||||
App::restart();
|
||||
Restart();
|
||||
} else {
|
||||
Logs::SetDebugEnabled(true);
|
||||
_launcher->writeDebugModeSetting();
|
||||
|
@ -742,7 +743,7 @@ void Application::switchFreeType() {
|
|||
}
|
||||
cSetUseFreeType(true);
|
||||
}
|
||||
App::restart();
|
||||
Restart();
|
||||
}
|
||||
|
||||
void Application::writeInstallBetaVersionsSetting() {
|
||||
|
@ -760,7 +761,7 @@ Main::Session *Application::maybeActiveSession() const {
|
|||
bool Application::exportPreventsQuit() {
|
||||
if (_exportManager->inProgress()) {
|
||||
_exportManager->stopWithConfirmation([] {
|
||||
App::quit();
|
||||
Quit();
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
@ -782,7 +783,7 @@ bool Application::uploadPreventsQuit() {
|
|||
account->session().uploadsStop();
|
||||
}
|
||||
}
|
||||
App::quit();
|
||||
Quit();
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
@ -790,8 +791,15 @@ bool Application::uploadPreventsQuit() {
|
|||
return false;
|
||||
}
|
||||
|
||||
bool Application::preventsQuit() {
|
||||
return exportPreventsQuit() || uploadPreventsQuit();
|
||||
bool Application::preventsQuit(QuitReason reason) {
|
||||
if (exportPreventsQuit() || uploadPreventsQuit()) {
|
||||
return true;
|
||||
} else if (const auto window = activeWindow()) {
|
||||
if (window->widget()->isActive()) {
|
||||
return window->widget()->preventsQuit(reason);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
int Application::unreadBadge() const {
|
||||
|
@ -999,7 +1007,7 @@ void Application::localPasscodeChanged() {
|
|||
}
|
||||
|
||||
bool Application::hasActiveWindow(not_null<Main::Session*> session) const {
|
||||
if (App::quitting() || !_primaryWindow) {
|
||||
if (Quitting() || !_primaryWindow) {
|
||||
return false;
|
||||
} else if (_calls->hasActivePanel(session)) {
|
||||
return true;
|
||||
|
@ -1173,9 +1181,10 @@ void Application::refreshGlobalProxy() {
|
|||
Sandbox::Instance().refreshGlobalProxy();
|
||||
}
|
||||
|
||||
void Application::QuitAttempt() {
|
||||
void QuitAttempt() {
|
||||
const auto savingSession = Sandbox::Instance().isSavingSession();
|
||||
if (!IsAppLaunched()
|
||||
|| Sandbox::Instance().isSavingSession()
|
||||
|| savingSession
|
||||
|| App().readyToQuit()) {
|
||||
Sandbox::QuitWhenStarted();
|
||||
}
|
||||
|
@ -1206,12 +1215,18 @@ bool Application::readyToQuit() {
|
|||
}
|
||||
|
||||
void Application::quitPreventFinished() {
|
||||
if (App::quitting()) {
|
||||
if (Quitting()) {
|
||||
QuitAttempt();
|
||||
}
|
||||
}
|
||||
|
||||
void Application::quitDelayed() {
|
||||
if (_primaryWindow) {
|
||||
_primaryWindow->widget()->hide();
|
||||
}
|
||||
for (const auto &[history, window] : _secondaryWindows) {
|
||||
window->widget()->hide();
|
||||
}
|
||||
if (!_private->quitTimer.isActive()) {
|
||||
_private->quitTimer.setCallback([] { Sandbox::QuitWhenStarted(); });
|
||||
_private->quitTimer.callOnce(kQuitPreventTimeoutMs);
|
||||
|
@ -1234,7 +1249,7 @@ void Application::startShortcuts() {
|
|||
) | rpl::start_with_next([=](not_null<Shortcuts::Request*> request) {
|
||||
using Command = Shortcuts::Command;
|
||||
request->check(Command::Quit) && request->handle([] {
|
||||
App::quit();
|
||||
Quit();
|
||||
return true;
|
||||
});
|
||||
request->check(Command::Lock) && request->handle([=] {
|
||||
|
@ -1276,4 +1291,39 @@ Application &App() {
|
|||
return *Application::Instance;
|
||||
}
|
||||
|
||||
void Quit(QuitReason reason) {
|
||||
if (Quitting()) {
|
||||
return;
|
||||
} else if (IsAppLaunched() && App().preventsQuit(reason)) {
|
||||
return;
|
||||
}
|
||||
SetLaunchState(LaunchState::QuitRequested);
|
||||
|
||||
QuitAttempt();
|
||||
}
|
||||
|
||||
bool Quitting() {
|
||||
return GlobalLaunchState != LaunchState::Running;
|
||||
}
|
||||
|
||||
LaunchState CurrentLaunchState() {
|
||||
return GlobalLaunchState;
|
||||
}
|
||||
|
||||
void SetLaunchState(LaunchState state) {
|
||||
GlobalLaunchState = state;
|
||||
}
|
||||
|
||||
void Restart() {
|
||||
const auto updateReady = !UpdaterDisabled()
|
||||
&& (UpdateChecker().state() == UpdateChecker::State::Ready);
|
||||
if (updateReady) {
|
||||
cSetRestartingUpdate(true);
|
||||
} else {
|
||||
cSetRestarting(true);
|
||||
cSetRestartingToSettings(true);
|
||||
}
|
||||
Quit();
|
||||
}
|
||||
|
||||
} // namespace Core
|
||||
|
|
|
@ -39,10 +39,6 @@ namespace ChatHelpers {
|
|||
class EmojiKeywords;
|
||||
} // namespace ChatHelpers
|
||||
|
||||
namespace App {
|
||||
void quit();
|
||||
} // namespace App
|
||||
|
||||
namespace Main {
|
||||
class Domain;
|
||||
class Account;
|
||||
|
@ -107,6 +103,17 @@ namespace Core {
|
|||
class Launcher;
|
||||
struct LocalUrlHandler;
|
||||
|
||||
enum class LaunchState {
|
||||
Running,
|
||||
QuitRequested,
|
||||
QuitProcessed,
|
||||
};
|
||||
|
||||
enum class QuitReason {
|
||||
Default,
|
||||
QtQuitEvent,
|
||||
};
|
||||
|
||||
class Application final : public QObject {
|
||||
public:
|
||||
struct ProxyChange {
|
||||
|
@ -255,7 +262,7 @@ public:
|
|||
void checkAutoLockIn(crl::time time);
|
||||
void localPasscodeChanged();
|
||||
|
||||
[[nodiscard]] bool preventsQuit();
|
||||
[[nodiscard]] bool preventsQuit(QuitReason reason);
|
||||
|
||||
[[nodiscard]] crl::time lastNonIdleTime() const;
|
||||
void updateNonIdle();
|
||||
|
@ -305,8 +312,7 @@ private:
|
|||
void startEmojiImageLoader();
|
||||
void startSystemDarkModeViewer();
|
||||
|
||||
friend void App::quit();
|
||||
static void QuitAttempt();
|
||||
friend void QuitAttempt();
|
||||
void quitDelayed();
|
||||
[[nodiscard]] bool readyToQuit();
|
||||
|
||||
|
@ -391,4 +397,12 @@ private:
|
|||
[[nodiscard]] bool IsAppLaunched();
|
||||
[[nodiscard]] Application &App();
|
||||
|
||||
[[nodiscard]] LaunchState CurrentLaunchState();
|
||||
void SetLaunchState(LaunchState state);
|
||||
|
||||
void Quit(QuitReason reason = QuitReason::Default);
|
||||
[[nodiscard]] bool Quitting();
|
||||
|
||||
void Restart();
|
||||
|
||||
} // namespace Core
|
||||
|
|
|
@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "core/crash_report_window.h"
|
||||
|
||||
#include "core/crash_reports.h"
|
||||
#include "core/application.h"
|
||||
#include "core/launcher.h"
|
||||
#include "core/sandbox.h"
|
||||
#include "core/update_checker.h"
|
||||
|
@ -15,7 +16,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "window/main_window.h"
|
||||
#include "platform/platform_specific.h"
|
||||
#include "base/zlib_help.h"
|
||||
#include "app.h"
|
||||
|
||||
#include <QtWidgets/QFileDialog>
|
||||
#include <QtGui/QScreen>
|
||||
|
@ -208,7 +208,7 @@ void NotStartedWindow::updateControls() {
|
|||
|
||||
void NotStartedWindow::closeEvent(QCloseEvent *e) {
|
||||
deleteLater();
|
||||
App::quit();
|
||||
Core::Quit();
|
||||
}
|
||||
|
||||
void NotStartedWindow::resizeEvent(QResizeEvent *e) {
|
||||
|
@ -906,7 +906,7 @@ void LastCrashedWindow::setUpdatingState(UpdatingState state, bool force) {
|
|||
case UpdatingReady:
|
||||
if (Core::checkReadyUpdate()) {
|
||||
cSetRestartingUpdate(true);
|
||||
App::quit();
|
||||
Core::Quit();
|
||||
return;
|
||||
} else {
|
||||
setUpdatingState(UpdatingFail);
|
||||
|
|
|
@ -27,7 +27,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "base/qt/qt_common_adapters.h"
|
||||
#include "ui/ui_utility.h"
|
||||
#include "ui/effects/animations.h"
|
||||
#include "app.h"
|
||||
|
||||
#include <QtCore/QLockFile>
|
||||
#include <QtGui/QSessionManager>
|
||||
|
@ -196,7 +195,7 @@ void Sandbox::QuitWhenStarted() {
|
|||
|
||||
void Sandbox::launchApplication() {
|
||||
InvokeQueued(this, [=] {
|
||||
if (App::quitting()) {
|
||||
if (Quitting()) {
|
||||
quit();
|
||||
} else if (_application) {
|
||||
return;
|
||||
|
@ -261,12 +260,12 @@ void Sandbox::setupScreenScale() {
|
|||
Sandbox::~Sandbox() = default;
|
||||
|
||||
bool Sandbox::event(QEvent *e) {
|
||||
if (e->type() == QEvent::Quit && !App::quitting()) {
|
||||
App::quit();
|
||||
if (e->type() == QEvent::Quit && !Quitting()) {
|
||||
Quit(QuitReason::QtQuitEvent);
|
||||
e->ignore();
|
||||
return false;
|
||||
} else if (e->type() == QEvent::Close) {
|
||||
App::quit();
|
||||
Quit();
|
||||
}
|
||||
return QApplication::event(e);
|
||||
}
|
||||
|
@ -318,16 +317,16 @@ void Sandbox::socketReading() {
|
|||
psActivateProcess(pid);
|
||||
}
|
||||
LOG(("Show command response received, pid = %1, activating and quitting...").arg(pid));
|
||||
return App::quit();
|
||||
return Quit();
|
||||
}
|
||||
}
|
||||
|
||||
void Sandbox::socketError(QLocalSocket::LocalSocketError e) {
|
||||
if (App::quitting()) return;
|
||||
if (Quitting()) return;
|
||||
|
||||
if (_secondInstance) {
|
||||
LOG(("Could not write show command, error %1, quitting...").arg(e));
|
||||
return App::quit();
|
||||
return Quit();
|
||||
}
|
||||
|
||||
if (e == QLocalSocket::ServerNotFoundError) {
|
||||
|
@ -343,7 +342,7 @@ void Sandbox::socketError(QLocalSocket::LocalSocketError e) {
|
|||
|
||||
if (!_localServer.listen(_localServerName)) {
|
||||
LOG(("Failed to start listening to %1 server: %2").arg(_localServerName, _localServer.errorString()));
|
||||
return App::quit();
|
||||
return Quit();
|
||||
}
|
||||
#endif // !Q_OS_WINRT
|
||||
|
||||
|
@ -352,11 +351,11 @@ void Sandbox::socketError(QLocalSocket::LocalSocketError e) {
|
|||
&& Core::checkReadyUpdate()) {
|
||||
cSetRestartingUpdate(true);
|
||||
DEBUG_LOG(("Sandbox Info: installing update instead of starting app..."));
|
||||
return App::quit();
|
||||
return Quit();
|
||||
}
|
||||
|
||||
if (cQuit()) {
|
||||
return App::quit();
|
||||
return Quit();
|
||||
}
|
||||
|
||||
singleInstanceChecked();
|
||||
|
@ -407,7 +406,7 @@ void Sandbox::singleInstanceChecked() {
|
|||
void Sandbox::socketDisconnected() {
|
||||
if (_secondInstance) {
|
||||
DEBUG_LOG(("Sandbox Error: socket disconnected before command response received, quitting..."));
|
||||
return App::quit();
|
||||
return Quit();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -499,7 +498,7 @@ void Sandbox::removeClients() {
|
|||
}
|
||||
|
||||
void Sandbox::checkForQuit() {
|
||||
if (App::quitting()) {
|
||||
if (Quitting()) {
|
||||
quit();
|
||||
}
|
||||
}
|
||||
|
@ -633,10 +632,10 @@ MTP::ProxyData Sandbox::sandboxProxy() const {
|
|||
}
|
||||
|
||||
void Sandbox::closeApplication() {
|
||||
if (App::launchState() == App::QuitProcessed) {
|
||||
if (CurrentLaunchState() == LaunchState::QuitProcessed) {
|
||||
return;
|
||||
}
|
||||
App::setLaunchState(App::QuitProcessed);
|
||||
SetLaunchState(LaunchState::QuitProcessed);
|
||||
|
||||
_application = nullptr;
|
||||
|
||||
|
@ -660,7 +659,7 @@ void Sandbox::execExternal(const QString &cmd) {
|
|||
PreLaunchWindow::instance()->activate();
|
||||
}
|
||||
} else if (cmd == "quit") {
|
||||
App::quit();
|
||||
Quit();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "window/window_session_controller.h"
|
||||
#include "settings/settings_intro.h"
|
||||
#include "ui/layers/box_content.h"
|
||||
#include "app.h"
|
||||
|
||||
#include <QtCore/QJsonDocument>
|
||||
#include <QtCore/QJsonObject>
|
||||
|
@ -1175,7 +1174,7 @@ void Updater::check() {
|
|||
void Updater::handleReady() {
|
||||
stop();
|
||||
_action = Action::Ready;
|
||||
if (!App::quitting()) {
|
||||
if (!Quitting()) {
|
||||
cSetLastUpdateCheck(base::unixtime::now());
|
||||
Local::writeSettings();
|
||||
}
|
||||
|
@ -1203,7 +1202,7 @@ void Updater::handleProgress() {
|
|||
|
||||
void Updater::scheduleNext() {
|
||||
stop();
|
||||
if (!App::quitting()) {
|
||||
if (!Quitting()) {
|
||||
cSetLastUpdateCheck(base::unixtime::now());
|
||||
Local::writeSettings();
|
||||
start(true);
|
||||
|
|
|
@ -51,9 +51,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "data/data_file_origin.h"
|
||||
#include "main/main_session.h"
|
||||
#include "main/main_session_settings.h"
|
||||
#include "core/application.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "storage/file_upload.h"
|
||||
#include "app.h"
|
||||
#include "styles/style_chat.h"
|
||||
#include "styles/style_dialogs.h"
|
||||
|
||||
|
@ -464,7 +464,7 @@ MediaPhoto::MediaPhoto(
|
|||
}
|
||||
|
||||
MediaPhoto::~MediaPhoto() {
|
||||
if (uploading() && !App::quitting()) {
|
||||
if (uploading() && !Core::Quitting()) {
|
||||
parent()->history()->session().uploader().cancel(parent()->fullId());
|
||||
}
|
||||
parent()->history()->owner().unregisterPhotoItem(_photo, parent());
|
||||
|
@ -649,7 +649,7 @@ MediaFile::MediaFile(
|
|||
}
|
||||
|
||||
MediaFile::~MediaFile() {
|
||||
if (uploading() && !App::quitting()) {
|
||||
if (uploading() && !Core::Quitting()) {
|
||||
parent()->history()->session().uploader().cancel(parent()->fullId());
|
||||
}
|
||||
parent()->history()->owner().unregisterDocumentItem(
|
||||
|
|
|
@ -64,7 +64,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "base/call_delayed.h"
|
||||
#include "base/random.h"
|
||||
#include "facades.h" // Notify::switchInlineBotButtonReceived
|
||||
#include "app.h"
|
||||
#include "styles/style_boxes.h" // st::backgroundSize
|
||||
|
||||
namespace Data {
|
||||
|
@ -291,7 +290,7 @@ void Session::clear() {
|
|||
_sentMessagesData.clear();
|
||||
cSetRecentInlineBots(RecentInlineBots());
|
||||
cSetRecentStickers(RecentStickerPack());
|
||||
App::clearMousedItems();
|
||||
HistoryView::Element::ClearGlobal();
|
||||
_histories->clearAll();
|
||||
_webpages.clear();
|
||||
_locations.clear();
|
||||
|
@ -3674,20 +3673,22 @@ void Session::unregisterItemView(not_null<ViewElement*> view) {
|
|||
_views.erase(i);
|
||||
}
|
||||
}
|
||||
if (App::hoveredItem() == view) {
|
||||
App::hoveredItem(nullptr);
|
||||
|
||||
using namespace HistoryView;
|
||||
if (Element::Hovered() == view) {
|
||||
Element::Hovered(nullptr);
|
||||
}
|
||||
if (App::pressedItem() == view) {
|
||||
App::pressedItem(nullptr);
|
||||
if (Element::Pressed() == view) {
|
||||
Element::Pressed(nullptr);
|
||||
}
|
||||
if (App::hoveredLinkItem() == view) {
|
||||
App::hoveredLinkItem(nullptr);
|
||||
if (Element::HoveredLink() == view) {
|
||||
Element::HoveredLink(nullptr);
|
||||
}
|
||||
if (App::pressedLinkItem() == view) {
|
||||
App::pressedLinkItem(nullptr);
|
||||
if (Element::PressedLink() == view) {
|
||||
Element::PressedLink(nullptr);
|
||||
}
|
||||
if (App::mousedItem() == view) {
|
||||
App::mousedItem(nullptr);
|
||||
if (Element::Moused() == view) {
|
||||
Element::Moused(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -47,7 +47,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "data/data_histories.h"
|
||||
#include "data/data_changes.h"
|
||||
#include "facades.h"
|
||||
#include "app.h"
|
||||
#include "styles/style_dialogs.h"
|
||||
#include "styles/style_chat.h"
|
||||
#include "styles/style_info.h"
|
||||
|
@ -607,7 +606,7 @@ void Widget::checkUpdateStatus() {
|
|||
_updateTelegram->show();
|
||||
_updateTelegram->setClickedCallback([] {
|
||||
Core::checkReadyUpdate();
|
||||
App::restart();
|
||||
Core::Restart();
|
||||
});
|
||||
if (_connecting) {
|
||||
_connecting->raise();
|
||||
|
|
|
@ -56,7 +56,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "data/data_channel.h"
|
||||
#include "data/data_user.h"
|
||||
#include "facades.h"
|
||||
#include "app.h"
|
||||
#include "styles/style_chat.h"
|
||||
#include "styles/style_menu_icons.h"
|
||||
|
||||
|
@ -529,7 +528,7 @@ void InnerWidget::updateEmptyText() {
|
|||
QString InnerWidget::tooltipText() const {
|
||||
if (_mouseCursorState == CursorState::Date
|
||||
&& _mouseAction == MouseAction::None) {
|
||||
if (const auto view = App::hoveredItem()) {
|
||||
if (const auto view = Element::Hovered()) {
|
||||
const auto format = QLocale::system().dateTimeFormat(
|
||||
QLocale::LongFormat);
|
||||
auto dateText = HistoryView::DateTooltipText(view);
|
||||
|
@ -545,7 +544,7 @@ QString InnerWidget::tooltipText() const {
|
|||
}
|
||||
} else if (_mouseCursorState == CursorState::Forwarded
|
||||
&& _mouseAction == MouseAction::None) {
|
||||
if (const auto view = App::hoveredItem()) {
|
||||
if (const auto view = Element::Hovered()) {
|
||||
if (const auto forwarded = view->data()->Get<HistoryMessageForwarded>()) {
|
||||
return forwarded->text.toString();
|
||||
}
|
||||
|
@ -582,7 +581,7 @@ std::unique_ptr<HistoryView::Element> InnerWidget::elementCreate(
|
|||
|
||||
bool InnerWidget::elementUnderCursor(
|
||||
not_null<const HistoryView::Element*> view) {
|
||||
return (App::hoveredItem() == view);
|
||||
return (Element::Hovered() == view);
|
||||
}
|
||||
|
||||
crl::time InnerWidget::elementHighlightTime(
|
||||
|
@ -1145,13 +1144,13 @@ void InnerWidget::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
|
|||
auto selFrom = _selectedText.from;
|
||||
auto selTo = _selectedText.to;
|
||||
hasSelected = (selTo > selFrom) ? 1 : 0;
|
||||
if (App::mousedItem() && App::mousedItem() == App::hoveredItem()) {
|
||||
if (Element::Moused() && Element::Moused() == Element::Hovered()) {
|
||||
auto mousePos = mapPointToItem(
|
||||
mapFromGlobal(_mousePosition),
|
||||
App::mousedItem());
|
||||
Element::Moused());
|
||||
StateRequest request;
|
||||
request.flags |= Ui::Text::StateRequest::Flag::LookupSymbol;
|
||||
auto dragState = App::mousedItem()->textState(mousePos, request);
|
||||
auto dragState = Element::Moused()->textState(mousePos, request);
|
||||
if (dragState.cursor == CursorState::Text
|
||||
&& base::in_range(dragState.symbol, selFrom, selTo)) {
|
||||
isUponSelected = 1;
|
||||
|
@ -1167,9 +1166,9 @@ void InnerWidget::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
|
|||
st::popupMenuWithIcons);
|
||||
|
||||
const auto link = ClickHandler::getActive();
|
||||
auto view = App::hoveredItem()
|
||||
? App::hoveredItem()
|
||||
: App::hoveredLinkItem();
|
||||
auto view = Element::Hovered()
|
||||
? Element::Hovered()
|
||||
: Element::HoveredLink();
|
||||
const auto lnkPhoto = link
|
||||
? reinterpret_cast<PhotoData*>(
|
||||
link->property(kPhotoLinkMediaProperty).toULongLong())
|
||||
|
@ -1526,9 +1525,9 @@ void InnerWidget::enterEventHook(QEnterEvent *e) {
|
|||
}
|
||||
|
||||
void InnerWidget::leaveEventHook(QEvent *e) {
|
||||
if (const auto view = App::hoveredItem()) {
|
||||
if (const auto view = Element::Hovered()) {
|
||||
repaintItem(view);
|
||||
App::hoveredItem(nullptr);
|
||||
Element::Hovered(nullptr);
|
||||
}
|
||||
ClickHandler::clearActive();
|
||||
Ui::Tooltip::Hide();
|
||||
|
@ -1544,14 +1543,14 @@ void InnerWidget::mouseActionStart(const QPoint &screenPos, Qt::MouseButton butt
|
|||
if (button != Qt::LeftButton) return;
|
||||
|
||||
ClickHandler::pressed();
|
||||
if (App::pressedItem() != App::hoveredItem()) {
|
||||
repaintItem(App::pressedItem());
|
||||
App::pressedItem(App::hoveredItem());
|
||||
repaintItem(App::pressedItem());
|
||||
if (Element::Pressed() != Element::Hovered()) {
|
||||
repaintItem(Element::Pressed());
|
||||
Element::Pressed(Element::Hovered());
|
||||
repaintItem(Element::Pressed());
|
||||
}
|
||||
|
||||
_mouseAction = MouseAction::None;
|
||||
_mouseActionItem = App::mousedItem();
|
||||
_mouseActionItem = Element::Moused();
|
||||
_dragStartPosition = mapPointToItem(
|
||||
mapFromGlobal(screenPos),
|
||||
_mouseActionItem);
|
||||
|
@ -1579,13 +1578,13 @@ void InnerWidget::mouseActionStart(const QPoint &screenPos, Qt::MouseButton butt
|
|||
mouseActionUpdate(_mousePosition);
|
||||
_trippleClickTimer.callOnce(QApplication::doubleClickInterval());
|
||||
}
|
||||
} else if (App::pressedItem()) {
|
||||
} else if (Element::Pressed()) {
|
||||
StateRequest request;
|
||||
request.flags = Ui::Text::StateRequest::Flag::LookupSymbol;
|
||||
dragState = _mouseActionItem->textState(_dragStartPosition, request);
|
||||
}
|
||||
if (_mouseSelectType != TextSelectType::Paragraphs) {
|
||||
if (App::pressedItem()) {
|
||||
if (Element::Pressed()) {
|
||||
_mouseTextSymbol = dragState.symbol;
|
||||
auto uponSelected = (dragState.cursor == CursorState::Text);
|
||||
if (uponSelected) {
|
||||
|
@ -1636,9 +1635,9 @@ void InnerWidget::mouseActionFinish(const QPoint &screenPos, Qt::MouseButton but
|
|||
if (_mouseAction == MouseAction::Dragging) {
|
||||
activated = nullptr;
|
||||
}
|
||||
if (const auto view = App::pressedItem()) {
|
||||
if (const auto view = Element::Pressed()) {
|
||||
repaintItem(view);
|
||||
App::pressedItem(nullptr);
|
||||
Element::Pressed(nullptr);
|
||||
}
|
||||
|
||||
_wasSelectedText = false;
|
||||
|
@ -1698,17 +1697,17 @@ void InnerWidget::updateSelected() {
|
|||
const auto view = (from != end) ? from->get() : nullptr;
|
||||
const auto item = view ? view->data().get() : nullptr;
|
||||
if (item) {
|
||||
App::mousedItem(view);
|
||||
Element::Moused(view);
|
||||
itemPoint = mapPointToItem(point, view);
|
||||
if (view->pointState(itemPoint) != PointState::Outside) {
|
||||
if (App::hoveredItem() != view) {
|
||||
repaintItem(App::hoveredItem());
|
||||
App::hoveredItem(view);
|
||||
if (Element::Hovered() != view) {
|
||||
repaintItem(Element::Hovered());
|
||||
Element::Hovered(view);
|
||||
repaintItem(view);
|
||||
}
|
||||
} else if (const auto view = App::hoveredItem()) {
|
||||
} else if (const auto view = Element::Hovered()) {
|
||||
repaintItem(view);
|
||||
App::hoveredItem(nullptr);
|
||||
Element::Hovered(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1716,7 +1715,7 @@ void InnerWidget::updateSelected() {
|
|||
ClickHandlerHost *lnkhost = nullptr;
|
||||
auto selectingText = _selectedItem
|
||||
&& (view == _mouseActionItem)
|
||||
&& (view == App::hoveredItem());
|
||||
&& (view == Element::Hovered());
|
||||
if (view) {
|
||||
if (view != _mouseActionItem || (itemPoint - _dragStartPosition).manhattanLength() >= QApplication::startDragDistance()) {
|
||||
if (_mouseAction == MouseAction::PrepareDrag) {
|
||||
|
@ -1807,7 +1806,7 @@ void InnerWidget::updateSelected() {
|
|||
}
|
||||
|
||||
// Voice message seek support.
|
||||
if (const auto pressedView = App::pressedLinkItem()) {
|
||||
if (const auto pressedView = Element::PressedLink()) {
|
||||
const auto adjustedPoint = mapPointToItem(point, pressedView);
|
||||
pressedView->updatePressed(adjustedPoint);
|
||||
}
|
||||
|
@ -1883,7 +1882,7 @@ void InnerWidget::performDrag() {
|
|||
//} else {
|
||||
// auto forwardMimeType = QString();
|
||||
// auto pressedMedia = static_cast<HistoryView::Media*>(nullptr);
|
||||
// if (auto pressedItem = App::pressedItem()) {
|
||||
// if (auto pressedItem = Element::Pressed()) {
|
||||
// pressedMedia = pressedItem->media();
|
||||
// if (_mouseCursorState == CursorState::Date
|
||||
// || (pressedMedia && pressedMedia->dragItem())) {
|
||||
|
@ -1892,7 +1891,7 @@ void InnerWidget::performDrag() {
|
|||
// session().data().itemOrItsGroup(pressedItem->data()));
|
||||
// }
|
||||
// }
|
||||
// if (auto pressedLnkItem = App::pressedLinkItem()) {
|
||||
// if (auto pressedLnkItem = Element::PressedLink()) {
|
||||
// if ((pressedMedia = pressedLnkItem->media())) {
|
||||
// if (forwardMimeType.isEmpty()
|
||||
// && pressedMedia->dragItemByHandler(pressedHandler)) {
|
||||
|
|
|
@ -82,7 +82,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "data/stickers/data_stickers.h"
|
||||
#include "data/data_sponsored_messages.h"
|
||||
#include "facades.h"
|
||||
#include "app.h"
|
||||
#include "styles/style_chat.h"
|
||||
#include "styles/style_window.h" // st::windowMinWidth
|
||||
#include "styles/style_menu_icons.h"
|
||||
|
@ -153,7 +152,7 @@ public:
|
|||
}
|
||||
bool elementUnderCursor(
|
||||
not_null<const Element*> view) override {
|
||||
return (App::mousedItem() == view);
|
||||
return (Element::Moused() == view);
|
||||
}
|
||||
crl::time elementHighlightTime(
|
||||
not_null<const HistoryItem*> item) override {
|
||||
|
@ -1400,13 +1399,13 @@ void HistoryInner::mouseActionStart(const QPoint &screenPos, Qt::MouseButton but
|
|||
if (button != Qt::LeftButton) return;
|
||||
|
||||
ClickHandler::pressed();
|
||||
if (App::pressedItem() != App::hoveredItem()) {
|
||||
repaintItem(App::pressedItem());
|
||||
App::pressedItem(App::hoveredItem());
|
||||
repaintItem(App::pressedItem());
|
||||
if (Element::Pressed() != Element::Hovered()) {
|
||||
repaintItem(Element::Pressed());
|
||||
Element::Pressed(Element::Hovered());
|
||||
repaintItem(Element::Pressed());
|
||||
}
|
||||
|
||||
const auto mouseActionView = App::mousedItem();
|
||||
const auto mouseActionView = Element::Moused();
|
||||
_mouseAction = MouseAction::None;
|
||||
_mouseActionItem = mouseActionView
|
||||
? mouseActionView->data().get()
|
||||
|
@ -1422,7 +1421,7 @@ void HistoryInner::mouseActionStart(const QPoint &screenPos, Qt::MouseButton but
|
|||
} else if (inSelectionMode()) {
|
||||
if (_dragStateItem
|
||||
&& _selected.find(_dragStateItem) != _selected.cend()
|
||||
&& App::hoveredItem()) {
|
||||
&& Element::Hovered()) {
|
||||
_mouseAction = MouseAction::PrepareDrag; // start items drag
|
||||
} else if (!_pressWasInactive) {
|
||||
_mouseAction = MouseAction::PrepareSelect; // start items select
|
||||
|
@ -1450,13 +1449,13 @@ void HistoryInner::mouseActionStart(const QPoint &screenPos, Qt::MouseButton but
|
|||
QApplication::doubleClickInterval());
|
||||
}
|
||||
}
|
||||
} else if (App::pressedItem()) {
|
||||
} else if (Element::Pressed()) {
|
||||
StateRequest request;
|
||||
request.flags = Ui::Text::StateRequest::Flag::LookupSymbol;
|
||||
dragState = mouseActionView->textState(_dragStartPosition, request);
|
||||
}
|
||||
if (_mouseSelectType != TextSelectType::Paragraphs) {
|
||||
if (App::pressedItem()) {
|
||||
if (Element::Pressed()) {
|
||||
_mouseTextSymbol = dragState.symbol;
|
||||
bool uponSelected = (dragState.cursor == CursorState::Text);
|
||||
if (uponSelected) {
|
||||
|
@ -1474,7 +1473,7 @@ void HistoryInner::mouseActionStart(const QPoint &screenPos, Qt::MouseButton but
|
|||
if (uponSelected) {
|
||||
_mouseAction = MouseAction::PrepareDrag; // start text drag
|
||||
} else if (!_pressWasInactive) {
|
||||
const auto media = App::pressedItem()->media();
|
||||
const auto media = Element::Pressed()->media();
|
||||
if ((media && media->dragItem())
|
||||
|| _mouseCursorState == CursorState::Date) {
|
||||
_mouseAction = MouseAction::PrepareDrag; // start sticker drag or by-date drag
|
||||
|
@ -1694,10 +1693,10 @@ void HistoryInner::mouseActionFinish(
|
|||
}
|
||||
}
|
||||
}
|
||||
const auto pressedItemView = App::pressedItem();
|
||||
const auto pressedItemView = Element::Pressed();
|
||||
if (pressedItemView) {
|
||||
repaintItem(pressedItemView);
|
||||
App::pressedItem(nullptr);
|
||||
Element::Pressed(nullptr);
|
||||
}
|
||||
|
||||
_wasSelectedText = false;
|
||||
|
@ -1874,15 +1873,15 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
|
|||
} else {
|
||||
isUponSelected = -2;
|
||||
}
|
||||
} else if (App::mousedItem()
|
||||
&& App::mousedItem() == App::hoveredItem()
|
||||
&& _selected.cbegin()->first == App::mousedItem()->data()) {
|
||||
} else if (Element::Moused()
|
||||
&& Element::Moused() == Element::Hovered()
|
||||
&& _selected.cbegin()->first == Element::Moused()->data()) {
|
||||
uint16 selFrom = _selected.cbegin()->second.from, selTo = _selected.cbegin()->second.to;
|
||||
hasSelected = (selTo > selFrom) ? 1 : 0;
|
||||
auto mousePos = mapPointToItem(mapFromGlobal(_mousePosition), App::mousedItem());
|
||||
auto mousePos = mapPointToItem(mapFromGlobal(_mousePosition), Element::Moused());
|
||||
StateRequest request;
|
||||
request.flags |= Ui::Text::StateRequest::Flag::LookupSymbol;
|
||||
auto dragState = App::mousedItem()->textState(mousePos, request);
|
||||
auto dragState = Element::Moused()->textState(mousePos, request);
|
||||
if (dragState.cursor == CursorState::Text
|
||||
&& dragState.symbol >= selFrom
|
||||
&& dragState.symbol < selTo) {
|
||||
|
@ -2146,10 +2145,10 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
|
|||
} else { // maybe cursor on some text history item?
|
||||
const auto albumPartItem = _dragStateItem;
|
||||
const auto item = [&] {
|
||||
const auto result = App::hoveredItem()
|
||||
? App::hoveredItem()->data().get()
|
||||
: App::hoveredLinkItem()
|
||||
? App::hoveredLinkItem()->data().get()
|
||||
const auto result = Element::Hovered()
|
||||
? Element::Hovered()->data().get()
|
||||
: Element::HoveredLink()
|
||||
? Element::HoveredLink()->data().get()
|
||||
: nullptr;
|
||||
return result ? groupLeaderOrSelf(result) : nullptr;
|
||||
}();
|
||||
|
@ -2288,8 +2287,8 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
|
|||
blockSenderAsGroup(itemId);
|
||||
}, &st::menuIconBlock);
|
||||
}
|
||||
} else if (App::mousedItem()) {
|
||||
addSelectMessageAction(App::mousedItem()->data());
|
||||
} else if (Element::Moused()) {
|
||||
addSelectMessageAction(Element::Moused()->data());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2898,9 +2897,9 @@ void HistoryInner::enterEventHook(QEnterEvent *e) {
|
|||
|
||||
void HistoryInner::leaveEventHook(QEvent *e) {
|
||||
_reactionsManager->updateButton({ .cursorLeft = true });
|
||||
if (auto item = App::hoveredItem()) {
|
||||
if (auto item = Element::Hovered()) {
|
||||
repaintItem(item);
|
||||
App::hoveredItem(nullptr);
|
||||
Element::Hovered(nullptr);
|
||||
}
|
||||
ClickHandler::clearActive();
|
||||
Ui::Tooltip::Hide();
|
||||
|
@ -3230,11 +3229,11 @@ void HistoryInner::mouseActionUpdate() {
|
|||
: nullptr;
|
||||
const auto item = view ? view->data().get() : nullptr;
|
||||
if (view) {
|
||||
const auto changed = (App::mousedItem() != view);
|
||||
const auto changed = (Element::Moused() != view);
|
||||
if (changed) {
|
||||
repaintItem(App::mousedItem());
|
||||
App::mousedItem(view);
|
||||
repaintItem(App::mousedItem());
|
||||
repaintItem(Element::Moused());
|
||||
Element::Moused(view);
|
||||
repaintItem(Element::Moused());
|
||||
}
|
||||
m = mapPointToItem(point, view);
|
||||
_reactionsManager->updateButton(reactionButtonParameters(
|
||||
|
@ -3245,19 +3244,19 @@ void HistoryInner::mouseActionUpdate() {
|
|||
_reactionsManager->updateUniqueLimit(item);
|
||||
}
|
||||
if (view->pointState(m) != PointState::Outside) {
|
||||
if (App::hoveredItem() != view) {
|
||||
repaintItem(App::hoveredItem());
|
||||
App::hoveredItem(view);
|
||||
repaintItem(App::hoveredItem());
|
||||
if (Element::Hovered() != view) {
|
||||
repaintItem(Element::Hovered());
|
||||
Element::Hovered(view);
|
||||
repaintItem(Element::Hovered());
|
||||
}
|
||||
} else if (App::hoveredItem()) {
|
||||
repaintItem(App::hoveredItem());
|
||||
App::hoveredItem(nullptr);
|
||||
} else if (Element::Hovered()) {
|
||||
repaintItem(Element::Hovered());
|
||||
Element::Hovered(nullptr);
|
||||
}
|
||||
} else {
|
||||
if (App::mousedItem()) {
|
||||
repaintItem(App::mousedItem());
|
||||
App::mousedItem(nullptr);
|
||||
if (Element::Moused()) {
|
||||
repaintItem(Element::Moused());
|
||||
Element::Moused(nullptr);
|
||||
}
|
||||
_reactionsManager->updateButton({});
|
||||
}
|
||||
|
@ -3268,7 +3267,7 @@ void HistoryInner::mouseActionUpdate() {
|
|||
TextState dragState;
|
||||
ClickHandlerHost *lnkhost = nullptr;
|
||||
auto selectingText = (item == _mouseActionItem)
|
||||
&& (view == App::hoveredItem())
|
||||
&& (view == Element::Hovered())
|
||||
&& !_selected.empty()
|
||||
&& (_selected.cbegin()->second != FullSelection);
|
||||
const auto overReaction = reactionView && reactionState.link;
|
||||
|
@ -3921,19 +3920,19 @@ void HistoryInner::applyDragSelection(
|
|||
QString HistoryInner::tooltipText() const {
|
||||
if (_mouseCursorState == CursorState::Date
|
||||
&& _mouseAction == MouseAction::None) {
|
||||
if (const auto view = App::hoveredItem()) {
|
||||
if (const auto view = Element::Hovered()) {
|
||||
return HistoryView::DateTooltipText(view);
|
||||
}
|
||||
} else if (_mouseCursorState == CursorState::Forwarded
|
||||
&& _mouseAction == MouseAction::None) {
|
||||
if (const auto view = App::mousedItem()) {
|
||||
if (const auto view = Element::Moused()) {
|
||||
if (const auto forwarded = view->data()->Get<HistoryMessageForwarded>()) {
|
||||
return forwarded->text.toString();
|
||||
}
|
||||
}
|
||||
} else if (const auto lnk = ClickHandler::getActive()) {
|
||||
return lnk->tooltip();
|
||||
} else if (const auto view = App::mousedItem()) {
|
||||
} else if (const auto view = Element::Moused()) {
|
||||
StateRequest request;
|
||||
const auto local = mapFromGlobal(_mousePosition);
|
||||
const auto point = _widget->clampMousePosition(local);
|
||||
|
|
|
@ -142,7 +142,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "dialogs/dialogs_key.h"
|
||||
#include "calls/calls_instance.h"
|
||||
#include "facades.h"
|
||||
#include "app.h"
|
||||
#include "styles/style_chat.h"
|
||||
#include "styles/style_dialogs.h"
|
||||
#include "styles/style_window.h"
|
||||
|
@ -2040,7 +2039,7 @@ void HistoryWidget::showHistory(
|
|||
Assert(_list == nullptr);
|
||||
}
|
||||
|
||||
App::clearMousedItems();
|
||||
HistoryView::Element::ClearGlobal();
|
||||
|
||||
_saveEditMsgRequestId = 0;
|
||||
_replyEditMsg = nullptr;
|
||||
|
@ -3978,8 +3977,8 @@ bool HistoryWidget::insertBotCommand(const QString &cmd) {
|
|||
if (!toInsert.isEmpty() && !insertingInlineBot) {
|
||||
auto bot = _peer->isUser()
|
||||
? _peer
|
||||
: (App::hoveredLinkItem()
|
||||
? App::hoveredLinkItem()->data()->fromOriginal().get()
|
||||
: (HistoryView::Element::HoveredLink()
|
||||
? HistoryView::Element::HoveredLink()->data()->fromOriginal().get()
|
||||
: nullptr);
|
||||
if (bot && (!bot->isUser() || !bot->asUser()->isBot())) {
|
||||
bot = nullptr;
|
||||
|
|
|
@ -37,7 +37,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "data/data_media_types.h"
|
||||
#include "data/data_sponsored_messages.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "app.h"
|
||||
#include "styles/style_chat.h"
|
||||
|
||||
namespace HistoryView {
|
||||
|
@ -46,6 +45,12 @@ namespace {
|
|||
// A new message from the same sender is attached to previous within 15 minutes.
|
||||
constexpr int kAttachMessageToPreviousSecondsDelta = 900;
|
||||
|
||||
Element *HoveredElement/* = nullptr*/;
|
||||
Element *PressedElement/* = nullptr*/;
|
||||
Element *HoveredLinkElement/* = nullptr*/;
|
||||
Element *PressedLinkElement/* = nullptr*/;
|
||||
Element *MousedElement/* = nullptr*/;
|
||||
|
||||
[[nodiscard]] bool IsAttachedToPreviousInSavedMessages(
|
||||
not_null<HistoryItem*> previous,
|
||||
HistoryMessageForwarded *prevForwarded,
|
||||
|
@ -1032,7 +1037,7 @@ void Element::clickHandlerActiveChanged(
|
|||
keyboard->clickHandlerActiveChanged(handler, active);
|
||||
}
|
||||
}
|
||||
App::hoveredLinkItem(active ? this : nullptr);
|
||||
HoveredLink(active ? this : nullptr);
|
||||
repaint();
|
||||
if (const auto media = this->media()) {
|
||||
media->clickHandlerActiveChanged(handler, active);
|
||||
|
@ -1047,7 +1052,7 @@ void Element::clickHandlerPressedChanged(
|
|||
keyboard->clickHandlerPressedChanged(handler, pressed);
|
||||
}
|
||||
}
|
||||
App::pressedLinkItem(pressed ? this : nullptr);
|
||||
PressedLink(pressed ? this : nullptr);
|
||||
repaint();
|
||||
if (const auto media = this->media()) {
|
||||
media->clickHandlerPressedChanged(handler, pressed);
|
||||
|
@ -1074,4 +1079,52 @@ Element::~Element() {
|
|||
history()->owner().unregisterItemView(this);
|
||||
}
|
||||
|
||||
void Element::Hovered(Element *view) {
|
||||
HoveredElement = view;
|
||||
}
|
||||
|
||||
Element *Element::Hovered() {
|
||||
return HoveredElement;
|
||||
}
|
||||
|
||||
void Element::Pressed(Element *view) {
|
||||
PressedElement = view;
|
||||
}
|
||||
|
||||
Element *Element::Pressed() {
|
||||
return PressedElement;
|
||||
}
|
||||
|
||||
void Element::HoveredLink(Element *view) {
|
||||
HoveredLinkElement = view;
|
||||
}
|
||||
|
||||
Element *Element::HoveredLink() {
|
||||
return HoveredLinkElement;
|
||||
}
|
||||
|
||||
void Element::PressedLink(Element *view) {
|
||||
PressedLinkElement = view;
|
||||
}
|
||||
|
||||
Element *Element::PressedLink() {
|
||||
return PressedLinkElement;
|
||||
}
|
||||
|
||||
void Element::Moused(Element *view) {
|
||||
MousedElement = view;
|
||||
}
|
||||
|
||||
Element *Element::Moused() {
|
||||
return MousedElement;
|
||||
}
|
||||
|
||||
void Element::ClearGlobal() {
|
||||
HoveredElement = nullptr;
|
||||
PressedElement = nullptr;
|
||||
HoveredLinkElement = nullptr;
|
||||
PressedLinkElement = nullptr;
|
||||
MousedElement = nullptr;
|
||||
}
|
||||
|
||||
} // namespace HistoryView
|
||||
|
|
|
@ -427,6 +427,18 @@ public:
|
|||
|
||||
virtual ~Element();
|
||||
|
||||
static void Hovered(Element *view);
|
||||
[[nodiscard]] static Element *Hovered();
|
||||
static void Pressed(Element *view);
|
||||
[[nodiscard]] static Element *Pressed();
|
||||
static void HoveredLink(Element *view);
|
||||
[[nodiscard]] static Element *HoveredLink();
|
||||
static void PressedLink(Element *view);
|
||||
[[nodiscard]] static Element *PressedLink();
|
||||
static void Moused(Element *view);
|
||||
[[nodiscard]] static Element *Moused();
|
||||
static void ClearGlobal();
|
||||
|
||||
protected:
|
||||
void repaint() const;
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "main/main_session.h"
|
||||
#include "boxes/abstract_box.h"
|
||||
#include "core/application.h"
|
||||
#include "app.h" // App::quitting.
|
||||
#include "styles/style_info.h"
|
||||
#include "styles/style_window.h"
|
||||
#include "styles/style_layers.h"
|
||||
|
@ -297,7 +296,7 @@ void LayerWidget::closeHook() {
|
|||
}
|
||||
|
||||
LayerWidget::~LayerWidget() {
|
||||
if (!App::quitting()) {
|
||||
if (!Core::Quitting()) {
|
||||
restoreFloatPlayerDelegate();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,7 +41,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "window/section_widget.h"
|
||||
#include "base/platform/base_platform_info.h"
|
||||
#include "api/api_text_entities.h"
|
||||
#include "app.h"
|
||||
#include "styles/style_layers.h"
|
||||
#include "styles/style_intro.h"
|
||||
#include "base/qt/qt_common_adapters.h"
|
||||
|
@ -304,7 +303,7 @@ void Widget::checkUpdateStatus() {
|
|||
_update->toggle(!stepHasCover, anim::type::instant);
|
||||
_update->entity()->setClickedCallback([] {
|
||||
Core::checkReadyUpdate();
|
||||
App::restart();
|
||||
Core::Restart();
|
||||
});
|
||||
} else {
|
||||
if (!_update) return;
|
||||
|
|
|
@ -21,7 +21,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "ui/text/text_utilities.h"
|
||||
#include "core/file_utilities.h"
|
||||
#include "core/click_handler_types.h"
|
||||
#include "app.h"
|
||||
#include "styles/style_layers.h"
|
||||
|
||||
namespace Lang {
|
||||
|
@ -548,7 +547,7 @@ void CloudManager::performSwitchToCustom() {
|
|||
+ getValue(tr::lng_sure_save_language.base);
|
||||
const auto change = [=] {
|
||||
_langpack.switchToCustomFile(filePath);
|
||||
App::restart();
|
||||
Core::Restart();
|
||||
};
|
||||
Ui::show(
|
||||
Box<Ui::ConfirmBox>(
|
||||
|
@ -595,7 +594,7 @@ void CloudManager::restartAfterSwitch() {
|
|||
if (_langPackRequestId || _langPackBaseRequestId) {
|
||||
_restartAfterSwitch = true;
|
||||
} else {
|
||||
App::restart();
|
||||
Core::Restart();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -798,7 +798,7 @@ void MainWindow::toggleDisplayNotifyFromTray() {
|
|||
void MainWindow::closeEvent(QCloseEvent *e) {
|
||||
if (Core::Sandbox::Instance().isSavingSession()) {
|
||||
e->accept();
|
||||
App::quit();
|
||||
Core::Quit();
|
||||
} else {
|
||||
e->ignore();
|
||||
const auto hasAuth = [&] {
|
||||
|
@ -813,7 +813,7 @@ void MainWindow::closeEvent(QCloseEvent *e) {
|
|||
return false;
|
||||
}();
|
||||
if (!hasAuth || !hideNoQuit()) {
|
||||
App::quit();
|
||||
Core::Quit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "platform/platform_audio.h"
|
||||
#include "core/application.h"
|
||||
#include "main/main_session.h"
|
||||
#include "app.h"
|
||||
|
||||
#include <al.h>
|
||||
#include <alc.h>
|
||||
|
@ -244,7 +243,7 @@ bool AttachToDevice() {
|
|||
}
|
||||
|
||||
crl::on_main([] {
|
||||
if (!App::quitting()) {
|
||||
if (!Core::Quitting()) {
|
||||
Current().reattachTracks();
|
||||
}
|
||||
});
|
||||
|
@ -253,7 +252,7 @@ bool AttachToDevice() {
|
|||
|
||||
void ScheduleDetachFromDeviceSafe() {
|
||||
crl::on_main([] {
|
||||
if (!App::quitting()) {
|
||||
if (!Core::Quitting()) {
|
||||
Current().scheduleDetachFromDevice();
|
||||
}
|
||||
});
|
||||
|
@ -261,7 +260,7 @@ void ScheduleDetachFromDeviceSafe() {
|
|||
|
||||
void ScheduleDetachIfNotUsedSafe() {
|
||||
crl::on_main([] {
|
||||
if (!App::quitting()) {
|
||||
if (!Core::Quitting()) {
|
||||
Current().scheduleDetachIfNotUsed();
|
||||
}
|
||||
});
|
||||
|
@ -269,7 +268,7 @@ void ScheduleDetachIfNotUsedSafe() {
|
|||
|
||||
void StopDetachIfNotUsedSafe() {
|
||||
crl::on_main([] {
|
||||
if (!App::quitting()) {
|
||||
if (!Core::Quitting()) {
|
||||
Current().stopDetachIfNotUsed();
|
||||
}
|
||||
});
|
||||
|
|
|
@ -35,6 +35,8 @@ public:
|
|||
|
||||
void psShowTrayMenu();
|
||||
|
||||
bool preventsQuit(Core::QuitReason reason) override;
|
||||
|
||||
class Private;
|
||||
|
||||
public Q_SLOTS:
|
||||
|
|
|
@ -29,6 +29,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "platform/platform_specific.h"
|
||||
#include "platform/platform_notifications_manager.h"
|
||||
#include "base/platform/base_platform_info.h"
|
||||
#include "base/platform/mac/base_confirm_quit.h"
|
||||
#include "boxes/peer_list_controllers.h"
|
||||
#include "boxes/about_box.h"
|
||||
#include "lang/lang_keys.h"
|
||||
|
@ -284,6 +285,15 @@ void MainWindow::hideAndDeactivate() {
|
|||
void MainWindow::psShowTrayMenu() {
|
||||
}
|
||||
|
||||
bool MainWindow::preventsQuit(Core::QuitReason reason) {
|
||||
// Thanks Chromium, see
|
||||
// chromium.org/developers/design-documents/confirm-to-quit-experiment
|
||||
return (reason == Core::QuitReason::QtQuitEvent)
|
||||
&& ([[NSApp currentEvent] type] == NSKeyDown)
|
||||
&& !Platform::ConfirmQuit::RunModal(
|
||||
tr::lng_mac_hold_to_quit(tr::now, lt_text, "{key}"));
|
||||
}
|
||||
|
||||
void MainWindow::psTrayMenuUpdated() {
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "platform/platform_specific.h"
|
||||
#include "core/application.h"
|
||||
#include "core/sandbox.h"
|
||||
#include "app.h"
|
||||
|
||||
#include <QtCore/QCoreApplication>
|
||||
#include <QtCore/QAbstractNativeEventFilter>
|
||||
|
@ -66,7 +65,7 @@ bool WindowsIntegration::processEvent(
|
|||
LRESULT *result) {
|
||||
switch (msg) {
|
||||
case WM_ENDSESSION:
|
||||
App::quit();
|
||||
Core::Quit();
|
||||
break;
|
||||
|
||||
case WM_TIMECHANGE:
|
||||
|
|
|
@ -282,7 +282,7 @@ void MainWindow::psShowTrayMenu() {
|
|||
}
|
||||
|
||||
void MainWindow::destroyedFromSystem() {
|
||||
App::quit();
|
||||
Core::Quit();
|
||||
}
|
||||
|
||||
int32 MainWindow::screenNameChecksum(const QString &name) const {
|
||||
|
|
|
@ -36,7 +36,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "main/main_domain.h"
|
||||
#include "main/main_session.h"
|
||||
#include "mtproto/facade.h"
|
||||
#include "app.h"
|
||||
#include "styles/style_settings.h"
|
||||
|
||||
#ifndef TDESKTOP_DISABLE_SPELLCHECK
|
||||
|
@ -243,7 +242,7 @@ void SetupUpdate(not_null<Ui::VerticalLayout*> container) {
|
|||
if (!Core::UpdaterDisabled()) {
|
||||
Core::checkReadyUpdate();
|
||||
}
|
||||
App::restart();
|
||||
Core::Restart();
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -599,7 +598,7 @@ void SetupANGLE(
|
|||
Core::App().settings().setDisableOpenGL(nowDisabled);
|
||||
Local::writeSettings();
|
||||
}
|
||||
App::restart();
|
||||
Core::Restart();
|
||||
});
|
||||
controller->show(Box<Ui::ConfirmBox>(
|
||||
tr::lng_settings_need_restart(tr::now),
|
||||
|
@ -638,7 +637,7 @@ void SetupOpenGL(
|
|||
const auto confirmed = crl::guard(button, [=] {
|
||||
Core::App().settings().setDisableOpenGL(!enabled);
|
||||
Local::writeSettings();
|
||||
App::restart();
|
||||
Core::Restart();
|
||||
});
|
||||
const auto cancelled = crl::guard(button, [=] {
|
||||
toggles->fire(!enabled);
|
||||
|
|
|
@ -35,7 +35,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "webrtc/webrtc_create_adm.h" // Webrtc::Backend.
|
||||
#include "tgcalls/VideoCaptureInterface.h"
|
||||
#include "facades.h"
|
||||
#include "app.h" // App::restart().
|
||||
#include "styles/style_layers.h"
|
||||
|
||||
namespace Settings {
|
||||
|
@ -453,7 +452,7 @@ object_ptr<Ui::GenericBox> ChooseAudioInputBox(
|
|||
// Core::App().settings().setCallAudioBackend(
|
||||
// static_cast<Webrtc::Backend>(option));
|
||||
// Core::App().saveSettings();
|
||||
// App::restart();
|
||||
// Core::Restart();
|
||||
// };
|
||||
// return Box([=](not_null<Ui::GenericBox*> box) {
|
||||
// SingleChoiceBox(box, {
|
||||
|
|
|
@ -25,9 +25,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "ui/painter.h"
|
||||
#include "ui/filter_icons.h"
|
||||
#include "settings/settings_common.h"
|
||||
#include "core/application.h"
|
||||
#include "lang/lang_keys.h"
|
||||
#include "apiwrap.h"
|
||||
#include "app.h"
|
||||
#include "styles/style_settings.h"
|
||||
#include "styles/style_layers.h"
|
||||
#include "styles/style_boxes.h"
|
||||
|
@ -575,7 +575,7 @@ Folders::Folders(
|
|||
}
|
||||
|
||||
Folders::~Folders() {
|
||||
if (!App::quitting()) {
|
||||
if (!Core::Quitting()) {
|
||||
_save();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,9 +37,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "window/window_controller.h"
|
||||
#include "window/window_session_controller.h"
|
||||
#include "core/click_handler_types.h"
|
||||
#include "core/application.h"
|
||||
#include "base/call_delayed.h"
|
||||
#include "facades.h"
|
||||
#include "app.h"
|
||||
#include "styles/style_settings.h"
|
||||
#include "base/platform/base_platform_info.h"
|
||||
|
||||
|
@ -230,7 +230,7 @@ void SetupInterfaceScale(
|
|||
const auto confirmed = crl::guard(button, [=] {
|
||||
cSetConfigScale(scale);
|
||||
Local::writeSettings();
|
||||
App::restart();
|
||||
Core::Restart();
|
||||
});
|
||||
const auto cancelled = crl::guard(button, [=] {
|
||||
base::call_delayed(
|
||||
|
|
|
@ -32,7 +32,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "mainwindow.h"
|
||||
#include "mainwidget.h" // session->content()->windowShown().
|
||||
#include "facades.h"
|
||||
#include "app.h"
|
||||
#include "styles/style_widgets.h"
|
||||
#include "styles/style_window.h"
|
||||
|
||||
|
@ -362,7 +361,7 @@ Window::SessionController *MainWindow::sessionController() const {
|
|||
}
|
||||
|
||||
bool MainWindow::hideNoQuit() {
|
||||
if (App::quitting()) {
|
||||
if (Core::Quitting()) {
|
||||
return false;
|
||||
}
|
||||
const auto workMode = Core::App().settings().workMode();
|
||||
|
@ -516,7 +515,7 @@ void MainWindow::showFromTray() {
|
|||
}
|
||||
|
||||
void MainWindow::quitFromTray() {
|
||||
App::quit();
|
||||
Core::Quit();
|
||||
}
|
||||
|
||||
void MainWindow::activate() {
|
||||
|
@ -804,7 +803,7 @@ void MainWindow::updateControlsGeometry() {
|
|||
}
|
||||
|
||||
void MainWindow::updateUnreadCounter() {
|
||||
if (App::quitting()) {
|
||||
if (Core::Quitting()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -894,7 +893,9 @@ void MainWindow::savePosition(Qt::WindowState state) {
|
|||
}
|
||||
|
||||
bool MainWindow::minimizeToTray() {
|
||||
if (App::quitting() || !hasTrayIcon()) return false;
|
||||
if (Core::Quitting() || !hasTrayIcon()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
closeWithoutDestroy();
|
||||
controller().updateIsActiveBlur();
|
||||
|
|
|
@ -27,6 +27,7 @@ class PlainShadow;
|
|||
|
||||
namespace Core {
|
||||
struct WindowPosition;
|
||||
enum class QuitReason;
|
||||
} // namespace Core
|
||||
|
||||
namespace Window {
|
||||
|
@ -137,6 +138,10 @@ public:
|
|||
updateGlobalMenuHook();
|
||||
}
|
||||
|
||||
[[nodiscard]] virtual bool preventsQuit(Core::QuitReason reason) {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected:
|
||||
void leaveEventHook(QEvent *e) override;
|
||||
|
||||
|
|
|
@ -32,7 +32,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "main/main_domain.h"
|
||||
#include "ui/text/text_utilities.h"
|
||||
#include "facades.h"
|
||||
#include "app.h"
|
||||
|
||||
#include <QtGui/QWindow>
|
||||
|
||||
|
@ -174,7 +173,7 @@ System::SkipState System::computeSkipState(
|
|||
bool showForMuted) const {
|
||||
const auto history = item->history();
|
||||
const auto notifyBy = item->specialNotificationPeer();
|
||||
if (App::quitting()) {
|
||||
if (Core::Quitting()) {
|
||||
return { SkipState::Skip };
|
||||
} else if (!Core::App().settings().notifyFromAll()
|
||||
&& &history->session().account() != &Core::App().domain().active()) {
|
||||
|
@ -432,7 +431,7 @@ void System::showGrouped() {
|
|||
void System::showNext() {
|
||||
Expects(_manager != nullptr);
|
||||
|
||||
if (App::quitting()) {
|
||||
if (Core::Quitting()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
#include "data/data_user.h"
|
||||
#include "data/data_changes.h"
|
||||
#include "mainwidget.h"
|
||||
#include "app.h"
|
||||
#include "styles/style_window.h"
|
||||
#include "styles/style_widgets.h"
|
||||
#include "styles/style_dialogs.h"
|
||||
|
@ -1214,7 +1213,7 @@ void MainMenu::initResetScaleButton() {
|
|||
_resetScaleButton->addClickHandler([] {
|
||||
cSetConfigScale(style::kScaleDefault);
|
||||
Local::writeSettings();
|
||||
App::restart();
|
||||
Core::Restart();
|
||||
});
|
||||
_resetScaleButton->show();
|
||||
updateControlsGeometry();
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit 136d2eb5bc0e26774bcf2611e0a4ac46dfb73388
|
||||
Subproject commit fdd2714a2ae0a42ff1ee06c4ae6815a3fd575a2e
|
Loading…
Add table
Reference in a new issue