KTextAddons

languagetoolmanager.h
1/*
2 SPDX-FileCopyrightText: 2019-2024 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "textgrammarcheck_export.h"
10#include <QHash>
11#include <QObject>
12class QColor;
14namespace TextGrammarCheck
15{
16class TEXTGRAMMARCHECK_EXPORT LanguageToolManager : public QObject
17{
18 Q_OBJECT
19public:
20 explicit LanguageToolManager(QObject *parent = nullptr);
21 ~LanguageToolManager() override;
22 static LanguageToolManager *self();
23
24 QNetworkAccessManager *networkAccessManager() const;
25
26 [[nodiscard]] QString languageToolPath() const;
27 void setLanguageToolPath(const QString &path);
28
29 void loadSettings();
30 void saveSettings();
31
32 [[nodiscard]] QString language() const;
33 void setLanguage(const QString &language);
34
35 [[nodiscard]] bool useLocalInstance() const;
36 void setUseLocalInstance(bool useLocalInstance);
37
38 [[nodiscard]] QString languageToolCheckPath() const;
39
40 [[nodiscard]] QString languageToolLanguagesPath() const;
41
42 [[nodiscard]] static QString convertToLanguagePath(const QString &path);
43
44 [[nodiscard]] QColor grammarColorForError(const QString &error);
45
46 [[nodiscard]] bool allowToGetListOfLanguages() const;
47
48private:
49 Q_DISABLE_COPY(LanguageToolManager)
50 QHash<QString, QColor> mGrammarColor;
51 QString mLanguage;
52 QString mLanguageToolPath;
53 QNetworkAccessManager *const mNetworkAccessManager;
54 bool mUseLocalInstance = false;
55};
56}
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:02:03 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.