mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 06:26:18 +00:00
ClickHandler, TopBarWidget and Overview layouts moved to separate files.
Xcode and QtCreator builds are currently broken.
This commit is contained in:
@@ -20,12 +20,11 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||
*/
|
||||
#include "stdafx.h"
|
||||
|
||||
#include "window.h"
|
||||
#include "mainwindow.h"
|
||||
#include "mainwidget.h"
|
||||
#include "application.h"
|
||||
|
||||
#include "core/click_handler_types.h"
|
||||
#include "boxes/confirmbox.h"
|
||||
|
||||
#include "layerwidget.h"
|
||||
#include "lang.h"
|
||||
|
||||
@@ -136,13 +135,13 @@ void removeDialog(History *history) {
|
||||
}
|
||||
|
||||
void showSettings() {
|
||||
if (Window *w = wnd()) {
|
||||
if (auto w = wnd()) {
|
||||
w->showSettings();
|
||||
}
|
||||
}
|
||||
|
||||
void activateClickHandler(ClickHandlerPtr handler, Qt::MouseButton button) {
|
||||
if (Window *w = wnd()) {
|
||||
if (auto w = wnd()) {
|
||||
qRegisterMetaType<ClickHandlerPtr>();
|
||||
qRegisterMetaType<Qt::MouseButton>();
|
||||
QMetaObject::invokeMethod(w, "app_activateClickHandler", Qt::QueuedConnection, Q_ARG(ClickHandlerPtr, handler), Q_ARG(Qt::MouseButton, button));
|
||||
@@ -150,7 +149,7 @@ void activateClickHandler(ClickHandlerPtr handler, Qt::MouseButton button) {
|
||||
}
|
||||
|
||||
void logOutDelayed() {
|
||||
if (Window *w = App::wnd()) {
|
||||
if (auto w = App::wnd()) {
|
||||
QMetaObject::invokeMethod(w, "onLogoutSure", Qt::QueuedConnection);
|
||||
}
|
||||
}
|
||||
@@ -160,25 +159,25 @@ void logOutDelayed() {
|
||||
namespace Ui {
|
||||
|
||||
void showMediaPreview(DocumentData *document) {
|
||||
if (Window *w = App::wnd()) {
|
||||
if (auto w = App::wnd()) {
|
||||
w->ui_showMediaPreview(document);
|
||||
}
|
||||
}
|
||||
|
||||
void showMediaPreview(PhotoData *photo) {
|
||||
if (Window *w = App::wnd()) {
|
||||
if (auto w = App::wnd()) {
|
||||
w->ui_showMediaPreview(photo);
|
||||
}
|
||||
}
|
||||
|
||||
void hideMediaPreview() {
|
||||
if (Window *w = App::wnd()) {
|
||||
if (auto w = App::wnd()) {
|
||||
w->ui_hideMediaPreview();
|
||||
}
|
||||
}
|
||||
|
||||
void showLayer(LayeredWidget *box, ShowLayerOptions options) {
|
||||
if (Window *w = App::wnd()) {
|
||||
if (auto w = App::wnd()) {
|
||||
w->ui_showLayer(box, options);
|
||||
} else {
|
||||
delete box;
|
||||
@@ -186,16 +185,16 @@ void showLayer(LayeredWidget *box, ShowLayerOptions options) {
|
||||
}
|
||||
|
||||
void hideLayer(bool fast) {
|
||||
if (Window *w = App::wnd()) w->ui_showLayer(0, ShowLayerOptions(CloseOtherLayers) | (fast ? ForceFastShowLayer : AnimatedShowLayer));
|
||||
if (auto w = App::wnd()) w->ui_showLayer(0, ShowLayerOptions(CloseOtherLayers) | (fast ? ForceFastShowLayer : AnimatedShowLayer));
|
||||
}
|
||||
|
||||
bool isLayerShown() {
|
||||
if (Window *w = App::wnd()) return w->ui_isLayerShown();
|
||||
if (auto w = App::wnd()) return w->ui_isLayerShown();
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isMediaViewShown() {
|
||||
if (Window *w = App::wnd()) return w->ui_isMediaViewShown();
|
||||
if (auto w = App::wnd()) return w->ui_isMediaViewShown();
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -236,7 +235,7 @@ void showPeerHistoryAsync(const PeerId &peer, MsgId msgId) {
|
||||
}
|
||||
|
||||
PeerData *getPeerForMouseAction() {
|
||||
if (Window *w = App::wnd()) {
|
||||
if (auto w = App::wnd()) {
|
||||
return w->ui_getPeerForMouseAction();
|
||||
}
|
||||
return nullptr;
|
||||
@@ -244,7 +243,7 @@ PeerData *getPeerForMouseAction() {
|
||||
|
||||
bool hideWindowNoQuit() {
|
||||
if (!App::quitting()) {
|
||||
if (Window *w = App::wnd()) {
|
||||
if (auto w = App::wnd()) {
|
||||
if (cWorkMode() == dbiwmTrayOnly || cWorkMode() == dbiwmWindowAndTray) {
|
||||
return w->minimizeToTray();
|
||||
} else if (cPlatform() == dbipMac || cPlatform() == dbipMacOld) {
|
||||
|
Reference in New Issue
Block a user