1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

feat: Add spell checking

Fix #1301

Spell checking implemented by KF5Sonnet
This commit is contained in:
Diadlo 2017-11-15 23:41:08 +03:00 committed by sudden6
parent a12bb068d0
commit 671b9456a8
No known key found for this signature in database
GPG Key ID: 279509B499E032B9
4 changed files with 27 additions and 0 deletions

View File

@ -12,6 +12,7 @@ option(USE_FILTERAUDIO "Enable the echo canceling backend" ON)
# AUTOUPDATE is currently broken and thus disabled
option(AUTOUPDATE "Enable the auto updater" OFF)
option(USE_CCACHE "Use ccache when available" ON)
option(SPELL_CHECK "Enable spell cheching support" ON)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug)

View File

@ -112,6 +112,16 @@ search_dependency(LIBSWSCALE PACKAGE libswscale)
search_dependency(SQLCIPHER PACKAGE sqlcipher)
search_dependency(VPX PACKAGE vpx)
if(${SPELL_CHECK})
find_package(KF5Sonnet)
if(KF5Sonnet_FOUND)
add_definitions(-DSPELL_CHECKING)
add_dependency(KF5::SonnetUi)
else()
message(WARNING "Sonnet not found. Spell checking will be disabled.")
endif()
endif()
# Try to find cmake toxcore libraries
if(WIN32)
search_dependency(TOXCORE PACKAGE toxcore OPTIONAL STATIC_PACKAGE)

View File

@ -46,6 +46,10 @@
#include <QKeyEvent>
#include <QMessageBox>
#ifdef SPELL_CHECKING
#include <KF5/SonnetUi/sonnet/spellcheckdecorator.h>
#endif
/**
* @class GenericChatForm
* @brief Parent class for all chatforms. It's provide the minimum required UI
@ -142,6 +146,9 @@ GenericChatForm::GenericChatForm(const Contact* contact, QWidget* parent)
connect(&s, &Settings::chatMessageFontChanged, this, &GenericChatForm::onChatMessageFontChanged);
msgEdit = new ChatTextEdit();
#ifdef SPELL_CHECKING
decorator = new Sonnet::SpellCheckDecorator(msgEdit);
#endif
sendButton = createButton("sendButton", this, &GenericChatForm::onSendTriggered);
emoteButton = createButton("emoteButton", this, &GenericChatForm::onEmoteButtonClicked);

View File

@ -54,6 +54,12 @@ namespace Ui {
class MainWindow;
}
#ifdef SPELL_CHECKING
namespace Sonnet {
class SpellCheckDecorator;
}
#endif
class GenericChatForm : public QWidget
{
Q_OBJECT
@ -166,6 +172,9 @@ protected:
SearchForm *searchForm;
ChatLog* chatWidget;
ChatTextEdit* msgEdit;
#ifdef SPELL_CHECKING
Sonnet::SpellCheckDecorator* decorator{nullptr};
#endif
FlyoutOverlayWidget* fileFlyout;
GenericNetCamView* netcam;
Widget* parent;