Removed Window::SessionController from ManageDictionariesBox.
This commit is contained in:
parent
28331b3617
commit
b900ac2b1d
|
@ -13,6 +13,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "chat_helpers/spellchecker_common.h"
|
#include "chat_helpers/spellchecker_common.h"
|
||||||
#include "core/application.h"
|
#include "core/application.h"
|
||||||
#include "main/main_account.h"
|
#include "main/main_account.h"
|
||||||
|
#include "main/main_session.h"
|
||||||
#include "mainwidget.h"
|
#include "mainwidget.h"
|
||||||
#include "mtproto/dedicated_file_loader.h"
|
#include "mtproto/dedicated_file_loader.h"
|
||||||
#include "spellcheck/spellcheck_utils.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/widgets/popup_menu.h"
|
||||||
#include "ui/wrap/slide_wrap.h"
|
#include "ui/wrap/slide_wrap.h"
|
||||||
#include "ui/effects/animations.h"
|
#include "ui/effects/animations.h"
|
||||||
#include "window/window_session_controller.h"
|
|
||||||
#include "styles/style_layers.h"
|
#include "styles/style_layers.h"
|
||||||
#include "styles/style_settings.h"
|
#include "styles/style_settings.h"
|
||||||
#include "styles/style_boxes.h"
|
#include "styles/style_boxes.h"
|
||||||
|
@ -44,7 +44,7 @@ class Inner : public Ui::RpWidget {
|
||||||
public:
|
public:
|
||||||
Inner(
|
Inner(
|
||||||
QWidget *parent,
|
QWidget *parent,
|
||||||
not_null<Window::SessionController*> controller,
|
not_null<Main::Session*> session,
|
||||||
Dictionaries enabledDictionaries);
|
Dictionaries enabledDictionaries);
|
||||||
|
|
||||||
Dictionaries enabledRows() const;
|
Dictionaries enabledRows() const;
|
||||||
|
@ -52,7 +52,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setupContent(
|
void setupContent(
|
||||||
not_null<Window::SessionController*> controller,
|
not_null<Main::Session*> session,
|
||||||
Dictionaries enabledDictionaries);
|
Dictionaries enabledDictionaries);
|
||||||
|
|
||||||
Dictionaries _enabledRows;
|
Dictionaries _enabledRows;
|
||||||
|
@ -97,10 +97,10 @@ auto CreateMultiSelect(QWidget *parent) {
|
||||||
|
|
||||||
Inner::Inner(
|
Inner::Inner(
|
||||||
QWidget *parent,
|
QWidget *parent,
|
||||||
not_null<Window::SessionController*> controller,
|
not_null<Main::Session*> session,
|
||||||
Dictionaries enabledDictionaries)
|
Dictionaries enabledDictionaries)
|
||||||
: RpWidget(parent) {
|
: RpWidget(parent) {
|
||||||
setupContent(controller, std::move(enabledDictionaries));
|
setupContent(session, std::move(enabledDictionaries));
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryCallback Inner::queryCallback() const {
|
QueryCallback Inner::queryCallback() const {
|
||||||
|
@ -113,7 +113,7 @@ Dictionaries Inner::enabledRows() const {
|
||||||
|
|
||||||
auto AddButtonWithLoader(
|
auto AddButtonWithLoader(
|
||||||
not_null<Ui::VerticalLayout*> content,
|
not_null<Ui::VerticalLayout*> content,
|
||||||
not_null<Window::SessionController*> controller,
|
not_null<Main::Session*> session,
|
||||||
const Spellchecker::Dict &dict,
|
const Spellchecker::Dict &dict,
|
||||||
bool buttonEnabled,
|
bool buttonEnabled,
|
||||||
rpl::producer<QStringView> query) {
|
rpl::producer<QStringView> query) {
|
||||||
|
@ -283,7 +283,7 @@ auto AddButtonWithLoader(
|
||||||
const auto weak = Ui::MakeWeak(button);
|
const auto weak = Ui::MakeWeak(button);
|
||||||
setLocalLoader(base::make_unique_q<Loader>(
|
setLocalLoader(base::make_unique_q<Loader>(
|
||||||
QCoreApplication::instance(),
|
QCoreApplication::instance(),
|
||||||
&controller->session(),
|
session,
|
||||||
id,
|
id,
|
||||||
Spellchecker::GetDownloadLocation(id),
|
Spellchecker::GetDownloadLocation(id),
|
||||||
Spellchecker::DictPathByLangId(id),
|
Spellchecker::DictPathByLangId(id),
|
||||||
|
@ -335,7 +335,7 @@ auto AddButtonWithLoader(
|
||||||
}
|
}
|
||||||
|
|
||||||
void Inner::setupContent(
|
void Inner::setupContent(
|
||||||
not_null<Window::SessionController*> controller,
|
not_null<Main::Session*> session,
|
||||||
Dictionaries enabledDictionaries) {
|
Dictionaries enabledDictionaries) {
|
||||||
const auto content = Ui::CreateChild<Ui::VerticalLayout>(this);
|
const auto content = Ui::CreateChild<Ui::VerticalLayout>(this);
|
||||||
|
|
||||||
|
@ -346,7 +346,7 @@ void Inner::setupContent(
|
||||||
const auto id = dict.id;
|
const auto id = dict.id;
|
||||||
const auto row = AddButtonWithLoader(
|
const auto row = AddButtonWithLoader(
|
||||||
content,
|
content,
|
||||||
controller,
|
session,
|
||||||
dict,
|
dict,
|
||||||
ranges::contains(enabledDictionaries, id),
|
ranges::contains(enabledDictionaries, id),
|
||||||
queryStream->events());
|
queryStream->events());
|
||||||
|
@ -376,8 +376,8 @@ void Inner::setupContent(
|
||||||
|
|
||||||
ManageDictionariesBox::ManageDictionariesBox(
|
ManageDictionariesBox::ManageDictionariesBox(
|
||||||
QWidget*,
|
QWidget*,
|
||||||
not_null<Window::SessionController*> controller)
|
not_null<Main::Session*> session)
|
||||||
: _controller(controller) {
|
: _session(session) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ManageDictionariesBox::setInnerFocus() {
|
void ManageDictionariesBox::setInnerFocus() {
|
||||||
|
@ -390,7 +390,7 @@ void ManageDictionariesBox::prepare() {
|
||||||
const auto inner = setInnerWidget(
|
const auto inner = setInnerWidget(
|
||||||
object_ptr<Inner>(
|
object_ptr<Inner>(
|
||||||
this,
|
this,
|
||||||
_controller,
|
_session,
|
||||||
Core::App().settings().dictionariesEnabled()),
|
Core::App().settings().dictionariesEnabled()),
|
||||||
st::boxScroll,
|
st::boxScroll,
|
||||||
multiSelect->height()
|
multiSelect->height()
|
||||||
|
|
|
@ -11,24 +11,22 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
|
||||||
#include "boxes/abstract_box.h"
|
#include "boxes/abstract_box.h"
|
||||||
|
|
||||||
namespace Window {
|
namespace Main {
|
||||||
class SessionController;
|
class Session;
|
||||||
} // namespace Window
|
} // namespace Main
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
|
|
||||||
class ManageDictionariesBox : public Ui::BoxContent {
|
class ManageDictionariesBox : public Ui::BoxContent {
|
||||||
public:
|
public:
|
||||||
ManageDictionariesBox(
|
ManageDictionariesBox(QWidget*, not_null<Main::Session*> session);
|
||||||
QWidget*,
|
|
||||||
not_null<Window::SessionController*> controller);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void prepare() override;
|
void prepare() override;
|
||||||
void setInnerFocus() override;
|
void setInnerFocus() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const not_null<Window::SessionController*> _controller;
|
const not_null<Main::Session*> _session;
|
||||||
Fn<void()> _setInnerFocus;
|
Fn<void()> _setInnerFocus;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
|
@ -323,7 +323,8 @@ void InitSpellchecker(
|
||||||
Spellchecker::SpellingHighlighter::CustomContextMenuItem{
|
Spellchecker::SpellingHighlighter::CustomContextMenuItem{
|
||||||
tr::lng_settings_manage_dictionaries(tr::now),
|
tr::lng_settings_manage_dictionaries(tr::now),
|
||||||
[=] {
|
[=] {
|
||||||
controller->show(Box<Ui::ManageDictionariesBox>(controller));
|
controller->show(
|
||||||
|
Box<Ui::ManageDictionariesBox>(&controller->session()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
field->setExtendedContextMenu(s->contextMenuCreated());
|
field->setExtendedContextMenu(s->contextMenuCreated());
|
||||||
|
|
|
@ -332,7 +332,8 @@ void SetupSpellchecker(
|
||||||
Spellchecker::ButtonManageDictsState(session),
|
Spellchecker::ButtonManageDictsState(session),
|
||||||
st::settingsButtonNoIcon
|
st::settingsButtonNoIcon
|
||||||
)->addClickHandler([=] {
|
)->addClickHandler([=] {
|
||||||
controller->show(Box<Ui::ManageDictionariesBox>(controller));
|
controller->show(
|
||||||
|
Box<Ui::ManageDictionariesBox>(&controller->session()));
|
||||||
});
|
});
|
||||||
|
|
||||||
button->toggledValue(
|
button->toggledValue(
|
||||||
|
|
Loading…
Reference in New Issue