Removed Window::SessionController from ManageDictionariesBox.

This commit is contained in:
23rd 2022-03-03 11:35:21 +03:00
parent 28331b3617
commit b900ac2b1d
4 changed files with 21 additions and 21 deletions

View File

@ -13,6 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "chat_helpers/spellchecker_common.h"
#include "core/application.h"
#include "main/main_account.h"
#include "main/main_session.h"
#include "mainwidget.h"
#include "mtproto/dedicated_file_loader.h"
#include "spellcheck/spellcheck_utils.h"
@ -23,7 +24,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/widgets/popup_menu.h"
#include "ui/wrap/slide_wrap.h"
#include "ui/effects/animations.h"
#include "window/window_session_controller.h"
#include "styles/style_layers.h"
#include "styles/style_settings.h"
#include "styles/style_boxes.h"
@ -44,7 +44,7 @@ class Inner : public Ui::RpWidget {
public:
Inner(
QWidget *parent,
not_null<Window::SessionController*> controller,
not_null<Main::Session*> session,
Dictionaries enabledDictionaries);
Dictionaries enabledRows() const;
@ -52,7 +52,7 @@ public:
private:
void setupContent(
not_null<Window::SessionController*> controller,
not_null<Main::Session*> session,
Dictionaries enabledDictionaries);
Dictionaries _enabledRows;
@ -97,10 +97,10 @@ auto CreateMultiSelect(QWidget *parent) {
Inner::Inner(
QWidget *parent,
not_null<Window::SessionController*> controller,
not_null<Main::Session*> session,
Dictionaries enabledDictionaries)
: RpWidget(parent) {
setupContent(controller, std::move(enabledDictionaries));
setupContent(session, std::move(enabledDictionaries));
}
QueryCallback Inner::queryCallback() const {
@ -113,7 +113,7 @@ Dictionaries Inner::enabledRows() const {
auto AddButtonWithLoader(
not_null<Ui::VerticalLayout*> content,
not_null<Window::SessionController*> controller,
not_null<Main::Session*> session,
const Spellchecker::Dict &dict,
bool buttonEnabled,
rpl::producer<QStringView> query) {
@ -283,7 +283,7 @@ auto AddButtonWithLoader(
const auto weak = Ui::MakeWeak(button);
setLocalLoader(base::make_unique_q<Loader>(
QCoreApplication::instance(),
&controller->session(),
session,
id,
Spellchecker::GetDownloadLocation(id),
Spellchecker::DictPathByLangId(id),
@ -335,7 +335,7 @@ auto AddButtonWithLoader(
}
void Inner::setupContent(
not_null<Window::SessionController*> controller,
not_null<Main::Session*> session,
Dictionaries enabledDictionaries) {
const auto content = Ui::CreateChild<Ui::VerticalLayout>(this);
@ -346,7 +346,7 @@ void Inner::setupContent(
const auto id = dict.id;
const auto row = AddButtonWithLoader(
content,
controller,
session,
dict,
ranges::contains(enabledDictionaries, id),
queryStream->events());
@ -376,8 +376,8 @@ void Inner::setupContent(
ManageDictionariesBox::ManageDictionariesBox(
QWidget*,
not_null<Window::SessionController*> controller)
: _controller(controller) {
not_null<Main::Session*> session)
: _session(session) {
}
void ManageDictionariesBox::setInnerFocus() {
@ -390,7 +390,7 @@ void ManageDictionariesBox::prepare() {
const auto inner = setInnerWidget(
object_ptr<Inner>(
this,
_controller,
_session,
Core::App().settings().dictionariesEnabled()),
st::boxScroll,
multiSelect->height()

View File

@ -11,24 +11,22 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "boxes/abstract_box.h"
namespace Window {
class SessionController;
} // namespace Window
namespace Main {
class Session;
} // namespace Main
namespace Ui {
class ManageDictionariesBox : public Ui::BoxContent {
public:
ManageDictionariesBox(
QWidget*,
not_null<Window::SessionController*> controller);
ManageDictionariesBox(QWidget*, not_null<Main::Session*> session);
protected:
void prepare() override;
void setInnerFocus() override;
private:
const not_null<Window::SessionController*> _controller;
const not_null<Main::Session*> _session;
Fn<void()> _setInnerFocus;
};

View File

@ -323,7 +323,8 @@ void InitSpellchecker(
Spellchecker::SpellingHighlighter::CustomContextMenuItem{
tr::lng_settings_manage_dictionaries(tr::now),
[=] {
controller->show(Box<Ui::ManageDictionariesBox>(controller));
controller->show(
Box<Ui::ManageDictionariesBox>(&controller->session()));
}
});
field->setExtendedContextMenu(s->contextMenuCreated());

View File

@ -332,7 +332,8 @@ void SetupSpellchecker(
Spellchecker::ButtonManageDictsState(session),
st::settingsButtonNoIcon
)->addClickHandler([=] {
controller->show(Box<Ui::ManageDictionariesBox>(controller));
controller->show(
Box<Ui::ManageDictionariesBox>(&controller->session()));
});
button->toggledValue(