feat: linux-only system dictionary spell checking (#6703)

Reviewed-by: Nerixyz <nerixdev@outlook.de>
This commit is contained in:
pajlada
2026-01-04 11:13:30 +01:00
committed by GitHub
parent 0f58bc3410
commit 5dda451238
7 changed files with 232 additions and 23 deletions
@@ -1,5 +1,7 @@
#include "widgets/settingspages/ExternalToolsPage.hpp"
#include "controllers/spellcheck/SpellChecker.hpp"
#include "singletons/Paths.hpp"
#include "singletons/Settings.hpp"
#include "util/Clipboard.hpp"
#include "util/Helpers.hpp"
@@ -16,6 +18,8 @@
#include <QMessageBox>
#include <QPushButton>
#include <algorithm>
namespace chatterino {
namespace {
@@ -227,6 +231,52 @@ void ExternalToolsPage::initLayout(GeneralPageView &layout)
layout.addLayout(buttonLayout);
}
#ifdef CHATTERINO_WITH_SPELLCHECK
{
// auto *form = new QFormLayout;
layout.addTitle("Spell checker (experimental)");
layout.addDescription(
u"Check the spelling of words in the input box of splits."
" Chatterino does not include dictionaries - they have to "
"be downloaded or created manually. Chatterino expects "
"Hunspell "
"dictionaries in " %
formatRichNamedLink(getApp()->getPaths().dictionariesDirectory,
getApp()->getPaths().dictionariesDirectory) %
u". The file index.aff has to contain the affixes and "
u"index.dic "
u"must contain the dictionary (subject to change).");
SettingWidget::checkbox("Check spelling by default",
s.enableSpellChecking)
->setTooltip("Check the spelling of words in the input box of all "
"splits by default.")
->addTo(layout);
auto toItem =
[](const DictionaryInfo &dict) -> std::pair<QString, QVariant> {
return {
dict.name,
dict.path,
};
};
std::vector<std::pair<QString, QVariant>> dictList{{"None", ""}};
std::ranges::transform(
getApp()->getSpellChecker()->getSystemDictionaries(),
std::back_inserter(dictList), toItem);
if (dictList.size() > 1)
{
SettingWidget::dropdown(
"Fallback spellchecking dictionary (requires restart)",
s.spellCheckingFallback, dictList)
->addTo(layout);
}
}
#endif
layout.addStretch();
}
-15
View File
@@ -481,21 +481,6 @@ void GeneralPage::initLayout(GeneralPageView &layout)
"yours is successfully sent in the matching channel.")
->addTo(layout);
#ifdef CHATTERINO_WITH_SPELLCHECK
SettingWidget::checkbox("Check spelling by default (experimental)",
s.enableSpellChecking)
->setTooltip(
u"Check the spelling of words in the input box of all splits by "
"default. This can be overwritten per split in the context menu."
" Chatterino does not include dictionaries - they have to "
"be downloaded or created manually. Chatterino expects Hunspell "
"dictionaries in '" %
getApp()->getPaths().dictionariesDirectory %
u"'. The file index.aff has to contain the affixes and index.dic "
u"must contain the dictionary (subject to change).")
->addTo(layout);
#endif
layout.addTitle("Messages");
SettingWidget::checkbox("Separate with lines", s.separateMessages)