KTextAddons

grammalectegenerateconfigoptionjob.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 <QObject>
11#include <QProcess>
12#include <QVector>
13namespace TextGrammarCheck
14{
15class TEXTGRAMMARCHECK_EXPORT GrammalecteGenerateConfigOptionJob : public QObject
16{
17 Q_OBJECT
18public:
19 struct Option {
20 QString optionName;
21 QString description;
22 bool defaultValue = false;
23 };
24
25 explicit GrammalecteGenerateConfigOptionJob(QObject *parent = nullptr);
26 ~GrammalecteGenerateConfigOptionJob() override;
27
28 void start();
29 [[nodiscard]] bool canStart() const;
30
31 [[nodiscard]] QString pythonPath() const;
32 void setPythonPath(const QString &pythonPath);
33
34 [[nodiscard]] QString grammarlecteCliPath() const;
35 void setGrammarlecteCliPath(const QString &grammarlecteCliPath);
36
37Q_SIGNALS:
38 void error();
39 void finished(const QVector<GrammalecteGenerateConfigOptionJob::Option> &result);
40
41private:
42 Q_DISABLE_COPY(GrammalecteGenerateConfigOptionJob)
43 TEXTGRAMMARCHECK_NO_EXPORT void receivedStandardOutput();
44 TEXTGRAMMARCHECK_NO_EXPORT void slotFinished(int exitCode, QProcess::ExitStatus exitStatus);
45 TEXTGRAMMARCHECK_NO_EXPORT void receivedError();
46 TEXTGRAMMARCHECK_NO_EXPORT void receivedStdErr();
47 TEXTGRAMMARCHECK_NO_EXPORT QVector<GrammalecteGenerateConfigOptionJob::Option> parseResult() const;
48 QString mResult;
49 QString mPythonPath;
50 QString mGrammarlecteCliPath;
51 QString mLastError;
52 QProcess *mProcess = nullptr;
53};
54}
55Q_DECLARE_TYPEINFO(TextGrammarCheck::GrammalecteGenerateConfigOptionJob::Option, Q_MOVABLE_TYPE);
Q_SCRIPTABLE Q_NOREPLY void start()
void error(QWidget *parent, const QString &text, const QString &title, const KGuiItem &buttonOk, Options options=Notify)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:29:59 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.