diff options
Diffstat (limited to 'qface/builtin/qtcpp/templates')
24 files changed, 0 insertions, 1043 deletions
diff --git a/qface/builtin/qtcpp/templates/CMakeLists.txt b/qface/builtin/qtcpp/templates/CMakeLists.txt deleted file mode 100644 index bb7fdb9..0000000 --- a/qface/builtin/qtcpp/templates/CMakeLists.txt +++ /dev/null @@ -1,42 +0,0 @@ -{% set module_name = module.name.lower().replace(".", "_") %} -{% set module_path = module.name_parts|join('/') %} - -project({{module_name}}) - -cmake_minimum_required(VERSION 3.1) - -set(CMAKE_CXX_STANDARD 11) -set(CMAKE_AUTOMOC ON) - -set(INSTALL_PATH "${CMAKE_BINARY_DIR}/imports" CACHE STRING "Path where the plugins are deployed") - -find_package(Qt5Core REQUIRED) -find_package(Qt5Qml REQUIRED) - -set (SOURCES - generated/qml{{module.module_name|lower}}module.cpp -{% for interface in module.interfaces %} - generated/qmlabstract{{interface|lower}}.cpp -{% endfor %} -{% for struct in module.structs %} - generated/qml{{struct|lower}}.cpp - generated/qml{{struct|lower}}model.cpp -{% endfor %} - generated/qmlvariantmodel.cpp -{% for interface in module.interfaces %} - qml{{interface|lower}}.cpp -{% endfor %} - plugin.cpp -) - -add_library({{module_name}}_plugin SHARED ${SOURCES}) - -set(OUTPUT_PATH ${INSTALL_PATH}/{{module_path}}) - -set_target_properties({{module_name}}_plugin PROPERTIES - LIBRARY_OUTPUT_DIRECTORY ${OUTPUT_PATH} - RUNTIME_OUTPUT_DIRECTORY ${OUTPUT_PATH} -) - -target_link_libraries({{module_name}}_plugin PUBLIC Qt5::Core Qt5::Qml) -configure_file(${CMAKE_SOURCE_DIR}/qmldir ${OUTPUT_PATH}/qmldir COPYONLY) diff --git a/qface/builtin/qtcpp/templates/__init__.py b/qface/builtin/qtcpp/templates/__init__.py deleted file mode 100644 index e69de29..0000000 --- a/qface/builtin/qtcpp/templates/__init__.py +++ /dev/null diff --git a/qface/builtin/qtcpp/templates/abstractinterface.cpp b/qface/builtin/qtcpp/templates/abstractinterface.cpp deleted file mode 100644 index 3a70cb6..0000000 --- a/qface/builtin/qtcpp/templates/abstractinterface.cpp +++ /dev/null @@ -1,77 +0,0 @@ -{# Copyright (c) Pelagicore AB 2016 #} -{% set class = 'QmlAbstract{0}'.format(interface) %} -/**************************************************************************** -** This is an auto-generated file. -** Do not edit! All changes made to it will be lost. -****************************************************************************/ - -#include "{{class|lower}}.h" - -#include <QtQml> - -/*! - \qmltype {{interface}} - \inqmlmodule {{module}} -{% with doc = interface.comment|parse_doc %} - \brief {{doc.brief}} - - {{doc.description}} -{% endwith %} -*/ -{{class}}::{{class}}(QObject *parent) - : QObject(parent) -{% for property in interface.properties %} - , m_{{property}}({{property|defaultValue}}) -{% endfor %} -{ -} - - -{{class}}::~{{class}}() -{ -} - -{% for property in interface.properties %} -/*! - \qmlproperty {{property.type}} {{interface}}::{{property}} -{% with doc = property.comment|parse_doc %} - \brief {{doc.brief}} - - {{doc.description}} -{% endwith %} -*/ - -void {{class}}::set{{property|upperfirst}}({{ property|parameterType }}) -{ - if(m_{{property}} == {{property}}) { - return; - } - m_{{property}} = {{property}}; - emit {{property}}Changed(); -} - -{{property|returnType}} {{class}}::{{property}}() const -{ - return m_{{property}}; -} -{% endfor %} - -{%- for operation in interface.operations %} -/*! - \qmlmethod {{operation.type}} {{interface}}::{{operation}}({{operation.parameters|map('parameterType')|join(', ')}}) -{% with doc = operation.comment|parse_doc %} - \brief {{doc.brief}} - {{doc.description}} -{% endwith %} -*/ -{{operation|returnType}} {{class}}::{{operation}}({{operation.parameters|map('parameterType')|join(', ')}}) -{ - {% for parameter in operation.parameters %} - Q_UNUSED({{parameter.name}}); - {% endfor %} - qWarning() << "{{class}}::{{operation}}(...) not implemented"; - return {{operation|defaultValue}}; -} -{% endfor %} - - diff --git a/qface/builtin/qtcpp/templates/abstractinterface.h b/qface/builtin/qtcpp/templates/abstractinterface.h deleted file mode 100644 index 17be77a..0000000 --- a/qface/builtin/qtcpp/templates/abstractinterface.h +++ /dev/null @@ -1,52 +0,0 @@ -{# Copyright (c) Pelagicore AB 2016 #} -{% set class = 'QmlAbstract{0}'.format(interface) %} -/**************************************************************************** -** This is an auto-generated file. -** Do not edit! All changes made to it will be lost. -****************************************************************************/ - -#pragma once - -#include <QtCore> - -#include "qml{{module.module_name|lower}}module.h" - -class {{class}} : public QObject -{ - Q_OBJECT -{% for property in interface.properties %} - Q_PROPERTY({{property|returnType}} {{property}} READ {{property}} {% if not property.readonly %}WRITE set{{property|upperfirst}} {% endif %}{% if not property.const %}NOTIFY {{property}}Changed{% endif %}) -{% endfor %} - -public: - {{class}}(QObject *parent = nullptr); - ~{{class}}(); - -public Q_SLOTS: -{% for operation in interface.operations %} - virtual {{operation|returnType}} {{operation}}({{operation.parameters|map('parameterType')|join(', ')}}); -{% endfor %} - -public: -{% for property in interface.properties %} - virtual void set{{property|upperfirst}}({{ property|parameterType }}); -{% endfor %} - -public: -{% for property in interface.properties %} - virtual {{property|returnType}} {{property}}() const; -{% endfor %} - -Q_SIGNALS: -{% for signal in interface.signals %} - void {{signal}}({{signal.parameters|map('parameterType')|join(', ')}}); -{% endfor %} -{% for property in interface.properties %} - void {{property}}Changed(); -{% endfor %} - -protected: -{% for property in interface.properties %} - {{property|returnType}} m_{{property}}; -{% endfor %} -}; diff --git a/qface/builtin/qtcpp/templates/docs.pri b/qface/builtin/qtcpp/templates/docs.pri deleted file mode 100644 index f6a3e81..0000000 --- a/qface/builtin/qtcpp/templates/docs.pri +++ /dev/null @@ -1,32 +0,0 @@ -exists($$[QT_INSTALL_BINS]/qdoc):exists($$[QT_INSTALL_BINS]/qhelpgenerator) { - check_qdoc = "qdoc/qhelpgenerator in $$[QT_INSTALL_BINS]" - QDOC = $$[QT_INSTALL_BINS]/qdoc - QHELPGENERATOR = $$[QT_INSTALL_BINS]/qhelpgenerator -} else { - check_qdoc = "qdoc/qhelpgenerator in PATH" - QDOC = qdoc - QHELPGENERATOR = qhelpgenerator -} - -defineReplace(cmdEnv) { - !equals(QMAKE_DIR_SEP, /): 1 ~= s,^(.*)$,(set \\1) &&,g - return("$$1") -} - -defineReplace(qdoc) { - return("$$cmdEnv(OUTDIR=$$1 QMLLIVE_VERSION=$$VERSION QMLLIVE_VERSION_TAG=$$VERSION_TAG QT_INSTALL_DOCS=$$[QT_INSTALL_DOCS/src]) $$QDOC") -} - -html-docs.commands = $$qdoc($$BUILD_DIR/doc/html) $$PWD/plugin.qdocconf -html-docs.files = $$BUILD_DIR/doc/html - -docs.depends = html-docs - -QMAKE_EXTRA_TARGETS += html-docs docs - - -OTHER_FILES += \ - $$PWD/*.qdocconf \ - $$PWD/*.qdoc \ - $$PWD/examples/*.qdoc \ - $$PWD/images/*.png diff --git a/qface/builtin/qtcpp/templates/generated.pri b/qface/builtin/qtcpp/templates/generated.pri deleted file mode 100644 index 7457474..0000000 --- a/qface/builtin/qtcpp/templates/generated.pri +++ /dev/null @@ -1,33 +0,0 @@ -{# Copyright (c) Pelagicore AB 2016 #} -############################################################################# -## This is an auto-generated file. -## Do not edit! All changes made to it will be lost. -############################################################################# - -QT += qml quick -CONFIG += c++11 - -HEADERS += \ - $$PWD/qml{{module.module_name|lower}}module.h \ -{% for interface in module.interfaces %} - $$PWD/qmlabstract{{interface|lower}}.h \ -{% endfor %} -{% for struct in module.structs %} - $$PWD/qml{{struct|lower}}.h \ - $$PWD/qml{{struct|lower}}model.h \ -{% endfor %} - $$PWD/qmlvariantmodel.h - - -SOURCES += \ - $$PWD/qml{{module.module_name|lower}}module.cpp \ -{% for interface in module.interfaces %} - $$PWD/qmlabstract{{interface|lower}}.cpp \ -{% endfor %} -{% for struct in module.structs %} - $$PWD/qml{{struct|lower}}.cpp \ - $$PWD/qml{{struct|lower}}model.cpp \ -{% endfor %} - $$PWD/qmlvariantmodel.cpp - - diff --git a/qface/builtin/qtcpp/templates/interface.cpp b/qface/builtin/qtcpp/templates/interface.cpp deleted file mode 100644 index 7aab4ae..0000000 --- a/qface/builtin/qtcpp/templates/interface.cpp +++ /dev/null @@ -1,51 +0,0 @@ -{# Copyright (c) Pelagicore AB 2016 #} -{% set class = 'Qml{0}'.format(interface) %} -/* - * This is a preserved file. - * Changes will not be overriden by the generator. - * To reset the file you need to delete it first. - */ - -#include "{{class|lower}}.h" - -#include <QtQml> - - -/*! - \inqmlmodule {{module}} 1.0 - */ - -QObject* {{class|lower}}_singletontype_provider(QQmlEngine*, QJSEngine*) -{ - return new {{class}}(); -} - - -/*! - \qmltype {{interface}} - \inqmlmodule {{module}} -{% with doc = interface.comment|parse_doc %} - \brief {{doc.brief}} - - {{doc.description}} -{% endwith %} -*/ - -{{interface.comment}} -{{class}}::{{class}}(QObject *parent) - : QmlAbstract{{interface}}(parent) -{ -} - -{{class}}::~{{class}}() -{ -} - -void {{class}}::registerQmlTypes(const QString& uri, int majorVersion, int minorVersion) -{ - {% if 'singleton' in interface.tags %} - qmlRegisterSingletonType<{{class}}>(uri.toLatin1(), majorVersion, minorVersion, "{{interface}}", {{class|lower}}_singletontype_provider); - {% else %} - qmlRegisterType<{{class}}>(uri.toLatin1(), majorVersion, minorVersion, "{{interface}}"); - {% endif %} -} diff --git a/qface/builtin/qtcpp/templates/interface.h b/qface/builtin/qtcpp/templates/interface.h deleted file mode 100644 index c1722f2..0000000 --- a/qface/builtin/qtcpp/templates/interface.h +++ /dev/null @@ -1,24 +0,0 @@ -{# Copyright (c) Pelagicore AB 2016 #} -{% set class = 'Qml{0}'.format(interface) %} -/* - * This is a preserved file. - * Changes will not be overriden by the generator. - * To reset the file you need to delete it first. - */ - -#pragma once - -#include <QtCore> - -#include "generated/qml{{module.module_name|lower}}module.h" -#include "generated/qmlabstract{{interface|lower}}.h" - -class {{class}} : public QmlAbstract{{interface}} -{ - Q_OBJECT -public: - {{class}}(QObject *parent = nullptr); - virtual ~{{class}}(); - - static void registerQmlTypes(const QString& uri, int majorVersion=1, int minorVersion=0); -}; diff --git a/qface/builtin/qtcpp/templates/module.cpp b/qface/builtin/qtcpp/templates/module.cpp deleted file mode 100644 index af2d2f1..0000000 --- a/qface/builtin/qtcpp/templates/module.cpp +++ /dev/null @@ -1,82 +0,0 @@ -{# Copyright (c) Pelagicore AB 2016 #} -/**************************************************************************** -** 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) %} - - -#include "{{class|lower}}.h" - -#include <QtQml> - -/*! - \qmlmodule {{module}} 1.0 -{% with doc = module.comment|parse_doc %} - - {{doc.brief}} - - - {{doc.description}} -{% endwith %} - */ - - -/*! - \qmltype {{module.module_name}}Module - \inqmlmodule {{module}} - \brief API to access module functionality - - Provides the enumerations and data type factories for - this module. -*/ -QObject* {{class|lower}}_singletontype_provider(QQmlEngine*, QJSEngine*) -{ - return new {{class}}(); -} - -{{class}}::{{class}}(QObject *parent) - : QObject(parent) -{ -} - -{% for struct in module.structs %} -/*! - \qmlmethod {{struct}} {{module.module_name}}Module::create{{struct}}() - \brief Creates a default constructed data object from type {{struct}} -*/ -Qml{{struct}} {{class}}::create{{struct}}() -{ - return Qml{{struct}}(); -} -{% endfor %} - -void {{class}}::registerTypes() -{ - {% for struct in module.structs %} - qRegisterMetaType<Qml{{struct}}>(); - {% endfor %} - {% for enum in module.enums %} - qRegisterMetaType<{{class}}::{{enum}}>(); - {% endfor %} -} - -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"); - {% endfor %} - qmlRegisterSingletonType<{{class}}>(uri.toLatin1(), majorVersion, minorVersion, "{{module.module_name}}Module", {{class|lower}}_singletontype_provider); -} - - -{% for enum in module.enums %} -/** - * \qmlproperty enumeration {{module.module_name}}Module::{{enum}} - * \list - {% for member in enum.members %} - * \li {{member}} - {% endfor %} - * \endlist - */ -{% endfor %}
\ No newline at end of file diff --git a/qface/builtin/qtcpp/templates/module.h b/qface/builtin/qtcpp/templates/module.h deleted file mode 100644 index 5e9ff6f..0000000 --- a/qface/builtin/qtcpp/templates/module.h +++ /dev/null @@ -1,41 +0,0 @@ -{# Copyright (c) Pelagicore AB 2016 #} -/**************************************************************************** -** 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) %} - -#pragma once - -#include <QtCore> - -#include "qmlvariantmodel.h" -{% for struct in module.structs %} -#include "qml{{struct|lower}}.h" -#include "qml{{struct|lower}}model.h" -{% endfor %} - -class {{class}} : public QObject { - Q_OBJECT -public: - {{class}}(QObject *parent = nullptr); - -{% for enum in module.enums %} - {% set comma = joiner(",") %} - enum {{enum}} { - {%- for member in enum.members -%} - {{ comma() }} - {{member.name}} = {{member.value}} - {%- endfor %} - - }; - Q_ENUM({{enum}}) -{% endfor %} - -{% for struct in module.structs %} - Q_INVOKABLE Qml{{struct}} create{{struct}}(); -{% endfor %} - - static void registerTypes(); - static void registerQmlTypes(const QString& uri, int majorVersion = 1, int minorVersion = 0); -}; diff --git a/qface/builtin/qtcpp/templates/plugin-online.qdocconf b/qface/builtin/qtcpp/templates/plugin-online.qdocconf deleted file mode 100644 index 771cdae..0000000 --- a/qface/builtin/qtcpp/templates/plugin-online.qdocconf +++ /dev/null @@ -1,19 +0,0 @@ -HTML.footer = \ - " </div>\n" \ - " <p class=\"copy-notice\">\n" \ - " <acronym title=\"Copyright\">©</acronym> 2016 Pelagicore AG.\n" \ - " Documentation contributions included herein are the copyrights of\n" \ - " their respective owners. " \ - " The documentation provided herein is licensed under the terms of the" \ - " <a href=\"http://www.gnu.org/licenses/fdl.html\">GNU Free Documentation" \ - " License version 1.3</a> as published by the Free Software Foundation. " \ - " Qt and respective logos are trademarks of The Qt Company Ltd. " \ - " in Finland and/or other countries worldwide. All other trademarks are property\n" \ - " of their respective owners. </p>\n" - -include($QT_INSTALL_DOCS/global/qt-html-templates-online.qdocconf) - -# Add an .html file with sidebar content, used in the online style -# HTML.stylesheets += style/qt5-sidebar.html - -include(plugin-project.qdocconf) diff --git a/qface/builtin/qtcpp/templates/plugin-project.qdocconf b/qface/builtin/qtcpp/templates/plugin-project.qdocconf deleted file mode 100644 index 0a846cb..0000000 --- a/qface/builtin/qtcpp/templates/plugin-project.qdocconf +++ /dev/null @@ -1,27 +0,0 @@ -{% set module_name = module|lower|replace(".", "_")%} -project = {{module}} -description = {{module|upper}} Reference Documentation -version = 1.0 - -sources.fileextensions = "*.cpp *.qdoc *.mm *.qml" -headers.fileextensions = "*.h *.ch *.h++ *.hh *.hpp *.hxx" - -examples.fileextensions = "*.cpp *.h *.js *.xq *.svg *.xml *.ui *.qhp *.qhcp *.qml" -examples.imageextensions = "*.png *.jpeg *.jpg *.gif *.mng" - -outputdir = html - -exampledirs = ../examples ../src - -headerdirs = \ - .. \ - ../generated - -sourcedirs = \ - .. \ - ../generated - -imagedirs = images - -navigation.landingpage = "{{module}}" -buildversion = "{{module_name}} 1.0" diff --git a/qface/builtin/qtcpp/templates/plugin.cpp b/qface/builtin/qtcpp/templates/plugin.cpp deleted file mode 100644 index aa8fb9a..0000000 --- a/qface/builtin/qtcpp/templates/plugin.cpp +++ /dev/null @@ -1,26 +0,0 @@ -{# Copyright (c) Pelagicore AB 2016 #} -{% set module_name = 'Qml{0}Module'.format(module.module_name) %} -/**************************************************************************** -** This is an auto-generated file. -** Do not edit! All changes made to it will be lost. -****************************************************************************/ - -#include "plugin.h" - -#include <qqml.h> - -#include "generated/{{module_name|lower}}.h" - -{% for interface in module.interfaces %} -#include "qml{{interface|lower}}.h" -{% endfor %} - -void Plugin::registerTypes(const char *uri) -{ - {{module_name}}::registerTypes(); - // @uri {{module|lower}} - {{module_name}}::registerQmlTypes(uri, 1, 0); -{% for interface in module.interfaces %} - Qml{{interface}}::registerQmlTypes(uri, 1, 0); -{% endfor %} -} diff --git a/qface/builtin/qtcpp/templates/plugin.h b/qface/builtin/qtcpp/templates/plugin.h deleted file mode 100644 index 1952c35..0000000 --- a/qface/builtin/qtcpp/templates/plugin.h +++ /dev/null @@ -1,18 +0,0 @@ -{# Copyright (c) Pelagicore AB 2016 #} -/**************************************************************************** -** This is an auto-generated file. -** Do not edit! All changes made to it will be lost. -****************************************************************************/ - -#pragma once - -#include <QtQml> - -class Plugin : public QQmlExtensionPlugin -{ - Q_OBJECT - Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") - -public: - void registerTypes(const char *uri); -}; diff --git a/qface/builtin/qtcpp/templates/plugin.pro b/qface/builtin/qtcpp/templates/plugin.pro deleted file mode 100644 index 4984015..0000000 --- a/qface/builtin/qtcpp/templates/plugin.pro +++ /dev/null @@ -1,47 +0,0 @@ -{# Copyright (c) Pelagicore AB 2016 #} - -## This is a preserved file and can be edited. -## All changes will not be override. - -TEMPLATE = lib -QT += qml quick -CONFIG += qt plugin c++11 -TARGET = $$qtLibraryTarget({{module|lower}}) - -uri = {{module}} - - -HEADERS += \ -{% for interface in module.interfaces %} - qml{{interface|lower}}.h \ -{% endfor %} - plugin.h - - -SOURCES += \ -{% for interface in module.interfaces %} - qml{{interface|lower}}.cpp \ -{% endfor %} - plugin.cpp - - -include( generated/generated.pri ) -include( docs/docs.pri ) - -DISTFILES = qmldir - -!equals(_PRO_FILE_PWD_, $$OUT_PWD) { - copy_qmldir.target = $$OUT_PWD/qmldir - copy_qmldir.depends = $$_PRO_FILE_PWD_/qmldir - copy_qmldir.commands = $(COPY_FILE) \"$$replace(copy_qmldir.depends, /, $$QMAKE_DIR_SEP)\" \"$$replace(copy_qmldir.target, /, $$QMAKE_DIR_SEP)\" - QMAKE_EXTRA_TARGETS += copy_qmldir - PRE_TARGETDEPS += $$copy_qmldir.target -} - -qmldir.files = qmldir -unix { - installPath = $$[QT_INSTALL_QML]/$$replace(uri, \\., /) - qmldir.path = $$installPath - target.path = $$installPath - INSTALLS += target qmldir -} diff --git a/qface/builtin/qtcpp/templates/plugin.qdocconf b/qface/builtin/qtcpp/templates/plugin.qdocconf deleted file mode 100644 index a45a34b..0000000 --- a/qface/builtin/qtcpp/templates/plugin.qdocconf +++ /dev/null @@ -1,21 +0,0 @@ -include($QT_INSTALL_DOCS/global/qt-html-templates-offline.qdocconf) -include(plugin-project.qdocconf) - -HTML.footer = \ - " </div>\n" \ - " </div>\n" \ - " </div>\n" \ - " </div>\n" \ - "</div>\n" \ - "<div class=\"footer\">\n" \ - " <p>\n" \ - " <acronym title=\"Copyright\">©</acronym> 2016 Pelagicore AG.\n" \ - " Documentation contributions included herein are the copyrights of\n" \ - " their respective owners.<br>" \ - " The documentation provided herein is licensed under the terms of the" \ - " <a href=\"http://www.gnu.org/licenses/fdl.html\">GNU Free Documentation" \ - " License version 1.3</a> as published by the Free Software Foundation.<br>" \ - " Qt and respective logos are trademarks of The Qt Company Ltd. " \ - " in Finland and/or other countries worldwide. All other trademarks are property\n" \ - " of their respective owners. </p>\n" \ - "</div>\n" diff --git a/qface/builtin/qtcpp/templates/qmake.conf b/qface/builtin/qtcpp/templates/qmake.conf deleted file mode 100644 index 03d3435..0000000 --- a/qface/builtin/qtcpp/templates/qmake.conf +++ /dev/null @@ -1,5 +0,0 @@ -SOURCE_DIR=$$PWD -BUILD_DIR=$$shadowed($$PWD) -QMAKEFEATURES=$$SOURCE_DIR/qmake-features - -VERSION = 1.0.0 diff --git a/qface/builtin/qtcpp/templates/qmldir b/qface/builtin/qtcpp/templates/qmldir deleted file mode 100644 index 9fe5d2b..0000000 --- a/qface/builtin/qtcpp/templates/qmldir +++ /dev/null @@ -1,3 +0,0 @@ -{# Copyright (c) Pelagicore AB 2016 #} -module {{module}} -plugin {{module}}
\ No newline at end of file diff --git a/qface/builtin/qtcpp/templates/struct.cpp b/qface/builtin/qtcpp/templates/struct.cpp deleted file mode 100644 index 86f358c..0000000 --- a/qface/builtin/qtcpp/templates/struct.cpp +++ /dev/null @@ -1,112 +0,0 @@ -{# Copyright (c) Pelagicore AB 2016 #} -{% set class = 'Qml{0}'.format(struct) %} -{% set ampersand = joiner(" &&") %} -/**************************************************************************** -** This is an auto-generated file. -** Do not edit! All changes made to it will be lost. -****************************************************************************/ - -#include "{{class|lower}}.h" - - -class {{class}}Data : public QSharedData -{ -public: - {{class}}Data() - : QSharedData() - {% for field in struct.fields %} - , {{field}}({{field|defaultValue}}) - {% endfor %} - { - } - {{class}}Data(const {{class}}Data &other) - : QSharedData(other) - {% for field in struct.fields %} - , {{field}}(other.{{field}}) - {% endfor %} - { - } - -public: -{% for field in struct.fields %} - {{field|returnType}} {{field}}; -{% endfor %} -}; - -// Class - -/*! - \qmltype {{struct}} - \inqmlmodule {{module}} -{% with doc = struct.comment|parse_doc %} - \brief {{doc.brief}} - - \note This is a none creatable data object - - Use the module factory method \l {{module.module_name}}Module::create{{struct}} to create - an instance. - - {{doc.description}} -{% endwith %} -*/ - -{{class}}::{{class}}() - : d(new {{class}}Data) -{ -} - -{{class}}::{{class}}(const {{class}} &other) - : d(other.d) -{ -} - -{{class}}::~{{class}}() -{ -} - -{% for field in struct.fields %} -/*! - \qmlproperty {{field.type}} {{struct}}::{{field}} (field) -{% with doc = field.comment|parse_doc %} - \brief {{doc.brief}} - - \note A none notifiable property - - {{doc.description}} -{% endwith %} -*/ -void {{class}}::set{{field|upperfirst}}({{field|parameterType}}) -{ - d->{{field}} = {{field}}; -} -{{field|returnType}} {{class}}::{{field}}() const -{ - return d->{{field}}; -} - -{% endfor %} - - - -{{class}} {{class}}::clone() -{ - {{class}} other(*this); - other.d.detach(); - return other; -} - -bool {{class}}::operator==(const {{class}} &other) const -{ - return ( - {%- for field in struct.fields %}{{ ampersand() }} - {{field}}() == other.{{field}}() - {%- endfor %} - ); -} - -{{class}} &{{class}}::operator=(const {{class}} &other) -{ - d = other.d; - return *this; -} - diff --git a/qface/builtin/qtcpp/templates/struct.h b/qface/builtin/qtcpp/templates/struct.h deleted file mode 100644 index 7c6a4e6..0000000 --- a/qface/builtin/qtcpp/templates/struct.h +++ /dev/null @@ -1,45 +0,0 @@ -{# Copyright (c) Pelagicore AB 2016 #} -{% set class = 'Qml{0}'.format(struct) %} -/**************************************************************************** -** This is an auto-generated file. -** Do not edit! All changes made to it will be lost. -****************************************************************************/ - -#pragma once - -#include <QtCore> - - -class {{class}}Data; - -class {{class}} -{ - Q_GADGET -{% for field in struct.fields %} - Q_PROPERTY({{field|returnType}} {{field}} READ {{field}} WRITE set{{field|upperfirst}}) -{% endfor %} - -public: - {{class}}(); - {{class}}(const {{class}} &other); - ~{{class}}(); - - Q_INVOKABLE {{class}} clone(); - - bool operator==(const {{class}} &other) const; - {{class}} &operator=(const {{class}} &other); - -{% for field in struct.fields %} - void set{{field|upperfirst}}({{field|parameterType}}); - {{field|returnType}} {{field}}() const; - -{% endfor %} - - -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 deleted file mode 100644 index 2759dae..0000000 --- a/qface/builtin/qtcpp/templates/structmodel.cpp +++ /dev/null @@ -1,106 +0,0 @@ -{# Copyright (c) Pelagicore AB 2016 #} -{% set class = 'Qml{0}Model'.format(struct) %} -/**************************************************************************** -** This is an auto-generated file. -** Do not edit! All changes made to it will be lost. -****************************************************************************/ - -#include "{{class|lower}}.h" - -{{class}}::{{class}}(QObject *parent) - : QAbstractListModel(parent) -{ - {% for field in struct.fields %} - m_roleNames.insert(Roles::{{field|upperfirst}}, QByteArray("{{field}}")); - {% endfor %} -} - -int {{class}}::count() const -{ - return m_data.count(); -} - -Qml{{struct}} {{class}}::get(int index) -{ - return m_data.value(index); -} - -int {{class}}::rowCount(const QModelIndex &parent) const -{ - Q_UNUSED(parent) - return m_data.count(); -} - -QVariant {{class}}::data(const QModelIndex &index, int role) const -{ - if(index.row() < 0 || index.row() >= count()) { - return QVariant(); - } - const Qml{{struct}} &{{struct|lower}} = m_data.at(index.row()); - switch(role) { - {% for field in struct.fields %} - case Roles::{{field|upperfirst}}: - return QVariant::fromValue({{struct|lower}}.{{field}}()); - {% endfor %} - } - return QVariant(); -} - -QHash<int, QByteArray> {{class}}::roleNames() const -{ - return m_roleNames; -} - - -void {{class}}::insert(int row, const Qml{{struct}} &{{struct|lower}}) -{ - if (row < 0) - row = 0; - if (row >= m_data.count()) - row = m_data.count(); - - beginInsertRows(QModelIndex(), row, row); - m_data.insert(row, {{struct|lower}}); - endInsertRows(); - emit countChanged(count()); -} - -void {{class}}::reset(const QList<Qml{{struct}}> data) -{ - beginResetModel(); - m_data = data; - endResetModel(); -} - -void {{class}}::append(const Qml{{struct}} &{{struct|lower}}) -{ - insert(m_data.count(), {{struct|lower}}); -} - -void {{class}}::update(int row, const Qml{{struct}} &{{struct|lower}}) -{ - if(row < 0 || row >= m_data.count()) { - return; - } - m_data[row] = {{struct|lower}}; - const QModelIndex &index = createIndex(row, 0); - emit dataChanged(index, index); -} - -void {{class}}::remove(int row) -{ - if(row < 0 || row >= m_data.count()) { - return; - } - beginRemoveRows(QModelIndex(), row, row); - m_data.removeAt(row); - endRemoveRows(); -} - -void {{class}}::clear() -{ - beginResetModel(); - m_data.clear(); - endResetModel(); -} - diff --git a/qface/builtin/qtcpp/templates/structmodel.h b/qface/builtin/qtcpp/templates/structmodel.h deleted file mode 100644 index ab02b25..0000000 --- a/qface/builtin/qtcpp/templates/structmodel.h +++ /dev/null @@ -1,40 +0,0 @@ -{# Copyright (c) Pelagicore AB 2016 #} -{% set class = 'Qml{0}Model'.format(struct) %} -/**************************************************************************** -** This is an auto-generated file. -** Do not edit! All changes made to it will be lost. -****************************************************************************/ - -#pragma once - -#include <QtCore> - -#include "qml{{struct|lower}}.h" - -class {{class}} : public QAbstractListModel -{ - Q_OBJECT - Q_PROPERTY(int count READ count NOTIFY countChanged) -public: - enum Roles { {{struct.fields|map('upperfirst')|join(', ')}} }; - {{class}}(QObject *parent = nullptr); - Q_INVOKABLE Qml{{struct}} get(int index); - int count() const; - void insert(int row, const Qml{{struct}} &{{struct|lower}}); - void append(const Qml{{struct}} &{{struct|lower}}); - void update(int row, const Qml{{struct}} &{{struct|lower}}); - void remove(int row); - void reset(const QList<Qml{{struct}}> data); - void clear(); -public: // from QAbstractListModel - virtual int rowCount(const QModelIndex &parent) const; - virtual QVariant data(const QModelIndex &index, int role) const; - virtual QHash<int, QByteArray> roleNames() const; -Q_SIGNALS: - void countChanged(int count); -private: - QList<Qml{{struct}}> m_data; - QHash<int, QByteArray> m_roleNames; -}; - - diff --git a/qface/builtin/qtcpp/templates/variantmodel.cpp b/qface/builtin/qtcpp/templates/variantmodel.cpp deleted file mode 100644 index 6e197f4..0000000 --- a/qface/builtin/qtcpp/templates/variantmodel.cpp +++ /dev/null @@ -1,102 +0,0 @@ -{# Copyright (c) Pelagicore AB 2016 #} -{% set class = 'QmlVariantModel' %} -/**************************************************************************** -** This is an auto-generated file. -** Do not edit! All changes made to it will be lost. -****************************************************************************/ - -#include "{{class|lower}}.h" - -{{class}}::{{class}}(QObject *parent) - : QAbstractListModel(parent) -{ - m_roleNames.insert(Roles::ModelData, QByteArray("modelData")); -} - -int {{class}}::count() const -{ - return m_data.count(); -} - -QVariant {{class}}::get(int index) -{ - return m_data.value(index); -} - -int {{class}}::rowCount(const QModelIndex &parent) const -{ - Q_UNUSED(parent) - return m_data.count(); -} - -QVariant {{class}}::data(const QModelIndex &index, int role) const -{ - if(index.row() < 0 || index.row() >= count()) { - return QVariant(); - } - const QVariant &entry = m_data.at(index.row()); - switch(role) { - case Roles::ModelData: - return entry; - } - return QVariant(); -} - -QHash<int, QByteArray> {{class}}::roleNames() const -{ - return m_roleNames; -} - - -void {{class}}::insert(int row, const QVariant &entry) -{ - if (row < 0) - row = 0; - if (row >= m_data.count()) - row = m_data.count(); - - beginInsertRows(QModelIndex(), row, row); - m_data.insert(row, entry); - endInsertRows(); - emit countChanged(count()); -} - -void {{class}}::reset(const QVariantList entries) -{ - beginResetModel(); - m_data = entries; - endResetModel(); -} - -void {{class}}::append(const QVariant &entry) -{ - insert(m_data.count(), entry); -} - -void {{class}}::update(int row, const QVariant &entry) -{ - if(row < 0 || row >= m_data.count()) { - return; - } - m_data[row] = entry; - const QModelIndex &index = createIndex(row, 0); - emit dataChanged(index, index); -} - -void {{class}}::remove(int row) -{ - if(row < 0 || row >= m_data.count()) { - return; - } - beginRemoveRows(QModelIndex(), row, row); - m_data.removeAt(row); - endRemoveRows(); -} - -void {{class}}::clear() -{ - beginResetModel(); - m_data.clear(); - endResetModel(); -} - diff --git a/qface/builtin/qtcpp/templates/variantmodel.h b/qface/builtin/qtcpp/templates/variantmodel.h deleted file mode 100644 index 3f1bbd3..0000000 --- a/qface/builtin/qtcpp/templates/variantmodel.h +++ /dev/null @@ -1,38 +0,0 @@ -{# Copyright (c) Pelagicore AB 2016 #} -{% set class = 'QmlVariantModel' %} -/**************************************************************************** -** This is an auto-generated file. -** Do not edit! All changes made to it will be lost. -****************************************************************************/ - -#pragma once - -#include <QtCore> - -class {{class}} : public QAbstractListModel -{ - Q_OBJECT - Q_PROPERTY(int count READ count NOTIFY countChanged) -public: - enum Roles { ModelData = Qt::UserRole }; - {{class}}(QObject *parent = nullptr); - Q_INVOKABLE QVariant get(int index); - int count() const; - void insert(int row, const QVariant &entry); - void append(const QVariant &entry); - void update(int row, const QVariant &entry); - void remove(int row); - void reset(const QVariantList entries); - void clear(); -public: // from QAbstractListModel - virtual int rowCount(const QModelIndex &parent) const; - virtual QVariant data(const QModelIndex &index, int role) const; - virtual QHash<int, QByteArray> roleNames() const; -Q_SIGNALS: - void countChanged(int count); -private: - QVariantList m_data; - QHash<int, QByteArray> m_roleNames; -}; - - |