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:
parent
a12bb068d0
commit
671b9456a8
@ -12,6 +12,7 @@ option(USE_FILTERAUDIO "Enable the echo canceling backend" ON)
|
|||||||
# AUTOUPDATE is currently broken and thus disabled
|
# AUTOUPDATE is currently broken and thus disabled
|
||||||
option(AUTOUPDATE "Enable the auto updater" OFF)
|
option(AUTOUPDATE "Enable the auto updater" OFF)
|
||||||
option(USE_CCACHE "Use ccache when available" ON)
|
option(USE_CCACHE "Use ccache when available" ON)
|
||||||
|
option(SPELL_CHECK "Enable spell cheching support" ON)
|
||||||
|
|
||||||
if(NOT CMAKE_BUILD_TYPE)
|
if(NOT CMAKE_BUILD_TYPE)
|
||||||
set(CMAKE_BUILD_TYPE Debug)
|
set(CMAKE_BUILD_TYPE Debug)
|
||||||
|
@ -112,6 +112,16 @@ search_dependency(LIBSWSCALE PACKAGE libswscale)
|
|||||||
search_dependency(SQLCIPHER PACKAGE sqlcipher)
|
search_dependency(SQLCIPHER PACKAGE sqlcipher)
|
||||||
search_dependency(VPX PACKAGE vpx)
|
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
|
# Try to find cmake toxcore libraries
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
search_dependency(TOXCORE PACKAGE toxcore OPTIONAL STATIC_PACKAGE)
|
search_dependency(TOXCORE PACKAGE toxcore OPTIONAL STATIC_PACKAGE)
|
||||||
|
@ -46,6 +46,10 @@
|
|||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
|
||||||
|
#ifdef SPELL_CHECKING
|
||||||
|
#include <KF5/SonnetUi/sonnet/spellcheckdecorator.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class GenericChatForm
|
* @class GenericChatForm
|
||||||
* @brief Parent class for all chatforms. It's provide the minimum required UI
|
* @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);
|
connect(&s, &Settings::chatMessageFontChanged, this, &GenericChatForm::onChatMessageFontChanged);
|
||||||
|
|
||||||
msgEdit = new ChatTextEdit();
|
msgEdit = new ChatTextEdit();
|
||||||
|
#ifdef SPELL_CHECKING
|
||||||
|
decorator = new Sonnet::SpellCheckDecorator(msgEdit);
|
||||||
|
#endif
|
||||||
|
|
||||||
sendButton = createButton("sendButton", this, &GenericChatForm::onSendTriggered);
|
sendButton = createButton("sendButton", this, &GenericChatForm::onSendTriggered);
|
||||||
emoteButton = createButton("emoteButton", this, &GenericChatForm::onEmoteButtonClicked);
|
emoteButton = createButton("emoteButton", this, &GenericChatForm::onEmoteButtonClicked);
|
||||||
|
@ -54,6 +54,12 @@ namespace Ui {
|
|||||||
class MainWindow;
|
class MainWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef SPELL_CHECKING
|
||||||
|
namespace Sonnet {
|
||||||
|
class SpellCheckDecorator;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
class GenericChatForm : public QWidget
|
class GenericChatForm : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -166,6 +172,9 @@ protected:
|
|||||||
SearchForm *searchForm;
|
SearchForm *searchForm;
|
||||||
ChatLog* chatWidget;
|
ChatLog* chatWidget;
|
||||||
ChatTextEdit* msgEdit;
|
ChatTextEdit* msgEdit;
|
||||||
|
#ifdef SPELL_CHECKING
|
||||||
|
Sonnet::SpellCheckDecorator* decorator{nullptr};
|
||||||
|
#endif
|
||||||
FlyoutOverlayWidget* fileFlyout;
|
FlyoutOverlayWidget* fileFlyout;
|
||||||
GenericNetCamView* netcam;
|
GenericNetCamView* netcam;
|
||||||
Widget* parent;
|
Widget* parent;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user