mirror of
https://github.com/yann64/haikuports.git
synced 2026-05-06 06:58:57 +02:00
106 lines
3.7 KiB
Plaintext
106 lines
3.7 KiB
Plaintext
From 7e56df8f6daa4f1960535050c130b86ee8d0026f Mon Sep 17 00:00:00 2001
|
|
From: Gerasim Troeglazov <3dEyes@gmail.com>
|
|
Date: Sun, 6 Oct 2019 15:25:59 +1000
|
|
Subject: Add Sonnet spell checking
|
|
|
|
|
|
diff --git a/Telegram/SourceFiles/ui/widgets/input_fields.cpp b/Telegram/SourceFiles/ui/widgets/input_fields.cpp
|
|
index 1c0b13c..9e98c8d 100644
|
|
--- a/Telegram/SourceFiles/ui/widgets/input_fields.cpp
|
|
+++ b/Telegram/SourceFiles/ui/widgets/input_fields.cpp
|
|
@@ -1336,6 +1336,8 @@ InputField::InputField(
|
|
setTextWithTags(_lastTextWithTags, HistoryAction::Clear);
|
|
}
|
|
|
|
+ _SpellCheckDecorator = std::make_unique<Sonnet::SpellCheckDecorator>(_inner.get());
|
|
+
|
|
startBorderAnimation();
|
|
startPlaceholderAnimation();
|
|
finishAnimating();
|
|
@@ -3305,6 +3307,12 @@ bool InputField::revertFormatReplace() {
|
|
void InputField::contextMenuEventInner(QContextMenuEvent *e) {
|
|
if (const auto menu = _inner->createStandardContextMenu()) {
|
|
addMarkdownActions(menu, e);
|
|
+ if (const auto h = _SpellCheckDecorator->highlighter()) {
|
|
+ menu->addSeparator();
|
|
+ menu->addAction(h->isActive() ? qstr("Disable spell checking") : qstr("Enable spell checking"), [=] {
|
|
+ h->setActive(!h->isActive());
|
|
+ });
|
|
+ }
|
|
_contextMenu = base::make_unique_q<PopupMenu>(this, menu);
|
|
_contextMenu->popup(e->globalPos());
|
|
}
|
|
diff --git a/Telegram/SourceFiles/ui/widgets/input_fields.h b/Telegram/SourceFiles/ui/widgets/input_fields.h
|
|
index ae480a0..fe65db1 100644
|
|
--- a/Telegram/SourceFiles/ui/widgets/input_fields.h
|
|
+++ b/Telegram/SourceFiles/ui/widgets/input_fields.h
|
|
@@ -13,6 +13,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|
#include "ui/text/text_entity.h"
|
|
#include "styles/style_widgets.h"
|
|
|
|
+#include <highlighter.h>
|
|
+#include <spellcheckdecorator.h>
|
|
+
|
|
#include <QtWidgets/QLineEdit>
|
|
#include <QtWidgets/QTextEdit>
|
|
#include <QtCore/QTimer>
|
|
@@ -514,6 +517,8 @@ private:
|
|
InstantReplaces _mutableInstantReplaces;
|
|
bool _instantReplacesEnabled = true;
|
|
|
|
+ std::unique_ptr<Sonnet::SpellCheckDecorator> _SpellCheckDecorator;
|
|
+
|
|
};
|
|
|
|
class MaskedInputField : public RpWidgetWrap<QLineEdit> {
|
|
diff --git a/Telegram/gyp/common/haiku.gypi b/Telegram/gyp/common/haiku.gypi
|
|
index 0c55076..b077e62 100644
|
|
--- a/Telegram/gyp/common/haiku.gypi
|
|
+++ b/Telegram/gyp/common/haiku.gypi
|
|
@@ -35,7 +35,16 @@
|
|
'-Wno-missing-field-initializers',
|
|
'-Wno-sign-compare',
|
|
],
|
|
+ 'haiku_path_include%': '@HAIKU_HEADERS@',
|
|
},
|
|
+ 'include_dirs': [
|
|
+ '<(haiku_path_include)/KF5/SonnetCore',
|
|
+ '<(haiku_path_include)/KF5/SonnetCore/Sonnet',
|
|
+ '<(haiku_path_include)/KF5/SonnetCore/sonnet',
|
|
+ '<(haiku_path_include)/KF5/SonnetUi',
|
|
+ '<(haiku_path_include)/KF5/SonnetUi/Sonnet',
|
|
+ '<(haiku_path_include)/KF5/SonnetUi/sonnet',
|
|
+ ],
|
|
'defines': [
|
|
'_REENTRANT',
|
|
'QT_PLUGIN',
|
|
diff --git a/Telegram/gyp/telegram/haiku.gypi b/Telegram/gyp/telegram/haiku.gypi
|
|
index 58da6a6..008585e 100644
|
|
--- a/Telegram/gyp/telegram/haiku.gypi
|
|
+++ b/Telegram/gyp/telegram/haiku.gypi
|
|
@@ -30,6 +30,12 @@
|
|
'<(haiku_path_include)/AL',
|
|
'<(haiku_path_include)/breakpad',
|
|
'<(haiku_path_include)/opus',
|
|
+ '<(haiku_path_include)/KF5/SonnetCore',
|
|
+ '<(haiku_path_include)/KF5/SonnetCore/Sonnet',
|
|
+ '<(haiku_path_include)/KF5/SonnetCore/sonnet',
|
|
+ '<(haiku_path_include)/KF5/SonnetUi',
|
|
+ '<(haiku_path_include)/KF5/SonnetUi/Sonnet',
|
|
+ '<(haiku_path_include)/KF5/SonnetUi/sonnet',
|
|
'<(submodules_loc)/range/include',
|
|
'<(submodules_loc)/variant/test/include',
|
|
],
|
|
@@ -46,6 +52,8 @@
|
|
'-lnetwork',
|
|
'-ltranslation',
|
|
'-lbe',
|
|
+ '-lKF5SonnetCore',
|
|
+ '-lKF5SonnetUi',
|
|
'-llzma',
|
|
'-lz',
|
|
# '<!(pkg-config 2> /dev/null --libs <@(pkgconfig_libs))',
|
|
--
|
|
2.23.0
|
|
|