Commit 242609ac authored by Laurent Montel's avatar Laurent Montel 😁

Continue to extract settings

parent 1d6550cb
......@@ -19,6 +19,8 @@
#include "grammalectegenerateconfigoptionjob.h"
#include "grammalecteplugin_debug.h"
#include <QRegularExpression>
#include <QRegularExpressionMatch>
GrammalecteGenerateConfigOptionJob::GrammalecteGenerateConfigOptionJob(QObject *parent)
: QObject(parent)
......@@ -93,15 +95,25 @@ void GrammalecteGenerateConfigOptionJob::slotFinished(int exitCode, QProcess::Ex
if (exitStatus != 0 || exitCode != 0) {
qDebug() << " ERROR :!!!!!!!!!!!!!!!!!!!!";
} else {
parseResult();
//TODO fixit !
Q_EMIT finished({});
Q_EMIT finished(parseResult());
}
deleteLater();
}
void GrammalecteGenerateConfigOptionJob::parseResult()
QVector<GrammalecteGenerateConfigOptionJob::Option> GrammalecteGenerateConfigOptionJob::parseResult() const
{
QVector<GrammalecteGenerateConfigOptionJob::Option> opt;
QRegularExpression reg(QStringLiteral("^([a-zA-Z0-9]+):\\s*(True|False)\\s*(.*)$"));
const QStringList lst = mResult.split(QLatin1Char('\n'));
for (const QString &str : lst) {
const QRegularExpressionMatch match = reg.match(str);
if (match.hasMatch()) {
const QString optionName = match.captured(0);
const QString value = match.captured(1);
const QString description = match.captured(2);
qDebug() << "optionName " << optionName << " value " << value << " description " << description;
}
}
return opt;
}
......@@ -55,7 +55,7 @@ Q_SIGNALS:
private:
void receivedStandardOutput();
void slotFinished(int exitCode, QProcess::ExitStatus exitStatus);
void parseResult();
QVector<GrammalecteGenerateConfigOptionJob::Option> parseResult() const;
QString mResult;
QString mPythonPath;
QString mGrammarlecteCliPath;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment