From eca4e7c25c5ffa2a56e52b436832ab616e276a2a Mon Sep 17 00:00:00 2001 From: Ben de Graaff Date: Thu, 9 Jun 2022 17:02:49 +0200 Subject: [PATCH 1/2] Optionally support libqtspell for spell check --- CMakeLists.txt | 3 +++ src/CMakeLists.txt | 6 ++++++ src/widgets/splits/Split.cpp | 7 +++++++ src/widgets/splits/Split.hpp | 8 ++++++++ 4 files changed, 24 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 571bb163755..9cb7f73f538 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -103,6 +103,9 @@ find_package(RapidJSON REQUIRED) find_package(Websocketpp REQUIRED) +find_package(PkgConfig REQUIRED) +pkg_check_modules(QTSPELL QtSpell-qt5) + if (BUILD_TESTS) add_subdirectory("${CMAKE_CURRENT_LIST_DIR}/lib/googletest" "lib/googletest") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c513436185e..dbd9bb7109c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -711,6 +711,12 @@ endif () target_include_directories(${LIBRARY_PROJECT} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) +if (QTSPELL_FOUND) + target_compile_definitions(${LIBRARY_PROJECT} PUBLIC HAVE_QTSPELL) + target_include_directories(${LIBRARY_PROJECT} PUBLIC ${QTSPELL_INCLUDE_DIRS}) + target_link_libraries(${LIBRARY_PROJECT} PUBLIC ${QTSPELL_LIBRARIES}) +endif() + if (WinToast_FOUND) target_link_libraries(${LIBRARY_PROJECT} PUBLIC diff --git a/src/widgets/splits/Split.cpp b/src/widgets/splits/Split.cpp index aec18782c42..6d595350cdc 100644 --- a/src/widgets/splits/Split.cpp +++ b/src/widgets/splits/Split.cpp @@ -54,6 +54,10 @@ #include #include +#ifdef HAVE_QTSPELL +# include +#endif + #include #include @@ -103,6 +107,9 @@ Split::Split(QWidget *parent) this->vbox_->addWidget(this->view_, 1); this->vbox_->addWidget(this->input_); +#ifdef HAVE_QTSPELL + this->checker_.setTextEdit(this->input_->ui_.textEdit); +#endif this->input_->ui_.textEdit->installEventFilter(parent); // update placeholder text on Twitch account change and channel change diff --git a/src/widgets/splits/Split.hpp b/src/widgets/splits/Split.hpp index 63c41b788f9..3ef31fd1663 100644 --- a/src/widgets/splits/Split.hpp +++ b/src/widgets/splits/Split.hpp @@ -12,6 +12,10 @@ #include #include +#ifdef HAVE_QTSPELL +# include +#endif + namespace chatterino { class ChannelView; @@ -154,6 +158,10 @@ class Split : public BaseWidget pajlada::Signals::SignalHolder signalHolder_; std::vector bSignals_; +#ifdef HAVE_QTSPELL + QtSpell::TextEditChecker checker_; +#endif + public slots: void addSibling(); void deleteFromContainer(); From f822fc2d4e6af60aad601256d28b4e07ef721c08 Mon Sep 17 00:00:00 2001 From: Ben de Graaff Date: Thu, 9 Jun 2022 17:22:25 +0200 Subject: [PATCH 2/2] Add libqtspell-qt5-dev to build docs and GH workflow --- .github/workflows/build.yml | 8 ++++---- BUILDING_ON_LINUX.md | 2 ++ CHANGELOG.md | 1 + 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a5a3c185305..1ebd9e134a1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,7 +8,7 @@ on: pull_request: workflow_dispatch: -concurrency: +concurrency: group: build-${{ github.ref }} cancel-in-progress: true @@ -87,12 +87,12 @@ jobs: - name: Add Conan to path if: startsWith(matrix.os, 'windows') run: echo "C:\Program Files\Conan\conan\" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - + - name: Install dependencies (Windows) if: startsWith(matrix.os, 'windows') run: | choco install conan -y - + - name: Enable Developer Command Prompt if: startsWith(matrix.os, 'windows') uses: ilammy/msvc-dev-cmd@v1.10.0 @@ -122,7 +122,7 @@ jobs: if: startsWith(matrix.os, 'windows') run: conan remove "*" -fsb shell: bash - + # LINUX - name: Install dependencies (Ubuntu) if: startsWith(matrix.os, 'ubuntu') diff --git a/BUILDING_ON_LINUX.md b/BUILDING_ON_LINUX.md index 33bae257422..b37b90b2d0e 100644 --- a/BUILDING_ON_LINUX.md +++ b/BUILDING_ON_LINUX.md @@ -9,6 +9,8 @@ Note on Qt version compatibility: If you are installing Qt from a package manage _Most likely works the same for other Debian-like distros_ Install all of the dependencies using `sudo apt install qttools5-dev qtmultimedia5-dev qt5-image-formats-plugins libqt5svg5-dev libboost-dev libssl-dev libboost-system-dev libboost-filesystem-dev cmake g++` +1. Install all of the dependencies using `sudo apt install qttools5-dev qtmultimedia5-dev qt5-image-formats-plugin libqt5svg5-dev libboost-dev libssl-dev libboost-system-dev libboost-filesystem-dev cmake g++` +1. Optionally install QtSpell using `sudo apt install libqtspell-qt5-dev` ### Arch Linux diff --git a/CHANGELOG.md b/CHANGELOG.md index cb4ab8a5511..421711eb141 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - Minor: Added a link to the upstream commit (Mm2PL/Dankerino#127) - Minor: Added RaccAttack URL to Twitch Emote context menu (Mm2PL/Dankerino#122) - Minor: Added a warning to not send bug reports to upstream (Mm2PL/Dankerino#128) +- Minor: Optionally support QtSpell for spell checking (Mm2PL/Dankerino#125) ### Chatterino - Major: Added multi-channel searching to search dialog via keyboard shortcut. (Ctrl+Shift+F by default) (#3694, #3875)