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

Remove some usages of App::main().

This commit is contained in:
John Preston
2020-06-10 22:08:17 +04:00
parent ea86433be5
commit ee43027bea
53 changed files with 518 additions and 429 deletions

View File

@@ -20,6 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_document_media.h"
#include "boxes/background_preview_box.h"
#include "boxes/confirm_box.h"
#include "window/window_session_controller.h"
#include "app.h"
#include "styles/style_overview.h"
#include "styles/style_layers.h"
@@ -131,8 +132,10 @@ private:
};
BackgroundBox::BackgroundBox(QWidget*, not_null<Main::Session*> session)
: _session(session) {
BackgroundBox::BackgroundBox(
QWidget*,
not_null<Window::SessionController*> controller)
: _controller(controller) {
}
void BackgroundBox::prepare() {
@@ -143,13 +146,13 @@ void BackgroundBox::prepare() {
setDimensions(st::boxWideWidth, st::boxMaxListHeight);
_inner = setInnerWidget(
object_ptr<Inner>(this, _session),
object_ptr<Inner>(this, &_controller->session()),
st::backgroundScroll);
_inner->chooseEvents(
) | rpl::start_with_next([=](const Data::WallPaper &paper) {
Ui::show(
Box<BackgroundPreviewBox>(_session, paper),
Box<BackgroundPreviewBox>(_controller, paper),
Ui::LayerOption::KeepOther);
}, _inner->lifetime());
@@ -161,7 +164,7 @@ void BackgroundBox::prepare() {
void BackgroundBox::removePaper(const Data::WallPaper &paper) {
const auto box = std::make_shared<QPointer<Ui::BoxContent>>();
const auto session = _session;
const auto session = &_controller->session();
const auto remove = [=, weak = Ui::MakeWeak(this)]{
if (*box) {
(*box)->closeBox();