diff --git a/Telegram/SourceFiles/boxes/edit_caption_box.cpp b/Telegram/SourceFiles/boxes/edit_caption_box.cpp index 8cc81d2c4..306213f25 100644 --- a/Telegram/SourceFiles/boxes/edit_caption_box.cpp +++ b/Telegram/SourceFiles/boxes/edit_caption_box.cpp @@ -268,7 +268,7 @@ EditCaptionBox::EditCaptionBox( _field->setEditLinkCallback( DefaultEditLinkCallback(&_controller->session(), _field)); - _spelling = InitSpellchecker(&_controller->session(), _field); + InitSpellchecker(&_controller->session(), _field); auto r = object_ptr>( this, diff --git a/Telegram/SourceFiles/boxes/edit_caption_box.h b/Telegram/SourceFiles/boxes/edit_caption_box.h index 825bc8aeb..14e7cd5c3 100644 --- a/Telegram/SourceFiles/boxes/edit_caption_box.h +++ b/Telegram/SourceFiles/boxes/edit_caption_box.h @@ -24,10 +24,6 @@ namespace Data { class Media; } // namespace Data -namespace Spellchecker { -class SpellingHighlighter; -} // namespace Spellchecker - namespace Ui { class InputField; class EmojiButton; @@ -103,7 +99,6 @@ private: object_ptr _emojiToggle = { nullptr }; base::unique_qptr _emojiPanel; base::unique_qptr _emojiFilter; - base::unique_qptr _spelling; int _thumbx = 0; int _thumbw = 0; diff --git a/Telegram/SourceFiles/boxes/send_files_box.cpp b/Telegram/SourceFiles/boxes/send_files_box.cpp index a20a084a2..0f5a43054 100644 --- a/Telegram/SourceFiles/boxes/send_files_box.cpp +++ b/Telegram/SourceFiles/boxes/send_files_box.cpp @@ -1679,7 +1679,7 @@ void SendFilesBox::setupCaption() { _caption, &_controller->session()); - _spelling = InitSpellchecker(&_controller->session(), _caption); + InitSpellchecker(&_controller->session(), _caption); updateCaptionPlaceholder(); setupEmojiPanel(); diff --git a/Telegram/SourceFiles/boxes/send_files_box.h b/Telegram/SourceFiles/boxes/send_files_box.h index 716f5e739..23f741295 100644 --- a/Telegram/SourceFiles/boxes/send_files_box.h +++ b/Telegram/SourceFiles/boxes/send_files_box.h @@ -40,10 +40,6 @@ namespace Window { class SessionController; } // namespace Window -namespace Spellchecker { -class SpellingHighlighter; -} // namespace Spellchecker - enum class SendMenuType; enum class SendFilesWay { @@ -154,7 +150,6 @@ private: object_ptr _emojiToggle = { nullptr }; base::unique_qptr _emojiPanel; base::unique_qptr _emojiFilter; - base::unique_qptr _spelling; object_ptr> _sendAlbum = { nullptr }; object_ptr> _sendPhotos = { nullptr }; diff --git a/Telegram/SourceFiles/boxes/share_box.cpp b/Telegram/SourceFiles/boxes/share_box.cpp index 9d234ff89..0f319b401 100644 --- a/Telegram/SourceFiles/boxes/share_box.cpp +++ b/Telegram/SourceFiles/boxes/share_box.cpp @@ -207,7 +207,7 @@ void ShareBox::prepareCommentField() { field->setEditLinkCallback( DefaultEditLinkCallback(&_navigation->session(), field)); - _spelling = InitSpellchecker(&_navigation->session(), field); + InitSpellchecker(&_navigation->session(), field); Ui::SendPendingMoveResizeEvents(_comment); } diff --git a/Telegram/SourceFiles/boxes/share_box.h b/Telegram/SourceFiles/boxes/share_box.h index 00e9e3d7a..55d223c04 100644 --- a/Telegram/SourceFiles/boxes/share_box.h +++ b/Telegram/SourceFiles/boxes/share_box.h @@ -36,10 +36,6 @@ namespace Notify { struct PeerUpdate; } // namespace Notify -namespace Spellchecker { -class SpellingHighlighter; -} // namespace Spellchecker - namespace Ui { class MultiSelect; class InputField; @@ -117,7 +113,6 @@ private: object_ptr _select; object_ptr> _comment; - base::unique_qptr _spelling; class Inner; QPointer _inner; diff --git a/Telegram/SourceFiles/chat_helpers/message_field.cpp b/Telegram/SourceFiles/chat_helpers/message_field.cpp index 253ee4e7a..4b337a642 100644 --- a/Telegram/SourceFiles/chat_helpers/message_field.cpp +++ b/Telegram/SourceFiles/chat_helpers/message_field.cpp @@ -78,7 +78,6 @@ private: QString _startLink; Fn _callback; Fn _setInnerFocus; - base::unique_qptr _spelling; }; @@ -128,7 +127,7 @@ void EditLinkBox::prepare() { getDelegate()->outerContainer(), text, _session); - _spelling = InitSpellchecker(_session, text); + InitSpellchecker(_session, text); const auto url = content->add( object_ptr( @@ -275,10 +274,11 @@ void InitMessageField( DefaultEditLinkCallback(&controller->session(), field)); } -base::unique_qptr InitSpellchecker( - not_null session, - not_null field) { - auto s = base::make_unique_q( +void InitSpellchecker( + not_null session, + not_null field) { +#ifndef TDESKTOP_DISABLE_SPELLCHECK + const auto s = field->lifetime().make_state( field->rawTextEdit(), session->settings().spellcheckerEnabledValue(), field->documentContentsChanges()); @@ -288,7 +288,7 @@ base::unique_qptr InitSpellchecker( { &ph::lng_spellchecker_ignore, tr::lng_spellchecker_ignore() }, } }); field->setExtendedContextMenu(s->contextMenuCreated()); - return s; +#endif // TDESKTOP_DISABLE_SPELLCHECK } bool HasSendText(not_null field) { diff --git a/Telegram/SourceFiles/chat_helpers/message_field.h b/Telegram/SourceFiles/chat_helpers/message_field.h index e327327d1..874e15b8e 100644 --- a/Telegram/SourceFiles/chat_helpers/message_field.h +++ b/Telegram/SourceFiles/chat_helpers/message_field.h @@ -7,11 +7,14 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL */ #pragma once -#include "spellcheck/spelling_highlighter.h" #include "ui/widgets/input_fields.h" #include "base/timer.h" #include "base/qt_connection.h" +#ifndef TDESKTOP_DISABLE_SPELLCHECK +#include "spellcheck/spelling_highlighter.h" +#endif // TDESKTOP_DISABLE_SPELLCHECK + #include namespace Main { @@ -35,9 +38,11 @@ Fn controller, not_null field); -base::unique_qptr InitSpellchecker( + +void InitSpellchecker( not_null session, not_null field); + bool HasSendText(not_null field); struct InlineBotQuery { diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index 48e7dc20c..069b81a11 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -416,7 +416,7 @@ HistoryWidget::HistoryWidget( } Unexpected("action in MimeData hook."); }); - _spelling = InitSpellchecker(&controller->session(), _field); + InitSpellchecker(&controller->session(), _field); const auto suggestions = Ui::Emoji::SuggestionsController::Init( this, diff --git a/Telegram/SourceFiles/history/history_widget.h b/Telegram/SourceFiles/history/history_widget.h index c386bbbab..5cd761aeb 100644 --- a/Telegram/SourceFiles/history/history_widget.h +++ b/Telegram/SourceFiles/history/history_widget.h @@ -86,10 +86,6 @@ class ContactStatus; class Element; } // namespace HistoryView -namespace Spellchecker { -class SpellingHighlighter; -} // namespace Spellchecker - class DragArea; class SendFilesBox; class BotKeyboard; @@ -745,7 +741,6 @@ private: object_ptr _scheduled = { nullptr }; bool _cmdStartShown = false; object_ptr _field; - base::unique_qptr _spelling; bool _recording = false; bool _inField = false; bool _inReplyEditForward = false; diff --git a/Telegram/SourceFiles/platform/mac/specific_mac_p.mm b/Telegram/SourceFiles/platform/mac/specific_mac_p.mm index 824bec2f6..1a640f938 100644 --- a/Telegram/SourceFiles/platform/mac/specific_mac_p.mm +++ b/Telegram/SourceFiles/platform/mac/specific_mac_p.mm @@ -25,8 +25,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include #include +#if __has_include() #include - +#endif // __has_include() #include #include #include @@ -285,6 +286,7 @@ void objc_outputDebugString(const QString &str) { } void objc_start() { +#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0) // Patch: Fix macOS regression. On 10.14.4, it crashes on GPU switches. // See https://bugreports.qt.io/browse/QTCREATORBUG-22215 const auto version = QOperatingSystemVersion::current(); @@ -293,6 +295,7 @@ void objc_start() { && version.microVersion() == 4) { qputenv("QT_MAC_PRO_WEBENGINE_WORKAROUND", "1"); } +#endif // Qt 5.9.0 _sharedDelegate = [[ApplicationDelegate alloc] init]; [[NSApplication sharedApplication] setDelegate:_sharedDelegate]; diff --git a/Telegram/SourceFiles/qt_static_plugins.cpp b/Telegram/SourceFiles/qt_static_plugins.cpp index a33f12701..cc1a767cf 100644 --- a/Telegram/SourceFiles/qt_static_plugins.cpp +++ b/Telegram/SourceFiles/qt_static_plugins.cpp @@ -8,8 +8,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include Q_IMPORT_PLUGIN(QWebpPlugin) + +#if QT_VERSION >= QT_VERSION_CHECK(5, 8, 0) Q_IMPORT_PLUGIN(QJpegPlugin) Q_IMPORT_PLUGIN(QGifPlugin) +#endif // Qt 5.8.0 + #ifdef Q_OS_WIN Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin) #elif defined Q_OS_MAC // Q_OS_WIN diff --git a/Telegram/gyp/Telegram.gyp b/Telegram/gyp/Telegram.gyp index e173e6174..1c4eba57e 100644 --- a/Telegram/gyp/Telegram.gyp +++ b/Telegram/gyp/Telegram.gyp @@ -76,7 +76,6 @@ '<(submodules_loc)/codegen/codegen.gyp:codegen_style', '<(submodules_loc)/lib_base/lib_base.gyp:lib_base', '<(submodules_loc)/lib_ui/lib_ui.gyp:lib_ui', - '<(submodules_loc)/lib_spellcheck/lib_spellcheck.gyp:lib_spellcheck', '<(third_party_loc)/libtgvoip/libtgvoip.gyp:libtgvoip', '<(submodules_loc)/lib_lottie/lib_lottie.gyp:lib_lottie', 'tests/tests.gyp:tests', @@ -122,16 +121,22 @@ 'sources!': [ '