2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

Move some settings from global to Session.

This commit is contained in:
John Preston
2019-08-02 11:40:35 +01:00
parent 7e4c9f98a6
commit 93a52bb66e
30 changed files with 315 additions and 169 deletions

View File

@@ -503,8 +503,10 @@ void SuggestionsWidget::leaveEventHook(QEvent *e) {
SuggestionsController::SuggestionsController(
not_null<QWidget*> outer,
not_null<QTextEdit*> field,
not_null<Main::Session*> session,
const Options &options)
: _field(field)
, _session(session)
, _showExactTimer([=] { showWithQuery(getEmojiQuery()); })
, _options(options) {
_container = base::make_unique_q<InnerDropdown>(
@@ -557,11 +559,13 @@ SuggestionsController::SuggestionsController(
SuggestionsController *SuggestionsController::Init(
not_null<QWidget*> outer,
not_null<Ui::InputField*> field,
not_null<Main::Session*> session,
const Options &options) {
const auto result = Ui::CreateChild<SuggestionsController>(
field.get(),
outer,
field->rawTextEdit(),
session,
options);
result->setReplaceCallback([=](
int from,
@@ -590,7 +594,8 @@ void SuggestionsController::setReplaceCallback(
}
void SuggestionsController::handleTextChange() {
if (Global::SuggestEmoji() && _field->textCursor().position() > 0) {
if (_session->settings().suggestEmoji()
&& _field->textCursor().position() > 0) {
Core::App().emojiKeywords().refresh();
}
@@ -619,7 +624,7 @@ void SuggestionsController::showWithQuery(const QString &query) {
}
QString SuggestionsController::getEmojiQuery() {
if (!Global::SuggestEmoji()) {
if (!_session->settings().suggestEmoji()) {
return QString();
}