Commit 95b60c89 authored by WINTZ Julien's avatar WINTZ Julien

Formatting code following our latest conventions.

parent 545dc980
......@@ -78,15 +78,21 @@ int main(int argc, char **argv)
if (parser->isSet(slaveOption)) {
dtkComposerEvaluatorSlave *slave = new dtkComposerEvaluatorSlave;
if (!parser->isSet(serverOption)) {
qCritical() << "Error: no server set when running as slave! Use --server <url> " ;
return 1;
}
slave->setServer(parser->value(serverOption));
slave->setFactory(factory);
application->spawn();
do { application->exec(slave); } while (slave->status() == 0);
do {
application->exec(slave);
} while (slave->status() == 0);
application->unspawn();
} else {
......@@ -103,15 +109,17 @@ int main(int argc, char **argv)
if (parser->isSet(pgOption)) {
evaluator->setProfiling(true);
}
if (!reader->read(args.first())) {
dtkError() << "read failure for " << args.first();
return 1;
}
if (no_gui) {
evaluator->run_static();
return 0;
} else {
QObject::connect(evaluator,SIGNAL(evaluationStopped()),qApp, SLOT(quit()));
QObject::connect(evaluator, SIGNAL(evaluationStopped()), qApp, SLOT(quit()));
QtConcurrent::run(evaluator, &dtkComposerEvaluator::run_static, false);
return qApp->exec();
}
......
......@@ -18,11 +18,11 @@
dtkConceptDefinitionPage::dtkConceptDefinitionPage(QWidget *parent) : QWizardPage(parent), ui(new Ui::dtkConceptDefinitionPage)
{
this->ui->setupUi(this);
this->registerField("def.runnable",ui->m_runnable);
this->registerField("def.qObject",ui->m_qObject);
this->registerField("def.custom",ui->m_custom);
this->registerField("def.customName",ui->m_customName);
this->registerField("def.pluginSystem",ui->m_pluginSystem);
this->registerField("def.runnable", ui->m_runnable);
this->registerField("def.qObject", ui->m_qObject);
this->registerField("def.custom", ui->m_custom);
this->registerField("def.customName", ui->m_customName);
this->registerField("def.pluginSystem", ui->m_pluginSystem);
}
dtkConceptDefinitionPage::~dtkConceptDefinitionPage(void)
......
......@@ -31,96 +31,96 @@ dtkConceptGenerator::dtkConceptGenerator(void) : QWizard()
void dtkConceptGenerator::accept(void)
{
QString name=field("new.name" ).toString();
QString prefix=field("new.prefix" ).toString();
QString layer=field("new.layer" ).toString();
QString namespaceText=field("new.namespace" ).toString();
QString customName=field("def.customName" ).toString();
QString name = field("new.name" ).toString();
QString prefix = field("new.prefix" ).toString();
QString layer = field("new.layer" ).toString();
QString namespaceText = field("new.namespace" ).toString();
QString customName = field("def.customName" ).toString();
QString pluginPrefix=field("plugin.prefix" ).toString();
QString pluginSuffix=field("plugin.suffix" ).toString();
QString pluginPrefix = field("plugin.prefix" ).toString();
QString pluginSuffix = field("plugin.suffix" ).toString();
QString outputFilesPath=field("intro.path" ).toString();
QString outputFilesPath = field("intro.path" ).toString();
QMap<QString,QString> values;
QMap<QString, QString> values;
// define variables required for abstraction
values.insert("${ABSTRACTION}", prefix+"Abstract"+name);
values.insert("${LAYER_NAME}", prefix+layer);
values.insert("${_LAYER_NAME}", (prefix+layer).toUpper());
values.insert("${ABSTRACTION}", prefix + "Abstract" + name);
values.insert("${LAYER_NAME}", prefix + layer);
values.insert("${_LAYER_NAME}", (prefix + layer).toUpper());
bool inheritsCustom, inheritsQObject, inheritsQRunnable, pluginSystem, inherits=false;
bool inheritsCustom, inheritsQObject, inheritsQRunnable, pluginSystem, inherits = false;
inheritsQRunnable=field("def.runnable" ).toBool();
inheritsQObject =field("def.qObject" ).toBool();
inheritsCustom =field("def.custom" ).toBool();
pluginSystem =field("def.pluginSystem").toBool();
inheritsQRunnable = field("def.runnable" ).toBool();
inheritsQObject = field("def.qObject" ).toBool();
inheritsCustom = field("def.custom" ).toBool();
pluginSystem = field("def.pluginSystem").toBool();
if(inheritsQObject) {
values.insert("${QOBJECT}","QObject");
values.insert("${QOBJECT_INCLUDE}","#include <QObject>");
values.insert("${QOBJECT_CTR}","QObject(parent)");
values.insert("${QOBJECT_CTR_PARAM}","QObject* parent=0");
values.insert("${Q_OBJECT_MACRO}","Q_OBJECT");
inherits=true;
if (inheritsQObject) {
values.insert("${QOBJECT}", "QObject");
values.insert("${QOBJECT_INCLUDE}", "#include <QObject>");
values.insert("${QOBJECT_CTR}", "QObject(parent)");
values.insert("${QOBJECT_CTR_PARAM}", "QObject* parent=0");
values.insert("${Q_OBJECT_MACRO}", "Q_OBJECT");
inherits = true;
} else {
values.insert("${QOBJECT}","");
values.insert("${QOBJECT_INCLUDE}","");
values.insert("${QOBJECT_CTR}","");
values.insert("${QOBJECT_CTR_PARAM}","");
values.insert("${Q_OBJECT_MACRO}","");
values.insert("${QOBJECT}", "");
values.insert("${QOBJECT_INCLUDE}", "");
values.insert("${QOBJECT_CTR}", "");
values.insert("${QOBJECT_CTR_PARAM}", "");
values.insert("${Q_OBJECT_MACRO}", "");
}
if(inheritsQRunnable) {
if (inheritsQRunnable) {
QString separator = inherits ? "," : "";
values.insert("${QRUNNABLE}",separator+"public QRunnable");
values.insert("${QRUNNABLE_CTR}",separator+"QRunnable()");
values.insert("${QRUNNABLE_INCLUDE}","#include <QRunnable>");
values.insert("${QRUNNABLE}", separator + "public QRunnable");
values.insert("${QRUNNABLE_CTR}", separator + "QRunnable()");
values.insert("${QRUNNABLE_INCLUDE}", "#include <QRunnable>");
inherits=true;
inherits = true;
} else {
values.insert("${QRUNNABLE}","");
values.insert("${QRUNNABLE_CTR}","");
values.insert("${QRUNNABLE_INCLUDE}","");
values.insert("${QRUNNABLE}", "");
values.insert("${QRUNNABLE_CTR}", "");
values.insert("${QRUNNABLE_INCLUDE}", "");
}
if(inheritsCustom) {
if (inheritsCustom) {
QString separator=inherits?",": "";
QString separator = inherits ? "," : "";
values.insert("${CUSTOM_ANCESTOR}",separator+customName);
values.insert("${CUSTOM_ANCESTOR_CTR}",separator+customName);
values.insert("${CUSTOM_ANCESTOR_INCLUDE}","#include \""+customName+"\"");
inherits=true;
values.insert("${CUSTOM_ANCESTOR}", separator + customName);
values.insert("${CUSTOM_ANCESTOR_CTR}", separator + customName);
values.insert("${CUSTOM_ANCESTOR_INCLUDE}", "#include \"" + customName + "\"");
inherits = true;
} else {
values.insert("${CUSTOM_ANCESTOR}","");
values.insert("${CUSTOM_ANCESTOR_CTR}","");
values.insert("${CUSTOM_ANCESTOR_INCLUDE}","");
values.insert("${CUSTOM_ANCESTOR}", "");
values.insert("${CUSTOM_ANCESTOR_CTR}", "");
values.insert("${CUSTOM_ANCESTOR_INCLUDE}", "");
}
if(pluginSystem) {
if (pluginSystem) {
QString macroParams="("+values["${ABSTRACTION}"]+", "+values["${_LAYER_NAME}"]+"_EXPORT)";
QString macroParams = "(" + values["${ABSTRACTION}"] + ", " + values["${_LAYER_NAME}"] + "_EXPORT)";
values.insert("${PLUGIN_SYSTEM}",
"DTK_DECLARE_PLUGIN "+macroParams + "\n" +
"DTK_DECLARE_PLUGIN_FACTORY"+macroParams + "\n" +
"DTK_DECLARE_PLUGIN_MANAGER"+macroParams);
values.insert("${PLUGIN_SYSTEM}",
"DTK_DECLARE_PLUGIN " + macroParams + "\n" +
"DTK_DECLARE_PLUGIN_FACTORY" + macroParams + "\n" +
"DTK_DECLARE_PLUGIN_MANAGER" + macroParams);
}
//values for plugins
values.insert("${PLUGIN_CLASS_NAME}",pluginPrefix+name+pluginSuffix);
values.insert("${NAMESPACE}",namespaceText);
values.insert("${PLUGIN_CLASS_NAME}", pluginPrefix + name + pluginSuffix);
values.insert("${NAMESPACE}", namespaceText);
//values for node
values.insert("${NODE_CLASS_NAME}",prefix+name+"Node");
values.insert("${NODE_CLASS_NAME}", prefix + name + "Node");
generate("abstraction",values,outputFilesPath);
generate("plugin",values,outputFilesPath);
generate("node",values,outputFilesPath);
generate("abstraction", values, outputFilesPath);
generate("plugin", values, outputFilesPath);
generate("node", values, outputFilesPath);
QWizard::accept();
}
......
......@@ -19,12 +19,12 @@ dtkIntroPage::dtkIntroPage(QWidget *parent) : QWizardPage(parent), ui(new Ui::dt
{
this->ui->setupUi(this);