2019-06-06 11:20:21 +00:00
|
|
|
/*
|
|
|
|
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 "mainwindow.h"
|
2019-09-18 11:19:05 +00:00
|
|
|
#include "ui/layers/layer_widget.h"
|
2019-06-06 11:20:21 +00:00
|
|
|
|
|
|
|
namespace Main {
|
|
|
|
class Account;
|
|
|
|
} // namespace Main
|
|
|
|
|
|
|
|
namespace Window {
|
|
|
|
|
|
|
|
class Controller final {
|
|
|
|
public:
|
2020-06-15 16:25:02 +00:00
|
|
|
Controller();
|
2019-06-06 11:20:21 +00:00
|
|
|
~Controller();
|
|
|
|
|
|
|
|
Controller(const Controller &other) = delete;
|
|
|
|
Controller &operator=(const Controller &other) = delete;
|
|
|
|
|
2020-06-15 16:25:02 +00:00
|
|
|
void showAccount(not_null<Main::Account*> account);
|
|
|
|
|
2020-06-24 07:56:16 +00:00
|
|
|
[[nodiscard]] not_null<::MainWindow*> widget() {
|
2019-06-06 11:20:21 +00:00
|
|
|
return &_widget;
|
|
|
|
}
|
2020-06-24 07:56:16 +00:00
|
|
|
[[nodiscard]] Main::Account &account() const {
|
2020-06-15 16:25:02 +00:00
|
|
|
Expects(_account != nullptr);
|
|
|
|
|
|
|
|
return *_account;
|
|
|
|
}
|
2020-06-24 07:56:16 +00:00
|
|
|
[[nodiscard]] SessionController *sessionController() const {
|
2019-06-06 11:20:21 +00:00
|
|
|
return _sessionController.get();
|
|
|
|
}
|
2020-06-24 07:56:16 +00:00
|
|
|
[[nodiscard]] bool locked() const;
|
2019-06-06 11:20:21 +00:00
|
|
|
|
2020-02-12 08:09:17 +00:00
|
|
|
void finishFirstShow();
|
2019-06-06 11:20:21 +00:00
|
|
|
|
|
|
|
void setupPasscodeLock();
|
|
|
|
void clearPasscodeLock();
|
|
|
|
void setupIntro();
|
|
|
|
void setupMain();
|
|
|
|
|
|
|
|
void showSettings();
|
|
|
|
|
2020-07-07 13:54:39 +00:00
|
|
|
[[nodiscard]] int verticalShadowTop() const;
|
|
|
|
|
2019-06-10 14:58:45 +00:00
|
|
|
template <typename BoxType>
|
|
|
|
QPointer<BoxType> show(
|
|
|
|
object_ptr<BoxType> content,
|
2019-09-18 11:19:05 +00:00
|
|
|
Ui::LayerOptions options = Ui::LayerOption::KeepOther,
|
2019-06-10 14:58:45 +00:00
|
|
|
anim::type animated = anim::type::normal) {
|
|
|
|
const auto result = QPointer<BoxType>(content.data());
|
|
|
|
showBox(std::move(content), options, animated);
|
|
|
|
return result;
|
|
|
|
}
|
2020-03-13 06:56:03 +00:00
|
|
|
void showToast(const QString &text);
|
2019-06-10 14:58:45 +00:00
|
|
|
|
2019-09-03 08:25:19 +00:00
|
|
|
void showRightColumn(object_ptr<TWidget> widget);
|
2020-03-03 12:07:22 +00:00
|
|
|
void sideBarChanged();
|
2019-09-03 08:25:19 +00:00
|
|
|
|
2019-06-06 11:20:21 +00:00
|
|
|
void activate();
|
|
|
|
void reActivate();
|
2020-06-17 09:36:25 +00:00
|
|
|
void updateIsActiveFocus();
|
|
|
|
void updateIsActiveBlur();
|
|
|
|
void updateIsActive();
|
2019-06-06 11:20:21 +00:00
|
|
|
void minimize();
|
|
|
|
void close();
|
|
|
|
|
|
|
|
QPoint getPointForCallPanelCenter() const;
|
|
|
|
|
|
|
|
private:
|
2019-06-10 14:58:45 +00:00
|
|
|
void showBox(
|
2019-09-18 11:19:05 +00:00
|
|
|
object_ptr<Ui::BoxContent> content,
|
|
|
|
Ui::LayerOptions options,
|
2019-06-10 14:58:45 +00:00
|
|
|
anim::type animated);
|
2019-09-02 16:10:18 +00:00
|
|
|
void checkThemeEditor();
|
2020-06-24 07:56:16 +00:00
|
|
|
void checkLockByTerms();
|
|
|
|
void showTermsDecline();
|
|
|
|
void showTermsDelete();
|
2019-06-10 14:58:45 +00:00
|
|
|
|
2020-06-15 16:25:02 +00:00
|
|
|
Main::Account *_account = nullptr;
|
2019-06-22 09:52:18 +00:00
|
|
|
::MainWindow _widget;
|
2019-08-16 12:44:20 +00:00
|
|
|
std::unique_ptr<SessionController> _sessionController;
|
2020-06-17 09:36:25 +00:00
|
|
|
base::Timer _isActiveTimer;
|
2020-06-24 07:56:16 +00:00
|
|
|
QPointer<Ui::BoxContent> _termsBox;
|
2019-06-06 11:20:21 +00:00
|
|
|
|
2020-06-15 16:25:02 +00:00
|
|
|
rpl::lifetime _accountLifetime;
|
2019-06-06 11:20:21 +00:00
|
|
|
rpl::lifetime _lifetime;
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Window
|