Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optionally support libqtspell for spell check #125

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
pull_request:
workflow_dispatch:

concurrency:
concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true

Expand Down Expand Up @@ -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/[email protected]
Expand Down Expand Up @@ -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')
Expand Down
2 changes: 2 additions & 0 deletions BUILDING_ON_LINUX.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
6 changes: 6 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions src/widgets/splits/Split.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@
#include <QPainter>
#include <QVBoxLayout>

#ifdef HAVE_QTSPELL
# include <QtSpell.hpp>
#endif

#include <functional>
#include <random>

Expand Down Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions src/widgets/splits/Split.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@
#include <QWidget>
#include <boost/signals2.hpp>

#ifdef HAVE_QTSPELL
# include <QtSpell.hpp>
#endif

namespace chatterino {

class ChannelView;
Expand Down Expand Up @@ -154,6 +158,10 @@ class Split : public BaseWidget
pajlada::Signals::SignalHolder signalHolder_;
std::vector<boost::signals2::scoped_connection> bSignals_;

#ifdef HAVE_QTSPELL
QtSpell::TextEditChecker checker_;
#endif

public slots:
void addSibling();
void deleteFromContainer();
Expand Down