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:
@@ -15,6 +15,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "window/window_session_controller.h"
|
||||
#include "window/window_lock_widgets.h"
|
||||
#include "window/window_outdated_bar.h"
|
||||
#include "window/window_controller.h"
|
||||
#include "boxes/confirm_box.h"
|
||||
#include "main/main_account.h" // Account::authSessionValue.
|
||||
#include "core/click_handler_types.h"
|
||||
@@ -108,8 +109,9 @@ QIcon CreateIcon() {
|
||||
return result;
|
||||
}
|
||||
|
||||
MainWindow::MainWindow()
|
||||
: _positionUpdatedTimer([=] { savePosition(); })
|
||||
MainWindow::MainWindow(not_null<Controller*> controller)
|
||||
: _controller(controller)
|
||||
, _positionUpdatedTimer([=] { savePosition(); })
|
||||
, _outdated(CreateOutdatedBar(this))
|
||||
, _body(this)
|
||||
, _icon(CreateIcon())
|
||||
@@ -127,14 +129,6 @@ MainWindow::MainWindow()
|
||||
workmodeUpdated(mode);
|
||||
});
|
||||
|
||||
Core::App().activeAccount().sessionValue(
|
||||
) | rpl::start_with_next([=](AuthSession *session) {
|
||||
_controller = session
|
||||
? std::make_unique<Window::SessionController>(session, this)
|
||||
: nullptr;
|
||||
updateWindowIcon();
|
||||
}, lifetime());
|
||||
|
||||
Core::App().termsLockValue(
|
||||
) | rpl::start_with_next([=] {
|
||||
checkLockByTerms();
|
||||
@@ -156,6 +150,10 @@ MainWindow::MainWindow()
|
||||
_inactivePressTimer.setCallback([this] { setInactivePress(false); });
|
||||
}
|
||||
|
||||
Window::SessionController *MainWindow::sessionController() const {
|
||||
return _controller->sessionController();
|
||||
}
|
||||
|
||||
void MainWindow::checkLockByTerms() {
|
||||
const auto data = Core::App().termsLocked();
|
||||
if (!data || !AuthSession::Exists()) {
|
||||
|
Reference in New Issue
Block a user