#include "parameterscreator.h" #include "model/step/parameters/abstractparameter.h" #include "model/step/tools.h" ParametersCreator::ParametersCreator(QObject *parent) : QObject(parent) { _model = new QStandardItemModel(); } QString ParametersCreator::getParamatersDoc() { QString result = ""; int count = _model->rowCount(); for (int i = 0 ; i < count; i++) { AbstractParameter* item = (AbstractParameter*) _model->item(i); QString temp = item->getParamaterDoc(); if (temp != "" && temp != "\n") { result += temp; if (i < count-1) result += "\n"; } } if (result == "") result = " * Aucun paramètre"; if (result.endsWith("\n")) result.chop(1); return result; } QString ParametersCreator::getParametersDeclaration() { QString result = ""; int count = _model->rowCount(); for (int i = 0 ; i < count; i++) { AbstractParameter* item = (AbstractParameter*) _model->item(i); QString temp = item->getParameterDeclaration(); if (temp != "" && temp != "\n") { result += temp; if (i < count-1) result += "\n"; } } if (result == "") result = Tools::getIndentation(1) + "// Aucun paramètre"; if (result.endsWith("\n")) result.chop(1); return result; } QString ParametersCreator::getParametersInitialization() { QString result = ""; int count = _model->rowCount(); for (int i = 0 ; i < count; i++) { AbstractParameter* item = (AbstractParameter*) _model->item(i); QString temp = item->getParameterInitialization(); if (temp != "" && temp != "\n") { result += temp; if (i < count-1) result += "\n"; } } if (result == "") result = Tools::getIndentation(1) + "// Aucun paramètre"; if (result.endsWith("\n")) result.chop(1); return result; } QString ParametersCreator::getParametersDialogCommands() { QString result = ""; int count = _model->rowCount(); for (int i = 0 ; i < count; i++) { AbstractParameter* item = (AbstractParameter*) _model->item(i); QString temp = item->getParameterDialogCommands(); if (temp != "" && temp != "\n") { result += temp; if (i < count-1) result += "\n"; } } if (result == "") result = Tools::getIndentation(1) + "// Aucun paramètre\n" + Tools::getIndentation(1) + "Q_UNUSED(postInputConfigDialog);"; if (result.endsWith("\n")) result.chop(1); return result; }