mirror of https://github.com/procxx/kepka.git
Added SpellingHighlighter to InputField in HistoryWidget and some boxes.
This commit is contained in:
parent
6e95cfc24d
commit
4be178c75f
|
@ -268,6 +268,8 @@ EditCaptionBox::EditCaptionBox(
|
||||||
_field->setEditLinkCallback(
|
_field->setEditLinkCallback(
|
||||||
DefaultEditLinkCallback(&_controller->session(), _field));
|
DefaultEditLinkCallback(&_controller->session(), _field));
|
||||||
|
|
||||||
|
_spelling = InitSpellchecker(&_controller->session(), _field);
|
||||||
|
|
||||||
auto r = object_ptr<Ui::SlideWrap<Ui::Checkbox>>(
|
auto r = object_ptr<Ui::SlideWrap<Ui::Checkbox>>(
|
||||||
this,
|
this,
|
||||||
object_ptr<Ui::Checkbox>(
|
object_ptr<Ui::Checkbox>(
|
||||||
|
|
|
@ -24,6 +24,10 @@ namespace Data {
|
||||||
class Media;
|
class Media;
|
||||||
} // namespace Data
|
} // namespace Data
|
||||||
|
|
||||||
|
namespace Spellchecker {
|
||||||
|
class SpellingHighlighter;
|
||||||
|
} // namespace Spellchecker
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class InputField;
|
class InputField;
|
||||||
class EmojiButton;
|
class EmojiButton;
|
||||||
|
@ -99,6 +103,7 @@ private:
|
||||||
object_ptr<Ui::EmojiButton> _emojiToggle = { nullptr };
|
object_ptr<Ui::EmojiButton> _emojiToggle = { nullptr };
|
||||||
base::unique_qptr<ChatHelpers::TabbedPanel> _emojiPanel;
|
base::unique_qptr<ChatHelpers::TabbedPanel> _emojiPanel;
|
||||||
base::unique_qptr<QObject> _emojiFilter;
|
base::unique_qptr<QObject> _emojiFilter;
|
||||||
|
base::unique_qptr<Spellchecker::SpellingHighlighter> _spelling;
|
||||||
|
|
||||||
int _thumbx = 0;
|
int _thumbx = 0;
|
||||||
int _thumbw = 0;
|
int _thumbw = 0;
|
||||||
|
|
|
@ -1679,6 +1679,8 @@ void SendFilesBox::setupCaption() {
|
||||||
_caption,
|
_caption,
|
||||||
&_controller->session());
|
&_controller->session());
|
||||||
|
|
||||||
|
_spelling = InitSpellchecker(&_controller->session(), _caption);
|
||||||
|
|
||||||
updateCaptionPlaceholder();
|
updateCaptionPlaceholder();
|
||||||
setupEmojiPanel();
|
setupEmojiPanel();
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,10 @@ namespace Window {
|
||||||
class SessionController;
|
class SessionController;
|
||||||
} // namespace Window
|
} // namespace Window
|
||||||
|
|
||||||
|
namespace Spellchecker {
|
||||||
|
class SpellingHighlighter;
|
||||||
|
} // namespace Spellchecker
|
||||||
|
|
||||||
enum class SendMenuType;
|
enum class SendMenuType;
|
||||||
|
|
||||||
enum class SendFilesWay {
|
enum class SendFilesWay {
|
||||||
|
@ -150,6 +154,7 @@ private:
|
||||||
object_ptr<Ui::EmojiButton> _emojiToggle = { nullptr };
|
object_ptr<Ui::EmojiButton> _emojiToggle = { nullptr };
|
||||||
base::unique_qptr<ChatHelpers::TabbedPanel> _emojiPanel;
|
base::unique_qptr<ChatHelpers::TabbedPanel> _emojiPanel;
|
||||||
base::unique_qptr<QObject> _emojiFilter;
|
base::unique_qptr<QObject> _emojiFilter;
|
||||||
|
base::unique_qptr<Spellchecker::SpellingHighlighter> _spelling;
|
||||||
|
|
||||||
object_ptr<Ui::Radioenum<SendFilesWay>> _sendAlbum = { nullptr };
|
object_ptr<Ui::Radioenum<SendFilesWay>> _sendAlbum = { nullptr };
|
||||||
object_ptr<Ui::Radioenum<SendFilesWay>> _sendPhotos = { nullptr };
|
object_ptr<Ui::Radioenum<SendFilesWay>> _sendPhotos = { nullptr };
|
||||||
|
|
|
@ -207,6 +207,7 @@ void ShareBox::prepareCommentField() {
|
||||||
field->setEditLinkCallback(
|
field->setEditLinkCallback(
|
||||||
DefaultEditLinkCallback(&_navigation->session(), field));
|
DefaultEditLinkCallback(&_navigation->session(), field));
|
||||||
|
|
||||||
|
_spelling = InitSpellchecker(&_navigation->session(), field);
|
||||||
Ui::SendPendingMoveResizeEvents(_comment);
|
Ui::SendPendingMoveResizeEvents(_comment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,10 @@ namespace Notify {
|
||||||
struct PeerUpdate;
|
struct PeerUpdate;
|
||||||
} // namespace Notify
|
} // namespace Notify
|
||||||
|
|
||||||
|
namespace Spellchecker {
|
||||||
|
class SpellingHighlighter;
|
||||||
|
} // namespace Spellchecker
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class MultiSelect;
|
class MultiSelect;
|
||||||
class InputField;
|
class InputField;
|
||||||
|
@ -113,6 +117,7 @@ private:
|
||||||
|
|
||||||
object_ptr<Ui::MultiSelect> _select;
|
object_ptr<Ui::MultiSelect> _select;
|
||||||
object_ptr<Ui::SlideWrap<Ui::InputField>> _comment;
|
object_ptr<Ui::SlideWrap<Ui::InputField>> _comment;
|
||||||
|
base::unique_qptr<Spellchecker::SpellingHighlighter> _spelling;
|
||||||
|
|
||||||
class Inner;
|
class Inner;
|
||||||
QPointer<Inner> _inner;
|
QPointer<Inner> _inner;
|
||||||
|
|
|
@ -78,6 +78,7 @@ private:
|
||||||
QString _startLink;
|
QString _startLink;
|
||||||
Fn<void(QString, QString)> _callback;
|
Fn<void(QString, QString)> _callback;
|
||||||
Fn<void()> _setInnerFocus;
|
Fn<void()> _setInnerFocus;
|
||||||
|
base::unique_qptr<Spellchecker::SpellingHighlighter> _spelling;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -127,6 +128,7 @@ void EditLinkBox::prepare() {
|
||||||
getDelegate()->outerContainer(),
|
getDelegate()->outerContainer(),
|
||||||
text,
|
text,
|
||||||
_session);
|
_session);
|
||||||
|
_spelling = InitSpellchecker(_session, text);
|
||||||
|
|
||||||
const auto url = content->add(
|
const auto url = content->add(
|
||||||
object_ptr<Ui::InputField>(
|
object_ptr<Ui::InputField>(
|
||||||
|
@ -273,6 +275,17 @@ void InitMessageField(
|
||||||
DefaultEditLinkCallback(&controller->session(), field));
|
DefaultEditLinkCallback(&controller->session(), field));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
base::unique_qptr<Spellchecker::SpellingHighlighter> InitSpellchecker(
|
||||||
|
not_null<Main::Session*> session,
|
||||||
|
not_null<Ui::InputField*> field) {
|
||||||
|
auto s = base::make_unique_q<Spellchecker::SpellingHighlighter>(
|
||||||
|
field->rawTextEdit(),
|
||||||
|
session->settings().spellcheckerEnabledValue(),
|
||||||
|
field->documentContentsChanges());
|
||||||
|
field->setExtendedContextMenu(s->contextMenuCreated());
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
bool HasSendText(not_null<const Ui::InputField*> field) {
|
bool HasSendText(not_null<const Ui::InputField*> field) {
|
||||||
const auto &text = field->getTextWithTags().text;
|
const auto &text = field->getTextWithTags().text;
|
||||||
for (const auto ch : text) {
|
for (const auto ch : text) {
|
||||||
|
|
|
@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "spellcheck/spelling_highlighter.h"
|
||||||
#include "ui/widgets/input_fields.h"
|
#include "ui/widgets/input_fields.h"
|
||||||
#include "base/timer.h"
|
#include "base/timer.h"
|
||||||
#include "base/qt_connection.h"
|
#include "base/qt_connection.h"
|
||||||
|
@ -34,6 +35,9 @@ Fn<bool(
|
||||||
void InitMessageField(
|
void InitMessageField(
|
||||||
not_null<Window::SessionController*> controller,
|
not_null<Window::SessionController*> controller,
|
||||||
not_null<Ui::InputField*> field);
|
not_null<Ui::InputField*> field);
|
||||||
|
base::unique_qptr<Spellchecker::SpellingHighlighter> InitSpellchecker(
|
||||||
|
not_null<Main::Session*> session,
|
||||||
|
not_null<Ui::InputField*> field);
|
||||||
bool HasSendText(not_null<const Ui::InputField*> field);
|
bool HasSendText(not_null<const Ui::InputField*> field);
|
||||||
|
|
||||||
struct InlineBotQuery {
|
struct InlineBotQuery {
|
||||||
|
|
|
@ -411,6 +411,7 @@ HistoryWidget::HistoryWidget(
|
||||||
}
|
}
|
||||||
Unexpected("action in MimeData hook.");
|
Unexpected("action in MimeData hook.");
|
||||||
});
|
});
|
||||||
|
_spelling = InitSpellchecker(&controller->session(), _field);
|
||||||
|
|
||||||
const auto suggestions = Ui::Emoji::SuggestionsController::Init(
|
const auto suggestions = Ui::Emoji::SuggestionsController::Init(
|
||||||
this,
|
this,
|
||||||
|
|
|
@ -86,6 +86,10 @@ class ContactStatus;
|
||||||
class Element;
|
class Element;
|
||||||
} // namespace HistoryView
|
} // namespace HistoryView
|
||||||
|
|
||||||
|
namespace Spellchecker {
|
||||||
|
class SpellingHighlighter;
|
||||||
|
} // namespace Spellchecker
|
||||||
|
|
||||||
class DragArea;
|
class DragArea;
|
||||||
class SendFilesBox;
|
class SendFilesBox;
|
||||||
class BotKeyboard;
|
class BotKeyboard;
|
||||||
|
@ -741,6 +745,7 @@ private:
|
||||||
object_ptr<Ui::IconButton> _scheduled = { nullptr };
|
object_ptr<Ui::IconButton> _scheduled = { nullptr };
|
||||||
bool _cmdStartShown = false;
|
bool _cmdStartShown = false;
|
||||||
object_ptr<Ui::InputField> _field;
|
object_ptr<Ui::InputField> _field;
|
||||||
|
base::unique_qptr<Spellchecker::SpellingHighlighter> _spelling;
|
||||||
bool _recording = false;
|
bool _recording = false;
|
||||||
bool _inField = false;
|
bool _inField = false;
|
||||||
bool _inReplyEditForward = false;
|
bool _inReplyEditForward = false;
|
||||||
|
|
Loading…
Reference in New Issue