diff options
author | Juergen Bocklage-Ryannel <jbocklage-ryannel@luxoft.com> | 2017-07-11 13:30:44 +0200 |
---|---|---|
committer | Juergen Bocklage-Ryannel <jbocklage-ryannel@luxoft.com> | 2017-07-11 13:30:44 +0200 |
commit | 97159f74248c477004522ebca81fa95f9a695de7 (patch) | |
tree | 989e0a62b375a5d79559e00ac8f0177343c91d43 | |
parent | f01315e85a2f62d28254637ff02b385fa82bb73b (diff) | |
download | qtivi-qface-97159f74248c477004522ebca81fa95f9a695de7.tar.gz |
Removed unused old templates. These generator are now available under
- https://github.com/Pelagicore/qface-qtcpp
- https://github.com/Pelagicore/qface-qtqml
42 files changed, 0 insertions, 1467 deletions
diff --git a/qface/builtin/__init__.py b/qface/builtin/__init__.py deleted file mode 100644 index e69de29..0000000 --- a/qface/builtin/__init__.py +++ /dev/null diff --git a/qface/builtin/qtcpp/__init__.py b/qface/builtin/qtcpp/__init__.py deleted file mode 100644 index e69de29..0000000 --- a/qface/builtin/qtcpp/__init__.py +++ /dev/null diff --git a/qface/builtin/qtcpp/log.yaml b/qface/builtin/qtcpp/log.yaml deleted file mode 100644 index 21b5bba..0000000 --- a/qface/builtin/qtcpp/log.yaml +++ /dev/null @@ -1,18 +0,0 @@ -version: 1 -formatters: - simple: - format: '%(asctime)s - %(name)s - %(levelname)s - %(message)s' -handlers: - console: - class: logging.StreamHandler - level: INFO - formatter: simple - stream: ext://sys.stdout -loggers: - qface.generator: - level: WARN - handlers: [console] - propagate: no -root: - level: DEBUG - handlers: [console] diff --git a/qface/builtin/qtcpp/qtcpp.py b/qface/builtin/qtcpp/qtcpp.py deleted file mode 100755 index 7aead34..0000000 --- a/qface/builtin/qtcpp/qtcpp.py +++ /dev/null @@ -1,83 +0,0 @@ -#!/usr/bin/env python3 -# Copyright (c) Pelagicore AB 2016 - -import click -import logging -import logging.config -import yaml -from path import Path - -from qface.generator import FileSystem, Generator -from qface.helper.qtcpp import Filters -from qface.helper.doc import parse_doc -from qface.watch import monitor - - -here = Path(__file__).dirname() - -logging.config.dictConfig(yaml.load(open(here / 'log.yaml'))) - -log = logging.getLogger(__file__) - - -def run(src, dst): - log.debug('run {0} {1}'.format(src, dst)) - system = FileSystem.parse(src) - generator = Generator(search_path=here / 'templates') - generator.register_filter('returnType', Filters.returnType) - generator.register_filter('parameterType', Filters.parameterType) - generator.register_filter('defaultValue', Filters.defaultValue) - generator.register_filter('parameters', Filters.parameters) - generator.register_filter('parse_doc', parse_doc) - ctx = {'dst': dst} - for module in system.modules: - log.debug('generate code for module %s', module) - ctx.update({'module': module}) - dst = generator.apply('{{dst}}/{{module|lower|replace(".", "-")}}', ctx) - generator.destination = dst - generator.write('.qmake.conf', 'qmake.conf', ctx) - generator.write('{{module|lower|replace(".", "-")}}.pro', 'plugin.pro', ctx, preserve=True) - generator.write('CMakeLists.txt', 'CMakeLists.txt', ctx) - generator.write('plugin.cpp', 'plugin.cpp', ctx, preserve=True) - generator.write('plugin.h', 'plugin.h', ctx, preserve=True) - generator.write('qmldir', 'qmldir', ctx, preserve=True) - generator.write('generated/generated.pri', 'generated/generated.pri', ctx) - generator.write('generated/qml{{module.module_name|lower}}module.h', 'generated/module.h', ctx) - generator.write('generated/qml{{module.module_name|lower}}module.cpp', 'generated/module.cpp', ctx) - generator.write('generated/qmlvariantmodel.h', 'generated/variantmodel.h', ctx) - generator.write('generated/qmlvariantmodel.cpp', 'generated/variantmodel.cpp', ctx) - generator.write('docs/plugin.qdocconf', 'docs/plugin.qdocconf', ctx) - generator.write('docs/plugin-project.qdocconf', 'docs/plugin-project.qdocconf', ctx) - generator.write('docs/docs.pri', 'docs/docs.pri', ctx) - for interface in module.interfaces: - log.debug('generate code for interface %s', interface) - ctx.update({'interface': interface}) - generator.write('qml{{interface|lower}}.h', 'interface.h', ctx, preserve=True) - generator.write('qml{{interface|lower}}.cpp', 'interface.cpp', ctx, preserve=True) - generator.write('generated/qmlabstract{{interface|lower}}.h', 'generated/abstractinterface.h', ctx) - generator.write('generated/qmlabstract{{interface|lower}}.cpp', 'generated/abstractinterface.cpp', ctx) - for struct in module.structs: - log.debug('generate code for struct %s', struct) - ctx.update({'struct': struct}) - generator.write('generated/qml{{struct|lower}}.h', 'generated/struct.h', ctx) - generator.write('generated/qml{{struct|lower}}.cpp', 'generated/struct.cpp', ctx) - generator.write('generated/qml{{struct|lower}}model.h', 'generated/structmodel.h', ctx) - generator.write('generated/qml{{struct|lower}}model.cpp', 'generated/structmodel.cpp', ctx) - - -@click.command() -@click.option('--reload/--no-reload', default=False) -@click.argument('src', nargs=-1, type=click.Path(exists=True)) -@click.argument('dst', nargs=1, type=click.Path(exists=True)) -def app(src, dst, reload): - """Takes several files or directories as src and generates the code - in the given dst directory.""" - if reload: - script = Path(__file__).abspath() - monitor(script, src, dst) - else: - run(src, dst) - - -if __name__ == '__main__': - app() diff --git a/qface/builtin/qtcpp/templates/CMakeLists.txt b/qface/builtin/qtcpp/templates/CMakeLists.txt deleted file mode 100644 index b2f7334..0000000 --- a/qface/builtin/qtcpp/templates/CMakeLists.txt +++ /dev/null @@ -1,44 +0,0 @@ -{% import "qtcpp.j2" as cpp %} -{{ cpp.autogenerated() }} -{% 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/docs/docs.pri b/qface/builtin/qtcpp/templates/docs/docs.pri deleted file mode 100644 index f6a3e81..0000000 --- a/qface/builtin/qtcpp/templates/docs/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/docs/plugin-online.qdocconf b/qface/builtin/qtcpp/templates/docs/plugin-online.qdocconf deleted file mode 100644 index 771cdae..0000000 --- a/qface/builtin/qtcpp/templates/docs/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/docs/plugin-project.qdocconf b/qface/builtin/qtcpp/templates/docs/plugin-project.qdocconf deleted file mode 100644 index 0a846cb..0000000 --- a/qface/builtin/qtcpp/templates/docs/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/docs/plugin.qdocconf b/qface/builtin/qtcpp/templates/docs/plugin.qdocconf deleted file mode 100644 index a45a34b..0000000 --- a/qface/builtin/qtcpp/templates/docs/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/generated/abstractinterface.cpp b/qface/builtin/qtcpp/templates/generated/abstractinterface.cpp deleted file mode 100644 index ecf1467..0000000 --- a/qface/builtin/qtcpp/templates/generated/abstractinterface.cpp +++ /dev/null @@ -1,43 +0,0 @@ -{# Copyright (c) Pelagicore AB 2016 #} -{% import "qtcpp.j2" as cpp %} -{% set class = 'QmlAbstract{0}'.format(interface) %} -{{ cpp.autogenerated() }} - -#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 %} -{{ cpp.property_setter_impl(class, property) }} - -{{ cpp.property_getter_impl(class, property) }} -{% endfor %} - -{%- for operation in interface.operations %} -{{ cpp.operation_impl(class, operation) }} -{% endfor %} - - diff --git a/qface/builtin/qtcpp/templates/generated/abstractinterface.h b/qface/builtin/qtcpp/templates/generated/abstractinterface.h deleted file mode 100644 index d5a4f24..0000000 --- a/qface/builtin/qtcpp/templates/generated/abstractinterface.h +++ /dev/null @@ -1,46 +0,0 @@ -{# Copyright (c) Pelagicore AB 2016 #} -{% import "qtcpp.j2" as cpp %} -{% set class = 'QmlAbstract{0}'.format(interface) %} -{{ cpp.autogenerated() }} - -#pragma once - -#include <QtCore> - -#include "{{module.module_name|lower}}module.h" - -class {{class}} : public QObject -{ - Q_OBJECT -{% for property in interface.properties %} - {{ cpp.property(property)}} -{% endfor %} - -public: - {{class}}(QObject *parent = nullptr); - ~{{class}}(); - -public Q_SLOTS: -{% for operation in interface.operations %} - {{ cpp.operation_decl(operation) }} -{% endfor %} -public: -{% for property in interface.properties %} - {{ cpp.property_setter_decl(property) }} -{% endfor %} -public: -{% for property in interface.properties %} - {{cpp.property_getter_decl(property) }} -{% endfor %} -Q_SIGNALS: -{% for signal in interface.signals %} - {{ cpp.signal_decl(signal)}} -{% endfor %} -{% for property in interface.properties %} - {{ cpp.signal_decl(property) }} -{% endfor %} -protected: -{% for property in interface.properties %} - {{ cpp.property_member_decl(property) }} -{% endfor %} -}; diff --git a/qface/builtin/qtcpp/templates/generated/generated.pri b/qface/builtin/qtcpp/templates/generated/generated.pri deleted file mode 100644 index 701cdae..0000000 --- a/qface/builtin/qtcpp/templates/generated/generated.pri +++ /dev/null @@ -1,31 +0,0 @@ -{# Copyright (c) Pelagicore AB 2016 #} -{% import "qtcpp.j2" as cpp %} -{{ cpp.autogenerated(prefix="##") }} - -QT += qml quick -CONFIG += c++11 - -HEADERS += \ - $$PWD/{{module.module_name|lower}}module.h \ -{% for interface in module.interfaces %} - $$PWD/abstract{{interface|lower}}.h \ -{% endfor %} -{% for struct in module.structs %} - $$PWD/{{struct|lower}}.h \ - $$PWD/{{struct|lower}}model.h \ -{% endfor %} - $$PWD/variantmodel.h - - -SOURCES += \ - $$PWD/{{module.module_name|lower}}module.cpp \ -{% for interface in module.interfaces %} - $$PWD/abstract{{interface|lower}}.cpp \ -{% endfor %} -{% for struct in module.structs %} - $$PWD/{{struct|lower}}.cpp \ - $$PWD/{{struct|lower}}model.cpp \ -{% endfor %} - $$PWD/variantmodel.cpp - - diff --git a/qface/builtin/qtcpp/templates/generated/module.cpp b/qface/builtin/qtcpp/templates/generated/module.cpp deleted file mode 100644 index d7b9833..0000000 --- a/qface/builtin/qtcpp/templates/generated/module.cpp +++ /dev/null @@ -1,80 +0,0 @@ -{# Copyright (c) Pelagicore AB 2016 #} -{% import "qtcpp.j2" as cpp %} -{{ cpp.autogenerated() }} -{% 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}} -*/ -{{struct}} {{class}}::create{{struct}}() -{ - return {{struct}}(); -} -{% endfor %} - -void {{class}}::registerTypes() -{ - {% for struct in module.structs %} - qRegisterMetaType<{{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<{{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/generated/module.h b/qface/builtin/qtcpp/templates/generated/module.h deleted file mode 100644 index 44e12f3..0000000 --- a/qface/builtin/qtcpp/templates/generated/module.h +++ /dev/null @@ -1,31 +0,0 @@ -{# Copyright (c) Pelagicore AB 2016 #} -{% import "qtcpp.j2" as cpp %} -{{ cpp.autogenerated() }} -{% set class = '{0}Module'.format(module.module_name) %} - -#pragma once - -#include <QtCore> - -#include "variantmodel.h" -{% for struct in module.structs %} -#include "{{struct|lower}}.h" -#include "{{struct|lower}}model.h" -{% endfor %} - -class {{class}} : public QObject { - Q_OBJECT -public: - {{class}}(QObject *parent = nullptr); - -{% for enum in module.enums %} -{{ cpp.enum_decl(enum) }} -{% endfor %} - -{% for struct in module.structs %} - Q_INVOKABLE {{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/generated/struct.cpp b/qface/builtin/qtcpp/templates/generated/struct.cpp deleted file mode 100644 index 7b97130..0000000 --- a/qface/builtin/qtcpp/templates/generated/struct.cpp +++ /dev/null @@ -1,118 +0,0 @@ -{# Copyright (c) Pelagicore AB 2016 #} -{% import "qtcpp.j2" as cpp %} -{{ cpp.autogenerated() }} -{% set class = 'Qml{0}'.format(struct) %} -{% set ampersand = joiner(" &&") %} - -#include "{{class|lower}}.h" -#include <QtQml> - - - -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}}() -{ -} - -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) -{% 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/generated/struct.h b/qface/builtin/qtcpp/templates/generated/struct.h deleted file mode 100644 index e9a0399..0000000 --- a/qface/builtin/qtcpp/templates/generated/struct.h +++ /dev/null @@ -1,43 +0,0 @@ -{# Copyright (c) Pelagicore AB 2016 #} -{% set class = 'Qml{0}'.format(struct) %} -{% import "qtcpp.j2" as cpp %} -{{ cpp.autogenerated() }} - -#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}}(); - - static void registerQmlTypes(const QString& uri, int majorVersion=1, int minorVersion=0); - - 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; -}; - - diff --git a/qface/builtin/qtcpp/templates/generated/structmodel.cpp b/qface/builtin/qtcpp/templates/generated/structmodel.cpp deleted file mode 100644 index 4657d6f..0000000 --- a/qface/builtin/qtcpp/templates/generated/structmodel.cpp +++ /dev/null @@ -1,104 +0,0 @@ -{# Copyright (c) Pelagicore AB 2016 #} -{% import "qtcpp.j2" as cpp %} -{{ cpp.autogenerated() }} -{% set class = 'Qml{0}Model'.format(struct) %} - -#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(); -} - -{{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 {{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<{{struct}}> data) -{ - beginResetModel(); - m_data = data; - endResetModel(); -} - -void {{class}}::append(const {{struct}} &{{struct|lower}}) -{ - insert(m_data.count(), {{struct|lower}}); -} - -void {{class}}::update(int row, const {{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/generated/structmodel.h b/qface/builtin/qtcpp/templates/generated/structmodel.h deleted file mode 100644 index 8d84e5a..0000000 --- a/qface/builtin/qtcpp/templates/generated/structmodel.h +++ /dev/null @@ -1,38 +0,0 @@ -{# Copyright (c) Pelagicore AB 2016 #} -{% import "qtcpp.j2" as cpp %} -{{ cpp.autogenerated() }} -{% set class = 'Qml{0}Model'.format(struct) %} - -#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/generated/variantmodel.cpp b/qface/builtin/qtcpp/templates/generated/variantmodel.cpp deleted file mode 100644 index 7e83a97..0000000 --- a/qface/builtin/qtcpp/templates/generated/variantmodel.cpp +++ /dev/null @@ -1,100 +0,0 @@ -{# Copyright (c) Pelagicore AB 2016 #} -{% import "qtcpp.j2" as cpp %} -{{ cpp.autogenerated() }} -{% set class = 'QmlVariantModel' %} - -#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/generated/variantmodel.h b/qface/builtin/qtcpp/templates/generated/variantmodel.h deleted file mode 100644 index 97cec4f..0000000 --- a/qface/builtin/qtcpp/templates/generated/variantmodel.h +++ /dev/null @@ -1,36 +0,0 @@ -{# Copyright (c) Pelagicore AB 2016 #} -{% import "qtcpp.j2" as cpp %} -{{ cpp.autogenerated() }} -{% set class = 'QmlVariantModel' %} - -#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; -}; - - diff --git a/qface/builtin/qtcpp/templates/interface.cpp b/qface/builtin/qtcpp/templates/interface.cpp deleted file mode 100644 index 01263bc..0000000 --- a/qface/builtin/qtcpp/templates/interface.cpp +++ /dev/null @@ -1,48 +0,0 @@ -{# Copyright (c) Pelagicore AB 2016 #} -{% import "qtcpp.j2" as cpp %} -{{ cpp.preserved() }} -{% set class = '{0}'.format(interface) %} - -#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) - : Abstract{{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 06953fe..0000000 --- a/qface/builtin/qtcpp/templates/interface.h +++ /dev/null @@ -1,21 +0,0 @@ -{# Copyright (c) Pelagicore AB 2016 #} -{% import "qtcpp.j2" as cpp %} -{{ cpp.preserved() }} -{% set class = '{0}'.format(interface) %} - -#pragma once - -#include <QtCore> - -#include "generated/{{module.module_name|lower}}module.h" -#include "generated/abstract{{interface|lower}}.h" - -class {{class}} : public Abstract{{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/plugin.cpp b/qface/builtin/qtcpp/templates/plugin.cpp deleted file mode 100644 index 91a3de5..0000000 --- a/qface/builtin/qtcpp/templates/plugin.cpp +++ /dev/null @@ -1,24 +0,0 @@ -{# Copyright (c) Pelagicore AB 2016 #} -{% import "qtcpp.j2" as cpp %} -{{ cpp.autogenerated()}} -{% set module_name = 'Qml{0}Module'.format(module.module_name) %} - -#include "plugin.h" - -#include <qqml.h> - -#include "generated/{{module_name|lower}}.h" - -{% for interface in module.interfaces %} -#include "{{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 %} - {{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 50e0602..0000000 --- a/qface/builtin/qtcpp/templates/plugin.h +++ /dev/null @@ -1,16 +0,0 @@ -{# Copyright (c) Pelagicore AB 2016 #} -{% import "qtcpp.j2" as cpp %} -{{ cpp.autogenerated() }} - -#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 a8fcb90..0000000 --- a/qface/builtin/qtcpp/templates/plugin.pro +++ /dev/null @@ -1,46 +0,0 @@ -{# Copyright (c) Pelagicore AB 2016 #} -{% import "qtcpp.j2" as cpp %} -{{ cpp.preserved(prefix="##")}} - -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/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/qtcpp.j2 b/qface/builtin/qtcpp/templates/qtcpp.j2 deleted file mode 100644 index 81b7d7a..0000000 --- a/qface/builtin/qtcpp/templates/qtcpp.j2 +++ /dev/null @@ -1,100 +0,0 @@ -{%+ macro enum_decl(enum) %} - enum {{enum}} { - {% for member in enum.members %} - {{member.name}} = {{member.value}}{% if not loop.last %},{%endif%} - - {% endfor %} - }; - Q_ENUM({{enum}}) -{%- endmacro %} - -{% macro property(property) -%} -Q_PROPERTY({{property|returnType}} {{property}} READ {{property}} {% if not property.readonly %}WRITE set{{property|upperfirst}} {% endif %}{% if not property.const %}NOTIFY {{property}}Changed{% endif %}) -{%- endmacro %} - -{% macro property_setter_decl(property) -%} -virtual void set{{property|upperfirst}}({{ property|parameterType }}); -{%- endmacro %} - -{% macro property_getter_decl(property) -%} -virtual {{property|returnType}} {{property}}() const; -{%- endmacro %} - -{% macro signal_decl(symbol) -%} -{% if symbol.is_property %} -void {{symbol}}Changed({{symbol|parameters}}); -{% else %} -void {{symbol}}({{symbol|parameters}}); -{%- endif %} - -{%- endmacro %} -{% macro property_member_decl(property) %} -{{property|returnType}} m_{{property}}; -{%- endmacro %} - -{% macro property_setter_impl(class, property) -%} -/*! - \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(); -} -{%- endmacro %} - - -{% macro property_getter_impl(class, property) -%} -{{property|returnType}} {{class}}::{{property}}() const -{ - return m_{{property}}; -} -{%- endmacro %} - - -{% macro operation_impl(class, operation) %} -/*! - \qmlmethod {{operation.type}} {{class}}::{{operation}}({{operation|parameters}}) -{% with doc = operation.comment|parse_doc %} - \brief {{doc.brief}} - {{doc.description}} -{% endwith %} -*/ -{{operation|returnType}} {{class}}::{{operation}}({{operation|parameters}}) -{ - {% for parameter in operation.parameters %} - Q_UNUSED({{parameter.name}}); - {% endfor %} - qWarning() << "{{class}}::{{operation}}(...) not implemented"; - return {{operation|defaultValue}}; -} -{% endmacro %} - -{% macro operation_decl(operation) %} - virtual {{operation|returnType}} {{operation}}({{operation|parameters}}); -{% endmacro %} - -{% macro autogenerated(prefix="//") %} - -{{prefix}} This is an auto-generated file. -{{prefix}} Do not edit! All changes made to it will be lost. - -{% endmacro %} - -{% macro preserved(prefix="//") %} - -{{prefix}} This is a preserved file. -{{prefix}} Changes will not be overriden by the generator. -{{prefix}} To reset the file you need to delete it first. - -{% endmacro %} - diff --git a/qface/builtin/qtqml/__init__.py b/qface/builtin/qtqml/__init__.py deleted file mode 100644 index e69de29..0000000 --- a/qface/builtin/qtqml/__init__.py +++ /dev/null diff --git a/qface/builtin/qtqml/log.yaml b/qface/builtin/qtqml/log.yaml deleted file mode 100644 index 21b5bba..0000000 --- a/qface/builtin/qtqml/log.yaml +++ /dev/null @@ -1,18 +0,0 @@ -version: 1 -formatters: - simple: - format: '%(asctime)s - %(name)s - %(levelname)s - %(message)s' -handlers: - console: - class: logging.StreamHandler - level: INFO - formatter: simple - stream: ext://sys.stdout -loggers: - qface.generator: - level: WARN - handlers: [console] - propagate: no -root: - level: DEBUG - handlers: [console] diff --git a/qface/builtin/qtqml/qtqml.py b/qface/builtin/qtqml/qtqml.py deleted file mode 100755 index 851d0bf..0000000 --- a/qface/builtin/qtqml/qtqml.py +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/env python3 -# Copyright (c) Pelagicore AB 2016 - -import click -import logging -import logging.config -import yaml -from path import Path - -from qface.generator import FileSystem, Generator -from qface.helper.qtqml import Filters -from qface.watch import monitor - - -here = Path(__file__).dirname() - -logging.config.dictConfig(yaml.load(open(here / 'log.yaml'))) - -log = logging.getLogger(__file__) - - -def run(src, dst): - log.debug('run {0} {1}'.format(src, dst)) - system = FileSystem.parse(src) - search_path = [ - Path('_templates').abspath(), - Path(here / 'templates').abspath() - ] - generator = Generator(search_path=search_path) - generator.register_filter('defaultValue', Filters.defaultValue) - generator.register_filter('propertyType', Filters.propertyType) - ctx = {'dst': dst} - for module in system.modules: - module_name = module.module_name - module_path = '/'.join(module.name_parts) - plugin_name = "".join(module.name_parts[:2]) - ctx.update({ - 'module': module, - 'module_name': module_name, - 'module_path': module_path, - 'plugin_name': plugin_name, - }) - generator.destination = generator.apply("{{dst}}/{{module_path}}", ctx) - generator.write('qmldir', 'qmldir', ctx) - generator.write('private/qmldir', 'private/qmldir', ctx) - generator.write('private/{{module_name}}Module.js', 'private/module.js', ctx) - - for interface in module.interfaces: - ctx.update({ - 'interface': interface, - }) - generator.write('private/Abstract{{interface}}.qml', 'private/AbstractInterface.qml', ctx) - generator.write('{{interface}}.qml', 'Interface.qml', ctx, preserve=True) - - -@click.command() -@click.option('--reload/--no-reload', default=False) -@click.argument('src', nargs=-1, type=click.Path(exists=True)) -@click.argument('dst', nargs=1, type=click.Path(exists=True)) -def app(src, dst, reload): - """Takes several files or directories as src and generates the code - in the given dst directory.""" - if reload: - script = Path(__file__).abspath() - monitor(script, src, dst) - else: - run(src, dst) - - -if __name__ == '__main__': - app() diff --git a/qface/builtin/qtqml/templates/Interface.qml b/qface/builtin/qtqml/templates/Interface.qml deleted file mode 100644 index f4ebf70..0000000 --- a/qface/builtin/qtqml/templates/Interface.qml +++ /dev/null @@ -1,21 +0,0 @@ -{% include 'copyright.h' %} - - -/* - * This is a preserved file. - * Changes will not be overriden by the generator. - * To reset the file you need to delete it first. - */ - -{% if 'singleton' in interface.tags %} -pragma Singleton -{% endif %} - -import QtQml 2.2 - -import "private" - -Abstract{{interface}} { - id: root -} - diff --git a/qface/builtin/qtqml/templates/__init__.py b/qface/builtin/qtqml/templates/__init__.py deleted file mode 100644 index e69de29..0000000 --- a/qface/builtin/qtqml/templates/__init__.py +++ /dev/null diff --git a/qface/builtin/qtqml/templates/copyright.h b/qface/builtin/qtqml/templates/copyright.h deleted file mode 100644 index a484f2e..0000000 --- a/qface/builtin/qtqml/templates/copyright.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2017 Pelagicore AG - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - */ diff --git a/qface/builtin/qtqml/templates/private/AbstractInterface.qml b/qface/builtin/qtqml/templates/private/AbstractInterface.qml deleted file mode 100644 index cac0847..0000000 --- a/qface/builtin/qtqml/templates/private/AbstractInterface.qml +++ /dev/null @@ -1,49 +0,0 @@ -{% include 'copyright.h' %} - - -/* - * This is an auto-generated file. - * Do not edit! All changes made to it will be lost. - */ - -import QtQml 2.2 -import QtQml.Models 2.2 - -import "." - -{{interface.comment}} -QtObject { - id: root - -{% for property in interface.properties %} -{% if property.readonly %} -{% if property.comment %} - {{ property.comment }} -{% endif %} - readonly property {{property|propertyType}} {{property}} : _{{property}} - property {{property|propertyType}} _{{property}} : {{property|defaultValue}} -{% else %} -{% if property.comment %} - {{ property.comment }} -{% endif %} - property {{property|propertyType}} {{property}} : {{property|defaultValue }} -{% endif %} -{% endfor %} - -{% for operation in interface.operations %} -{% if operation.comment %} - {{ operation.comment }} -{% endif %} - property var {{operation}} : function({{operation.parameters|join(', ')}}) {} -{% endfor %} - -{% for signal in interface.signals %} - signal {{signal}}( - {%- for parameter in signal.parameters %} - {{- parameter.type|propertyType }} {{ parameter.name -}} - {% if not loop.last %}, {% endif %} - {% endfor -%} - ) -{% endfor %} -} - diff --git a/qface/builtin/qtqml/templates/private/module.js b/qface/builtin/qtqml/templates/private/module.js deleted file mode 100644 index c1a92a1..0000000 --- a/qface/builtin/qtqml/templates/private/module.js +++ /dev/null @@ -1,26 +0,0 @@ -{% include 'copyright.h' %} - - -/* - * This is an auto-generated file. - * Do not edit! All changes made to it will be lost. - */ - -.pragma library - -{% for enum in module.enums %} -// Enum: {{enum}} -{% for member in enum.members %} -var {{member}} = {{member.value}}; -{% endfor %} -{% endfor %} - -{% for struct in module.structs %} -function create{{struct}}() { - return { - {% for field in struct.fields %} - {{field}} : {{field | defaultValue}}, - {% endfor %} - }; -} -{% endfor %} diff --git a/qface/builtin/qtqml/templates/private/qmldir b/qface/builtin/qtqml/templates/private/qmldir deleted file mode 100644 index 152af67..0000000 --- a/qface/builtin/qtqml/templates/private/qmldir +++ /dev/null @@ -1,4 +0,0 @@ -{{module_name}}Module 1.0 {{module_name}}Module.js -{% for interface in module.interfaces %} -Abstract{{interface}} 1.0 Abstract{{interface}}.qml -{% endfor %} diff --git a/qface/builtin/qtqml/templates/qmldir b/qface/builtin/qtqml/templates/qmldir deleted file mode 100644 index 2fcfe50..0000000 --- a/qface/builtin/qtqml/templates/qmldir +++ /dev/null @@ -1,4 +0,0 @@ -{{module_name}}Module 1.0 private/{{module_name}}Module.js -{% for interface in module.interfaces %} -{% if 'singleton' in interface.tags %}singleton {% endif %}{{interface}} 1.0 {{interface}}.qml -{% endfor %} diff --git a/qface/builtin/schema/log.yaml b/qface/builtin/schema/log.yaml deleted file mode 100644 index 21b5bba..0000000 --- a/qface/builtin/schema/log.yaml +++ /dev/null @@ -1,18 +0,0 @@ -version: 1 -formatters: - simple: - format: '%(asctime)s - %(name)s - %(levelname)s - %(message)s' -handlers: - console: - class: logging.StreamHandler - level: INFO - formatter: simple - stream: ext://sys.stdout -loggers: - qface.generator: - level: WARN - handlers: [console] - propagate: no -root: - level: DEBUG - handlers: [console] diff --git a/qface/builtin/schema/schema.py b/qface/builtin/schema/schema.py deleted file mode 100755 index 5735844..0000000 --- a/qface/builtin/schema/schema.py +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/env python3 -# Copyright (c) Pelagicore AB 2016 - -import click -import logging -import logging.config -import yaml -from path import Path - -from qface.generator import FileSystem, Generator -from qface.watch import monitor -from qface.filters import jsonify - - -here = Path(__file__).dirname() - -logging.config.dictConfig(yaml.load(open(here / 'log.yaml'))) - -log = logging.getLogger(__file__) - - -def run(src, dst): - log.debug('run {0} {1}'.format(src, dst)) - system = FileSystem.parse(src) - search_path = [ - Path('_templates').abspath(), - Path(here / 'templates').abspath() - ] - generator = Generator(search_path=search_path) - generator.register_filter('jsonify', jsonify) - ctx = {'dst': dst} - for module in system.modules: - ctx.update({ - 'module': module, - }) - generator.destination = generator.apply("{{dst}}", ctx) - generator.write('{{module}}.json', 'module.json', ctx) - - -@click.command() -@click.option('--reload/--no-reload', default=False) -@click.argument('src', nargs=-1, type=click.Path(exists=True)) -@click.argument('dst', nargs=1, type=click.Path(exists=True)) -def app(src, dst, reload): - """Takes several files or directories as src and generates the code - in the given dst directory.""" - if reload: - script = Path(__file__).abspath() - monitor(script, src, dst) - else: - run(src, dst) - - -if __name__ == '__main__': - app() diff --git a/qface/builtin/schema/templates/module.json b/qface/builtin/schema/templates/module.json deleted file mode 100644 index 288ea15..0000000 --- a/qface/builtin/schema/templates/module.json +++ /dev/null @@ -1 +0,0 @@ -{{module|jsonify}}
\ No newline at end of file |