2014-05-30 12:53:19 +04:00
|
|
|
/*
|
|
|
|
This file is part of Telegram Desktop,
|
2018-01-03 13:23:14 +03:00
|
|
|
the official desktop application for the Telegram messaging service.
|
2014-05-30 12:53:19 +04:00
|
|
|
|
2018-01-03 13:23:14 +03:00
|
|
|
For license and copyright information please follow this link:
|
|
|
|
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
2014-05-30 12:53:19 +04:00
|
|
|
*/
|
2016-01-30 19:31:10 +03:00
|
|
|
#pragma once
|
2014-05-30 12:53:19 +04:00
|
|
|
|
2016-06-16 15:59:54 +03:00
|
|
|
#include "platform/platform_main_window.h"
|
2019-09-18 14:19:05 +03:00
|
|
|
#include "ui/layers/layer_widget.h"
|
2014-05-30 12:53:19 +04:00
|
|
|
|
|
|
|
class MainWidget;
|
2016-10-02 12:30:28 +03:00
|
|
|
|
2016-11-24 22:28:23 +03:00
|
|
|
namespace Intro {
|
|
|
|
class Widget;
|
2020-06-23 18:55:08 +04:00
|
|
|
enum class EnterPoint : uchar;
|
2016-11-24 22:28:23 +03:00
|
|
|
} // namespace Intro
|
|
|
|
|
2016-11-02 17:44:33 +03:00
|
|
|
namespace Window {
|
2019-09-13 09:06:02 +03:00
|
|
|
class MediaPreviewWidget;
|
2017-10-03 14:05:58 +01:00
|
|
|
class SectionMemento;
|
|
|
|
struct SectionShow;
|
2018-06-03 16:30:40 +03:00
|
|
|
class PasscodeLockWidget;
|
2016-11-02 17:44:33 +03:00
|
|
|
namespace Theme {
|
|
|
|
struct BackgroundUpdate;
|
|
|
|
class WarningWidget;
|
|
|
|
} // namespace Theme
|
|
|
|
} // namespace Window
|
|
|
|
|
2016-11-11 16:46:04 +03:00
|
|
|
namespace Ui {
|
|
|
|
class LinkButton;
|
2019-09-18 14:19:05 +03:00
|
|
|
class BoxContent;
|
|
|
|
class LayerStackWidget;
|
2016-11-11 16:46:04 +03:00
|
|
|
} // namespace Ui
|
|
|
|
|
2016-04-10 22:18:26 +04:00
|
|
|
class MediaPreviewWidget;
|
2016-02-17 19:37:21 +03:00
|
|
|
|
2023-01-10 16:23:47 +04:00
|
|
|
extern const char kOptionAutoScrollInactiveChat[];
|
|
|
|
|
2016-11-04 14:14:47 +03:00
|
|
|
class MainWindow : public Platform::MainWindow {
|
2014-05-30 12:53:19 +04:00
|
|
|
public:
|
2019-06-06 14:20:21 +03:00
|
|
|
explicit MainWindow(not_null<Window::Controller*> controller);
|
2016-04-13 00:31:28 +03:00
|
|
|
~MainWindow();
|
2014-05-30 12:53:19 +04:00
|
|
|
|
2020-02-12 12:09:17 +04:00
|
|
|
void finishFirstShow();
|
2014-05-30 12:53:19 +04:00
|
|
|
|
2020-12-13 16:08:16 +03:00
|
|
|
void preventOrInvoke(Fn<void()> callback);
|
|
|
|
|
2018-06-03 16:30:40 +03:00
|
|
|
void setupPasscodeLock();
|
|
|
|
void clearPasscodeLock();
|
2022-12-01 14:14:35 +04:00
|
|
|
void setupIntro(Intro::EnterPoint point, QPixmap oldContentCache);
|
|
|
|
void setupMain(MsgId singlePeerShowAtMsgId, QPixmap oldContentCache);
|
2014-05-30 12:53:19 +04:00
|
|
|
|
2021-01-22 16:16:18 +04:00
|
|
|
void showSettings();
|
|
|
|
|
2021-02-25 19:12:51 +04:00
|
|
|
void setInnerFocus() override;
|
2021-01-22 16:16:18 +04:00
|
|
|
|
2020-06-10 22:08:17 +04:00
|
|
|
MainWidget *sessionContent() const;
|
2014-05-30 12:53:19 +04:00
|
|
|
|
2023-03-21 16:22:38 +04:00
|
|
|
void checkActivation() override;
|
2022-11-02 20:03:42 +04:00
|
|
|
[[nodiscard]] bool markingAsRead() const;
|
2014-05-30 12:53:19 +04:00
|
|
|
|
2017-09-19 13:32:34 +03:00
|
|
|
bool takeThirdSectionFromLayer();
|
2014-05-30 12:53:19 +04:00
|
|
|
|
2014-07-18 14:37:34 +04:00
|
|
|
void sendPaths();
|
|
|
|
|
2022-11-30 16:55:51 +04:00
|
|
|
[[nodiscard]] bool contentOverlapped(const QRect &globalRect);
|
|
|
|
[[nodiscard]] bool contentOverlapped(QWidget *w, QPaintEvent *e) {
|
|
|
|
return contentOverlapped(
|
|
|
|
QRect(w->mapToGlobal(e->rect().topLeft()), e->rect().size()));
|
2015-10-01 17:05:05 +03:00
|
|
|
}
|
2022-11-30 16:55:51 +04:00
|
|
|
[[nodiscard]] bool contentOverlapped(QWidget *w, const QRegion &r) {
|
|
|
|
return contentOverlapped(QRect(
|
|
|
|
w->mapToGlobal(r.boundingRect().topLeft()),
|
|
|
|
r.boundingRect().size()));
|
2015-10-01 17:05:05 +03:00
|
|
|
}
|
|
|
|
|
2016-11-11 22:51:59 +03:00
|
|
|
void showMainMenu();
|
2020-07-07 17:54:39 +04:00
|
|
|
void fixOrder() override;
|
2016-11-11 22:51:59 +03:00
|
|
|
|
2022-12-01 14:14:35 +04:00
|
|
|
[[nodiscard]] QPixmap grabForSlideAnimation();
|
|
|
|
|
2023-05-24 21:20:18 +04:00
|
|
|
void showOrHideBoxOrLayer(
|
|
|
|
std::variant<
|
|
|
|
v::null_t,
|
|
|
|
object_ptr<Ui::BoxContent>,
|
|
|
|
std::unique_ptr<Ui::LayerWidget>> &&layer,
|
2021-02-17 08:48:39 +03:00
|
|
|
Ui::LayerOptions options,
|
|
|
|
anim::type animated);
|
2017-09-15 20:34:41 +03:00
|
|
|
void showSpecialLayer(
|
2019-09-18 14:19:05 +03:00
|
|
|
object_ptr<Ui::LayerWidget> layer,
|
2017-09-20 13:23:57 +03:00
|
|
|
anim::type animated);
|
2017-10-03 14:05:58 +01:00
|
|
|
bool showSectionInExistingLayer(
|
|
|
|
not_null<Window::SectionMemento*> memento,
|
|
|
|
const Window::SectionShow ¶ms);
|
2017-09-20 13:23:57 +03:00
|
|
|
void ui_hideSettingsAndLayer(anim::type animated);
|
2018-09-06 17:58:43 +03:00
|
|
|
void ui_removeLayerBlackout();
|
2022-11-02 20:03:42 +04:00
|
|
|
[[nodiscard]] bool ui_isLayerShown() const;
|
2020-04-10 17:18:51 +04:00
|
|
|
bool showMediaPreview(
|
2018-07-14 00:25:47 +03:00
|
|
|
Data::FileOrigin origin,
|
|
|
|
not_null<DocumentData*> document);
|
2020-04-10 17:18:51 +04:00
|
|
|
bool showMediaPreview(
|
2018-07-14 00:25:47 +03:00
|
|
|
Data::FileOrigin origin,
|
|
|
|
not_null<PhotoData*> photo);
|
2019-06-29 13:29:04 +03:00
|
|
|
void hideMediaPreview();
|
2015-12-22 11:01:02 +03:00
|
|
|
|
2020-03-03 16:07:22 +04:00
|
|
|
void updateControlsGeometry() override;
|
|
|
|
|
2016-11-04 11:23:50 +03:00
|
|
|
protected:
|
|
|
|
bool eventFilter(QObject *o, QEvent *e) override;
|
|
|
|
void closeEvent(QCloseEvent *e) override;
|
|
|
|
|
2016-11-07 18:24:28 +03:00
|
|
|
void initHook() override;
|
2017-01-01 20:45:20 +04:00
|
|
|
void clearWidgetsHook() override;
|
2016-11-07 18:24:28 +03:00
|
|
|
|
2014-05-30 12:53:19 +04:00
|
|
|
private:
|
2020-02-12 12:09:17 +04:00
|
|
|
void applyInitialWorkMode();
|
2017-04-06 22:14:12 +03:00
|
|
|
void ensureLayerCreated();
|
2018-11-23 15:05:06 +04:00
|
|
|
void destroyLayer();
|
2017-04-06 22:14:12 +03:00
|
|
|
|
2016-11-02 17:44:33 +03:00
|
|
|
void themeUpdated(const Window::Theme::BackgroundUpdate &data);
|
|
|
|
|
2020-02-19 20:54:19 +04:00
|
|
|
QPoint _lastMousePosition;
|
2014-12-12 19:27:03 +03:00
|
|
|
|
2018-06-03 16:30:40 +03:00
|
|
|
object_ptr<Window::PasscodeLockWidget> _passcodeLock = { nullptr };
|
2016-12-13 20:07:56 +03:00
|
|
|
object_ptr<Intro::Widget> _intro = { nullptr };
|
|
|
|
object_ptr<MainWidget> _main = { nullptr };
|
2019-09-18 14:19:05 +03:00
|
|
|
base::unique_qptr<Ui::LayerStackWidget> _layer;
|
2019-09-13 09:06:02 +03:00
|
|
|
object_ptr<Window::MediaPreviewWidget> _mediaPreview = { nullptr };
|
2014-05-30 12:53:19 +04:00
|
|
|
|
2016-12-13 20:07:56 +03:00
|
|
|
object_ptr<Window::Theme::WarningWidget> _testingThemeWarning = { nullptr };
|
2014-05-30 12:53:19 +04:00
|
|
|
|
|
|
|
};
|