2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Use Window::Controller to manage MainWindow.

This commit is contained in:
John Preston
2019-06-06 14:20:21 +03:00
parent a547f80ae9
commit dd68c7e90d
18 changed files with 229 additions and 61 deletions

View File

@@ -15,6 +15,7 @@ class BoxContent;
namespace Window {
class Controller;
class SessionController;
class TitleWidget;
struct TermsLock;
@@ -28,11 +29,12 @@ class MainWindow : public Ui::RpWidget, protected base::Subscriber {
Q_OBJECT
public:
MainWindow();
explicit MainWindow(not_null<Controller*> controller);
Window::SessionController *sessionController() const {
return _controller.get();
not_null<Window::Controller*> controller() const {
return _controller;
}
Window::SessionController *sessionController() const;
void setInactivePress(bool inactive);
bool wasInactivePress() const {
return _wasInactivePress;
@@ -83,6 +85,8 @@ public:
rpl::producer<> leaveEvents() const;
virtual void updateWindowIcon();
public slots:
bool minimizeToTray();
void updateGlobalMenu() {
@@ -110,8 +114,6 @@ protected:
virtual void clearWidgetsHook() {
}
virtual void updateWindowIcon();
virtual void stateChangedHook(Qt::WindowState state) {
}
@@ -159,10 +161,11 @@ private:
int computeMinHeight() const;
not_null<Window::Controller*> _controller;
base::Timer _positionUpdatedTimer;
bool _positionInited = false;
std::unique_ptr<Window::SessionController> _controller;
object_ptr<TitleWidget> _title = { nullptr };
object_ptr<Ui::RpWidget> _outdated;
object_ptr<TWidget> _body;