Commit c6bfd73f authored by Laurent Montel's avatar Laurent Montel 😁

Load default value

parent a91cf4df
......@@ -45,3 +45,14 @@ GrammalecteConfigDialog::~GrammalecteConfigDialog()
{
}
void GrammalecteConfigDialog::loadSettings()
{
//TODO
}
void GrammalecteConfigDialog::saveSettings()
{
//TODO
}
......@@ -29,6 +29,8 @@ public:
explicit GrammalecteConfigDialog(QWidget *parent = nullptr);
~GrammalecteConfigDialog();
private:
void loadSettings();
void saveSettings();
GrammalecteConfigWidget *mConfigWidget = nullptr;
};
......
......@@ -65,6 +65,7 @@ void GrammalecteConfigWidget::slotGetSettingsFinished(const QVector<GrammalecteG
for (const GrammalecteGenerateConfigOptionJob::Option &opt : result) {
QCheckBox *box = new QCheckBox(opt.description, this);
box->setProperty("optionname", opt.optionName);
box->setChecked(opt.defaultValue);
mGrammarTabWidget->layout()->addWidget(box);
mListOptions.append(box);
}
......
......@@ -110,12 +110,13 @@ QVector<GrammalecteGenerateConfigOptionJob::Option> GrammalecteGenerateConfigOpt
const QRegularExpressionMatch match = reg.match(str);
if (match.hasMatch()) {
const QString optionName = match.captured(1);
//const QString value = match.captured(2);
const QString value = match.captured(2);
const QString description = match.captured(3);
if (!optionName.isEmpty() && !description.isEmpty()) {
if (!optionName.isEmpty() && !description.isEmpty() && !value.isEmpty()) {
GrammalecteGenerateConfigOptionJob::Option opt;
opt.description = description;
opt.optionName = optionName;
opt.defaultValue = (value == QStringLiteral("True"));
opts.append(opt);
}
}
......
......@@ -34,6 +34,7 @@ public:
{
QString optionName;
QString description;
bool defaultValue = false;
};
explicit GrammalecteGenerateConfigOptionJob(QObject *parent = nullptr);
......
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