aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJuergen Bocklage-Ryannel <juergen.bocklage-ryannel@pelagicore.com>2017-07-08 11:16:24 +0200
committerJuergen Bocklage-Ryannel <juergen.bocklage-ryannel@pelagicore.com>2017-07-08 11:16:24 +0200
commite4206bad07d39eeeb719ee82768819a69e6c09bf (patch)
tree40f39952f71d1dc34a61450671d9f036f8eb3956
parent729d206c289bfaba33ce2067a564e36d804350ed (diff)
remove the QML prefix from the generated code. Ideally there will
be a prefix as parameter. But maybe later.
-rw-r--r--qface/builtin/qtcpp/templates/abstractinterface.h2
-rw-r--r--qface/builtin/qtcpp/templates/generated.pri20
-rw-r--r--qface/builtin/qtcpp/templates/interface.cpp4
-rw-r--r--qface/builtin/qtcpp/templates/interface.h8
-rw-r--r--qface/builtin/qtcpp/templates/module.cpp8
-rw-r--r--qface/builtin/qtcpp/templates/module.h10
-rw-r--r--qface/builtin/qtcpp/templates/plugin.cpp6
-rw-r--r--qface/builtin/qtcpp/templates/struct.cpp8
-rw-r--r--qface/builtin/qtcpp/templates/struct.h4
-rw-r--r--qface/builtin/qtcpp/templates/structmodel.cpp10
10 files changed, 44 insertions, 36 deletions
diff --git a/qface/builtin/qtcpp/templates/abstractinterface.h b/qface/builtin/qtcpp/templates/abstractinterface.h
index 17be77a..de45f24 100644
--- a/qface/builtin/qtcpp/templates/abstractinterface.h
+++ b/qface/builtin/qtcpp/templates/abstractinterface.h
@@ -9,7 +9,7 @@
#include <QtCore>
-#include "qml{{module.module_name|lower}}module.h"
+#include "{{module.module_name|lower}}module.h"
class {{class}} : public QObject
{
diff --git a/qface/builtin/qtcpp/templates/generated.pri b/qface/builtin/qtcpp/templates/generated.pri
index 7457474..ac176db 100644
--- a/qface/builtin/qtcpp/templates/generated.pri
+++ b/qface/builtin/qtcpp/templates/generated.pri
@@ -8,26 +8,26 @@ QT += qml quick
CONFIG += c++11
HEADERS += \
- $$PWD/qml{{module.module_name|lower}}module.h \
+ $$PWD/{{module.module_name|lower}}module.h \
{% for interface in module.interfaces %}
- $$PWD/qmlabstract{{interface|lower}}.h \
+ $$PWD/abstract{{interface|lower}}.h \
{% endfor %}
{% for struct in module.structs %}
- $$PWD/qml{{struct|lower}}.h \
- $$PWD/qml{{struct|lower}}model.h \
+ $$PWD/{{struct|lower}}.h \
+ $$PWD/{{struct|lower}}model.h \
{% endfor %}
- $$PWD/qmlvariantmodel.h
+ $$PWD/variantmodel.h
SOURCES += \
- $$PWD/qml{{module.module_name|lower}}module.cpp \
+ $$PWD/{{module.module_name|lower}}module.cpp \
{% for interface in module.interfaces %}
- $$PWD/qmlabstract{{interface|lower}}.cpp \
+ $$PWD/abstract{{interface|lower}}.cpp \
{% endfor %}
{% for struct in module.structs %}
- $$PWD/qml{{struct|lower}}.cpp \
- $$PWD/qml{{struct|lower}}model.cpp \
+ $$PWD/{{struct|lower}}.cpp \
+ $$PWD/{{struct|lower}}model.cpp \
{% endfor %}
- $$PWD/qmlvariantmodel.cpp
+ $$PWD/variantmodel.cpp
diff --git a/qface/builtin/qtcpp/templates/interface.cpp b/qface/builtin/qtcpp/templates/interface.cpp
index 7aab4ae..bbd705a 100644
--- a/qface/builtin/qtcpp/templates/interface.cpp
+++ b/qface/builtin/qtcpp/templates/interface.cpp
@@ -1,5 +1,5 @@
{# Copyright (c) Pelagicore AB 2016 #}
-{% set class = 'Qml{0}'.format(interface) %}
+{% set class = '{0}'.format(interface) %}
/*
* This is a preserved file.
* Changes will not be overriden by the generator.
@@ -33,7 +33,7 @@ QObject* {{class|lower}}_singletontype_provider(QQmlEngine*, QJSEngine*)
{{interface.comment}}
{{class}}::{{class}}(QObject *parent)
- : QmlAbstract{{interface}}(parent)
+ : Abstract{{interface}}(parent)
{
}
diff --git a/qface/builtin/qtcpp/templates/interface.h b/qface/builtin/qtcpp/templates/interface.h
index c1722f2..4a1448b 100644
--- a/qface/builtin/qtcpp/templates/interface.h
+++ b/qface/builtin/qtcpp/templates/interface.h
@@ -1,5 +1,5 @@
{# Copyright (c) Pelagicore AB 2016 #}
-{% set class = 'Qml{0}'.format(interface) %}
+{% set class = '{0}'.format(interface) %}
/*
* This is a preserved file.
* Changes will not be overriden by the generator.
@@ -10,10 +10,10 @@
#include <QtCore>
-#include "generated/qml{{module.module_name|lower}}module.h"
-#include "generated/qmlabstract{{interface|lower}}.h"
+#include "generated/{{module.module_name|lower}}module.h"
+#include "generated/abstract{{interface|lower}}.h"
-class {{class}} : public QmlAbstract{{interface}}
+class {{class}} : public Abstract{{interface}}
{
Q_OBJECT
public:
diff --git a/qface/builtin/qtcpp/templates/module.cpp b/qface/builtin/qtcpp/templates/module.cpp
index af2d2f1..46aeec7 100644
--- a/qface/builtin/qtcpp/templates/module.cpp
+++ b/qface/builtin/qtcpp/templates/module.cpp
@@ -45,16 +45,16 @@ QObject* {{class|lower}}_singletontype_provider(QQmlEngine*, QJSEngine*)
\qmlmethod {{struct}} {{module.module_name}}Module::create{{struct}}()
\brief Creates a default constructed data object from type {{struct}}
*/
-Qml{{struct}} {{class}}::create{{struct}}()
+{{struct}} {{class}}::create{{struct}}()
{
- return Qml{{struct}}();
+ return {{struct}}();
}
{% endfor %}
void {{class}}::registerTypes()
{
{% for struct in module.structs %}
- qRegisterMetaType<Qml{{struct}}>();
+ qRegisterMetaType<{{struct}}>();
{% endfor %}
{% for enum in module.enums %}
qRegisterMetaType<{{class}}::{{enum}}>();
@@ -64,7 +64,7 @@ void {{class}}::registerTypes()
void {{class}}::registerQmlTypes(const QString& uri, int majorVersion, int minorVersion)
{
{% for struct in module.structs %}
- qmlRegisterUncreatableType<Qml{{struct}}Model>(uri.toLatin1(), majorVersion, minorVersion, "{{struct}}Model", "Model can not be instantiated from QML");
+ qmlRegisterUncreatableType<{{struct}}Model>(uri.toLatin1(), majorVersion, minorVersion, "{{struct}}Model", "Model can not be instantiated from QML");
{% endfor %}
qmlRegisterSingletonType<{{class}}>(uri.toLatin1(), majorVersion, minorVersion, "{{module.module_name}}Module", {{class|lower}}_singletontype_provider);
}
diff --git a/qface/builtin/qtcpp/templates/module.h b/qface/builtin/qtcpp/templates/module.h
index 5e9ff6f..6d09f37 100644
--- a/qface/builtin/qtcpp/templates/module.h
+++ b/qface/builtin/qtcpp/templates/module.h
@@ -3,16 +3,16 @@
** This is an auto-generated file.
** Do not edit! All changes made to it will be lost.
****************************************************************************/
-{% set class = 'Qml{0}Module'.format(module.module_name) %}
+{% set class = '{0}Module'.format(module.module_name) %}
#pragma once
#include <QtCore>
-#include "qmlvariantmodel.h"
+#include "variantmodel.h"
{% for struct in module.structs %}
-#include "qml{{struct|lower}}.h"
-#include "qml{{struct|lower}}model.h"
+#include "{{struct|lower}}.h"
+#include "{{struct|lower}}model.h"
{% endfor %}
class {{class}} : public QObject {
@@ -33,7 +33,7 @@ public:
{% endfor %}
{% for struct in module.structs %}
- Q_INVOKABLE Qml{{struct}} create{{struct}}();
+ Q_INVOKABLE {{struct}} create{{struct}}();
{% endfor %}
static void registerTypes();
diff --git a/qface/builtin/qtcpp/templates/plugin.cpp b/qface/builtin/qtcpp/templates/plugin.cpp
index aa8fb9a..c7821ae 100644
--- a/qface/builtin/qtcpp/templates/plugin.cpp
+++ b/qface/builtin/qtcpp/templates/plugin.cpp
@@ -12,15 +12,15 @@
#include "generated/{{module_name|lower}}.h"
{% for interface in module.interfaces %}
-#include "qml{{interface|lower}}.h"
+#include "{{interface|lower}}.h"
{% endfor %}
void Plugin::registerTypes(const char *uri)
{
- {{module_name}}::registerTypes();
+ {{module_name}}::registerTypes();
// @uri {{module|lower}}
{{module_name}}::registerQmlTypes(uri, 1, 0);
{% for interface in module.interfaces %}
- Qml{{interface}}::registerQmlTypes(uri, 1, 0);
+ {{interface}}::registerQmlTypes(uri, 1, 0);
{% endfor %}
}
diff --git a/qface/builtin/qtcpp/templates/struct.cpp b/qface/builtin/qtcpp/templates/struct.cpp
index 86f358c..c8a2f03 100644
--- a/qface/builtin/qtcpp/templates/struct.cpp
+++ b/qface/builtin/qtcpp/templates/struct.cpp
@@ -7,6 +7,8 @@
****************************************************************************/
#include "{{class|lower}}.h"
+#include <QtQml>
+
class {{class}}Data : public QSharedData
@@ -64,6 +66,12 @@ public:
{
}
+void {{class}}::registerQmlTypes(const QString& uri, int majorVersion=1, int minorVersion=0);
+{
+ qmlRegisterType<{{class}}>(uri.toLatin1(), majorVersion, minorVersion, "{{class}}");
+}
+
+
{% for field in struct.fields %}
/*!
\qmlproperty {{field.type}} {{struct}}::{{field}} (field)
diff --git a/qface/builtin/qtcpp/templates/struct.h b/qface/builtin/qtcpp/templates/struct.h
index 7c6a4e6..54c8715 100644
--- a/qface/builtin/qtcpp/templates/struct.h
+++ b/qface/builtin/qtcpp/templates/struct.h
@@ -24,6 +24,8 @@ public:
{{class}}(const {{class}} &other);
~{{class}}();
+ static void registerQmlTypes(const QString& uri, int majorVersion=1, int minorVersion=0);
+
Q_INVOKABLE {{class}} clone();
bool operator==(const {{class}} &other) const;
@@ -40,6 +42,4 @@ private:
QExplicitlySharedDataPointer <{{class}}Data> d;
};
-Q_DECLARE_METATYPE({{class}})
-
diff --git a/qface/builtin/qtcpp/templates/structmodel.cpp b/qface/builtin/qtcpp/templates/structmodel.cpp
index 2759dae..58cc871 100644
--- a/qface/builtin/qtcpp/templates/structmodel.cpp
+++ b/qface/builtin/qtcpp/templates/structmodel.cpp
@@ -20,7 +20,7 @@ int {{class}}::count() const
return m_data.count();
}
-Qml{{struct}} {{class}}::get(int index)
+{{struct}} {{class}}::get(int index)
{
return m_data.value(index);
}
@@ -52,7 +52,7 @@ QHash<int, QByteArray> {{class}}::roleNames() const
}
-void {{class}}::insert(int row, const Qml{{struct}} &{{struct|lower}})
+void {{class}}::insert(int row, const {{struct}} &{{struct|lower}})
{
if (row < 0)
row = 0;
@@ -65,19 +65,19 @@ void {{class}}::insert(int row, const Qml{{struct}} &{{struct|lower}})
emit countChanged(count());
}
-void {{class}}::reset(const QList<Qml{{struct}}> data)
+void {{class}}::reset(const QList<{{struct}}> data)
{
beginResetModel();
m_data = data;
endResetModel();
}
-void {{class}}::append(const Qml{{struct}} &{{struct|lower}})
+void {{class}}::append(const {{struct}} &{{struct|lower}})
{
insert(m_data.count(), {{struct|lower}});
}
-void {{class}}::update(int row, const Qml{{struct}} &{{struct|lower}})
+void {{class}}::update(int row, const {{struct}} &{{struct|lower}})
{
if(row < 0 || row >= m_data.count()) {
return;