/* 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 #include "platform/platform_main_window.h" #include "base/unique_qptr.h" #include "ui/layers/layer_widget.h" #include "ui/effects/animation_value.h" class MainWidget; namespace Intro { class Widget; enum class EnterPoint : uchar; } // namespace Intro namespace Media { class SystemMediaControlsManager; } // namespace Media namespace Window { class MediaPreviewWidget; class SectionMemento; struct SectionShow; class PasscodeLockWidget; namespace Theme { struct BackgroundUpdate; class WarningWidget; } // namespace Theme } // namespace Window namespace Ui { class LinkButton; class BoxContent; class LayerStackWidget; } // namespace Ui class MediaPreviewWidget; class MainWindow : public Platform::MainWindow { public: explicit MainWindow(not_null controller); ~MainWindow(); void finishFirstShow(); void preventOrInvoke(Fn callback); void setupPasscodeLock(); void clearPasscodeLock(); void setupIntro(Intro::EnterPoint point); void setupMain(); void showSettings(); void setInnerFocus() override; MainWidget *sessionContent() const; [[nodiscard]] bool doWeMarkAsRead(); bool takeThirdSectionFromLayer(); void checkHistoryActivation(); void sendPaths(); QImage iconWithCounter(int size, int count, style::color bg, style::color fg, bool smallIcon) override; void placeSmallCounter(QImage &img, int size, int count, style::color bg, const QPoint &shift, style::color color) override; bool contentOverlapped(const QRect &globalRect); bool contentOverlapped(QWidget *w, QPaintEvent *e) { return contentOverlapped(QRect(w->mapToGlobal(e->rect().topLeft()), e->rect().size())); } bool contentOverlapped(QWidget *w, const QRegion &r) { return contentOverlapped(QRect(w->mapToGlobal(r.boundingRect().topLeft()), r.boundingRect().size())); } void showMainMenu(); void updateTrayMenu() override; void fixOrder() override; void showSpecialLayer( object_ptr layer, anim::type animated); bool showSectionInExistingLayer( not_null memento, const Window::SectionShow ¶ms); void ui_showBox( object_ptr box, Ui::LayerOptions options, anim::type animated); void ui_hideSettingsAndLayer(anim::type animated); void ui_removeLayerBlackout(); bool ui_isLayerShown(); bool showMediaPreview( Data::FileOrigin origin, not_null document); bool showMediaPreview( Data::FileOrigin origin, not_null photo); void hideMediaPreview(); void updateControlsGeometry() override; protected: bool eventFilter(QObject *o, QEvent *e) override; void closeEvent(QCloseEvent *e) override; void initHook() override; void activeChangedHook() override; void clearWidgetsHook() override; private: [[nodiscard]] bool skipTrayClick() const; void createTrayIconMenu(); void handleTrayIconActication( QSystemTrayIcon::ActivationReason reason) override; void applyInitialWorkMode(); void ensureLayerCreated(); void destroyLayer(); void themeUpdated(const Window::Theme::BackgroundUpdate &data); void toggleDisplayNotifyFromTray(); QPixmap grabInner(); std::unique_ptr _mediaControlsManager; QImage icon16, icon32, icon64, iconbig16, iconbig32, iconbig64; crl::time _lastTrayClickTime = 0; QPoint _lastMousePosition; bool _activeForTrayIconAction = true; object_ptr _passcodeLock = { nullptr }; object_ptr _intro = { nullptr }; object_ptr _main = { nullptr }; base::unique_qptr _layer; object_ptr _mediaPreview = { nullptr }; object_ptr _testingThemeWarning = { nullptr }; }; namespace App { MainWindow *wnd(); } // namespace App