Commit 8827a3fe authored by Michal Policht's avatar Michal Policht

Update examples.

parent f4a69d8b
...@@ -12,4 +12,8 @@ Project { ...@@ -12,4 +12,8 @@ Project {
SubProject { SubProject {
filePath: "QML/QML.qbs" filePath: "QML/QML.qbs"
} }
SubProject {
filePath: "examples/examples.qbs"
}
} }
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!-- Root element. CuteHMI projects live in a tree. This tree is (more or less) reflected by the structure of XML document. <!-- Root element. CuteHMI projects live in a tree. This tree is (more or less) reflected by the structure of XML document.
The task of parsing XML document is delegated to 'cutehmi_base' library. This library loads plugins and feeds them The task of parsing XML document is delegated to 'cutehmi_xml_1' library. This library acts as a backend of a project,
with relevant XML data. It can also expose extensions provided by plugins as QML context properties. together with plugins, which provide cutehmi::xml::BackendPlugin extension.
name - project name. name - project name.
xmlns - XML namespace, which denotes document format. xmlns - XML namespace, which denotes document format.
--> -->
<cutehmi_project name="Sample Project" xmlns="http://michpolicht.github.io/CuteHMI/cutehmi_base_1_lib/xsd/1.0/"> <cutehmi_project name="Sample Project" xmlns="http://michpolicht.github.io/CuteHMI/cutehmi_1/xsd/1.0/">
<!-- Plugin section. Plugin 'cutehmi_services_1' is required by 'cutehmi_modbus_1'. <!-- Plugin section. Plugin 'cutehmi_services_1' is required by 'cutehmi_modbus_1'.
binary - name of the plugin binary to load (file name without a file extension). binary - name of the plugin binary to load (file name without a file extension).
req_minor - required minor version of a plugin. req_minor - required minor version of a plugin.
--> -->
<plugin binary="cutehmi_services_1" req_minor="0" /> <plugin name="cutehmi_services_1" req_minor="0" />
<!-- Plugin 'cutehmi_modbus_1' provides a way to interact with Modbus devices. --> <!-- Plugin 'cutehmi_modbus_1' provides a way to interact with Modbus devices. -->
<plugin binary="cutehmi_modbus_1" req_minor="0"> <plugin name="cutehmi_modbus_1" req_minor="0">
<!-- Extension section. Extension points can be provided by plugins or libraries. <!-- Extension section. Extension points can be provided by plugins or libraries.
In this case plugin 'cutehmi_modbus_1' provides instance of 'cutehmi::base::XMLBackendPlugin' In this case plugin 'cutehmi_modbus_1' provides instance of 'cutehmi::xml::BackendPlugin'
class and 'cutehmi_base' library uses this object to pass XML data to the plugin. class and 'cutehmi_xml_1' library uses this object to pass XML data to the plugin.
object - extension object (instance of cutehmi::base::XMLBackendPlugin in this case). object - extension object (instance of cutehmi::xml::BackendPlugin in this case).
--> -->
<extension object="cutehmi::base::XMLBackendPlugin"> <extension object="cutehmi::xml::BackendPlugin">
<!-- Section of 'cutehmi_modbus_1' plugin. This is where plugin 'cutehmi_modbus_1' starts <!-- Section of 'cutehmi_modbus_1' plugin. This is where plugin 'cutehmi_modbus_1' starts
parsing its own portion of document. parsing its own portion of document.
xmlns - XML namespace. It denotes section format. xmlns - XML namespace. It denotes section format.
...@@ -74,13 +74,13 @@ ...@@ -74,13 +74,13 @@
</plugin> </plugin>
<!-- Plugin 'cutehmi_app_1' provides a way to interact with frontend application. --> <!-- Plugin 'cutehmi_app_1' provides a way to interact with frontend application. -->
<plugin binary="cutehmi_app_1" req_minor="0"> <plugin name="cutehmi_app_1" req_minor="0">
<extension object="cutehmi::base::XMLBackendPlugin"> <extension object="cutehmi::xml::BackendPlugin">
<cutehmi_app_1 xmlns="http://michpolicht.github.io/CuteHMI/cutehmi_app_1/xsd/1.0/"> <cutehmi_app_1 xmlns="http://michpolicht.github.io/CuteHMI/cutehmi_app_1/xsd/1.0/">
<!-- Screens section. --> <!-- Screens section. -->
<screens> <screens>
<!-- Points to QML, which should be loaded and shown instead of default, empty screen. --> <!-- Points to QML, which should be loaded and shown instead of default, empty screen. -->
<main_screen source="QML/Screens/SampleProject/_Main.ui.qml" /> <main_screen source="examples/SampleProject/_Main.ui.qml" />
</screens> </screens>
</cutehmi_app_1> </cutehmi_app_1>
</extension> </extension>
...@@ -93,8 +93,8 @@ ...@@ -93,8 +93,8 @@
<!-- Element 'extension_ref' points to an extension. <!-- Element 'extension_ref' points to an extension.
context_property - context property name. context_property - context property name.
In C++ this will make somewhat long reference: cutehmi::base::CuteHMI::Instance().project()->model()->root().child("cutehmi_services_1")->extension("cutehmi::services::ServiceRegistry"). In C++ this would make somewhat long reference: cutehmi::CuteHMI::Instance()->project()->model()->root().child("cutehmi_services_1")->extension("cutehmi::services::ServiceRegistry").
This reference will be turned to context property with Qt setContextProperty() function. From now on instance of "cutehmi::services::ServiceRegistry" class will be available in QML as 'serviceRegistry'. This reference will be turned to context property with Qt setContextProperty() function. From now, instance of "cutehmi::services::ServiceRegistry" class will be available in QML as 'serviceRegistry'.
--> -->
<extension_ref object="cutehmi::services::ServiceRegistry" context_property="serviceRegistry" /> <extension_ref object="cutehmi::services::ServiceRegistry" context_property="serviceRegistry" />
</node_ref> </node_ref>
......
import qbs
import cutehmi
cutehmi.Example {
name: "SampleProject"
vendor: "CuteHMI"
friendlyName: "Sample Project"
description: "Sample project."
author: "Michal Policht"
copyright: "Michal Policht"
license: "WTFPL"
files: [
"SampleProject.cutehmi.xml",
"ServicesView.qml",
"_Main.ui.qml",
]
}
Project {
minimumQbsVersion: "1.6"
references: [
"SampleProject"
]
}
import qbs
import qbs.FileInfo
import "CommonProduct.qbs" as CommonProduct
CommonProduct {
type: "dynamiclibrary"
baseName: name
property string installDir: FileInfo.relativePath(path + "/../../..", sourceDirectory)
FileTagger {
patterns: "*.qml"
fileTags: ["qml"]
}
FileTagger {
patterns: "*.js"
fileTags: ["js"]
}
FileTagger {
patterns: "*.xml"
fileTags: ["xml"]
}
FileTagger {
patterns: "*.png"
fileTags: ["png"]
}
FileTagger {
patterns: "*.svg"
fileTags: ["svg"]
}
Group {
name: "Project files"
fileTagsFilter: ["qml", "js", "xml", "png", "svg"]
qbs.install: true
qbs.installSourceBase: sourceDirectory
qbs.installDir: installDir
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment