diff options
Diffstat (limited to 'src')
150 files changed, 6890 insertions, 2738 deletions
diff --git a/src/doc/qtautomotivesuite/qtautomotivesuite-project.qdocconf b/src/doc/qtautomotivesuite/qtautomotivesuite-project.qdocconf index 5c746e2..f04200a 100644 --- a/src/doc/qtautomotivesuite/qtautomotivesuite-project.qdocconf +++ b/src/doc/qtautomotivesuite/qtautomotivesuite-project.qdocconf @@ -18,14 +18,10 @@ qhp.QtAutomotiveSuite.filterAttributes = qtautomotivesuite $QT_VERSION qtrefd qhp.QtAutomotiveSuite.customFilters.Qt.name = QtAutomotiveSuite $QT_VERSION qhp.QtAutomotiveSuite.customFilters.Qt.filterAttributes = qtautomotivesuite $QT_VERSION -qhp.QtAutomotiveSuite.subprojects = overview install -qhp.QtAutomotiveSuite.subprojects.overview.title = Overview -qhp.QtAutomotiveSuite.subprojects.overview.indexTitle = Qt Automotive Suite Overview -qhp.QtAutomotiveSuite.subprojects.overview.selectors = fake:none - -qhp.QtAutomotiveSuite.subprojects.install.title = Installation -qhp.QtAutomotiveSuite.subprojects.install.indexTitle = Installing Qt Automotive Suite -qhp.QtAutomotiveSuite.subprojects.install.selectors = fake:none +qhp.QtAutomotiveSuite.subprojects = manual +qhp.QtAutomotiveSuite.subprojects.manual.title = Qt Automotive Suite +qhp.QtAutomotiveSuite.subprojects.manual.indexTitle = Qt Automotive Suite TOC +qhp.QtAutomotiveSuite.subprojects.manual.selectors = manual tagfile = qtautomotivesuite.tags diff --git a/src/doc/qtautomotivesuite/src/qtautomotivesuite-toc.qdoc b/src/doc/qtautomotivesuite/src/qtautomotivesuite-toc.qdoc new file mode 100644 index 0000000..701975b --- /dev/null +++ b/src/doc/qtautomotivesuite/src/qtautomotivesuite-toc.qdoc @@ -0,0 +1,45 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the Qt Automotive Suite. +** +** $QT_BEGIN_LICENSE:FDL-QTAS$ +** Commercial License Usage +** Licensees holding valid commercial Qt Automotive Suite licenses may use +** this file in accordance with the commercial license agreement provided +** with the Software or, alternatively, in accordance with the terms +** contained in a written agreement between you and The Qt Company. For +** licensing terms and conditions see https://www.qt.io/terms-conditions. +** For further information use the contact form at https://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! + \contentspage {Qt Automotive Suite} + \page qtautomotivesuite-toc.html + + \title Qt Automotive Suite TOC + + This file is used only for generating the TOC for the help file to be + displayed in the Qt Creator Help mode Contents view. + + \list + \li \l{Contents} + \list + \li \l {Qt Automotive Suite Overview}{Overview} + \li \l {Installing Qt Automotive Suite}{Install Instructions} + \li \l {Related Information} + \endlist + \endlist +*/ diff --git a/src/doc/qtivi/images/backendtypes.jpg b/src/doc/qtivi/images/backendtypes.jpg Binary files differnew file mode 100644 index 0000000..b06681d --- /dev/null +++ b/src/doc/qtivi/images/backendtypes.jpg diff --git a/src/doc/qtivi/images/feature_backend.jpg b/src/doc/qtivi/images/feature_backend.jpg Binary files differnew file mode 100644 index 0000000..98e3fca --- /dev/null +++ b/src/doc/qtivi/images/feature_backend.jpg diff --git a/src/doc/qtivi/qtivi-project.qdocconf b/src/doc/qtivi/qtivi-project.qdocconf index 6626607..7cd027a 100644 --- a/src/doc/qtivi/qtivi-project.qdocconf +++ b/src/doc/qtivi/qtivi-project.qdocconf @@ -5,12 +5,17 @@ url = http://doc.qt.io/QtIVI sourcedirs += . headerdirs += . +imagedirs += images # include sub-modules' sources and headers include(../../ivicore/doc/qtivicore.qdocconf) include(../../ivivehiclefunctions/doc/qtivivehiclefunctions.qdocconf) include(../../ivimedia/doc/qtivimedia.qdocconf) +# include the backend plugins documentation +include(../../plugins/ivimedia/doc/qtivimedia_plugins.qdocconf) +include(../../plugins/ivivehiclefunctions/doc/qtivivehiclefunctions_plugins.qdocconf) + qhp.projects = QtIvi qhp.QtIvi.file = qtivi.qhp diff --git a/src/doc/qtivi/src/attribute-system.qdoc b/src/doc/qtivi/src/attribute-system.qdoc index 07c3c10..4708d7f 100644 --- a/src/doc/qtivi/src/attribute-system.qdoc +++ b/src/doc/qtivi/src/attribute-system.qdoc @@ -28,6 +28,9 @@ \page attribute-system.html \title The Qt IVI Attribute System \keyword AttributeSystem +\previouspage Dynamic Backend System +\nextpage Models +\contentspage Concepts In the IVI world a system often needs to support a lot of different car configurations. These configurations could vary in display sizes and resolutions are used or the actual hardware changes @@ -140,7 +143,7 @@ class SimpleControl : public QObject Q_OBJECT Q_PROPERTY(QIviProperty *temperature READ temperatureProperty CONSTANT) - SimpleControl(QObject *parent = Q_NULLPTR); + SimpleControl(QObject *parent = nullptr); ~SimpleControl(); int temperature() const; diff --git a/src/doc/qtivi/src/backend-system.qdoc b/src/doc/qtivi/src/backend-system.qdoc new file mode 100644 index 0000000..dbc0528 --- /dev/null +++ b/src/doc/qtivi/src/backend-system.qdoc @@ -0,0 +1,137 @@ +/**************************************************************************** +** +** Copyright (C) 2017 Pelagicore AG +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the QtIvi module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL-QTAS$ +** Commercial License Usage +** Licensees holding valid commercial Qt Automotive Suite licenses may use +** this file in accordance with the commercial license agreement provided +** with the Software or, alternatively, in accordance with the terms +** contained in a written agreement between you and The Qt Company. For +** licensing terms and conditions see https://www.qt.io/terms-conditions. +** For further information use the contact form at https://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ +/*! +\page backend-system.html +\title Dynamic Backend System +\nextpage The Qt IVI Attribute System +\contentspage Concepts + +\section1 What's a Feature + +Modern automotive systems are very complex and are developed in a tight timeframe. Because of that, +it often makes sense to reuse parts of previously developed systems. At the same time, the main +development is done by independent companies (tier-1). To make it possible to reuse code from +previous project, but at the same time also make it possible to use parts the tier-1 can offer, it +makes sense to split the APIs into two layers: a frontend and a backend. In QtIvi, the frontend API +is called a \b feature, as usually a specific class is responsible for a specific feature area, +e.g. QIviClimateControl, for controlling the climate feature area. + +\section1 What's a Backend + +To function correctly, every feature needs to have a connected backend. This backend needs to +implement the corresponding feature backend interface. Only then a valid connection between the +feature and its backend can be created. + +Usually every feature has exactly one backend interface class, which needs to be implemented by the +backend for this feature to work. Every backend interface is derived from QIviFeatureInterface, +which provides generic functions and signals needed by every feature, e.g. for error handling. + +The backend implementations are grouped together and are implemented inside a Qt plugin. This makes +it easy to provide multiple backends at the same time and switch the backend at runtime. Those +backend plugins are loaded through \l{qtivicore - the Glue}{qtivicore}. A plugin can provide +implementations for multiple features. There is no need to create a separate plugin for every +feature. QtIvi also distinguishes between two types of backends: production and simulation. While +on a production system, you only want to have production backends running. But during the +development phase, it might be useful to have a simulation backend available, which can be used for +frontend development until the backend services are in an usable state. QtIvi uses a simple naming +scheme to identify whether a plugin provides simulation or production backends. Every simulation +plugin needs to have either "simulation" or "simulator" in its name. + +\image backendtypes.jpg "Backend types" + +\section1 ServiceObjects + +To keep the features very flexible and to make it possible to change the backends at runtime, we +introduced a concept called ServiceObject. A QIviServiceObject is a handle, which is used by the +feature to connect to the correct backend interface. It provides methods to query the available +backend interfaces that the ServiceObject is implementing. Plugins are automatically wrapped by +ServiceObjects. This makes it possible to share the ServiceObject between multiple features and to +explicltly select which backend should be used for your feature instance. + +\section1 qtivicore - the Glue + +The qtivicore module provides all the classes that are needed to glue the parts together. In +addition to providing the base classes like QIviAbstractFeature or QIviServiceObject, it also +provides the QIviServiceManager, responsible for loading the needed backend plugins. + +\image feature_backend.jpg "Feature backend relation" + +\section1 QIviServiceManager + +The QIviServiceManager is the central part of qtivicore, keeping book on all the available backends +and their exported interfaces. For this, the manager scans through all available plugins and their +accompanying metadata. This gives the QIviServiceManager the ability to only load the plugins, +which are actually needed by a Feature in order to reduce the startup time. All these information +is collected in the manager in form of a model, which enables the user to pick and choose the +plugin he wants to use. + +\section1 How a Feature Finds its Backend + +Usually every Feature is using the so called auto discovery mode. From QML, you can set the +QIviAbstractFeature::discoveryMode property; from the C++ side, this can be started using +QIviAbstractFeature::startAutoDiscovery(). This will ask the QIviServiceManager for all the +available backends implementing the required interface for your feature. The manager will then +choose the first matching backend and will connect the feature to it. QIviAbstractFeature will +first ask for production backends and only if none are available, fall back to a simulation +backend. This behavior can be controlled using the QIviAbstractFeature::discoveryMode (defaults to +QIviAbstractFeature::AutoDiscovery). The resulting backend type can be retrieved via +QIviAbstractFeature::discoveryResult. After the feature has successfully loaded a backend, the +QIviAbstractFeature::serviceObject property holds the loaded ServiceObject and +QIviAbstractFeature::isValid returns \c true. + +\section2 Manual Assignment + +If a feature does not want not use the auto discovery mechanism, it can simply set the +discoveryMode to QIviAbstractFeature::NoAutoDiscovery. After that, the feature won't search for a +backend itself anymore, so the user needs to assign a ServiceObject manually. + +\section2 DiscoveryModels + +For features like QIviClimateControl the auto discovery is fitting, as there is usually a 1:1 +mapping between a feature and a backend providing the implementation for the feature. For more +generic interfaces like a media player, this might not be sufficient: you could control a built-in +media player backend with this, but you might also want to control the media player running on your +mobile phone over bluetooth. For this to work, you first would need to discovery the available +devices and then pass the ServiceObject of the selected device to the media player interface. The +discovery of the available mobile phones can be done using a DiscoveryModel. This provides you with +a ServiceObject for every device found. The concept of a discovery model is not limited to mobile +phones, it can be used for all backends that are not hard-wired to the system, like internet +services or controlling multiple rearseat systems. + +\section2 Detailed connection order + +\list 1 + \li A ClimateControl element is created in QML. + \li ClimateControl will call QIviAbstractFeature::startAutoDiscovery on its completion. + \li QIviAbstractFeature::startAutoDiscovery will ask QIviServiceManager for all backends. + \li QIviServiceManager searches for all available plugins and the interfaces they are implementing + (this happens only once). + \li QIviAbstractFeature will accept the first QIviServiceObject and connect to the + corresponding interface. + \li The ClimateControl element is ready to be used. +\endlist +*/ diff --git a/src/doc/qtivi/src/concepts.qdoc b/src/doc/qtivi/src/concepts.qdoc new file mode 100644 index 0000000..2b54878 --- /dev/null +++ b/src/doc/qtivi/src/concepts.qdoc @@ -0,0 +1,40 @@ +/**************************************************************************** +** +** Copyright (C) 2017 Pelagicore AG +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the QtIvi module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL-QTAS$ +** Commercial License Usage +** Licensees holding valid commercial Qt Automotive Suite licenses may use +** this file in accordance with the commercial license agreement provided +** with the Software or, alternatively, in accordance with the terms +** contained in a written agreement between you and The Qt Company. For +** licensing terms and conditions see https://www.qt.io/terms-conditions. +** For further information use the contact form at https://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ +/*! +\page concepts.html +\title Concepts + +All Qt IVI feature APIs depend on a set of key concepts. These are explained in the +following sections. + +\list + \li \l {Dynamic Backend System} + \li \l {The Qt IVI Attribute System} + \li \l {Models} + \li \l {The Qt IVI Query Language} +\endlist +*/ diff --git a/src/doc/qtivi/src/extending-qtivi.qdoc b/src/doc/qtivi/src/extending-qtivi.qdoc index c55e4f8..921a3cb 100644 --- a/src/doc/qtivi/src/extending-qtivi.qdoc +++ b/src/doc/qtivi/src/extending-qtivi.qdoc @@ -147,7 +147,7 @@ is to be used in a climate control API, while the zoned interface provides per-z Building a zoned feature requires the backend interface to be derived from QIviZonedFeatureInterface. This provides the backend an interface for enumerating the available zones. This interface also includes the necessary -QIviZonedFeatureInterface::initializeAttributes method to initialize any +QIviZonedFeatureInterface::initialize method to initialize any \l {Extending Qt IVI#property-attributes} {property attributes}. \section2 Property Attributes diff --git a/src/doc/qtivi/src/generator-usage.qdoc b/src/doc/qtivi/src/generator-usage.qdoc new file mode 100644 index 0000000..6f20285 --- /dev/null +++ b/src/doc/qtivi/src/generator-usage.qdoc @@ -0,0 +1,249 @@ +/**************************************************************************** +** +** Copyright (C) 2017 Pelagicore AG +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the QtIvi module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL-QTAS$ +** Commercial License Usage +** Licensees holding valid commercial Qt Automotive Suite licenses may use +** this file in accordance with the commercial license agreement provided +** with the Software or, alternatively, in accordance with the terms +** contained in a written agreement between you and The Qt Company. For +** licensing terms and conditions see https://www.qt.io/terms-conditions. +** For further information use the contact form at https://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ +/*! +\page generator-usage.html +\title AutoGenerator usage +\previouspage Jinja template syntax +\nextpage Qmake integration + +This page is about the usage of the QtIVI auto-generator. + +\section1 Introduction + +The Generator is a Python script that can be run manually or using the qmake integration (see \l +{Qmakeintegration}). This script uses QFace as the autogenerator framework which parses the IDL +file,generates the domain-model (similar to AST) and then feeds it to the actual generator. +Depending on the type of the generated project, different \e{formats} are specified. + +\section1 Command line parameters +The generation is run using the following command: +\code +${QTIVI_REPO_PATH}/src/ivicore/qface/generate.py interface.qface out_dir --format=backend_simulator +\endcode + +The options and parameters are: +\table + \row + \li --reload / --no-reload [optional] + \li specifies whether the generator should keep track of the changes in the IDL file + and update output on the fly (--no-reload by default) + \row + \li -f, --format [frontend|backend_simulator] + \li see below + \row + \li --help + \li Show options and exit. + \row + \li source + \li Path or paths to the IDL source files. In case of multiple entries present, each one + will be handled. In case a directory path is provided, it will be scanned for all the IDL + files. + \row + \li outputdir + \li Generation destination folder +\endtable + +At the moment the generator is able to generate 2 kinds of projects given an interface IDL file +based on the \e {--format} option value. +These are: +\table + \row + \li frontend + \li Generates a developer facing API using base classes from qtivicore and the \l {Dynamic + Backend System} + \row + \li backend simulator + \li Generates a simulation backend for the API generated by the "frontend" option. This + backend serves as a mock implementation. +\endtable + +\section1 YAML configuration + +The Python script is responsible for parsing the input files and for the creation of a domain +model. This domain model is passed as a context to the Jinja template engine. To control which +files are generated, the "Generation YAML" can be used. In addition, an "Annotations YAML" can be +used to add more information to the IDL file, which are generator specific. + +\section2 Generation YAML + +After the domain model tree has been created, this tree is traversed and each leaf of the domain +model object tree (module, interface, structure, etc) is passed to a specific Jinja template +defined by the configuration file. This file must be in YAML format and for every particular +generation format its name is defined in the script. This file must have the following structure: + +\code +generate_rules: + module_rules: + - dest_file: "{{module.module_name|lower}}plugin.h" + template_file: "plugin.h.tpl" + interface_rules: + - dest_file: '{{interface|lower}}backend.h' + template_file: 'backend.h.tpl' + struct_rules: +\endcode + +For every entity there is a list of templates needed to be called when traversing this entity +in the domain model tree. Here, \e{dest_file} is a name of the file need to be created specified in +the \l {Jinja template syntax}{Jinja template language} format: the value of the object property +used in the name template will be processed and substitued into the template, thus forming the +final name of the file to create. \e{dest_file} is a name of the template to be used. For the IVI +generator, rules for three kinds of entities need to be specified: modules, interfaces and +structures. + +\section2 Annotations YAML + +At the moment not all aspects of the interface description cannot be expressed using the IDL +itself. For instance there is no language construct to define default value for the property or +values the property can take on. Still this can be achieved via a mechanism called \l +{annotations_reference} {Annotations}. Annotations allow great freedom and flexibility of +expressing any concepts and constructs. + +Below is an example of using annotations in the IDL. Here it's defined that interface is zoned and +its identifier is specified. + +\code +@config: {zoned: true, id: "org.qt-project.qtivi.ClimateControl/1.2" } +\endcode + +Not all of the annotations make sense to be put in the main IDL file either. For instance, one may +need to define some aspects of generation of the auto-testing code. Such annotations can be put in +the YAML file accompanying the main IDL file and named after it. During the parse phase +QFace picks this file up autmatically and merges annotation specified in this YAML file with those +defined in the IDL file. + +For QtIvi there are following annotations used for the IDL definition: + +\table + \header + \li Tag + \li Where + \li Object type + \li Purpose + \row + \li @config(zoned) + \li Main IDL file + \li Interface + \li tells the generator whether the interface is zoned or not. This allows to define + whether the backend feature interface is derived from QIviZonedFeatureInterface or from + QIviFeatureInterface + \row + \li @config(id=org.qt.project.qtivi.ClimateControl.1.0) + \li Main IDL file + \li Interface + \li defines the interface id. The id is a string used by the QtIvi service manager to glue + frontend interface and backend implementation together. See \l {Dynamic Backend System} + for more details. +\endtable + +The annotations that are not logically part of the interface description but rather the ones used +for specifying additional information are put in the accompnying YAML file. Here is the list of +annotations used for defining various aspects of the generation of the backend-simulator: + +\table + \header + \li Tag + \li Where + \li Object type + \li Purpose + \row + \li + \code + config_simulator: + zones: { left : FrontLeft, right : FrontRight, rear: Rear } + \endcode + \li Accompanying YAML file + \li Interface + \li For the backend simulator defines a list of zones supported by the simulation code + with their names + \row + \li \code + config_simulator: + default_value: AirflowDirection.Floor | AirflowDirection.Dashboard + \endcode + \li Accompanying YAML file + \li Property + \li Defines the initial values for the property returned by the simulator backend. +\endtable + + +\section1 Generated projects structure + +In the generator output directory first a new subfolder with the name of the module id will be +created. All the generated files will be put in this folder. The following files will be generated: + +\section2 Frontend +\table + \header + \li File name + \li Purpose + \row + \li "{{module.module_name|lower}}global.h" + \li Standard file with global EXPORT defines + \row + \li "{{module.module_name|lower}}module.h/cpp" + \li Files defining a module class used for module global variables and types. + \row + \li "{{module|lower|replace('.', '-')}}.pri" + \li Standard Qt .pri file, containing all the generated files that can be used for + including the autogenerated files into a qmake project. + \row + \li "{{interface|lower}}backendinterface.h/cpp" + \li Files defining the interface need to be implemented by the backend implementation of + the feature + \row + \li "{{interface|lower}}.h/cpp" + \li Front end implementation of the feature, ready to be used from QML. + \row + \li "{{interface|lower}}_p.h" + \li Private part of the frontend implementation +\endtable + +\section2 Backend simulator + +\table + \header + \li File name + \li Purpose + \row + \li "{{module.module_name|lower}}plugin.h/cpp" + \li Files defining implementation of QtIvi backend plugin implementing + QIviServiceInterface + \row + \li "{{module.module_name|lower}}.json" + \li File containing identifiers of the exposed feature interfaces needed by the Qt plugin + system. + \row + \li "{{module|lower|replace('.', '-')}}.pri" + \li Standard Qt .pri file, containing all the generated files that can be used for + including the autogenerated files into a qmake project. + \row + \li "{{interface|lower}}backend.h/cpp" + \li Files containing the implementation of the simulation backend. +\endtable + + +*/ diff --git a/src/doc/qtivi/src/idl-syntax.qdoc b/src/doc/qtivi/src/idl-syntax.qdoc new file mode 100644 index 0000000..e43936d --- /dev/null +++ b/src/doc/qtivi/src/idl-syntax.qdoc @@ -0,0 +1,315 @@ +/**************************************************************************** +** +** Copyright (C) 2017 Pelagicore AG +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the QtIvi module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL-QTAS$ +** Commercial License Usage +** Licensees holding valid commercial Qt Automotive Suite licenses may use +** this file in accordance with the commercial license agreement provided +** with the Software or, alternatively, in accordance with the terms +** contained in a written agreement between you and The Qt Company. For +** licensing terms and conditions see https://www.qt.io/terms-conditions. +** For further information use the contact form at https://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ +/*! +\page idl-syntax.html +\title QFace IDL syntax +\nextpage Jinja template syntax +\keyword IDL + +This page explains the basic usage of the QFace IDL. A more detailed description of the library +can be found on its \l {https://pelagicore.github.io/qface/}{page} + +QFace (Qt interface language) is an Interface Description Languge (IDL). While it is primarily +designed to define an interface between Qt, QML and C++, it is intended to be flexible enough also +to be used in other contexts. + + +\section1 The IDL + +The IDL uses common API concepts such as modules, interfaces, properties, structs and enums/flags. +Additionally it knows about lists and \l {Model/View Programming}{models}. +A list is an array of primitive or complex types. A model is an indicator for large data sets +which are typical used via a defined API (e.g. pagination). + +\code +module org.example 1.0 + +interface Echo { + string message; + void echo(string message); + signal broadcast(string message); + Status status; +} + +enum Status { + Null, Loading, Ready, Error +} +\endcode + +The data types provided by QFace can be divided into primitive and complex types: + +\b {Primitive Types} +\list + \li bool + \li int + \li real + \li string + \li var +\endlist + +\b {Complex Types} +\list + \li Interface + \li Struct + \li Enum + \li Flag + \li Array + \li Model +\endlist + +The language as such does not provide any support for maps or dictionaries. The reason for not +providing a map container type is that keys in dictionaries requires a hash which can not always +be guaranteed to be available in complex types. + +\section1 Grammar +The grammar of QFace is well defined and is based on the concepts of modules as a larger +collection of information. + +A module can have several interfaces, structs and/or enums/flags. + +\code +module <module> <version> +import <module> <version> + +interface <Identifier> { + [readonly] <type> <identifier> + <type> <operation>(<parameter>*) + signal <signal>(<parameter>*) +} + +struct <Identifier> { + <type> <identifier>; +} + +enum <Identifier> { + <name> = <value>, +} + +flag <Identifier> { + <name> = <value>, +} +\endcode + +A QFace document always describes one module. Each document can contain one or more interfaces, +structs, flags or enums. Each document can import other modules using the import statement. + +\section1 Module + +A module is identified by its name. The name should normally be a URI where all parts are +lowercase (e.g. \e {entertainment.tuner}). A module may import other modules with the primary +purpose being to ensure that dependencies are declared inside the QFace file. + +\code +// org.example.qface +module org.example 1.0 + +import org.common 1.0 +\endcode + +\section1 Interface + +An interface is a collection of properties, operation and signals. Properties carry data, whereas +the operations normally modify the data. Signals are used to notify the user of changes. + +\code +interface WeatherStation { + real temperature; + void reset(); + signal error(string message); +} +\endcode + +\section1 Struct + +The struct is supposed to serve as a container to transport structured data. It supports neither +properties nor operations. + +\section1 Property + +Interfaces and structures data are carried by properties: syntax elements allowing to describe +some attributes of the entity. A property can be of any type, known to IDL. It can be marked as \e +{readonly}, in which case this attribute of the interface is not supposed to be written to from +the outside code. It's up to the generator to enforce this constraint. + +\section1 Enum/Flag +Enums and flags are the concepts known from many popular programming languages (C++,Java,etc). +They differ only in what values they can take: enums are allowed to take only a single value, +whereas flags can be an OR-ed combination of multiple values. + +\section1 Types + +Types are either local and can be referenced simply by their name, or they are from an external +module in which case they need to be referenced with the fully qualified name (module + '.' + +name). A type can be an interface, struct, enum or flag. + +A module consists of either one or more interfaces, structs and enums/flags. They can come in any +number or combination. The interface is the only type which can contain operations and signals. +A struct is merely a container to transport structured data. Enum and flags allows the user to +encode information used inside the struct or interface as datatype. + +The QFace library does not allow to extend interfaces. It is by design kept simple. + +Below is an example of a QFace file. + +\code +module entertainment.tuner 1.0; + +import common 1.0 + +interface Tuner { + // property currentStation + readonly Station currentStation; + // operation nextStation + void nextStation(); + // operation previousStation + void previousStation(); + // operation updateCurrentStation + void updateCurrentStation(int stationId); + + list<int> primitiveList; + list<Station> complexList; + model<int> primitiveModel; + model<Station> complexModel; +} + +\endcode + + +\section1 Annotations +\target annotations_reference + +Annotations is a way to add meta information to your interface definition. It is available to each +symbol in the interface. + +Annotations allows an interface author to extend the existing interface with additional meta +information, called tags, aka annotations. One or several annotations can precede a module, +interface, struct or enum. They are also allowed before an operation, property or signal. +Everywhere where a documentation comment is allowed you can also add annotations. + +An annotation looks like this: + +\code +@service: {port: 12345} +interface Tuner { +} +\endcode + +An in code annotation precedes a symbol and it starts with an @ sign. A symbol can have more than +one one annotation line. Each line should be one individual annotation. The content is YAML +content. All @ signs preceding a symbol are collected and then evaluated using a YAML parser. + +For larger annotations one can use the external annotation document feature. + +\code +@singleton: yes +@data: [1,2,3] +@config: { values: [LEFT, RIGHT, TOP] } +\endcode + +This will be result into a YAML content of + +\code +singleton: yes +data: [1,2,3] +config: { values: [LEFT, RIGHT, TOP] } +\endcode + +And the result as Python object would be + +\code +{ + "data": [ 1, 2, 3 ], + "singleton": true, + "config": { + "values": [ "LEFT", "RIGHT", "TOP" ] + } +} +\endcode + +\section1 Annotation Documents + +QFace allows also to specify these annotations in external documents using the YAML syntax. For +this you need to create a document with the same name as the QFace document but with the extension +.yaml. It should have roughly the following format + +\code +com.pelagicore.ivi.Tuner: + service: + port: 12345 +\endcode + +On the root level should be a fully qualified name of a symbol. The symbol will be looked up and +the following annotation information merged with the existing annotations from the QFace document. + +\section1 Merging Annotations + +The external annotations will be merged on top of the embedded annotations on per symbol base. +Dictionaries will be merged. If a merge can not be done then the external document based +annotations will override the embedded annotations. + +The annotation are available later when navigating the domain model. + +\code +{% if "service" in interface.tags %} +interface {{interface}} is served on port: {{interface.tags.service.port}} +{% else %} +interface {{interface}} is not served +{% endif %} +\endcode + +\note +QFace does not specify specific annotations, but defines just the annotation format. The set of +annotations supported must be defined and documented by the generator. + +\section1 Domain Model + +As a result of parsing the IDL document, a domain model object must be created. The domain model +resembles the structure of our system as objects. It is build by the parser and serves as the +input into the generator. + +The IDL is converted into an in memory domain model (see qface/idl/domain.py) + +\code +- System + - Module + - Import + - Interface + - Property + - Operation + - Event + - Enum + - Flag + - Struct + - Property +\endcode + +The domain model is the base for the code generation. You traverse the domain tree and trigger +your own code generation. + +Detailed description of QFace library API is found on the library \l +{http://qface.readthedocs.io/en/latest/api.html} {page} +*/ diff --git a/src/doc/qtivi/src/models.qdoc b/src/doc/qtivi/src/models.qdoc new file mode 100644 index 0000000..6eabfd4 --- /dev/null +++ b/src/doc/qtivi/src/models.qdoc @@ -0,0 +1,115 @@ +/**************************************************************************** +** +** Copyright (C) 2017 Pelagicore AG +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the QtIvi module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL-QTAS$ +** Commercial License Usage +** Licensees holding valid commercial Qt Automotive Suite licenses may use +** this file in accordance with the commercial license agreement provided +** with the Software or, alternatively, in accordance with the terms +** contained in a written agreement between you and The Qt Company. For +** licensing terms and conditions see https://www.qt.io/terms-conditions. +** For further information use the contact form at https://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ +/*! +\page models.html +\title Models +\previouspage The Qt IVI Attribute System +\nextpage The Qt IVI Query Language +\contentspage Concepts + +For interacting with lists in Qt applications, you usually want to use Qt's ListView classes, which +are based on the Model-View-Controller pattern. QtIvi offers support classes, making it easy to +provide your own models. + +\section1 QIviAbstractListModel + +When designing features like a contacts list of a connected mobile phone, you may want to use +QtIvi's frontend/backend separation by deriving from QIviAbstractFeature and at the same time make +it possible to use this feature with a QAbstractItemView derived class to show your contacts in a +list form. + +QtIviCore provides QIviAbstractListModel for this use-case. The class is derived from +QIviAbstractFeatureListModel, but also provides all the functionality from QIviAbstractFeature. + +\section1 QIviSearchAndBrowseModel + +The QIviSearchAndBrowseModel is not directly a base class, but intended to be used as-is. As the +name suggests, it provides a model, that supports searching the model content as well as browsing +through a set of model data. Let's go through all its features in more detail: + +\section2 Fetch Modes + +As we don't have control over the interfaces of the data providers, the +QIviSearchAndBrowseModel +supports two distinct fetch modes: +\list 1 +\li If the number of items in the model is \b not known from the +beginning, the \l{QIviSearchAndBrowseModel::FetchMore}{FetchMore} mode should be used. This mode +will fetch a number of items from the backend once they are needed and the backend tells the +frontend whether there is more data to be fetched. + +\li The second fetch mode - \l{QIviSearchAndBrowseModel::DataChanged}{DataChanged} - will fill the +complete model with empty data and use the \l{QAbstractItemModel::dataChanged()} signal to tell the +View about the actual content. For this mode to work correctly, the number of items in the list +needs to be known from the beginning. +\endlist + +See the QIviSearchAndBrowseModel documentation for a more detailed description of the fetch modes +and their (dis)advantages. + +\section2 Modifying the Content + +QIviSearchAndBrowseModel provides some generic methods for modifying the content of the model: + +\list + \li \l{QIviSearchAndBrowseModel::insert}{insert()} + \li \l{QIviSearchAndBrowseModel::remove}{remove()} + \li \l{QIviSearchAndBrowseModel::move}{move()} +\endlist + +\section2 Filtering and Sorting (Search) + +For filtering and sorting, QIviSearchAndBrowseModel uses \l{the Qt IVI Query Language}. This makes +the system very flexible and powerful at the same time. See the \l {The Qt IVI Query Language}{next +page} for more information about the query language. + +\section2 Browsing + +Although the Qt IVI Query Language supports very complex queries, enabling you to filter list +content, it might still not be suitable for all use-cases. With the query language, the frontend +developer defines which data is needed next. This is sometimes not possible, as the backend already +defines a specific browsing order. A DLNA backend for example already specifies that first an +artist needs to be selected and only then a list of all albums of that artist is presented. + +For this scenario, the QIviSearchAndBrowseModel provides some methods to navigate through the +models using the following methods: + +\list + \li \l{QIviSearchAndBrowseModel::canGoForward}{canGoForward(index)} + \li \l{QIviSearchAndBrowseModel::goForward}{goForward(index)} + \li \l{QIviSearchAndBrowseModel::canGoBack}{canGoBack()} + \li \l{QIviSearchAndBrowseModel::goBack}{goBack()} +\endlist + +\section2 Capabilities + +You might not need all of the above features at the same time or your backend doesn't even support +them. In this case, there is a capability system within the QIviSearchAndBrowseModel. The backend +reports which capabilities it can support. Based on that information, only the supported +functionalities are enabled in the frontend API. + +*/ diff --git a/src/doc/qtivi/src/qface-main.qdoc b/src/doc/qtivi/src/qface-main.qdoc new file mode 100644 index 0000000..45b7a0d --- /dev/null +++ b/src/doc/qtivi/src/qface-main.qdoc @@ -0,0 +1,42 @@ +/**************************************************************************** +** +** Copyright (C) 2017 Pelagicore AG +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the QtIvi module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL-QTAS$ +** Commercial License Usage +** Licensees holding valid commercial Qt Automotive Suite licenses may use +** this file in accordance with the commercial license agreement provided +** with the Software or, alternatively, in accordance with the terms +** contained in a written agreement between you and The Qt Company. For +** licensing terms and conditions see https://www.qt.io/terms-conditions. +** For further information use the contact form at https://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ +/*! +\page qface-main.html +\title QFace Autogeneration +\keyword QFace + +QtIvi provides a way to describe interfaces using its own IDL (interface definition language) and +then generate Qt/QML API code based on this definition. The generator is based on the QFace +library, which provides a generic autogeneration framework. + +\list + \li \l {QFace IDL syntax} + \li \l {Jinja template syntax} + \li \l {AutoGenerator Usage} + \li \l {qmake integration} +\endlist +*/ diff --git a/src/doc/qtivi/src/qmake-integration.qdoc b/src/doc/qtivi/src/qmake-integration.qdoc new file mode 100644 index 0000000..7931fc3 --- /dev/null +++ b/src/doc/qtivi/src/qmake-integration.qdoc @@ -0,0 +1,34 @@ +/**************************************************************************** +** +** Copyright (C) 2017 Pelagicore AG +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the QtIvi module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL-QTAS$ +** Commercial License Usage +** Licensees holding valid commercial Qt Automotive Suite licenses may use +** this file in accordance with the commercial license agreement provided +** with the Software or, alternatively, in accordance with the terms +** contained in a written agreement between you and The Qt Company. For +** licensing terms and conditions see https://www.qt.io/terms-conditions. +** For further information use the contact form at https://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ +/*! +\page qmake-integration.html +\title Qmake integration +\previouspage AutoGenerator usage + + + +*/ diff --git a/src/doc/qtivi/src/qtivi-backends.qdoc b/src/doc/qtivi/src/qtivi-backends.qdoc new file mode 100644 index 0000000..37fa2dc --- /dev/null +++ b/src/doc/qtivi/src/qtivi-backends.qdoc @@ -0,0 +1,46 @@ +/**************************************************************************** +** +** Copyright (C) 2017 Pelagicore AG +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the QtIvi module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL-QTAS$ +** Commercial License Usage +** Licensees holding valid commercial Qt Automotive Suite licenses may use +** this file in accordance with the commercial license agreement provided +** with the Software or, alternatively, in accordance with the terms +** contained in a written agreement between you and The Qt Company. For +** licensing terms and conditions see https://www.qt.io/terms-conditions. +** For further information use the contact form at https://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! +\page qtivi-backends.html +\title QtIvi Backends + +All supported QtIvi Backends by module + +\annotatedlist qtivi_backend_groups + +A list of all QtIvi Backends can be found \l {All QtIvi Backends}{here}. +*/ + +/*! +\page qtivi-all-backends.html +\title All QtIvi Backends + +All supported QtIvi Backends + +\annotatedlist qtivi_backend +*/ diff --git a/src/doc/qtivi/src/qtivi.qdoc b/src/doc/qtivi/src/qtivi.qdoc index 96cd131..816bf9b 100644 --- a/src/doc/qtivi/src/qtivi.qdoc +++ b/src/doc/qtivi/src/qtivi.qdoc @@ -56,10 +56,9 @@ automotive features to Qt-based applications in a structured manner. \list + \li \l{Concepts} \li \l{Using the Qt IVI Reference API} - \li \l{Extending Qt IVI} - \li \l{The Qt IVI Attribute System} - \li \l{The Qt IVI Query Language} + \li \l{QtIvi Backends}{Available Backends} \endlist \section1 Modules diff --git a/src/doc/qtivi/src/query-language.qdoc b/src/doc/qtivi/src/query-language.qdoc index 421553a..580abf3 100644 --- a/src/doc/qtivi/src/query-language.qdoc +++ b/src/doc/qtivi/src/query-language.qdoc @@ -28,6 +28,8 @@ \page query-language.html \title The Qt IVI Query Language \keyword Qt IVI Query Language +\previouspage Models +\contentspage Concepts Automotive systems are getting bigger and bigger and with it also the feature-set in areas like entertainment or connectivity. Modern system can handle phone calls, access the mobile phone's addressbook, and have a mediaplayer diff --git a/src/doc/qtivi/src/reference-api.qdoc b/src/doc/qtivi/src/reference-api.qdoc index 182d548..86bdc76 100644 --- a/src/doc/qtivi/src/reference-api.qdoc +++ b/src/doc/qtivi/src/reference-api.qdoc @@ -52,72 +52,4 @@ The feature areas covered by the Qt IVI module reference API are: \endlist \endomit \endlist - -\chapter Key Concepts - -All Qt IVI feature APIs depend on a set of key concepts. These are explained in the -following sections. - -\section2 Loading Backends - -As the implementation of each feature is separate from the API definition, all features -have an QIviAbstractFeature::isValid property. Until this value is \c true, the API is -effectively disabled and only return safe default values. - -For more detailed information about the backend loading status, the -QIviAbstractFeature::discoveryResult property is provided. It can be used to detect backend -loading errors. - -The backend loading behavior is controlled through the QIviAbstractFeature::discoveryMode -property from QML, or by calling QIviAbstractFeature::startAutoDiscovery() from C++. - -In most cases, each front-end has a single corresponding backend, that is, there is commonly -only a single climate control system in each vehicle. In these cases, setting -QIviAbstractFeature::discoveryMode mode to QIviAbstractFeature::AutoDiscovery means that the -feature implementation automatically finds and loads the corresponding backend or reports -an error. The application code only has to wait for the QIviAbstractFeature::isValid property -to become \c true. - -As the front-end and backend of each feature is separated, the backends can be dynamically -exchanged. For instance, a single API can be provided to all media playback features of -the vehicle and then the backend is exchanged dynamically. This is done by modifying the -QIviAbstractFeature::serviceObject property. In these cases -QIviAbstractFeature::discoveryMode must be set to QIviAbstractFeature::NoAutoDiscovery to -prevent Qt IVI to automatically loading a backend. - -\section2 Zones - -Zones provide a standard way to provide a single API for multiple points in the vehicle. -For instance, climate control commonly has driver and passenger zones, and might even have -a rear seat zone. The same goes for wheels, doors, mirrors, windows and more. - -A zoned feature provides a QIviAbstractZonedFeature::availableZones property holding the -names of the available zones. Notice that there are no zones until the \c isValid property -is \c true. - -In C++, zones are accessed through the QIviAbstractZonedFeature::zoneAt() or through the -QIviAbstractZonedFeature::zones list. - -In QML, the zones can be accessed through the AbstractZonedFeature::zoneAt property, for example, \c{climateControl.zoneAt.FrontSeat.seatheater}, or through the AbstractZonedFeature::zones -model. The model's \c modelData property exposes the API of the individual zones. - -Zones with similar but slightly different configurations, e.g. there is no steering wheel -heater on the passenger side, commonly rely on -\l {Using the Qt IVI Reference API#property-attributes} {property attributes} to to -differentiate between the zones. - -\section2 Property Attributes - -Some properties are represented as QIviProperty instances instead of a plain old data -value type. - -A QIviProperty has a \c value property, an \c availableValues list, a \c minimumValue -and \c maximumValue range pair, and an \c available flag. - -The \c availableValues is only used for enums, while \c minimumValue and \c maximumValue are -used for numeric values. \c value and \c available are used for all properties. - -Accessing a property where \c available is \c false will return an undefined value, -while trying to set an unavailable property has no effect. - */ diff --git a/src/doc/qtivi/src/template-syntax.qdoc b/src/doc/qtivi/src/template-syntax.qdoc new file mode 100644 index 0000000..e404305 --- /dev/null +++ b/src/doc/qtivi/src/template-syntax.qdoc @@ -0,0 +1,474 @@ +/**************************************************************************** +** +** Copyright (C) 2017 Pelagicore AG +** Copyright (C) 2017 Jinja Team. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the QtIvi module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL-QTAS$ +** Commercial License Usage +** Licensees holding valid commercial Qt Automotive Suite licenses may use +** this file in accordance with the commercial license agreement provided +** with the Software or, alternatively, in accordance with the terms +** contained in a written agreement between you and The Qt Company. For +** licensing terms and conditions see https://www.qt.io/terms-conditions. +** For further information use the contact form at https://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ +/* + NOTE: Some content in this file was copied from the Jinja Template Engine Documentation +*/ +/*! +\page template-syntax.html +\title Jinja template syntax +\previouspage QFace IDL syntax +\nextpage AutoGenerator usage + +This page is about the Jinja template engine. While the most detailed description of the template +language can be found at \l {http://jinja.pocoo.org/docs/dev/templates/}{Jinja documentation}, +some basic concepts are given in this article. + + +\section1 Code Generation Principle + +The code generation is driven by a small script which iterates over the domain model and writes +files using the Python Jinja template language. + + +Given that generator script has read and parsed the IDL file into a domain model, this latter one +is then used as the root object for the code generation inside the template language. Below is an +example of the code traversing the domain model: + +\code +{% for module in system.modules %} + {%- for interface in module.interfaces -%} + SERVICE, {{module}}.{{interface}} + {% endfor -%} + {%- for struct in module.structs -%} + STRUCT , {{module}}.{{struct}} + {% endfor -%} + {%- for enum in module.enums -%} + ENUM , {{module}}.{{enum}} + {% endfor -%} +{% endfor %} +\endcode + +The template iterates over the domain objects and generates text which is written into a file. + +\section1 Laguage constructs +\section2 Synopsis + +A template contains variables and/or expressions, which get replaced with values when a template +is rendered; and tags, which control the logic of the template. + +There are a few kinds of delimiters. The default Jinja delimiters are configured as follows: + +\list + \li {% ... %} for Statements + \li {{ ... }} for Expressions to print to the template output + \li {# ... #} for Comments not included in the template output + \li # ... ## for \l {line_statements}{Line Statements} +\endlist + +\section2 Control structures + +A control structure refers to all those things that control the flow of a program - conditionals +(i.e. if/elif/else), for-loops, as well as things like macros and blocks. With the default syntax, +control structures appear inside {% ... %} blocks. + +\section3 For + +Loop over each item in a sequence. For example, to display a list of users provided in a variable +called users: + +\code +<h1>Members</h1> +<ul> +{% for user in users %} + <li>{{ user.username|e }}</li> +{% endfor %} +</ul> +\endcode + +As variables in templates retain their object properties, it is possible to iterate over +containers like dict: + +\code +<dl> +{% for key, value in my_dict.iteritems() %} + <dt>{{ key|e }}</dt> + <dd>{{ value|e }}</dd> +{% endfor %} +</dl> +\endcode + +Inside of a for-loop block some special variables are available: + +\table + \header + \li Variable + \li Description + \row + \li loop.index + \li The current iteration of the loop. (starting with \e 1) + \row + \li loop.index0 + \li The current iteration of the loop. (starting with \e 0) + \row + \li loop.revindex + \li The number of iterations from the end of the loop (starting with \e 1) + \row + \li loop.revindex0 + \li The number of iterations from the end of the loop (starting with \e 0) + \row + \li loop.first + \li True if first iteration. + \row + \li loop.last + \li True if last iteration. + \row + \li loop.length + \li The number of items in the sequence. +\endtable + +See for more \l{http://jinja.pocoo.org/docs/2.9/templates/#list-of-control-structures}{Jinja +documentation} + + +Unlike in Python, it’s not possible to break or continue in a loop. One can, however, filter the +sequence during iteration, which allows one to skip items. The following example skips all the +users which are hidden: + +\code +{% for user in users if not user.hidden %} + <li>{{ user.username|e }}</li> +{% endfor %} +\endcode + +The advantage is that the special loop variable will count correctly; thus not counting the users +not iterated over. + +If no iteration took place because the sequence was empty or the filtering removed all the items +from the sequence, one can render a default block by using else: + +\code +<ul> +{% for user in users %} + <li>{{ user.username|e }}</li> +{% else %} + <li><em>no users found</em></li> +{% endfor %} +</ul> +\endcode + +In Python, \e {else} blocks are executed whenever the corresponding loop did not break. Since +Jinja loops cannot break anyway, a slightly different behavior of the \e {else} keyword was chosen. + +It is also possible to use loops recursively. This is useful when dealing with recursive data such +as sitemaps or RDFa. To use loops recursively, one basically has to add the recursive modifier to +the loop definition and call the loop variable with the new iterable where recursion is needed. + +The following example implements a sitemap with recursive loops: + +\code +<ul class="sitemap"> +{%- for item in sitemap recursive %} + <li><a href="{{ item.href|e }}">{{ item.title }}</a> + {%- if item.children -%} + <ul class="submenu">{{ loop(item.children) }}</ul> + {%- endif %}</li> +{%- endfor %} +</ul> +\endcode + +The loop variable always refers to the closest (innermost) loop. If we there is more than one +level of loops, we can rebind the variable loop by writing {% set outer_loop = loop %} after the +loop that we want to use recursively. Then, we can call it using {{ outer_loop(...) }} + +Please note that assignments in loops will be cleared at the end of the iteration and cannot +outlive the loop scope. Older versions of Jinja2 had a bug where in some circumstances it appeared +that assignments would work. This is not supported. + +\section3 If + +The if statement in Jinja is comparable with the Python if statement. In the simplest form, one +can use it to test if a variable is defined, not empty and not false: + +\code +{% if users %} +<ul> +{% for user in users %} + <li>{{ user.username|e }}</li> +{% endfor %} +</ul> +{% endif %} +\endcode + +For multiple branches, elif and else can be used like in Python. One can use more complex +Expressions there, too: + +\code +{% if kenny.sick %} + Kenny is sick. +{% elif kenny.dead %} + You killed Kenny! You bastard!!! +{% else %} + Kenny looks okay --- so far +{% endif %} +\endcode + +\section2 Tests +Beside filters, there are also so-called “tests” available. Tests can be used to test a variable +against a common expression. To test a variable or expression, its name is used followed by the +name of the test. For example, to find out if a variable is defined, one can try \e {name is +defined}, which will then return true or false depending on whether name is defined in the current +template context. + +Tests can accept arguments, too. If the test only takes one argument, one can leave out the +parentheses. For example, the following two expressions do the same thing: + +\code +{% if loop.index is divisibleby 3 %} +{% if loop.index is divisibleby(3) %} +\endcode + +The List of builtin tests can be found on the \l{http://jinja.pocoo.org/docs/2.9/ +templates/#builtin-tests}{Jinja documentation page}. +\section2 Filters + +Variables can be modified by functions called filters. Filters are separated from the variable by +a pipe symbol (|) and may have optional arguments in parentheses. Multiple filters can be chained. +The output of one filter is applied to the next. + +For example, {{ name|striptags|title }} will remove all HTML Tags from variable name and +title-case the output (title(striptags(name))). + +Filters that accept arguments have parentheses around the arguments, just like a function call. +For example: \code {{ listx|join(', ') }}\endcode will join a list with commas (equivalent to +\code str.join(', ', listx)\endcode). Nevertheless, the variable filter is applying to is always +passed as a first argument to the filter function. + +One can define custom filters by registering a Python function as a new filter with the +Environment object: + +\code +def lower_first_filter(s): + s = str(s) + return s[0].lower() + s[1:] + + +env = Environment( + loader=FileSystemLoader(search_path), + trim_blocks=True, + lstrip_blocks=True + ) +env.filters['lowerfirst'] = lower_first_filter +\endcode + +After that filter called lower first will be available from the template: +\code +{{ var | lowerfirst }} +\endcode + + +\section2 Variables +Template variables are defined by the context dictionary passed to the template. Variables can be +complex object having their own attributes. + +One can use a dot (.) to access attributes of a variable in addition to the standard Python +__getitem__ “subscript” syntax ([]). + +The following lines are equivalent: + +\code +{{ foo.bar }} +{{ foo['bar'] }} +\endcode + +If a variable or attribute does not exist, its value will result to undefined value. The +interpretation of that kind of value depends on the application configuration: the default +behavior is to evaluate to an empty string if printed or iterated over, and to fail for every +other operation. + +\section2 Comments + +To comment-out part of a line in a template, use the comment syntax which is by default set to {# +... #}. This is useful to comment out parts of the template for debugging or to add information +for other template designers or yourself: + +\code +{# note: commented-out template because we no longer use this + {% for user in users %} + ... + {% endfor %} +#} +\endcode + +\section2 Line Statements +\target line_statements + +If line statements are enabled by the application, it’s possible to mark a line as a statement. +For example, if the line statement prefix is configured to #, the following two examples are +equivalent: + +\code +<ul> +# for item in seq + <li>{{ item }}</li> +# endfor +</ul> +\endcode + +\code +<ul> +{% for item in seq %} + <li>{{ item }}</li> +{% endfor %} +</ul> +\endcode + +The line statement prefix can appear anywhere on the line as long as no text precedes it. For +better readability, statements that start a block (such as for, if, elif etc.) may end with a +colon: + +\code +# for item in seq: + ... +# endfor +\endcode + +Line statements can span multiple lines if there are open parentheses, braces or brackets: + +\code +<ul> +# for href, caption in [('index.html', 'Index'), + ('about.html', 'About')]: + <li><a href="{{ href }}">{{ caption }}</a></li> +# endfor +</ul> +\endcode + +Since Jinja 2.2, line-based comments are available as well. For example, if the line-comment +prefix is configured to be ##, everything from ## to the end of the line is ignored (excluding the +newline sign): + +\code +# for item in seq: + <li>{{ item }}</li> ## this comment is ignored +# endfor +\endcode + +\section2 Assignments + +Inside code blocks, you can also assign values to variables. Assignments at top level (outside of +blocks, macros or loops) are exported from the template like top level macros and can be imported +by other templates. + +Assignments use the set tag and can have multiple targets: + +\code +{% set navigation = [('index.html', 'Index'), ('about.html', 'About')] %} +{% set key, value = call_something() %} +\endcode + +It is not possible to set variables inside a block and have them show up outside of it. This also +applies to loops. The only exception to that rule are if statements which do not introduce a scope. + + +\section2 Whitespace Control + +In the default configuration: + +\list + \li a single trailing newline is stripped if present + \li other whitespace (spaces, tabs, newlines etc.) is returned unchanged +\endlist + +If an application configures Jinja to trim_blocks, the first newline after a template tag is +removed automatically (like in PHP). The lstrip_blocks option can also be set to strip tabs and +spaces from the beginning of a line to the start of a block. (Nothing will be stripped if there +are other characters before the start of the block) + +With both trim_blocks and lstrip_blocks enabled, you can put block tags on their own lines, and +the entire block line will be removed when rendered, preserving the whitespace of the contents. +For example, without the trim_blocks and lstrip_blocks options, this template: + +\code +<div> + {% if True %} + yay + {% endif %} +</div> +\endcode + +gets rendered with blank lines inside the div: + +\code +<div> + + yay + +</div> +\endcode + +But with both trim_blocks and lstrip_blocks enabled, the template block lines are removed and +other whitespace is preserved: + +\code +<div> + yay +</div> +\endcode + +One can manually disable the lstrip_blocks behavior by putting a plus sign (+) at the start of a +block: + +\code +<div> + {%+ if something %}yay{% endif %} +</div> +\endcode + +It's also possible to strip whitespace in templates by hand. With a minus sign (-) at the start or +end of a block (e.g. a For tag), a comment, or a variable expression, the whitespaces before or +after that block will be removed: + +\code +{% for item in seq -%} + {{ item }} +{%- endfor %} +\endcode + +This will yield all elements without whitespace between them. If seq was a list of numbers from 1 +to 9, the output would be 123456789. + +If Line Statements are enabled, they strip leading whitespace automatically up to the beginning of +the line. + +By default, Jinja2 also removes trailing newlines. To keep single trailing newlines, configure +Jinja to keep_trailing_newline. + +\note + +One must not add whitespace between the tag and the minus sign. + +valid: +\code +{%- if foo -%}...{% endif %} +\endcode +invalid: +\code +{% - if foo - %}...{% endif %} +\endcode + +*/ diff --git a/src/geniviextras/doc/qtgeniviextras.qdocconf b/src/geniviextras/doc/qtgeniviextras.qdocconf index 62550d3..c8161ca 100644 --- a/src/geniviextras/doc/qtgeniviextras.qdocconf +++ b/src/geniviextras/doc/qtgeniviextras.qdocconf @@ -1,6 +1,6 @@ -headerdirs += .. \ +headerdirs += .. -sourcedirs += .. \ +sourcedirs += .. exampledirs += ../../../examples/geniviextras \ snippets diff --git a/src/geniviextras/qdltregistration.cpp b/src/geniviextras/qdltregistration.cpp index 2a6ee9f..e2dc499 100644 --- a/src/geniviextras/qdltregistration.cpp +++ b/src/geniviextras/qdltregistration.cpp @@ -173,7 +173,7 @@ void QDltRegistrationPrivate::dltLogLevelChanged(char context_id[], uint8_t log_ QLoggingCategory* category = it.value().m_category; if (category->isEnabled(type) != enabled) { category->setEnabled(type, enabled); - q->logLevelChanged(category); + emit q->logLevelChanged(category); } } } @@ -209,8 +209,9 @@ DltLogLevelType QDltRegistrationPrivate::category2dltLevel(const QLoggingCategor types of a QLoggingCategory whenever the log level of a dlt context changes. */ -QDltRegistration::QDltRegistration() - : d_ptr(new QDltRegistrationPrivate(this)) +QDltRegistration::QDltRegistration(QObject *parent) + : QObject(parent) + , d_ptr(new QDltRegistrationPrivate(this)) { } diff --git a/src/geniviextras/qdltregistration.h b/src/geniviextras/qdltregistration.h index 2477eee..b0a067b 100644 --- a/src/geniviextras/qdltregistration.h +++ b/src/geniviextras/qdltregistration.h @@ -55,9 +55,10 @@ class QDltRegistrationPrivate; class Q_GENIVIEXTRAS_EXPORT QDltRegistration : public QObject { Q_OBJECT + Q_DISABLE_COPY(QDltRegistration) public: - QDltRegistration(); + QDltRegistration(QObject *parent = nullptr); ~QDltRegistration(); void registerApplication(const char *dltAppID, const char *dltAppDescription); diff --git a/src/ivicore/ivicore.pro b/src/ivicore/ivicore.pro index e2beea1..7470cfd 100644 --- a/src/ivicore/ivicore.pro +++ b/src/ivicore/ivicore.pro @@ -35,7 +35,8 @@ HEADERS += \ qivisearchandbrowsemodel_p.h \ qivisearchandbrowsemodelinterface.h \ qivisearchandbrowsemodelinterface_p.h \ - qivisearchandbrowsemodelitem.h + qivisearchandbrowsemodelitem.h \ + qivifeatureinterface.h SOURCES += \ qiviservicemanager.cpp \ @@ -51,7 +52,8 @@ SOURCES += \ qiviabstractfeaturelistmodel.cpp \ qivisearchandbrowsemodel.cpp \ qivisearchandbrowsemodelinterface.cpp \ - qivisearchandbrowsemodelitem.cpp + qivisearchandbrowsemodelitem.cpp \ + qivifeatureinterface.cpp include(queryparser/queryparser.pri) diff --git a/src/ivicore/qface/generate.py b/src/ivicore/qface/generate.py new file mode 100755 index 0000000..47633e2 --- /dev/null +++ b/src/ivicore/qface/generate.py @@ -0,0 +1,219 @@ +#!/usr/bin/env python3 +# Copyright (C) 2017 Pelagicore AG +# Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB) +# Contact: https://www.qt.io/licensing/ +# +# This file is part of the QtIvi module of the Qt Toolkit. +# +# $QT_BEGIN_LICENSE:LGPL-QTAS$ +# Commercial License Usage +# Licensees holding valid commercial Qt Automotive Suite licenses may use +# this file in accordance with the commercial license agreement provided +# with the Software or, alternatively, in accordance with the terms +# contained in a written agreement between you and The Qt Company. For +# licensing terms and conditions see https://www.qt.io/terms-conditions. +# For further information use the contact form at https://www.qt.io/contact-us. +# +# GNU Lesser General Public License Usage +# Alternatively, this file may be used under the terms of the GNU Lesser +# General Public License version 3 as published by the Free Software +# Foundation and appearing in the file LICENSE.LGPL3 included in the +# packaging of this file. Please review the following information to +# ensure the GNU Lesser General Public License version 3 requirements +# will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +# +# GNU General Public License Usage +# Alternatively, this file may be used under the terms of the GNU +# General Public License version 2.0 or (at your option) the GNU General +# Public license version 3 or any later version approved by the KDE Free +# Qt Foundation. The licenses are as published by the Free Software +# Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +# included in the packaging of this file. Please review the following +# information to ensure the GNU General Public License requirements will +# be met: https://www.gnu.org/licenses/gpl-2.0.html and +# https://www.gnu.org/licenses/gpl-3.0.html. +# +# $QT_END_LICENSE$ +# +# SPDX-License-Identifier: LGPL-3.0 + +import click +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 +from qface.idl.domain import Property + +here = Path(__file__).dirname() + +log = logging.getLogger(__file__) + +Filters.classPrefix = '' + + +def tag_by_path(symbol, path, default_value=False): + """ + Find the tag given by its full path in the object hierarchy, + like "property.config_sim.zones.right". If some part of the + path is missing, return None + """ + path_parts = path.split(".") + cur_level_obj = symbol.tags + for path_part in path_parts: + if path_part in cur_level_obj: + cur_level_obj = cur_level_obj[path_part] + else: + cur_level_obj = None + break + if cur_level_obj is None: + cur_level_obj = default_value + return cur_level_obj + + +def conf_sim_tag(symbol, path, default_value=False): + """ + Find tag, given by its path, located under "config_simulator" sub-object. + Returns None, of any of the path parts is missing + """ + return tag_by_path(symbol, "config_simulator." + path, default_value) + + +def enum_value_to_cppliteral(value, module_name): + value = value.strip().rsplit('.', 1)[-1] + return '{0}{1}Module::{2}'.format(Filters.classPrefix, module_name, value) + + +def enum_value(value, module_name): + sub_values = value.split('|') + sub_values = [enum_value_to_cppliteral(v, module_name) for v in sub_values] + return "|".join(sub_values) + + +def simulator_default_value(symbol): + sim_default_value = Filters.defaultValue(symbol) + if 'config_simulator' in symbol.tags and 'default_value' in symbol.tags['config_simulator']: + sim_default_value = symbol.tags['config_simulator']['default_value'] + t = symbol.type + if t.is_enum: + module_name = t.reference.module.module_name + return enum_value(sim_default_value, module_name) + # in case it's bool, Python True is sent to the C++ as "True", let's take care of that + if t.is_bool: + if sim_default_value: + sim_default_value = 'true' + else: + sim_default_value = 'false' + return sim_default_value + + +def value_range(symbol, what): + """ + Check in the tags if range_[high|low] specified and return it. + Returns None if no range has been specified + """ + if type(symbol) is Property and symbol.type.is_int or symbol.type.is_real: + what_range = 'range_' + what + if 'config_simulator' in symbol.tags and what_range in symbol.tags["config_simulator"]: + return symbol.tags["config_simulator"][what_range] + return None + + +def range_high(symbol): + return value_range(symbol, "high") + + +def range_low(symbol): + return value_range(symbol, "low") + + +def lower_first_filter(s): + s = str(s) + return s[0].lower() + s[1:] + + +def generate(tplconfig, moduleConfig, src, dst): + log.debug('run {0} {1}'.format(src, dst)) + system = FileSystem.parse(src) + generator = Generator(search_path=here / tplconfig) + generator.register_filter('return_type', Filters.returnType) + generator.register_filter('parameter_type', Filters.parameterType) + generator.register_filter('default_value', Filters.defaultValue) + generator.register_filter('parse_doc', parse_doc) + generator.register_filter('sim_default_value', simulator_default_value) + generator.register_filter('lowerfirst', lower_first_filter) + generator.register_filter('range_low', range_low) + generator.register_filter('range_high', range_high) + generator.register_filter("enum_value", enum_value) + generator.register_filter("tag_by_path", tag_by_path) + generator.register_filter("conf_sim_tag", conf_sim_tag) + + ctx = {'dst': dst, 'qtASVersion': 1.2} + gen_config = yaml.load(open(here / '{0}.yaml'.format(tplconfig))) + for module in system.modules: + log.debug('generate code for module %s', module) + module.add_tag('config') + for val, key in moduleConfig.items(): + module.add_attribute('config', val, key) + ctx.update({'module': module}) + #TODO: refine that, probably just use plain output folder + dst = generator.apply('{{dst}}', ctx) + generator.destination = dst + module_rules = gen_config['generate_rules']['module_rules'] + if module_rules is None: module_rules = [] + for rule in module_rules: + preserve = rule['preserve'] if 'preserve' in rule else False + generator.write(rule['dest_file'], rule['template_file'], ctx, preserve) + for interface in module.interfaces: + log.debug('generate backend code for interface %s', interface) + interface.add_tag('config') + ctx.update({'interface': interface}) + for rule in gen_config['generate_rules']['interface_rules']: + preserve = rule['preserve'] if 'preserve' in rule else False + generator.write(rule['dest_file'], rule['template_file'], ctx, preserve) + for struct in module.structs: + log.debug('generate code for struct %s', struct) + struct.add_tag('config') + for rule in gen_config['generate_rules']['struct_rules']: + preserve = rule['preserve'] if 'preserve' in rule else False + generator.write(rule['dest_file'], rule['template_file'], ctx, preserve) + + +def run(formats, moduleConfig, src, dst): + for f in formats: + switcher = { + 'frontend': 'templates_frontend', + 'backend_simulator': 'templates_backend_simulator', + 'test': 'templates_test', + } + tplConfig = switcher.get(f, 'unknown') + if tplConfig == 'unknown': + log.debug('unknown format {0}'.format(f)) + else: + generate(tplConfig, moduleConfig, src, dst) + + +@click.command() +@click.option('--reload/--no-reload', default=False) +@click.option('--format', '-f', multiple=True, type=click.Choice(['frontend', 'backend_simulator', 'test'])) +@click.option('--module', 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, format, reload, module): + """Takes several files or directories as src and generates the code + in the given dst directory.""" + if reload: + script = '{0} {1} {2}'.format(Path(__file__).abspath(), ' '.join(src), dst) + monitor(src, script) + else: + moduleConfig = { + "module": module + } + run(format, moduleConfig, src, dst) + + +if __name__ == '__main__': + app() diff --git a/src/ivicore/qface/templates_backend_simulator.yaml b/src/ivicore/qface/templates_backend_simulator.yaml new file mode 100644 index 0000000..76441df --- /dev/null +++ b/src/ivicore/qface/templates_backend_simulator.yaml @@ -0,0 +1,17 @@ +generate_rules: + module_rules: + - dest_file: "{{module.module_name|lower}}plugin.h" + template_file: "plugin.h.tpl" + - dest_file: "{{module.module_name|lower}}plugin.cpp" + template_file: "plugin.cpp.tpl" + - dest_file: "{{module.module_name|lower}}.json" + template_file: "plugin.json" + - dest_file: "{{module|lower|replace('.', '-')}}.pri" + template_file: "plugin.pri.tpl" + interface_rules: + - dest_file: '{{interface|lower}}backend.h' + template_file: 'backend.h.tpl' + - dest_file: '{{interface|lower}}backend.cpp' + template_file: 'backend.cpp.tpl' + struct_rules: + diff --git a/src/ivicore/qface/templates_backend_simulator/backend.cpp.tpl b/src/ivicore/qface/templates_backend_simulator/backend.cpp.tpl new file mode 100644 index 0000000..6ca90c7 --- /dev/null +++ b/src/ivicore/qface/templates_backend_simulator/backend.cpp.tpl @@ -0,0 +1,212 @@ +{# +# Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). +# Copyright (C) 2017 Pelagicore AG +# Contact: https://www.qt.io/licensing/ +# +# This file is part of the QtIvi module of the Qt Toolkit. +# +# $QT_BEGIN_LICENSE:LGPL-QTAS$ +# Commercial License Usage +# Licensees holding valid commercial Qt Automotive Suite licenses may use +# this file in accordance with the commercial license agreement provided +# with the Software or, alternatively, in accordance with the terms +# contained in a written agreement between you and The Qt Company. For +# licensing terms and conditions see https://www.qt.io/terms-conditions. +# For further information use the contact form at https://www.qt.io/contact-us. +# +# GNU Lesser General Public License Usage +# Alternatively, this file may be used under the terms of the GNU Lesser +# General Public License version 3 as published by the Free Software +# Foundation and appearing in the file LICENSE.LGPL3 included in the +# packaging of this file. Please review the following information to +# ensure the GNU Lesser General Public License version 3 requirements +# will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +# +# GNU General Public License Usage +# Alternatively, this file may be used under the terms of the GNU +# General Public License version 2.0 or (at your option) the GNU General +# Public license version 3 or any later version approved by the KDE Free +# Qt Foundation. The licenses are as published by the Free Software +# Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +# included in the packaging of this file. Please review the following +# information to ensure the GNU General Public License requirements will +# be met: https://www.gnu.org/licenses/gpl-2.0.html and +# https://www.gnu.org/licenses/gpl-3.0.html. +# +# $QT_END_LICENSE$ +# +# SPDX-License-Identifier: LGPL-3.0 +#} +{% include "generated_comment.cpp.tpl" %} +{% import 'utils.tpl' as utils %} +{% set class = '{0}Backend'.format(interface) %} +{% set interface_zoned = interface.tags.config and interface.tags.config.zoned %} +#include "{{class|lower}}.h" + +#include <QDebug> + +/*! + \class {{class}} + \inmodule {{module}} +{{ utils.format_comments(interface.comment) }} +*/ +{{class}}::{{class}}(QObject *parent) : + {{class}}Interface(parent) +{% for property in interface.properties %} +{% if not property.tags.config_simulator or not property.tags.config_simulator.zoned %} + , m_{{ property }}({{property|sim_default_value}}) +{% endif %} +{% endfor %} +{ + +{% set zones = interface.tags.config_simulator.zones if interface.tags.config_simulator else {} %} +{% for zone_name, zone_id in zones.items() %} + ZoneBackend {{zone_name}}Zone; +{% for property in interface.properties %} +{% if property.tags.config_simulator and property.tags.config_simulator.zoned %} + {{zone_name}}Zone.{{property}} = {{property|sim_default_value}}; +{% endif %} +{% endfor %} + m_zoneMap.insert("{{zone_id}}", {{zone_name}}Zone); + +{% endfor %} +} + +{{class}}::~{{class}}() +{ +} + +{% if interface_zoned %} +/*! + \fn QStringList {{class}}::availableZones() const + + Returns a list of supported zone names. This is called from the client + after having connected. + + The returned names must be valid QML property names, i.e. \c {[a-z_][A-Za-z0-9_]*}. + + \sa {Providing Available Zones} +*/ +QStringList {{class}}::availableZones() const +{ +{% if interface.tags.config_simulator and interface.tags.config_simulator.zoned %} + return m_zoneMap.keys(); +{% else %} + return QStringList(); +{% endif%} +} +{% endif %} + +/*! + \fn void {{class}}::initialize() + + Initializes the backend and informs about its current state by + emitting signals with the current status (property values). + +*/ +void {{class}}::initialize() +{ +{% for property in interface.properties %} +{% if not interface_zoned %} + emit {{property}}Changed(m_{{property}}); +{% elif not property.tags.config_simulator or not property.tags.config_simulator.zoned%} + emit {{property}}Changed(m_{{property}}, QString()); +{% endif %} +{% endfor %} + +{% if interface.tags.config.zoned %} + const auto zones = availableZones(); + for (const QString &zone : zones) { +{% for property in interface.properties %} +{% if property.tags.config_simulator and property.tags.config_simulator.zoned %} + emit {{property}}Changed(m_zoneMap[zone].{{property}}, zone); +{% endif %} +{% endfor %} + } +{% endif %} +} + +{% for property in interface.properties %} +/*! + \fn virtual void {{class}}::set{{property|upperfirst}}({{ property|parameter_type }}{% if interface_zoned %}, const QString &zone){%endif%}) + +{{ utils.format_comments(property.comment) }} +*/ +{% if interface_zoned %} +void {{class}}::set{{property|upperfirst}}({{ property|parameter_type }}, const QString &zone) +{% else %} +void {{class}}::set{{property|upperfirst}}({{ property|parameter_type }}) +{% endif %} +{ +{% if property.tags.config_simulator and property.tags.config_simulator.unsupported %} + Q_UNUSED({{ property }}); +{% if interface_zoned %} + Q_UNUSED(zone); +{% endif %} + qWarning() << "SIMULATION Setting {{ property | upperfirst }} is not supported!"; + +{% else %} +{% set range_low_val = property|range_low %} +{% set range_high_val = property|range_high %} +{% set zoned = property.tags.config_simulator and property.tags.config_simulator.zoned %} +{% if zoned and interface_zoned %} + if (!m_zoneMap.contains(zone)) + return; + + if (m_zoneMap[zone].{{property}} == {{property}}) + return; +{% if range_low_val and range_high_val %} + + if ({{property}} < {{range_low}} || {{property}} > {{range_high}}) { + qWarning() << "SIMULATION {{ property | upperfirst }} change out of range ({{range_low}}-{{range_high}})" << {{property}}; + emit {{property}}Changed({{property}}, zone); + return; + } +{% endif %} + + qWarning() << "SIMULATION {{ property | upperfirst }} for Zone" << zone << "changed to" << {{property}}; + + m_zoneMap[zone].{{property}} = {{property}}; + emit {{ property }}Changed({{property}}, zone); + +{% else %} + if ({% if interface_zoned %}!zone.isEmpty() || {%endif%}m_{{ property }} == {{property}}) + return; + +{% if range_low_val != None and range_high_val != None %} + if ({{property}} < {{range_low_val}} || {{property}} > {{range_high_val}}) { + qWarning() << "SIMULATION {{ property | upperfirst }} change out of range ({{range_low}}-{{range_high}})" << {{property}}; + emit {{property}}Changed(m_{{property}}{% if interface_zoned%}, QString(){% endif %}); + return; + } +{% endif %} + qWarning() << "SIMULATION {{ property | upperfirst }} changed to" << {{property}}; + + m_{{property}} = {{property}}; + emit {{property}}Changed(m_{{property}}{% if interface_zoned%}, QString(){% endif %}); +{% endif %} +{% endif %} +} + +{% endfor %} + +{% for operation in interface.operations %} +{% set operation_parameters = operation.parameters|map('parameter_type')|join(', ') %} +{% if interface_zoned %} +{% if operation.parameters|length %} +{% set operation_parameters = operation_parameters + ', ' %} +{% endif %} +{% set operation_parameters = operation_parameters + 'const QString &zone' %} +{% endif%} +/*! + \fn virtual void {{class}}::{{operation}}({{operation_parameters}}) + +{{ utils.format_comments(operation.comment) }} +*/ +{{operation|return_type}} {{class}}::{{operation}}({{operation_parameters}}) +{ + qWarning() << "Not implemented!"; + return {{operation|default_value}}; +} + +{% endfor %} diff --git a/src/ivicore/qface/templates_backend_simulator/backend.h.tpl b/src/ivicore/qface/templates_backend_simulator/backend.h.tpl new file mode 100644 index 0000000..d041866 --- /dev/null +++ b/src/ivicore/qface/templates_backend_simulator/backend.h.tpl @@ -0,0 +1,106 @@ +{# +# Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). +# Copyright (C) 2017 Pelagicore AG +# Contact: https://www.qt.io/licensing/ +# +# This file is part of the QtIvi module of the Qt Toolkit. +# +# $QT_BEGIN_LICENSE:LGPL-QTAS$ +# Commercial License Usage +# Licensees holding valid commercial Qt Automotive Suite licenses may use +# this file in accordance with the commercial license agreement provided +# with the Software or, alternatively, in accordance with the terms +# contained in a written agreement between you and The Qt Company. For +# licensing terms and conditions see https://www.qt.io/terms-conditions. +# For further information use the contact form at https://www.qt.io/contact-us. +# +# GNU Lesser General Public License Usage +# Alternatively, this file may be used under the terms of the GNU Lesser +# General Public License version 3 as published by the Free Software +# Foundation and appearing in the file LICENSE.LGPL3 included in the +# packaging of this file. Please review the following information to +# ensure the GNU Lesser General Public License version 3 requirements +# will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +# +# GNU General Public License Usage +# Alternatively, this file may be used under the terms of the GNU +# General Public License version 2.0 or (at your option) the GNU General +# Public license version 3 or any later version approved by the KDE Free +# Qt Foundation. The licenses are as published by the Free Software +# Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +# included in the packaging of this file. Please review the following +# information to ensure the GNU General Public License requirements will +# be met: https://www.gnu.org/licenses/gpl-2.0.html and +# https://www.gnu.org/licenses/gpl-3.0.html. +# +# $QT_END_LICENSE$ +# +# SPDX-License-Identifier: LGPL-3.0 +#} +{% include "generated_comment.cpp.tpl" %} +{% set class = '{0}Backend'.format(interface) %} +{% set interface_zoned = interface.tags.config and interface.tags.config.zoned %} +{% set oncedefine = '{0}_{1}_H_'.format(module.module_name|upper, class|upper) %} +#ifndef {{oncedefine}} +#define {{oncedefine}} + +#include <QObject> +{% if module.tags.config.module %} +#include <{{module.tags.config.module}}/{{class}}Interface> +{% else %} +#include "{{class|lower}}interface.h" +{% endif %} + +class {{class}} : public {{class}}Interface +{ +public: + explicit {{class}}(QObject *parent = nullptr); + ~{{class}}(); + +public: +{% if interface_zoned %} + QStringList availableZones() const override; +{% endif %} + + void initialize() override; +{% for property in interface.properties %} +{% if interface_zoned %} + virtual void set{{property|upperfirst}}({{ property|parameter_type }}, const QString &zone) override; +{% else %} + virtual void set{{property|upperfirst}}({{ property|parameter_type }}) override; +{% endif %} +{% endfor %} + +{% for operation in interface.operations %} +{% if interface_zoned %} +{% if operation.parameters|length %} + virtual {{operation|return_type}} {{operation}}({{operation.parameters|map('parameter_type')|join(', ')}}, const QString &zone) override; +{% else %} + virtual {{operation|return_type}} {{operation}}(const QString &zone) override; +{% endif %} +{% else %} + virtual {{operation|return_type}} {{operation}}({{operation.parameters|map('parameter_type')|join(', ')}}) override; +{% endif %} +{% endfor %} + +private: +{% for property in interface.properties %} +{% if not property.tags.config_simulator or not property.tags.config_simulator.zoned %} + {{ property|return_type }} m_{{ property }}; +{% endif %} +{% endfor %} + +{% if interface_zoned %} + struct ZoneBackend { +{% for property in interface.properties %} +{% if property.tags.config_simulator and property.tags.config_simulator.zoned %} + {{ property|return_type }} {{ property }}; +{% endif %} +{% endfor %} + }; + QMap<QString,ZoneBackend> m_zoneMap; +{% endif %} + +}; + +#endif // {{oncedefine}} diff --git a/src/ivicore/qface/templates_backend_simulator/generated_comment.cpp.tpl b/src/ivicore/qface/templates_backend_simulator/generated_comment.cpp.tpl new file mode 100644 index 0000000..b6c2e74 --- /dev/null +++ b/src/ivicore/qface/templates_backend_simulator/generated_comment.cpp.tpl @@ -0,0 +1,47 @@ +{# +# Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). +# Copyright (C) 2017 Pelagicore AG +# Contact: https://www.qt.io/licensing/ +# +# This file is part of the QtIvi module of the Qt Toolkit. +# +# $QT_BEGIN_LICENSE:LGPL-QTAS$ +# Commercial License Usage +# Licensees holding valid commercial Qt Automotive Suite licenses may use +# this file in accordance with the commercial license agreement provided +# with the Software or, alternatively, in accordance with the terms +# contained in a written agreement between you and The Qt Company. For +# licensing terms and conditions see https://www.qt.io/terms-conditions. +# For further information use the contact form at https://www.qt.io/contact-us. +# +# GNU Lesser General Public License Usage +# Alternatively, this file may be used under the terms of the GNU Lesser +# General Public License version 3 as published by the Free Software +# Foundation and appearing in the file LICENSE.LGPL3 included in the +# packaging of this file. Please review the following information to +# ensure the GNU Lesser General Public License version 3 requirements +# will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +# +# GNU General Public License Usage +# Alternatively, this file may be used under the terms of the GNU +# General Public License version 2.0 or (at your option) the GNU General +# Public license version 3 or any later version approved by the KDE Free +# Qt Foundation. The licenses are as published by the Free Software +# Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +# included in the packaging of this file. Please review the following +# information to ensure the GNU General Public License requirements will +# be met: https://www.gnu.org/licenses/gpl-2.0.html and +# https://www.gnu.org/licenses/gpl-3.0.html. +# +# $QT_END_LICENSE$ +# +# SPDX-License-Identifier: LGPL-3.0 +#} +/**************************************************************************** +** Generated from '{{module}}.qface' +** +** Created by: The QFace generator (QtAS {{qtASVersion}}) +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + diff --git a/src/ivicore/qface/templates_backend_simulator/plugin.cpp.tpl b/src/ivicore/qface/templates_backend_simulator/plugin.cpp.tpl new file mode 100644 index 0000000..911785e --- /dev/null +++ b/src/ivicore/qface/templates_backend_simulator/plugin.cpp.tpl @@ -0,0 +1,85 @@ +{# +# Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). +# Copyright (C) 2017 Pelagicore AG +# Contact: https://www.qt.io/licensing/ +# +# This file is part of the QtIvi module of the Qt Toolkit. +# +# $QT_BEGIN_LICENSE:LGPL-QTAS$ +# Commercial License Usage +# Licensees holding valid commercial Qt Automotive Suite licenses may use +# this file in accordance with the commercial license agreement provided +# with the Software or, alternatively, in accordance with the terms +# contained in a written agreement between you and The Qt Company. For +# licensing terms and conditions see https://www.qt.io/terms-conditions. +# For further information use the contact form at https://www.qt.io/contact-us. +# +# GNU Lesser General Public License Usage +# Alternatively, this file may be used under the terms of the GNU Lesser +# General Public License version 3 as published by the Free Software +# Foundation and appearing in the file LICENSE.LGPL3 included in the +# packaging of this file. Please review the following information to +# ensure the GNU Lesser General Public License version 3 requirements +# will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +# +# GNU General Public License Usage +# Alternatively, this file may be used under the terms of the GNU +# General Public License version 2.0 or (at your option) the GNU General +# Public license version 3 or any later version approved by the KDE Free +# Qt Foundation. The licenses are as published by the Free Software +# Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +# included in the packaging of this file. Please review the following +# information to ensure the GNU General Public License requirements will +# be met: https://www.gnu.org/licenses/gpl-2.0.html and +# https://www.gnu.org/licenses/gpl-3.0.html. +# +# $QT_END_LICENSE$ +# +# SPDX-License-Identifier: LGPL-3.0 +#} +{% include "generated_comment.cpp.tpl" %} +{% set class = '{0}Plugin'.format(module.module_name) %} + +#include "{{class|lower}}.h" + +{% for interface in module.interfaces %} +#include "{{interface|lower}}backend.h" +{% endfor %} + +#include <QStringList> + +/*! + \class {{class}} + \inmodule {{module}} + +*/ +/*! \internal */ +{{class}}::{{class}}(QObject *parent) : + QObject(parent) +{% for interface in module.interfaces %} + , m_{{interface|lowerfirst}}Backend(new {{interface}}Backend(this)) +{% endfor %} +{ +} + +/*! \internal */ +QStringList {{class}}::interfaces() const +{ + QStringList list; +{% for iface in module.interfaces %} +{% if loop.first %} list{% endif %} << {{module.module_name}}_{{iface}}_iid{% if loop.last %};{% endif %} +{% endfor %} + + return list; +} + +/*! \internal */ +QIviFeatureInterface *{{class}}::interfaceInstance(const QString &interface) const +{ +{% for iface in module.interfaces %} +{% if loop.index > 1 %} else {%else%} {%endif%}if (interface == {{module.module_name}}_{{iface}}_iid) + return m_{{iface|lowerfirst}}Backend; +{% endfor %} + + return nullptr; +} diff --git a/src/ivicore/qface/templates_backend_simulator/plugin.h.tpl b/src/ivicore/qface/templates_backend_simulator/plugin.h.tpl new file mode 100644 index 0000000..6eaf43d --- /dev/null +++ b/src/ivicore/qface/templates_backend_simulator/plugin.h.tpl @@ -0,0 +1,73 @@ + +{# +# Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). +# Copyright (C) 2017 Pelagicore AG +# Contact: https://www.qt.io/licensing/ +# +# This file is part of the QtIvi module of the Qt Toolkit. +# +# $QT_BEGIN_LICENSE:LGPL-QTAS$ +# Commercial License Usage +# Licensees holding valid commercial Qt Automotive Suite licenses may use +# this file in accordance with the commercial license agreement provided +# with the Software or, alternatively, in accordance with the terms +# contained in a written agreement between you and The Qt Company. For +# licensing terms and conditions see https://www.qt.io/terms-conditions. +# For further information use the contact form at https://www.qt.io/contact-us. +# +# GNU Lesser General Public License Usage +# Alternatively, this file may be used under the terms of the GNU Lesser +# General Public License version 3 as published by the Free Software +# Foundation and appearing in the file LICENSE.LGPL3 included in the +# packaging of this file. Please review the following information to +# ensure the GNU Lesser General Public License version 3 requirements +# will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +# +# GNU General Public License Usage +# Alternatively, this file may be used under the terms of the GNU +# General Public License version 2.0 or (at your option) the GNU General +# Public license version 3 or any later version approved by the KDE Free +# Qt Foundation. The licenses are as published by the Free Software +# Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +# included in the packaging of this file. Please review the following +# information to ensure the GNU General Public License requirements will +# be met: https://www.gnu.org/licenses/gpl-2.0.html and +# https://www.gnu.org/licenses/gpl-3.0.html. +# +# $QT_END_LICENSE$ +# +# SPDX-License-Identifier: LGPL-3.0 +#} +{% include "generated_comment.cpp.tpl" %} +{% set class = '{0}Plugin'.format(module.module_name) %} +{% set oncedefine = '{0}_{1}_H_'.format(module.module_name|upper, class|upper) %} + +#ifndef {{oncedefine}} +#define {{oncedefine}} + +#include <QtIviCore/QIviServiceInterface> + +{% for interface in module.interfaces %} +class {{interface}}Backend; +{% endfor %} + +class {{class}} : public QObject, QIviServiceInterface +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID QIviServiceInterface_iid FILE "{{module.module_name|lower}}.json") + Q_INTERFACES(QIviServiceInterface) + +public: + explicit {{class}}(QObject *parent = nullptr); + + QStringList interfaces() const; + QIviFeatureInterface* interfaceInstance(const QString& interface) const; + +private: +{% for interface in module.interfaces %} + {{interface}}Backend *m_{{interface|lowerfirst}}Backend; +{% endfor %} + +}; + +#endif // {{oncedefine}} diff --git a/src/ivicore/qface/templates_backend_simulator/plugin.json b/src/ivicore/qface/templates_backend_simulator/plugin.json new file mode 100644 index 0000000..5575ee5 --- /dev/null +++ b/src/ivicore/qface/templates_backend_simulator/plugin.json @@ -0,0 +1,49 @@ +{# +# Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). +# Copyright (C) 2017 Pelagicore AG +# Contact: https://www.qt.io/licensing/ +# +# This file is part of the QtIvi module of the Qt Toolkit. +# +# $QT_BEGIN_LICENSE:LGPL-QTAS$ +# Commercial License Usage +# Licensees holding valid commercial Qt Automotive Suite licenses may use +# this file in accordance with the commercial license agreement provided +# with the Software or, alternatively, in accordance with the terms +# contained in a written agreement between you and The Qt Company. For +# licensing terms and conditions see https://www.qt.io/terms-conditions. +# For further information use the contact form at https://www.qt.io/contact-us. +# +# GNU Lesser General Public License Usage +# Alternatively, this file may be used under the terms of the GNU Lesser +# General Public License version 3 as published by the Free Software +# Foundation and appearing in the file LICENSE.LGPL3 included in the +# packaging of this file. Please review the following information to +# ensure the GNU Lesser General Public License version 3 requirements +# will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +# +# GNU General Public License Usage +# Alternatively, this file may be used under the terms of the GNU +# General Public License version 2.0 or (at your option) the GNU General +# Public license version 3 or any later version approved by the KDE Free +# Qt Foundation. The licenses are as published by the Free Software +# Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +# included in the packaging of this file. Please review the following +# information to ensure the GNU General Public License requirements will +# be met: https://www.gnu.org/licenses/gpl-2.0.html and +# https://www.gnu.org/licenses/gpl-3.0.html. +# +# $QT_END_LICENSE$ +# +# SPDX-License-Identifier: LGPL-3.0 +#} +{ + "interfaces" : [ +{% for interface in module.interfaces %} +{% if 'config' in interface.tags and 'id' in interface.tags.config %} + "{{interface.tags.config.id}}"{% if not loop.last %}, + {%endif%} +{% endif%} +{% endfor%} + ] +} diff --git a/src/ivicore/qface/templates_backend_simulator/plugin.pri.tpl b/src/ivicore/qface/templates_backend_simulator/plugin.pri.tpl new file mode 100644 index 0000000..17cc4a4 --- /dev/null +++ b/src/ivicore/qface/templates_backend_simulator/plugin.pri.tpl @@ -0,0 +1,54 @@ +{# +# Copyright (C) 2017 Pelagicore AG. +# Contact: https://www.qt.io/licensing/ +# +# This file is part of the QtIvi module of the Qt Toolkit. +# +# $QT_BEGIN_LICENSE:LGPL-QTAS$ +# Commercial License Usage +# Licensees holding valid commercial Qt Automotive Suite licenses may use +# this file in accordance with the commercial license agreement provided +# with the Software or, alternatively, in accordance with the terms +# contained in a written agreement between you and The Qt Company. For +# licensing terms and conditions see https://www.qt.io/terms-conditions. +# For further information use the contact form at https://www.qt.io/contact-us. +# +# GNU Lesser General Public License Usage +# Alternatively, this file may be used under the terms of the GNU Lesser +# General Public License version 3 as published by the Free Software +# Foundation and appearing in the file LICENSE.LGPL3 included in the +# packaging of this file. Please review the following information to +# ensure the GNU Lesser General Public License version 3 requirements +# will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +# +# GNU General Public License Usage +# Alternatively, this file may be used under the terms of the GNU +# General Public License version 2.0 or (at your option) the GNU General +# Public license version 3 or any later version approved by the KDE Free +# Qt Foundation. The licenses are as published by the Free Software +# Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +# included in the packaging of this file. Please review the following +# information to ensure the GNU General Public License requirements will +# be met: https://www.gnu.org/licenses/gpl-2.0.html and +# https://www.gnu.org/licenses/gpl-3.0.html. +# +# $QT_END_LICENSE$ +# +# SPDX-License-Identifier: LGPL-3.0 +#} +############################################################################# +## This is an auto-generated file. +## Do not edit! All changes made to it will be lost. +############################################################################# + +HEADERS += \ +{% for interface in module.interfaces %} + $$PWD/{{interface|lower}}backend.h \ +{% endfor %} + $$PWD/{{module.module_name|lower}}plugin.h + +SOURCES += \ +{% for interface in module.interfaces %} + $$PWD/{{interface|lower}}backend.cpp \ +{% endfor %} + $$PWD/{{module.module_name|lower}}plugin.cpp diff --git a/src/ivicore/qface/templates_backend_simulator/plugin.pro b/src/ivicore/qface/templates_backend_simulator/plugin.pro new file mode 100644 index 0000000..cf274d8 --- /dev/null +++ b/src/ivicore/qface/templates_backend_simulator/plugin.pro @@ -0,0 +1,63 @@ +{# +# Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). +# Copyright (C) 2017 Pelagicore AG +# Contact: https://www.qt.io/licensing/ +# +# This file is part of the QtIvi module of the Qt Toolkit. +# +# $QT_BEGIN_LICENSE:LGPL-QTAS$ +# Commercial License Usage +# Licensees holding valid commercial Qt Automotive Suite licenses may use +# this file in accordance with the commercial license agreement provided +# with the Software or, alternatively, in accordance with the terms +# contained in a written agreement between you and The Qt Company. For +# licensing terms and conditions see https://www.qt.io/terms-conditions. +# For further information use the contact form at https://www.qt.io/contact-us. +# +# GNU Lesser General Public License Usage +# Alternatively, this file may be used under the terms of the GNU Lesser +# General Public License version 3 as published by the Free Software +# Foundation and appearing in the file LICENSE.LGPL3 included in the +# packaging of this file. Please review the following information to +# ensure the GNU Lesser General Public License version 3 requirements +# will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +# +# GNU General Public License Usage +# Alternatively, this file may be used under the terms of the GNU +# General Public License version 2.0 or (at your option) the GNU General +# Public license version 3 or any later version approved by the KDE Free +# Qt Foundation. The licenses are as published by the Free Software +# Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +# included in the packaging of this file. Please review the following +# information to ensure the GNU General Public License requirements will +# be met: https://www.gnu.org/licenses/gpl-2.0.html and +# https://www.gnu.org/licenses/gpl-3.0.html. +# +# $QT_END_LICENSE$ +# +# SPDX-License-Identifier: LGPL-3.0 +#} +TARGET = {{module.module_name|lower}}_simulator + +PLUGIN_TYPE = qtivi +PLUGIN_EXTENDS = qtivi +PLUGIN_CLASS_NAME = QIviServiceInterface + +QT += core ivicore {{module|lower}} + +load(qt_plugin) + + +SOURCES += {{module.module_name|lower}}plugin.cpp \ +{% for interface in module.interfaces %} + {{interface|lower}}backend.cpp {% if not loop.last %}\ + {% endif%} +{% endfor %} + +HEADERS += {{module.module_name|lower}}plugin.h \ +{% for interface in module.interfaces %} + {{interface|lower}}backend.h {% if not loop.last %}\ + {% endif%} +{% endfor %} + +DISTFILES += {{module.module_name|lower}}_simulator.json diff --git a/src/ivicore/qface/templates_backend_simulator/utils.tpl b/src/ivicore/qface/templates_backend_simulator/utils.tpl new file mode 100644 index 0000000..42ffa5e --- /dev/null +++ b/src/ivicore/qface/templates_backend_simulator/utils.tpl @@ -0,0 +1,7 @@ +{% macro format_comments(comments) -%} +{% with doc = comments|parse_doc -%} +{% if doc.brief %} \brief {{doc.brief}} {% endif %} +{% if doc.descriptiont -%} + {{doc.description|join(' ')}}{% endif -%} +{%- endwith %} +{%- endmacro %} diff --git a/src/ivicore/qface/templates_frontend.yaml b/src/ivicore/qface/templates_frontend.yaml new file mode 100644 index 0000000..b0911ed --- /dev/null +++ b/src/ivicore/qface/templates_frontend.yaml @@ -0,0 +1,22 @@ +generate_rules: + module_rules: + - dest_file: "{{module.module_name|lower}}global.h" + template_file: "global.h.tpl" + - dest_file: "{{module.module_name|lower}}module.h" + template_file: "module.h.tpl" + - dest_file: "{{module.module_name|lower}}module.cpp" + template_file: "module.cpp.tpl" + - dest_file: "{{module|lower|replace('.', '-')}}.pri" + template_file: "module.pri.tpl" + interface_rules: + - dest_file: '{{interface|lower}}backendinterface.h' + template_file: 'backendinterface.h.tpl' + - dest_file: '{{interface|lower}}backendinterface.cpp' + template_file: 'backendinterface.cpp.tpl' + - dest_file: '{{interface|lower}}.h' + template_file: 'interface.h.tpl' + - dest_file: '{{interface|lower}}_p.h' + template_file: 'interface_p.h.tpl' + - dest_file: '{{interface|lower}}.cpp' + template_file: 'interface.cpp.tpl' + struct_rules: diff --git a/src/ivicore/qface/templates_frontend/backendinterface.cpp.tpl b/src/ivicore/qface/templates_frontend/backendinterface.cpp.tpl new file mode 100644 index 0000000..dd3f818 --- /dev/null +++ b/src/ivicore/qface/templates_frontend/backendinterface.cpp.tpl @@ -0,0 +1,66 @@ +{# +# Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). +# Contact: https://www.qt.io/licensing/ +# +# This file is part of the QtIvi module of the Qt Toolkit. +# +# $QT_BEGIN_LICENSE:LGPL-QTAS$ +# Commercial License Usage +# Licensees holding valid commercial Qt Automotive Suite licenses may use +# this file in accordance with the commercial license agreement provided +# with the Software or, alternatively, in accordance with the terms +# contained in a written agreement between you and The Qt Company. For +# licensing terms and conditions see https://www.qt.io/terms-conditions. +# For further information use the contact form at https://www.qt.io/contact-us. +# +# GNU Lesser General Public License Usage +# Alternatively, this file may be used under the terms of the GNU Lesser +# General Public License version 3 as published by the Free Software +# Foundation and appearing in the file LICENSE.LGPL3 included in the +# packaging of this file. Please review the following information to +# ensure the GNU Lesser General Public License version 3 requirements +# will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +# +# GNU General Public License Usage +# Alternatively, this file may be used under the terms of the GNU +# General Public License version 2.0 or (at your option) the GNU General +# Public license version 3 or any later version approved by the KDE Free +# Qt Foundation. The licenses are as published by the Free Software +# Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +# included in the packaging of this file. Please review the following +# information to ensure the GNU General Public License requirements will +# be met: https://www.gnu.org/licenses/gpl-2.0.html and +# https://www.gnu.org/licenses/gpl-3.0.html. +# +# $QT_END_LICENSE$ +# +# SPDX-License-Identifier: LGPL-3.0 +#} +{% set class = '{0}BackendInterface'.format(interface) %} +{% include 'generated_comment.cpp.tpl' %} + +#include "{{class|lower}}.h" + +QT_BEGIN_NAMESPACE + +/*! + * \class {{class}} + * \inmodule {{module}} + * + * \brief Abstract backend interface for {{interface}}. + * \sa {{interface}}. + */ +{{class}}::{{class}}(QObject *parent) +{% if interface.tags.config.zoned %} + : QIviZonedFeatureInterface(parent) +{% else %} + : QIviFeatureInterface(parent) +{% endif %} +{ +} + +{{class}}::~{{class}}() +{ +} + +QT_END_NAMESPACE diff --git a/src/ivicore/qface/templates_frontend/backendinterface.h.tpl b/src/ivicore/qface/templates_frontend/backendinterface.h.tpl new file mode 100644 index 0000000..17540eb --- /dev/null +++ b/src/ivicore/qface/templates_frontend/backendinterface.h.tpl @@ -0,0 +1,111 @@ +{# +# Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). +# Contact: https://www.qt.io/licensing/ +# +# This file is part of the QtIvi module of the Qt Toolkit. +# +# $QT_BEGIN_LICENSE:LGPL-QTAS$ +# Commercial License Usage +# Licensees holding valid commercial Qt Automotive Suite licenses may use +# this file in accordance with the commercial license agreement provided +# with the Software or, alternatively, in accordance with the terms +# contained in a written agreement between you and The Qt Company. For +# licensing terms and conditions see https://www.qt.io/terms-conditions. +# For further information use the contact form at https://www.qt.io/contact-us. +# +# GNU Lesser General Public License Usage +# Alternatively, this file may be used under the terms of the GNU Lesser +# General Public License version 3 as published by the Free Software +# Foundation and appearing in the file LICENSE.LGPL3 included in the +# packaging of this file. Please review the following information to +# ensure the GNU Lesser General Public License version 3 requirements +# will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +# +# GNU General Public License Usage +# Alternatively, this file may be used under the terms of the GNU +# General Public License version 2.0 or (at your option) the GNU General +# Public license version 3 or any later version approved by the KDE Free +# Qt Foundation. The licenses are as published by the Free Software +# Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +# included in the packaging of this file. Please review the following +# information to ensure the GNU General Public License requirements will +# be met: https://www.gnu.org/licenses/gpl-2.0.html and +# https://www.gnu.org/licenses/gpl-3.0.html. +# +# $QT_END_LICENSE$ +# +# SPDX-License-Identifier: LGPL-3.0 +#} +{% set class = '{0}BackendInterface'.format(interface) %} +{% set oncedefine = '{0}_{1}_H_'.format(module.module_name|upper, class|upper) %} +{% include 'generated_comment.cpp.tpl' %} + +#ifndef {{oncedefine}} +#define {{oncedefine}} + +#include "{{module.module_name|lower}}module.h" + +{% if interface.tags.config.zoned %} +#include <QtIviCore/QIviZonedFeatureInterface> +{% else %} +#include <QtIviCore/QIviFeatureInterface> +{% endif %} + +QT_BEGIN_NAMESPACE + +{% if interface.tags.config.zoned %} +class {{class}} : public QIviZonedFeatureInterface +{% else %} +class {{class}} : public QIviFeatureInterface +{% endif %} +{ + Q_OBJECT +public: + explicit {{class}}(QObject *parent = nullptr); + ~{{class}}(); + +{% for property in interface.properties %} +{% if interface.tags.config.zoned %} + virtual void set{{property|upperfirst}}({{ property|parameter_type }}, const QString &zone) = 0; +{% else %} + virtual void set{{property|upperfirst}}({{ property|parameter_type }}) = 0; +{% endif %} +{% endfor %} +{% for operation in interface.operations %} +{% if interface.tags.config.zoned %} +{% if operation.parameters|length %} + virtual {{operation|return_type}} {{operation}}({{operation.parameters|map('parameter_type')|join(', ')}}, const QString &zone) = 0; +{% else %} + virtual {{operation|return_type}} {{operation}}(const QString &zone) = 0; +{% endif %} +{% else %} + virtual {{operation|return_type}} {{operation}}({{operation.parameters|map('parameter_type')|join(', ')}}) = 0; +{% endif %} +{% endfor %} + +Q_SIGNALS: +{% for signal in interface.signals %} +{% if interface.tags.config.zoned %} +{% if signal.parameters|length %} + void {{signal}}({{signal.parameters|map('parameter_type')|join(', ')}}, const QString &zone = QString()); +{% else %} + void {{signal}}(const QString &zone = QString()); +{% endif %} +{% else %} + void {{signal}}({{signal.parameters|map('parameter_type')|join(', ')}}); +{% endif %} +{% endfor %} +{% for property in interface.properties %} +{% if interface.tags.config.zoned %} + void {{property}}Changed({{ property|parameter_type }}, const QString &zone); +{% else %} + void {{property}}Changed({{ property|parameter_type }}); +{% endif %} +{% endfor %} +}; + +#define {{module.module_name}}_{{interface}}_iid ("{{interface.tags.config.id}}") + +QT_END_NAMESPACE + +#endif // {{oncedefine}} diff --git a/src/ivicore/qface/templates_frontend/generated_comment.cpp.tpl b/src/ivicore/qface/templates_frontend/generated_comment.cpp.tpl new file mode 100644 index 0000000..95878f2 --- /dev/null +++ b/src/ivicore/qface/templates_frontend/generated_comment.cpp.tpl @@ -0,0 +1,46 @@ +{# +# Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). +# Contact: https://www.qt.io/licensing/ +# +# This file is part of the QtIvi module of the Qt Toolkit. +# +# $QT_BEGIN_LICENSE:LGPL-QTAS$ +# Commercial License Usage +# Licensees holding valid commercial Qt Automotive Suite licenses may use +# this file in accordance with the commercial license agreement provided +# with the Software or, alternatively, in accordance with the terms +# contained in a written agreement between you and The Qt Company. For +# licensing terms and conditions see https://www.qt.io/terms-conditions. +# For further information use the contact form at https://www.qt.io/contact-us. +# +# GNU Lesser General Public License Usage +# Alternatively, this file may be used under the terms of the GNU Lesser +# General Public License version 3 as published by the Free Software +# Foundation and appearing in the file LICENSE.LGPL3 included in the +# packaging of this file. Please review the following information to +# ensure the GNU Lesser General Public License version 3 requirements +# will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +# +# GNU General Public License Usage +# Alternatively, this file may be used under the terms of the GNU +# General Public License version 2.0 or (at your option) the GNU General +# Public license version 3 or any later version approved by the KDE Free +# Qt Foundation. The licenses are as published by the Free Software +# Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +# included in the packaging of this file. Please review the following +# information to ensure the GNU General Public License requirements will +# be met: https://www.gnu.org/licenses/gpl-2.0.html and +# https://www.gnu.org/licenses/gpl-3.0.html. +# +# $QT_END_LICENSE$ +# +# SPDX-License-Identifier: LGPL-3.0 +#} +/**************************************************************************** +** Generated from '{{module}}.qface' +** +** Created by: The QFace generator (QtAS {{qtASVersion}}) +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + diff --git a/src/ivicore/qface/templates_frontend/global.h.tpl b/src/ivicore/qface/templates_frontend/global.h.tpl new file mode 100644 index 0000000..f2be24c --- /dev/null +++ b/src/ivicore/qface/templates_frontend/global.h.tpl @@ -0,0 +1,62 @@ +{# +# Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). +# Contact: https://www.qt.io/licensing/ +# +# This file is part of the QtIvi module of the Qt Toolkit. +# +# $QT_BEGIN_LICENSE:LGPL-QTAS$ +# Commercial License Usage +# Licensees holding valid commercial Qt Automotive Suite licenses may use +# this file in accordance with the commercial license agreement provided +# with the Software or, alternatively, in accordance with the terms +# contained in a written agreement between you and The Qt Company. For +# licensing terms and conditions see https://www.qt.io/terms-conditions. +# For further information use the contact form at https://www.qt.io/contact-us. +# +# GNU Lesser General Public License Usage +# Alternatively, this file may be used under the terms of the GNU Lesser +# General Public License version 3 as published by the Free Software +# Foundation and appearing in the file LICENSE.LGPL3 included in the +# packaging of this file. Please review the following information to +# ensure the GNU Lesser General Public License version 3 requirements +# will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +# +# GNU General Public License Usage +# Alternatively, this file may be used under the terms of the GNU +# General Public License version 2.0 or (at your option) the GNU General +# Public license version 3 or any later version approved by the KDE Free +# Qt Foundation. The licenses are as published by the Free Software +# Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +# included in the packaging of this file. Please review the following +# information to ensure the GNU General Public License requirements will +# be met: https://www.gnu.org/licenses/gpl-2.0.html and +# https://www.gnu.org/licenses/gpl-3.0.html. +# +# $QT_END_LICENSE$ +# +# SPDX-License-Identifier: LGPL-3.0 +#} +{% set exportsymbol = '{0}'.format(module.module_name|upper) %} +{% set oncedefine = '{0}GLOBAL_H_'.format(exportsymbol) %} +{% include 'generated_comment.cpp.tpl' %} + +#ifndef {{oncedefine}} +#define {{oncedefine}} + +#include <QtCore/qglobal.h> + +QT_BEGIN_NAMESPACE + +#ifndef QT_STATIC +# if defined(QT_BUILD_{{exportsymbol}}_LIB) +# define Q_QT{{exportsymbol}}_EXPORT Q_DECL_EXPORT +# else +# define Q_QT{{exportsymbol}}_EXPORT Q_DECL_IMPORT +# endif +#else +# define Q_QT{{exportsymbol}}_EXPORT +#endif + +QT_END_NAMESPACE + +#endif // {{oncedefine}} diff --git a/src/ivicore/qface/templates_frontend/interface.cpp.tpl b/src/ivicore/qface/templates_frontend/interface.cpp.tpl new file mode 100644 index 0000000..17d4ea2 --- /dev/null +++ b/src/ivicore/qface/templates_frontend/interface.cpp.tpl @@ -0,0 +1,280 @@ +{# +# Copyright (C) 2017 Pelagicore AG. +# Contact: https://www.qt.io/licensing/ +# +# This file is part of the QtIvi module of the Qt Toolkit. +# +# $QT_BEGIN_LICENSE:LGPL-QTAS$ +# Commercial License Usage +# Licensees holding valid commercial Qt Automotive Suite licenses may use +# this file in accordance with the commercial license agreement provided +# with the Software or, alternatively, in accordance with the terms +# contained in a written agreement between you and The Qt Company. For +# licensing terms and conditions see https://www.qt.io/terms-conditions. +# For further information use the contact form at https://www.qt.io/contact-us. +# +# GNU Lesser General Public License Usage +# Alternatively, this file may be used under the terms of the GNU Lesser +# General Public License version 3 as published by the Free Software +# Foundation and appearing in the file LICENSE.LGPL3 included in the +# packaging of this file. Please review the following information to +# ensure the GNU Lesser General Public License version 3 requirements +# will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +# +# GNU General Public License Usage +# Alternatively, this file may be used under the terms of the GNU +# General Public License version 2.0 or (at your option) the GNU General +# Public license version 3 or any later version approved by the KDE Free +# Qt Foundation. The licenses are as published by the Free Software +# Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +# included in the packaging of this file. Please review the following +# information to ensure the GNU General Public License requirements will +# be met: https://www.gnu.org/licenses/gpl-2.0.html and +# https://www.gnu.org/licenses/gpl-3.0.html. +# +# $QT_END_LICENSE$ +# +# SPDX-License-Identifier: LGPL-3.0 +#} +{% set class = '{0}'.format(interface) %} +{% include 'generated_comment.cpp.tpl' %} +{% import 'utils.tpl' as utils %} + +#include "{{class|lower}}.h" +#include "{{class|lower}}_p.h" +#include "{{class|lower}}backendinterface.h" + +#include <QQmlEngine> +#include <QIviServiceObject> + +QT_BEGIN_NAMESPACE + +/*! + \class {{interface}} + \inmodule {{module}} +{{ utils.format_comments(interface.comment) }} +*/ + +/*! \internal */ +{% if module.tags.config.disablePrivateIVI %} +{{class}}Private::{{class}}Private({{class}} *q) + : QObject(q) +{% else %} +{% if interface.tags.config.zoned %} +{{class}}Private::{{class}}Private(const QString &interface, const QString &zone, {{class}} *parent) + : QIviAbstractZonedFeaturePrivate(interface, zone, parent) +{% else %} +{{class}}Private::{{class}}Private(const QString &interface, {{class}} *parent) + : QIviAbstractFeaturePrivate(interface, parent) +{% endif %} + , q_ptr(parent) +{% endif %} +{% for property in interface.properties %} + , m_{{property}}({{property|default_value}}) +{% endfor %} +{ +} + +/*! \internal */ +{{class}}Private *{{class}}Private::get({{class}} *v) +{ +{% if module.tags.config.disablePrivateIVI %} + return v->m_helper; +{% else %} + return ({{class}}Private *) v->d_ptr.data(); +{% endif %} +} + +/*! \internal */ +const {{class}}Private *{{class}}Private::get(const {{class}} *v) +{ +{% if module.tags.config.disablePrivateIVI %} + return v->m_helper; +{% else %} + return (const {{class}}Private *) v->d_ptr.data(); +{% endif %} +} + +/*! \internal */ +{{class}} *{{class}}Private::getParent() +{ +{% if module.tags.config.disablePrivateIVI %} + return qobject_cast<{{class}} *>(parent()); +{% else %} + return q_ptr; +{% endif %} +} + +/*! \internal */ +void {{class}}Private::clearToDefaults() +{ +{% for property in interface.properties %} + m_{{property}} = {{property|default_value}}; +{% endfor %} +} + +{% for property in interface.properties %} +/*! \internal */ +{% if interface.tags.config.zoned %} +void {{class}}Private::on{{property|upperfirst}}Changed({{property|parameter_type}}, const QString &zone) +{ + auto q = getParent(); + auto f = qobject_cast<{{class}}*>(q->zoneAt(zone)); + if (!f) + f = q; + if (f->zone() != zone) + return; + {{class}}Private::get(f)->m_{{property}} = {{property}}; + emit f->{{property}}Changed({{property}}); +} +{% else %} +void {{class}}Private::on{{property|upperfirst}}Changed({{property|parameter_type}}) +{ + if (m_{{property}} != {{property}}) { + auto q = getParent(); + m_{{property}} = {{property}}; + emit q->{{property}}Changed({{property}}); + } +} +{% endif %} + +{% endfor %} + +{% if module.tags.config.disablePrivateIVI %} +{% if interface.tags.config.zoned %} +{{class}}::{{class}}(const QString &zone, QObject *parent) + : QIviAbstractZonedFeature(QLatin1String({{module.module_name}}_{{interface}}_iid), zone, parent) +{% else %} +{{class}}::{{class}}(QObject *parent) + : QIviAbstractFeature({{module.module_name}}_{{interface}}_iid, parent) +{% endif %} + , m_helper(new {{class}}Private(this)) +{% else %} +{% if interface.tags.config.zoned %} +{{class}}::{{class}}(const QString &zone, QObject *parent) + : QIviAbstractZonedFeature(*new {{class}}Private(QLatin1String({{module.module_name}}_{{interface}}_iid), zone, this), parent) +{% else %} +{{class}}::{{class}}(QObject *parent) + : QIviAbstractFeature(*new {{class}}Private(QLatin1String({{module.module_name}}_{{interface}}_iid), this), parent) +{% endif %} +{% endif %} +{ +} + +/*! \internal */ +{{class}}::~{{class}}() +{ +{% if module.tags.config.disablePrivateIVI %} + delete m_helper; +{% endif %} +} + +/*! \internal */ +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 %} +} + +{% for property in interface.properties %} + +/*! + \property {{class}}::{{property}} +{{ utils.format_comments(property.comment) }} +*/ +{{property|return_type}} {{class}}::{{property}}() const +{ + const auto d = {{class}}Private::get(this); + return d->m_{{property}}; +} + +void {{class}}::set{{property|upperfirst}}({{ property|parameter_type }}) +{ + auto d = {{class}}Private::get(this); + if (d->m_{{property}} == {{property}}) + return; + d->m_{{property}} = {{property}}; + emit {{property}}Changed({{property}}); +} + +{% endfor %} + +{%- for operation in interface.operations %} +/*! +{{ utils.format_comments(operation.comment) }} +*/ +{{operation|return_type}} {{class}}::{{operation}}({{operation.parameters|map('parameter_type')|join(', ')}}) +{ + if ({{class}}BackendInterface *backend = ({{class}}BackendInterface *) this->backend()) +{% if interface.tags.config.zoned %} +{% if operation.parameters|length %} + return backend->{{operation}}({{operation.parameters|join(', ')}}, zone()); +{% else %} + return backend->{{operation}}(zone()); +{% endif %} +{% else %} + return backend->{{operation}}({{operation.parameters|join(', ')}}); +{% endif %} + return {{operation|default_value}}; +} + +{% endfor %} + +{% if interface.tags.config.zoned %} +/*! \internal */ +QIviAbstractZonedFeature *{{class}}::createZoneFeature(const QString &zone) +{ + return new {{class}}(zone, this); +} +{% endif %} + +/*! \internal */ +void {{class}}::connectToServiceObject(QIviServiceObject *serviceObject) +{ +{% if interface.tags.config.zoned %} + QIviAbstractZonedFeature::connectToServiceObject(serviceObject); +{% else %} + Q_UNUSED(serviceObject); +{% endif %} + auto d = {{class}}Private::get(this); + + auto *backend = qobject_cast<{{class}}BackendInterface*>(this->backend()); + if (!backend) + return; + +{% for property in interface.properties %} +{% if module.tags.config.disablePrivateIVI %}{% set Connect = 'QObject::connect' %} +{% else %}{% set Connect = 'QObjectPrivate::connect' %}{% endif %} + {{Connect}}(backend, &{{class}}BackendInterface::{{property}}Changed, + d, &{{class}}Private::on{{property|upperfirst}}Changed); +{% endfor %} + + backend->initialize(); +} + +/*! \internal */ +void {{class}}::clearServiceObject() +{ + auto d = {{class}}Private::get(this); + d->clearToDefaults(); +{% if interface.tags.config.zoned %} + QIviAbstractZonedFeature::clearServiceObject(); +{% endif %} +} + +{% if interface.tags.config.zoned != True %} +/*! \internal */ +{{class}}BackendInterface *{{class}}::backend() const +{ + if (QIviServiceObject *so = serviceObject()) + return qobject_cast<{{class}}BackendInterface*>(so->interfaceInstance(interfaceName())); + return nullptr; +} +{% endif %} + +QT_END_NAMESPACE + +#include "moc_{{class|lower}}.cpp" diff --git a/src/ivicore/qface/templates_frontend/interface.h.tpl b/src/ivicore/qface/templates_frontend/interface.h.tpl new file mode 100644 index 0000000..b437e53 --- /dev/null +++ b/src/ivicore/qface/templates_frontend/interface.h.tpl @@ -0,0 +1,126 @@ +{# +# Copyright (C) 2017 Pelagicore AG. +# Contact: https://www.qt.io/licensing/ +# +# This file is part of the QtIvi module of the Qt Toolkit. +# +# $QT_BEGIN_LICENSE:LGPL-QTAS$ +# Commercial License Usage +# Licensees holding valid commercial Qt Automotive Suite licenses may use +# this file in accordance with the commercial license agreement provided +# with the Software or, alternatively, in accordance with the terms +# contained in a written agreement between you and The Qt Company. For +# licensing terms and conditions see https://www.qt.io/terms-conditions. +# For further information use the contact form at https://www.qt.io/contact-us. +# +# GNU Lesser General Public License Usage +# Alternatively, this file may be used under the terms of the GNU Lesser +# General Public License version 3 as published by the Free Software +# Foundation and appearing in the file LICENSE.LGPL3 included in the +# packaging of this file. Please review the following information to +# ensure the GNU Lesser General Public License version 3 requirements +# will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +# +# GNU General Public License Usage +# Alternatively, this file may be used under the terms of the GNU +# General Public License version 2.0 or (at your option) the GNU General +# Public license version 3 or any later version approved by the KDE Free +# Qt Foundation. The licenses are as published by the Free Software +# Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +# included in the packaging of this file. Please review the following +# information to ensure the GNU General Public License requirements will +# be met: https://www.gnu.org/licenses/gpl-2.0.html and +# https://www.gnu.org/licenses/gpl-3.0.html. +# +# $QT_END_LICENSE$ +# +# SPDX-License-Identifier: LGPL-3.0 +#} +{% set class = '{0}'.format(interface) %} +{% set oncedefine = '{0}_{1}_H_'.format(module.module_name|upper, class|upper) %} +{% set exportsymbol = 'Q_QT{0}_EXPORT'.format(module.module_name|upper) %} +{% include 'generated_comment.cpp.tpl' %} + +#ifndef {{oncedefine}} +#define {{oncedefine}} + +#include "{{module.module_name|lower}}module.h" + +{% if interface.tags.config.zoned %} +#include <QtIviCore/QIviAbstractZonedFeature> +{% else %} +#include <QtIviCore/QIviAbstractFeature> +{% endif %} + +QT_BEGIN_NAMESPACE + +class {{class}}Private; +class {{class}}BackendInterface; + +{% if interface.tags.config.zoned %} +class {{exportsymbol}} {{class}} : public QIviAbstractZonedFeature { +{% else %} +class {{exportsymbol}} {{class}} : public QIviAbstractFeature { +{% endif %} + Q_OBJECT +{% for property in interface.properties %} + Q_PROPERTY({{property|return_type}} {{property}} READ {{property}} {% if not property.is_readonly %} WRITE set{{property|upperfirst}} {% endif %}NOTIFY {{property}}Changed) +{% endfor %} +public: +{% if interface.tags.config.zoned %} + explicit {{class}}(const QString &zone = QString(), QObject *parent = nullptr); +{% else %} + explicit {{class}}(QObject *parent = nullptr); +{% endif %} + ~{{class}}(); + + static void registerQmlTypes(const QString& uri, int majorVersion=1, int minorVersion=0); + +{% for property in interface.properties %} + {{property|return_type}} {{property}}() const; +{% endfor %} + +public Q_SLOTS: +{% for operation in interface.operations %} + {{operation|return_type}} {{operation}}({{operation.parameters|map('parameter_type')|join(', ')}}); +{% endfor %} +{% for property in interface.properties %} + void set{{property|upperfirst}}({{property|parameter_type}}); +{% endfor %} + +Q_SIGNALS: +{% for signal in interface.signals %} + void {{signal}}({{signal.parameters|map('parameter_type')|join(', ')}}); +{% endfor %} +{% for property in interface.properties %} + void {{property}}Changed({{property|parameter_type}}); +{% endfor %} + +protected: +{% if interface.tags.config.zoned %} + QIviAbstractZonedFeature *createZoneFeature(const QString &zone) Q_DECL_OVERRIDE; +{% else %} + {{class}}BackendInterface *backend() const; +{% endif %} + void connectToServiceObject(QIviServiceObject *service) Q_DECL_OVERRIDE; + void clearServiceObject() Q_DECL_OVERRIDE; + +private: +{% if module.tags.config.disablePrivateIVI %} + friend class {{class}}Private; + {{class}}Private *m_helper; +{% else %} +{% for property in interface.properties %} +{% if interface.tags.config.zoned %} + Q_PRIVATE_SLOT(d_func(), void on{{property|upperfirst}}Changed({{property|parameter_type}}, const QString &)) +{% else %} + Q_PRIVATE_SLOT(d_func(), void on{{property|upperfirst}}Changed({{property|parameter_type}})) +{% endif %} +{% endfor %} + Q_DECLARE_PRIVATE({{class}}) +{% endif %} +}; + +QT_END_NAMESPACE + +#endif // {{oncedefine}} diff --git a/src/ivicore/qface/templates_frontend/interface_p.h.tpl b/src/ivicore/qface/templates_frontend/interface_p.h.tpl new file mode 100644 index 0000000..55f514b --- /dev/null +++ b/src/ivicore/qface/templates_frontend/interface_p.h.tpl @@ -0,0 +1,122 @@ +{# +# Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). +# Contact: https://www.qt.io/licensing/ +# +# This file is part of the QtIvi module of the Qt Toolkit. +# +# $QT_BEGIN_LICENSE:LGPL-QTAS$ +# Commercial License Usage +# Licensees holding valid commercial Qt Automotive Suite licenses may use +# this file in accordance with the commercial license agreement provided +# with the Software or, alternatively, in accordance with the terms +# contained in a written agreement between you and The Qt Company. For +# licensing terms and conditions see https://www.qt.io/terms-conditions. +# For further information use the contact form at https://www.qt.io/contact-us. +# +# GNU Lesser General Public License Usage +# Alternatively, this file may be used under the terms of the GNU Lesser +# General Public License version 3 as published by the Free Software +# Foundation and appearing in the file LICENSE.LGPL3 included in the +# packaging of this file. Please review the following information to +# ensure the GNU Lesser General Public License version 3 requirements +# will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +# +# GNU General Public License Usage +# Alternatively, this file may be used under the terms of the GNU +# General Public License version 2.0 or (at your option) the GNU General +# Public license version 3 or any later version approved by the KDE Free +# Qt Foundation. The licenses are as published by the Free Software +# Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +# included in the packaging of this file. Please review the following +# information to ensure the GNU General Public License requirements will +# be met: https://www.gnu.org/licenses/gpl-2.0.html and +# https://www.gnu.org/licenses/gpl-3.0.html. +# +# $QT_END_LICENSE$ +# +# SPDX-License-Identifier: LGPL-3.0 +#} +{% set class = '{0}'.format(interface) %} +{% set oncedefine = '{0}_{1}PRIVATE_H_'.format(module.module_name|upper, class|upper) %} +{% include 'generated_comment.cpp.tpl' %} + +#ifndef {{oncedefine}} +#define {{oncedefine}} + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "{{module.module_name|lower}}module.h" + +{% if module.tags.config.disablePrivateIVI %} +#include <QObject> +{% else %} +{% if interface.tags.config.zoned %} +#include <QtIviCore/private/qiviabstractzonedfeature_p.h> +{% else %} +#include <QtIviCore/private/qiviabstractfeature_p.h> +{% endif %} +{% endif %} + +QT_BEGIN_NAMESPACE + +class {{class}}; + +{% if module.tags.config.disablePrivateIVI %} +class {{class}}Private : public QObject +{% else %} +{% if interface.tags.config.zoned %} +class {{class}}Private : public QIviAbstractZonedFeaturePrivate +{% else %} +class {{class}}Private : public QIviAbstractFeaturePrivate +{% endif %} +{% endif %} +{ +public: +{% if module.tags.config.disablePrivateIVI %} + {{class}}Private({{class}} *parent); +{% else %} +{% if interface.tags.config.zoned %} + {{class}}Private(const QString &interface, const QString &zone, {{class}} *parent); +{% else %} + {{class}}Private(const QString &interface, {{class}} *parent); +{% endif %} +{% endif %} + + static {{class}}Private *get({{class}} *p); + static const {{class}}Private *get(const {{class}} *p); + {{class}} *getParent(); + + void clearToDefaults(); + +{% for property in interface.properties %} +{% if interface.tags.config.zoned %} + void on{{property|upperfirst}}Changed({{property|parameter_type}}, const QString &zone); +{% else %} + void on{{property|upperfirst}}Changed({{property|parameter_type}}); +{% endif %} +{% endfor %} + +{% if not module.tags.config.disablePrivateIVI %} + {{class}} * const q_ptr; +{% endif %} +{% for property in interface.properties %} + {{property|return_type}} m_{{property}}; +{% endfor %} + +{% if not module.tags.config.disablePrivateIVI %} + Q_DECLARE_PUBLIC({{class}}) +{% endif %} +}; + +QT_END_NAMESPACE + +#endif // {{oncedefine}} diff --git a/src/ivicore/qface/templates_frontend/module.cpp.tpl b/src/ivicore/qface/templates_frontend/module.cpp.tpl new file mode 100644 index 0000000..d04b52e --- /dev/null +++ b/src/ivicore/qface/templates_frontend/module.cpp.tpl @@ -0,0 +1,89 @@ +{# +# Copyright (C) 2017 Pelagicore AG. +# Contact: https://www.qt.io/licensing/ +# +# This file is part of the QtIvi module of the Qt Toolkit. +# +# $QT_BEGIN_LICENSE:LGPL-QTAS$ +# Commercial License Usage +# Licensees holding valid commercial Qt Automotive Suite licenses may use +# this file in accordance with the commercial license agreement provided +# with the Software or, alternatively, in accordance with the terms +# contained in a written agreement between you and The Qt Company. For +# licensing terms and conditions see https://www.qt.io/terms-conditions. +# For further information use the contact form at https://www.qt.io/contact-us. +# +# GNU Lesser General Public License Usage +# Alternatively, this file may be used under the terms of the GNU Lesser +# General Public License version 3 as published by the Free Software +# Foundation and appearing in the file LICENSE.LGPL3 included in the +# packaging of this file. Please review the following information to +# ensure the GNU Lesser General Public License version 3 requirements +# will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +# +# GNU General Public License Usage +# Alternatively, this file may be used under the terms of the GNU +# General Public License version 2.0 or (at your option) the GNU General +# Public license version 3 or any later version approved by the KDE Free +# Qt Foundation. The licenses are as published by the Free Software +# Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +# included in the packaging of this file. Please review the following +# information to ensure the GNU General Public License requirements will +# be met: https://www.gnu.org/licenses/gpl-2.0.html and +# https://www.gnu.org/licenses/gpl-3.0.html. +# +# $QT_END_LICENSE$ +# +# SPDX-License-Identifier: LGPL-3.0 +#} +{% set class = '{0}Module'.format(module.module_name) %} +{% include 'generated_comment.cpp.tpl' %} +{% import 'utils.tpl' as utils %} + +#include "{{class|lower}}.h" + +#include <QQmlEngine> + +{% for interface in module.interfaces %} +#include "{{interface|lower}}.h" +{% endfor %} + +QT_BEGIN_NAMESPACE + +/*! \internal */ +QObject* {{class|lower}}_singletontype_provider(QQmlEngine*, QJSEngine*) +{ + return new {{class}}(); +} + +/*! + \class {{class}} + \inmodule {{module}} + +{{ utils.format_comments(module.comment) }} +*/ +{{class}}::{{class}}(QObject *parent) + : QObject(parent) +{ +} + +/*! \internal */ +void {{class}}::registerTypes() +{ +{% for enum in module.enums %} + qRegisterMetaType<{{class}}::{{enum}}>(); +{% endfor %} +} + +/*! \internal */ +void {{class}}::registerQmlTypes(const QString& uri, int majorVersion, int minorVersion) +{ + qmlRegisterSingletonType<{{class}}>(uri.toLatin1(), majorVersion, minorVersion, + "{{module.module_name}}Module", + {{class|lower}}_singletontype_provider); +{% for interface in module.interfaces %} + {{interface}}::registerQmlTypes(uri, majorVersion, minorVersion); +{% endfor %} +} + +QT_END_NAMESPACE diff --git a/src/ivicore/qface/templates_frontend/module.h.tpl b/src/ivicore/qface/templates_frontend/module.h.tpl new file mode 100644 index 0000000..bbc0341 --- /dev/null +++ b/src/ivicore/qface/templates_frontend/module.h.tpl @@ -0,0 +1,78 @@ +{# +# Copyright (C) 2017 Pelagicore AG. +# Contact: https://www.qt.io/licensing/ +# +# This file is part of the QtIvi module of the Qt Toolkit. +# +# $QT_BEGIN_LICENSE:LGPL-QTAS$ +# Commercial License Usage +# Licensees holding valid commercial Qt Automotive Suite licenses may use +# this file in accordance with the commercial license agreement provided +# with the Software or, alternatively, in accordance with the terms +# contained in a written agreement between you and The Qt Company. For +# licensing terms and conditions see https://www.qt.io/terms-conditions. +# For further information use the contact form at https://www.qt.io/contact-us. +# +# GNU Lesser General Public License Usage +# Alternatively, this file may be used under the terms of the GNU Lesser +# General Public License version 3 as published by the Free Software +# Foundation and appearing in the file LICENSE.LGPL3 included in the +# packaging of this file. Please review the following information to +# ensure the GNU Lesser General Public License version 3 requirements +# will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +# +# GNU General Public License Usage +# Alternatively, this file may be used under the terms of the GNU +# General Public License version 2.0 or (at your option) the GNU General +# Public license version 3 or any later version approved by the KDE Free +# Qt Foundation. The licenses are as published by the Free Software +# Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +# included in the packaging of this file. Please review the following +# information to ensure the GNU General Public License requirements will +# be met: https://www.gnu.org/licenses/gpl-2.0.html and +# https://www.gnu.org/licenses/gpl-3.0.html. +# +# $QT_END_LICENSE$ +# +# SPDX-License-Identifier: LGPL-3.0 +#} +{% set exportsymbol = 'Q_QT{0}_EXPORT'.format(module.module_name|upper) %} +{% set class = '{0}Module'.format(module.module_name) %} +{% set oncedefine = '{0}_H_'.format(class|upper) %} +{% include 'generated_comment.cpp.tpl' %} +{% import 'utils.tpl' as utils %} + +#ifndef {{oncedefine}} +#define {{oncedefine}} + +#include "{{module.module_name|lower}}global.h" +#include <QObject> + +QT_BEGIN_NAMESPACE + +class {{exportsymbol}} {{class}} : public QObject { + Q_OBJECT +public: + {{class}}(QObject *parent=0); + +{% for enum in module.enums %} +{% if enum.comment %} + /*! + {{ utils.format_comments(enum.comment) }} + */ +{% endif %} + enum {{enum}} { + {% for member in enum.members %} + {{member.name}} = {{member.value}}, {{member.comment}} + {% endfor %} + }; + Q_ENUM({{enum}}) +{% endfor %} + + static void registerTypes(); + static void registerQmlTypes(const QString& uri, int majorVersion = 1, int minorVersion = 0); +}; + +QT_END_NAMESPACE + +#endif // {{oncedefine}} diff --git a/src/ivicore/qface/templates_frontend/module.pri.tpl b/src/ivicore/qface/templates_frontend/module.pri.tpl new file mode 100644 index 0000000..0ffc678 --- /dev/null +++ b/src/ivicore/qface/templates_frontend/module.pri.tpl @@ -0,0 +1,58 @@ +{# +# Copyright (C) 2017 Pelagicore AG. +# Contact: https://www.qt.io/licensing/ +# +# This file is part of the QtIvi module of the Qt Toolkit. +# +# $QT_BEGIN_LICENSE:LGPL-QTAS$ +# Commercial License Usage +# Licensees holding valid commercial Qt Automotive Suite licenses may use +# this file in accordance with the commercial license agreement provided +# with the Software or, alternatively, in accordance with the terms +# contained in a written agreement between you and The Qt Company. For +# licensing terms and conditions see https://www.qt.io/terms-conditions. +# For further information use the contact form at https://www.qt.io/contact-us. +# +# GNU Lesser General Public License Usage +# Alternatively, this file may be used under the terms of the GNU Lesser +# General Public License version 3 as published by the Free Software +# Foundation and appearing in the file LICENSE.LGPL3 included in the +# packaging of this file. Please review the following information to +# ensure the GNU Lesser General Public License version 3 requirements +# will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +# +# GNU General Public License Usage +# Alternatively, this file may be used under the terms of the GNU +# General Public License version 2.0 or (at your option) the GNU General +# Public license version 3 or any later version approved by the KDE Free +# Qt Foundation. The licenses are as published by the Free Software +# Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +# included in the packaging of this file. Please review the following +# information to ensure the GNU General Public License requirements will +# be met: https://www.gnu.org/licenses/gpl-2.0.html and +# https://www.gnu.org/licenses/gpl-3.0.html. +# +# $QT_END_LICENSE$ +# +# SPDX-License-Identifier: LGPL-3.0 +#} +############################################################################# +## This is an auto-generated file. +## Do not edit! All changes made to it will be lost. +############################################################################# + +HEADERS += \ +{% for interface in module.interfaces %} + $$PWD/{{interface|lower}}.h \ + $$PWD/{{interface|lower}}_p.h \ + $$PWD/{{interface|lower}}backendinterface.h \ +{% endfor %} + $$PWD/{{module.module_name|lower}}module.h \ + $$PWD/{{module.module_name|lower}}global.h + +SOURCES += \ +{% for interface in module.interfaces %} + $$PWD/{{interface|lower}}.cpp \ + $$PWD/{{interface|lower}}backendinterface.cpp \ +{% endfor %} + $$PWD/{{module.module_name|lower}}module.cpp diff --git a/src/ivicore/qface/templates_frontend/utils.tpl b/src/ivicore/qface/templates_frontend/utils.tpl new file mode 100644 index 0000000..42ffa5e --- /dev/null +++ b/src/ivicore/qface/templates_frontend/utils.tpl @@ -0,0 +1,7 @@ +{% macro format_comments(comments) -%} +{% with doc = comments|parse_doc -%} +{% if doc.brief %} \brief {{doc.brief}} {% endif %} +{% if doc.descriptiont -%} + {{doc.description|join(' ')}}{% endif -%} +{%- endwith %} +{%- endmacro %} diff --git a/src/ivicore/qface/templates_test/tst_test.cpp.tpl b/src/ivicore/qface/templates_test/tst_test.cpp.tpl new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/src/ivicore/qface/templates_test/tst_test.cpp.tpl diff --git a/src/ivicore/qiviabstractfeature.cpp b/src/ivicore/qiviabstractfeature.cpp index 2750c48..5a1fe1a 100644 --- a/src/ivicore/qiviabstractfeature.cpp +++ b/src/ivicore/qiviabstractfeature.cpp @@ -50,15 +50,18 @@ #include <QMetaEnum> #include <QDebug> +QT_BEGIN_NAMESPACE + QIviAbstractFeaturePrivate::QIviAbstractFeaturePrivate(const QString &interface, QIviAbstractFeature *parent) : QObjectPrivate() , q_ptr(parent) , m_interface(interface) - , m_serviceObject(0) + , m_serviceObject(nullptr) , m_discoveryMode(QIviAbstractFeature::AutoDiscovery) , m_discoveryResult(QIviAbstractFeature::NoResult) , m_error(QIviAbstractFeature::NoError) , m_qmlCreation(false) + , m_isInitialized(false) { } @@ -76,91 +79,101 @@ void QIviAbstractFeaturePrivate::setDiscoveryResult(QIviAbstractFeature::Discove emit q->discoveryResultChanged(discoveryResult); } +void QIviAbstractFeaturePrivate::onInitializationDone() +{ + if (m_isInitialized) + return; + + m_isInitialized = true; + Q_Q(QIviAbstractFeature); + emit q->isInitializedChanged(true); +} + /*! - * \class QIviAbstractFeature - * \inmodule QtIviCore - * \brief The QIviAbstractFeature is the base class for all QtIvi Features - * - * QIviAbstractFeature is the base class for the front facing API towards the developer. - * The QIviAbstractFeature provides you with a way to automatically connect to a backend implementing - * the interface needed. This discovery is started by using the startAutoDiscovery() function. - * - * Once the auto discovery is done, it can be checked whether a backend has been found by using the - * isValid function. - * - * The auto discovery gives you an easy way to automatically connect to the right backend implementation. - * If you don't want to use the auto discovery, it's also possible to use QIviServiceManager to retrieve - * all Backends and search manually for the right one and connect it to the QIviAbstractFeature by calling - * setServiceObject(). - * - * The type of backend to be loaded can be controlled by setting the auto discovery mode. By default, - * it is set to AutoDiscovery, which indicates that a production backend will be preferred over a simulation backend. - * - * QIviAbstractFeature is an abstract base class that needs to be subclassed to create an API for your - * Feature. - * - * \chapter Subclassing - * - * When subclassing QIviAbstractFeature, you must provide implementations of the following functions: - * \list - * \li acceptServiceObject() - * \li connectToServiceObject() - * \li disconnectFromServiceObject() - * \li clearServiceObject() - * \endlist - * - * Once a QIviServiceObject has been set, either by auto discovery or by manually setting it, the acceptServiceObject() - * function will be called to make sure the QIviServiceObject provides everything needed by the Feature. - * - * If the interface provides signals, you need to do all the connect statements in connectToServiceObject() and - * disconnect them again in disconnectFromServiceObject(). - * - * clearServiceObject() will be called once the Feature doesn't have a connection to a ServiceObject anymore and should - * reset its state to sane defaults. - */ - -/*! - \enum QIviAbstractFeature::Error - - \value NoError + \class QIviAbstractFeature + \inmodule QtIviCore + \brief The QIviAbstractFeature is the base class for all QtIvi Features + + QIviAbstractFeature is the base class for the front facing API towards the developer. + The QIviAbstractFeature provides you with a way to automatically connect to a backend implementing + the interface needed. This discovery is started by using the startAutoDiscovery() function. + + Once the auto discovery is done, it can be checked whether a backend has been found by using the + isValid function. + + The auto discovery gives you an easy way to automatically connect to the right backend implementation. + If you don't want to use the auto discovery, it's also possible to use QIviServiceManager to retrieve + all Backends and search manually for the right one and connect it to the QIviAbstractFeature by calling + setServiceObject(). + + The type of backend to be loaded can be controlled by setting the auto discovery mode. By default, + it is set to AutoDiscovery, which indicates that a production backend will be preferred over a simulation backend. + + QIviAbstractFeature is an abstract base class that needs to be subclassed to create an API for your + Feature. + + \chapter Subclassing + + When subclassing QIviAbstractFeature, you must provide implementations of the following functions: + \list + \li acceptServiceObject() + \li connectToServiceObject() + \li disconnectFromServiceObject() + \li clearServiceObject() + \endlist + + Once a QIviServiceObject has been set, either by auto discovery or by manually setting it, the acceptServiceObject() + function will be called to make sure the QIviServiceObject provides everything needed by the Feature. + + If the interface provides signals, you need to do all the connect statements in connectToServiceObject() and + disconnect them again in disconnectFromServiceObject(). + + clearServiceObject() will be called once the Feature doesn't have a connection to a ServiceObject anymore and should + reset its state to sane defaults. +*/ + +/*! + \enum QIviAbstractFeature::Error + + \value NoError No error - \value PermissionDenied + \value PermissionDenied Permission for the operation is denied - \value InvalidOperation + \value InvalidOperation Operation is invalid - \value Timeout + \value Timeout Operation timeout - \value InvalidZone + \value InvalidZone Zone is not available for the operation - \value Unknown + \value Unknown Unknown error - */ +*/ /*! - \enum QIviAbstractFeature::DiscoveryMode + \enum QIviAbstractFeature::DiscoveryMode - \value NoAutoDiscovery + \value NoAutoDiscovery No auto discovery is done and the ServiceObject needs to be set manually - \value AutoDiscovery + \value AutoDiscovery Tries to first find a production backend with a matching interface and falls back to a simulation backend if not found - \value LoadOnlyProductionBackends + \value LoadOnlyProductionBackends Only tries to load a production backend with a matching interface - \value LoadOnlySimulationBackends + \value LoadOnlySimulationBackends Only tries to load a simulation backend with a matching interface - */ +*/ /*! - \enum QIviAbstractFeature::DiscoveryResult + \enum QIviAbstractFeature::DiscoveryResult - \value NoResult + \value NoResult Indicates that no auto discovery was started because the feature has already assigned a valid ServiceObject - \value ErrorWhileLoading + \value ErrorWhileLoading An error has happened while searching for a backend with a matching interface - \value ProductionBackendLoaded + \value ProductionBackendLoaded As a result of the auto discovery a production backend was loaded - \value SimulationBackendLoaded + \value SimulationBackendLoaded As a result of the auto discovery a simulation backend was loaded - */ +*/ /*! \qmltype AbstractFeature @@ -176,43 +189,26 @@ void QIviAbstractFeaturePrivate::setDiscoveryResult(QIviAbstractFeature::Discove */ /*! - * \fn void QIviAbstractFeature::connectToServiceObject(QIviServiceObject *serviceObject) - * - * This method is expected to be implemented by any class subclassing QIviAbstractFeature. - * - * The implementation should connect to the \a serviceObject, and set up all - * properties to reflect the state of the service object. - * - * There is no previous service object connected, as this function call is always preceded by a call to - * \l disconnectFromServiceObject or \l clearServiceObject. - * - * It is safe to assume that the \a serviceObject, has always been accepted through the - * \l acceptServiceObject method prior to being passed to this method. - * - * \sa acceptServiceObject(), disconnectFromServiceObject(), clearServiceObject() - */ - -/*! - * \fn void QIviAbstractFeature::clearServiceObject() - * - * This method is expected to be implemented by any class subclassing QIviAbstractFeature. - * - * Called when no service object is available. The implementation is expected to set all - * properties to safe defaults and forget all links to the previous service object. - * - * There is no need to disconnect from the service object. If it still exists, it is guaranteed - * that \l disconnectFromServiceObject is called first. - * - * \sa acceptServiceObject(), connectToServiceObject(), disconnectFromServiceObject() - */ - -/*! - * Constructs an abstract feature. - * - * The \a parent argument is passed on to the \l QObject constructor. - * - * The \a interface argument is used to locate suitable service objects. - */ + \fn void QIviAbstractFeature::clearServiceObject() + + This method is expected to be implemented by any class subclassing QIviAbstractFeature. + + Called when no service object is available. The implementation is expected to set all + properties to safe defaults and forget all links to the previous service object. + + There is no need to disconnect from the service object. If it still exists, it is guaranteed + that \l disconnectFromServiceObject is called first. + + \sa acceptServiceObject(), connectToServiceObject(), disconnectFromServiceObject() +*/ + +/*! + Constructs an abstract feature. + + The \a parent argument is passed on to the \l QObject constructor. + + The \a interface argument is used to locate suitable service objects. +*/ QIviAbstractFeature::QIviAbstractFeature(const QString &interface, QObject *parent) : QObject(*new QIviAbstractFeaturePrivate(interface, this), parent) { @@ -224,37 +220,37 @@ QIviAbstractFeature::QIviAbstractFeature(const QString &interface, QObject *pare } /*! - * Destructor. - */ + Destructor. +*/ QIviAbstractFeature::~QIviAbstractFeature() { } /*! - * \qmlproperty ServiceObject AbstractFeature::serviceObject - * \brief Sets the service object for the feature. - * - * As features only expose the front API facing the developer, a service object implementing the - * actual function is required. This is usually retrieved through the auto discovery mechanism. - * - * The setter for this property returns false if the \e {Service Object} is already set to exactly this instance - * or the \e {Service Object} doesn't get accepted by the feature. - * - * \sa discoveryMode - */ -/*! - * \property QIviAbstractFeature::serviceObject - * \brief Sets the service object for the feature. - * - * As features only expose the front API facing the developer, a service object implementing the - * actual function is required. This is usually retrieved through the auto discovery mechanism. - * - * The setter for this property returns false if the \e {Service Object} is already set to exactly this instance - * or the \e {Service Object} doesn't get accepted by the feature. - * - * \sa discoveryMode - */ + \qmlproperty ServiceObject AbstractFeature::serviceObject + \brief Sets the service object for the feature. + + As features only expose the front API facing the developer, a service object implementing the + actual function is required. This is usually retrieved through the auto discovery mechanism. + + The setter for this property returns false if the \e {Service Object} is already set to exactly this instance + or the \e {Service Object} doesn't get accepted by the feature. + + \sa discoveryMode +*/ +/*! + \property QIviAbstractFeature::serviceObject + \brief Sets the service object for the feature. + + As features only expose the front API facing the developer, a service object implementing the + actual function is required. This is usually retrieved through the auto discovery mechanism. + + The setter for this property returns false if the \e {Service Object} is already set to exactly this instance + or the \e {Service Object} doesn't get accepted by the feature. + + \sa discoveryMode +*/ bool QIviAbstractFeature::setServiceObject(QIviServiceObject *so) { Q_D(QIviAbstractFeature); @@ -267,7 +263,7 @@ bool QIviAbstractFeature::setServiceObject(QIviServiceObject *so) disconnect(d->m_serviceObject, SIGNAL(destroyed()), this, SLOT(serviceObjectDestroyed())); } - d->m_serviceObject = 0; + d->m_serviceObject = nullptr; //We only want to call clearServiceObject if we are sure that the serviceObject changes if (!so) { @@ -296,32 +292,32 @@ bool QIviAbstractFeature::setServiceObject(QIviServiceObject *so) } /*! - * \qmlproperty enumeration AbstractFeature::discoveryMode - * \brief Holds the mode that is used for the autoDiscovery - * - * Available values are: - * \value NoAutoDiscovery - * No auto discovery is done and the ServiceObject needs to be set manually. - * \value AutoDiscovery - * Tries to find a production backend with a matching interface and falls back to a simulation backend if not found. - * \value LoadOnlyProductionBackends - * Only tries to load a production backend with a matching interface. - * \value LoadOnlySimulationBackends - * Only tries to load a simulation backend with a matching interface. - * - * If needed the auto discovery will be started once the Feature creation is completed. - * - * \note If you change this property after the Feature is instantiated you need to call startAutoDiscovery() to search for - * a new Service Object - */ - -/*! - * \property QIviAbstractFeature::discoveryMode - * \brief Holds the mode that is used for the autoDiscovery - * - * \note If you change this property after the Feature is instantiated you need to call startAutoDiscovery() to search for - * a new Service Object - */ + \qmlproperty enumeration AbstractFeature::discoveryMode + \brief Holds the mode that is used for the autoDiscovery + + Available values are: + \value NoAutoDiscovery + No auto discovery is done and the ServiceObject needs to be set manually. + \value AutoDiscovery + Tries to find a production backend with a matching interface and falls back to a simulation backend if not found. + \value LoadOnlyProductionBackends + Only tries to load a production backend with a matching interface. + \value LoadOnlySimulationBackends + Only tries to load a simulation backend with a matching interface. + + If needed the auto discovery will be started once the Feature creation is completed. + + \note If you change this property after the Feature is instantiated you need to call startAutoDiscovery() to search for + a new Service Object +*/ + +/*! + \property QIviAbstractFeature::discoveryMode + \brief Holds the mode that is used for the autoDiscovery + + \note If you change this property after the Feature is instantiated you need to call startAutoDiscovery() to search for + a new Service Object +*/ void QIviAbstractFeature::setDiscoveryMode(QIviAbstractFeature::DiscoveryMode discoveryMode) { Q_D(QIviAbstractFeature); @@ -333,9 +329,9 @@ void QIviAbstractFeature::setDiscoveryMode(QIviAbstractFeature::DiscoveryMode di } /*! - * \internal - * \overload - */ + \internal + \overload +*/ void QIviAbstractFeature::classBegin() { Q_D(QIviAbstractFeature); @@ -343,8 +339,8 @@ void QIviAbstractFeature::classBegin() } /*! - * Invoked automatically when used from QML. Calls \l startAutoDiscovery(). - */ + Invoked automatically when used from QML. Calls \l startAutoDiscovery(). +*/ void QIviAbstractFeature::componentComplete() { Q_D(QIviAbstractFeature); @@ -353,12 +349,12 @@ void QIviAbstractFeature::componentComplete() } /*! - * Returns the interface name this Feature is implementing. - * - * When the Feature discovers a matching backend, this interface name needs to be supported by the Service Object the Feature is connecting to. - * - * See \l {Extending Qt IVI} for more information. - */ + Returns the interface name this Feature is implementing. + + When the Feature discovers a matching backend, this interface name needs to be supported by the Service Object the Feature is connecting to. + + See \l {Extending Qt IVI} for more information. +*/ QString QIviAbstractFeature::interfaceName() const { Q_D(const QIviAbstractFeature); @@ -378,26 +374,26 @@ QIviAbstractFeature::DiscoveryMode QIviAbstractFeature::discoveryMode() const } /*! - * \qmlproperty enumeration AbstractFeature::autoDiscoveryResult - * \brief The result of the last autoDiscovery - * - * Available values are: - * \value NoResult - * Indicates that no auto discovery was started because the feature has already assigned a valid ServiceObject. - * \value ErrorWhileLoading - * An error has happened while searching for a backend with a matching interface. - * \value ProductionBackendLoaded - * As a result of the auto discovery a production backend was loaded. - * \value SimulationBackendLoaded - * As a result of the auto discovery a simulation backend was loaded. - */ - -/*! - * \property QIviAbstractFeature::discoveryResult - * \brief The result of the last autoDiscovery - * - * \sa startAutoDiscovery() - */ + \qmlproperty enumeration AbstractFeature::autoDiscoveryResult + \brief The result of the last autoDiscovery + + Available values are: + \value NoResult + Indicates that no auto discovery was started because the feature has already assigned a valid ServiceObject. + \value ErrorWhileLoading + An error has happened while searching for a backend with a matching interface. + \value ProductionBackendLoaded + As a result of the auto discovery a production backend was loaded. + \value SimulationBackendLoaded + As a result of the auto discovery a simulation backend was loaded. +*/ + +/*! + \property QIviAbstractFeature::discoveryResult + \brief The result of the last autoDiscovery + + \sa startAutoDiscovery() +*/ QIviAbstractFeature::DiscoveryResult QIviAbstractFeature::discoveryResult() const { Q_D(const QIviAbstractFeature); @@ -405,12 +401,12 @@ QIviAbstractFeature::DiscoveryResult QIviAbstractFeature::discoveryResult() cons } /*! - Sets \a error with the \a message. + Sets \a error with the \a message. - Emits errorChanged() signal. + Emits errorChanged() signal. - \sa QIviAbstractZonedFeature::Error - */ + \sa QIviAbstractZonedFeature::Error +*/ void QIviAbstractFeature::setError(QIviAbstractFeature::Error error, const QString &message) { Q_D(QIviAbstractFeature); @@ -422,10 +418,10 @@ void QIviAbstractFeature::setError(QIviAbstractFeature::Error error, const QStri } /*! - Returns the last error code. + Returns the last error code. - \sa QIviAbstractFeature::Error - */ + \sa QIviAbstractFeature::Error +*/ QIviAbstractFeature::Error QIviAbstractFeature::error() const { Q_D(const QIviAbstractFeature); @@ -434,15 +430,15 @@ QIviAbstractFeature::Error QIviAbstractFeature::error() const /*! - \qmlproperty string QIviAbstractFeature::error + \qmlproperty string QIviAbstractFeature::error - Last error message of the feature. Empty if no error. - */ + Last error message of the feature. Empty if no error. +*/ /*! - \property QIviAbstractFeature::error + \property QIviAbstractFeature::error - Last error message of the feature. Empty if no error. - */ + Last error message of the feature. Empty if no error. +*/ QString QIviAbstractFeature::errorMessage() const { Q_D(const QIviAbstractFeature); @@ -450,9 +446,9 @@ QString QIviAbstractFeature::errorMessage() const } /*! - Returns the current error code converted from QIviAbstractFeature::Error to QString + Returns the current error code converted from QIviAbstractFeature::Error to QString - \sa error + \sa error */ QString QIviAbstractFeature::errorText() const { @@ -465,46 +461,48 @@ QString QIviAbstractFeature::errorText() const /*! - * \qmlmethod enumeration AbstractFeature::startAutoDiscovery() - * - * Performs an automatic discovery attempt. - * - * The feature will try to locate a single service object implementing the required interface. - * - * If no service object is found, the feature will stay invalid. If more than one service object - * is found, the first instance is used. - * - * Either the type of the backend which was loaded or an error is returned. - * - * If the discoveryMode is set to QIviAbstractFeature::NoAutoDiscovery this function will - * do nothing and return QIviAbstractFeature::NoResult. - * - * Return values are: - * \value NoResult - * Indicates that no auto discovery was started because the feature has already assigned a valid ServiceObject. - * \value ErrorWhileLoading - * An error has happened while searching for a backend with a matching interface. - * \value ProductionBackendLoaded - * As a result of the auto discovery a production backend was loaded. - * \value SimulationBackendLoaded - * As a result of the auto discovery a simulation backend was loaded. - */ - -/*! - * \brief Performs an automatic discovery attempt. - * - * The feature will try to locate a single service object implementing the required interface. - * - * If no service object is found, the feature will stay invalid. If more than one service object - * is found, the first instance is used. - * - * Either the type of the backend which was loaded or an error is returned. - * - * If the discoveryMode is set to QIviAbstractFeature::NoAutoDiscovery this function will - * do nothing and return QIviAbstractFeature::NoResult. - * - * \sa discoveryMode() - */ + \qmlmethod enumeration AbstractFeature::startAutoDiscovery() + + Performs an automatic discovery attempt. + + The feature will try to locate a single service object implementing the required interface. + + If no service object is found, the feature will stay invalid. If more than one service object + is found, the first instance is used. + + Either the type of the backend which was loaded or an error is returned. + + If the discoveryMode is set to QIviAbstractFeature::NoAutoDiscovery this function will + do nothing and return QIviAbstractFeature::NoResult. + + Return values are: + \value NoResult + Indicates that no auto discovery was started because the feature has already assigned a valid ServiceObject. + \value ErrorWhileLoading + An error has happened while searching for a backend with a matching interface. + \value ProductionBackendLoaded + As a result of the auto discovery a production backend was loaded. + \value SimulationBackendLoaded + As a result of the auto discovery a simulation backend was loaded. + + \sa {Dynamic Backend System} QIviServiceManager +*/ + +/*! + \brief Performs an automatic discovery attempt. + + The feature will try to locate a single service object implementing the required interface. + + If no service object is found, the feature will stay invalid. If more than one service object + is found, the first instance is used. + + Either the type of the backend which was loaded or an error is returned. + + If the discoveryMode is set to QIviAbstractFeature::NoAutoDiscovery this function will + do nothing and return QIviAbstractFeature::NoResult. + + \sa discoveryMode() {Dynamic Backend System} +*/ QIviAbstractFeature::DiscoveryResult QIviAbstractFeature::startAutoDiscovery() { Q_D(QIviAbstractFeature); @@ -576,36 +574,87 @@ QIviAbstractFeature::QIviAbstractFeature(QIviAbstractFeaturePrivate &dd, QObject } /*! - * This method is expected to be implemented by any class subclassing QIviAbstractFeature. - * - * The method should return \c true if the given \a serviceObject is accepted and - * can be used, otherwise \c false. - * - * If the object is accepted, \l connectToServiceObject is called to actually connect to the - * service object. - * - * The default implementation accepts the \a serviceObject if it implements the interface - * returned by interfaceName(); - * - * \sa connectToServiceObject(), disconnectFromServiceObject(), clearServiceObject() - */ + This method is expected to be implemented by any class subclassing QIviAbstractFeature. + + The method should return \c true if the given \a serviceObject is accepted and + can be used, otherwise \c false. + + If the object is accepted, \l connectToServiceObject is called to actually connect to the + service object. + + The default implementation accepts the \a serviceObject if it implements the interface + returned by interfaceName(); + + \sa connectToServiceObject(), disconnectFromServiceObject(), clearServiceObject() +*/ bool QIviAbstractFeature::acceptServiceObject(QIviServiceObject *serviceObject) { return serviceObject->interfaces().contains(interfaceName()); } /*! - * This method is expected to be implemented by any class subclassing QIviAbstractFeature. - * - * The implementation should disconnect all connections to the \a serviceObject. - * - * There is no need to reset internal variables to safe defaults. A call to this function is - * always followed by a call to \l connectToServiceObject or \l clearServiceObject. - * - * The default implementation disconnects all signals from the serviceObject to this instance. - * - * \sa acceptServiceObject(), connectToServiceObject(), clearServiceObject() - */ + This method is expected to be implemented by any class subclassing QIviAbstractFeature. + + The implementation should connect to the \a serviceObject, and set up all + properties to reflect the state of the service object. + + There is no previous service object connected, as this function call is always preceded by a call to + \l disconnectFromServiceObject or \l clearServiceObject. + + It is safe to assume that the \a serviceObject, has always been accepted through the + \l acceptServiceObject method prior to being passed to this method. + + The default implementation connects to the signals offered by QIviFeatureInterface and calls + QIviFeatureInterface::initialize() afterwards. + + When reimplementing please keep in mind to connect all signals before calling this function. e.g. + + /code + void SimpleFeature::connectToServiceObject(QIviServiceObject *serviceObject) + { + SimpleFeatureBackendInterface *backend = backend(serviceObject); + if (!backend) + return; + + // connect your signals + connect(backend, &SimpleFeatureBackendInterface::propertyChanged, + this, &SimpleFeature::onPropertyChanged); + + // connects the base signals and call initialize() + QIviAbstractFeature::connectToServiceObject(serviceObject); + + // Additional initialization functions can be added here + } + /endcode + + \sa acceptServiceObject(), disconnectFromServiceObject(), clearServiceObject() +*/ +void QIviAbstractFeature::connectToServiceObject(QIviServiceObject *serviceObject) +{ + Q_D(QIviAbstractFeature); + Q_ASSERT(serviceObject); + QIviFeatureInterface *backend = serviceObject->interfaceInstance(interfaceName()); + + if (backend) { + connect(backend, &QIviFeatureInterface::errorChanged, this, &QIviAbstractFeature::onErrorChanged); + QObjectPrivate::connect(backend, &QIviFeatureInterface::initializationDone, + d, &QIviAbstractFeaturePrivate::onInitializationDone); + backend->initialize(); + } +} + +/*! + This method is expected to be implemented by any class subclassing QIviAbstractFeature. + + The implementation should disconnect all connections to the \a serviceObject. + + There is no need to reset internal variables to safe defaults. A call to this function is + always followed by a call to \l connectToServiceObject or \l clearServiceObject. + + The default implementation disconnects all signals from the serviceObject to this instance. + + \sa acceptServiceObject(), connectToServiceObject(), clearServiceObject() +*/ void QIviAbstractFeature::disconnectFromServiceObject(QIviServiceObject *serviceObject) { Q_ASSERT(serviceObject); @@ -616,25 +665,31 @@ void QIviAbstractFeature::disconnectFromServiceObject(QIviServiceObject *service } /*! - * \qmlproperty bool AbstractFeature::isValid - * \brief Indicates whether the feature is ready for use. - * - * The property is \c true if the feature is ready to be used, otherwise \c false. Not being - * ready usually indicates that no suitable service object could be found, or that automatic - * discovery has not been triggered. - * - * \sa QIviServiceObject, discoveryMode - */ -/*! - * \property QIviAbstractFeature::isValid - * \brief Indicates whether the feature is ready to use. - * - * The property is \c true if the feature is ready to be used, otherwise \c false. Not being - * ready usually indicates that no suitable service object could be found, or that automatic - * discovery has not been triggered. - * - * \sa QIviServiceObject, discoveryMode - */ + \qmlproperty bool AbstractFeature::isValid + \brief Indicates whether the feature is ready for use. + + The property is \c true if the feature is ready to be used, otherwise \c false. Not being + ready usually indicates that no suitable service object could be found, or that automatic + discovery has not been triggered. + + The backend still might not have sent all properties yet and is not fully initialized. + Use isInitialized instead to know when the feature holds all correct values. + + \sa QIviServiceObject, discoveryMode, isInitialized +*/ +/*! + \property QIviAbstractFeature::isValid + \brief Indicates whether the feature is ready to use. + + The property is \c true if the feature is ready to be used, otherwise \c false. Not being + ready usually indicates that no suitable service object could be found, or that automatic + discovery has not been triggered. + + The backend still might not have sent all properties yet and is not fully initialized. + Use isInitialized instead to know when the feature holds all correct values. + + \sa QIviServiceObject, discoveryMode, isInitialized +*/ bool QIviAbstractFeature::isValid() const { Q_D(const QIviAbstractFeature); @@ -642,9 +697,33 @@ bool QIviAbstractFeature::isValid() const } /*! - Updates \a error and \a message from the backend. + \qmlproperty bool AbstractFeature::isInitialized + \brief Indicates whether the feature has been initialized with all the values from the backend. + + The property is \c true once the backend sends the QIviFeatureInterface::initializationDone signal + to indicate that all values have now been initialized with values from the backend. + + \sa isValid, QIviFeatureInterface::initializationDone +*/ +/*! + \property QIviAbstractFeature::isInitialized + \brief Indicates whether the feature has been initialized with all the values from the backend. + + The property is \c true once the backend sends the QIviFeatureInterface::initializationDone signal + to indicate that all values have now been initialized with values from the backend. + + \sa isValid, QIviFeatureInterface::initializationDone +*/ +bool QIviAbstractFeature::isInitialized() const +{ + Q_D(const QIviAbstractFeature); + return d->m_isInitialized; +} + +/*! + Updates \a error and \a message from the backend. - This slot can be used when implementing a new Feature to report generic errors. + This slot can be used when implementing a new Feature to report generic errors. */ void QIviAbstractFeature::onErrorChanged(QIviAbstractFeature::Error error, const QString &message) { @@ -654,7 +733,11 @@ void QIviAbstractFeature::onErrorChanged(QIviAbstractFeature::Error error, const void QIviAbstractFeature::serviceObjectDestroyed() { Q_D(QIviAbstractFeature); - d->m_serviceObject = 0; + d->m_serviceObject = nullptr; clearServiceObject(); emit serviceObjectChanged(); } + +QT_END_NAMESPACE + +#include "moc_qiviabstractfeature.cpp" diff --git a/src/ivicore/qiviabstractfeature.h b/src/ivicore/qiviabstractfeature.h index ee4d0b3..1e42957 100644 --- a/src/ivicore/qiviabstractfeature.h +++ b/src/ivicore/qiviabstractfeature.h @@ -61,6 +61,7 @@ class Q_QTIVICORE_EXPORT QIviAbstractFeature : public QObject, public QQmlParser Q_PROPERTY(QIviAbstractFeature::DiscoveryResult discoveryResult READ discoveryResult NOTIFY discoveryResultChanged) Q_PROPERTY(QIviServiceObject *serviceObject READ serviceObject WRITE setServiceObject NOTIFY serviceObjectChanged) Q_PROPERTY(bool isValid READ isValid NOTIFY isValidChanged) + Q_PROPERTY(bool isInitialized READ isInitialized NOTIFY isInitializedChanged) Q_PROPERTY(QString error READ errorMessage NOTIFY errorChanged) public: @@ -91,13 +92,14 @@ public: }; Q_ENUM(DiscoveryResult) - explicit QIviAbstractFeature(const QString &interface, QObject *parent = Q_NULLPTR); - virtual ~QIviAbstractFeature(); + explicit QIviAbstractFeature(const QString &interface, QObject *parent = nullptr); + ~QIviAbstractFeature(); QIviServiceObject *serviceObject() const; QIviAbstractFeature::DiscoveryMode discoveryMode() const; QIviAbstractFeature::DiscoveryResult discoveryResult() const; bool isValid() const; + bool isInitialized() const; QIviAbstractFeature::Error error() const; QString errorMessage() const; @@ -111,13 +113,14 @@ Q_SIGNALS: void discoveryModeChanged(QIviAbstractFeature::DiscoveryMode discoveryMode); void discoveryResultChanged(QIviAbstractFeature::DiscoveryResult discoveryResult); void isValidChanged(bool arg); + void isInitializedChanged(bool isInitialized); void errorChanged(QIviAbstractFeature::Error error, const QString &message); protected: - QIviAbstractFeature(QIviAbstractFeaturePrivate &dd, QObject *parent = Q_NULLPTR); + QIviAbstractFeature(QIviAbstractFeaturePrivate &dd, QObject *parent = nullptr); virtual bool acceptServiceObject(QIviServiceObject*); - virtual void connectToServiceObject(QIviServiceObject*) = 0; + virtual void connectToServiceObject(QIviServiceObject*); virtual void disconnectFromServiceObject(QIviServiceObject*); virtual void clearServiceObject() = 0; @@ -136,6 +139,7 @@ private Q_SLOTS: private: Q_DECLARE_PRIVATE(QIviAbstractFeature) + Q_PRIVATE_SLOT(d_func(), void onInitializationDone()) friend class QIviFeatureTester; }; diff --git a/src/ivicore/qiviabstractfeature_p.h b/src/ivicore/qiviabstractfeature_p.h index 05cbb5d..ce2fd2b 100644 --- a/src/ivicore/qiviabstractfeature_p.h +++ b/src/ivicore/qiviabstractfeature_p.h @@ -68,6 +68,7 @@ public: virtual void initialize(); void setDiscoveryResult(QIviAbstractFeature::DiscoveryResult discoveryResult); + void onInitializationDone(); QIviAbstractFeature * const q_ptr; Q_DECLARE_PUBLIC(QIviAbstractFeature) @@ -79,6 +80,7 @@ public: QString m_errorMessage; QIviAbstractFeature::Error m_error; bool m_qmlCreation; + bool m_isInitialized; }; QT_END_NAMESPACE diff --git a/src/ivicore/qiviabstractfeaturelistmodel.cpp b/src/ivicore/qiviabstractfeaturelistmodel.cpp index e1777e7..2b40efa 100644 --- a/src/ivicore/qiviabstractfeaturelistmodel.cpp +++ b/src/ivicore/qiviabstractfeaturelistmodel.cpp @@ -42,6 +42,8 @@ #include "qiviabstractfeaturelistmodel.h" #include "qiviabstractfeaturelistmodel_p.h" +QT_BEGIN_NAMESPACE + QIviHelperFeature::QIviHelperFeature(const QString &interface, QIviAbstractFeatureListModel *model) : QIviAbstractFeature(interface) , m_model(model) @@ -63,11 +65,21 @@ void QIviHelperFeature::connectToServiceObject(QIviServiceObject *so) m_model->connectToServiceObject(so); } +void QIviHelperFeature::connectToServiceObjectDefaultImpl(QIviServiceObject *so) +{ + QIviAbstractFeature::connectToServiceObject(so); +} + void QIviHelperFeature::disconnectFromServiceObject(QIviServiceObject *so) { m_model->disconnectFromServiceObject(so); } +void QIviHelperFeature::disconnectFromServiceObjectDefaultImpl(QIviServiceObject *so) +{ + QIviAbstractFeature::disconnectFromServiceObject(so); +} + void QIviHelperFeature::clearServiceObject() { m_model->clearServiceObject(); @@ -120,23 +132,6 @@ void QIviAbstractFeatureListModelPrivate::initialize() */ /*! - \fn void QIviAbstractFeatureListModel::connectToServiceObject(QIviServiceObject *serviceObject) - - This method is expected to be implemented by any class subclassing QIviAbstractFeature. - - The implementation should connect to the \a serviceObject, and set up all - properties to reflect the state of the service object. - - There is no previous service object connected, as this function call is always preceded by a call to - \l disconnectFromServiceObject or \l clearServiceObject. - - It is safe to assume that the \a serviceObject, has always been accepted through the - \l acceptServiceObject method prior to being passed to this method. - - \sa acceptServiceObject(), disconnectFromServiceObject(), clearServiceObject() - */ - -/*! \fn void QIviAbstractFeatureListModel::clearServiceObject() This method is expected to be implemented by any class subclassing QIviAbstractFeatureListModel. @@ -148,14 +143,14 @@ void QIviAbstractFeatureListModelPrivate::initialize() that \l disconnectFromServiceObject is called first. \sa acceptServiceObject(), connectToServiceObject(), disconnectFromServiceObject() - */ +*/ /*! - Constructs a QIviAbstractFeatureListModel. + Constructs a QIviAbstractFeatureListModel. - The \a parent argument is passed on to the \l QAbstractListModel base class. + The \a parent argument is passed on to the \l QAbstractListModel base class. - The \a interface argument is used to locate suitable service objects. + The \a interface argument is used to locate suitable service objects. */ QIviAbstractFeatureListModel::QIviAbstractFeatureListModel(const QString &interface, QObject *parent) : QAbstractListModel(*new QIviAbstractFeatureListModelPrivate(interface, this), parent) @@ -166,6 +161,7 @@ QIviAbstractFeatureListModel::QIviAbstractFeatureListModel(const QString &interf connect(d->m_feature, &QIviAbstractFeature::discoveryModeChanged, this, &QIviAbstractFeatureListModel::discoveryModeChanged); connect(d->m_feature, &QIviAbstractFeature::discoveryResultChanged, this, &QIviAbstractFeatureListModel::discoveryResultChanged); connect(d->m_feature, &QIviAbstractFeature::isValidChanged, this, &QIviAbstractFeatureListModel::isValidChanged); + connect(d->m_feature, &QIviAbstractFeature::isInitializedChanged, this, &QIviAbstractFeatureListModel::isInitializedChanged); connect(d->m_feature, &QIviAbstractFeature::errorChanged, this, &QIviAbstractFeatureListModel::errorChanged); } @@ -185,7 +181,7 @@ QIviAbstractFeatureListModel::~QIviAbstractFeatureListModel() or the \e {Service Object} doesn't get accepted by the feature. \sa discoveryMode - */ +*/ /*! \property QIviAbstractFeatureListModel::serviceObject @@ -198,7 +194,7 @@ QIviAbstractFeatureListModel::~QIviAbstractFeatureListModel() or the \e {Service Object} doesn't get accepted by the feature. \sa discoveryMode - */ +*/ QIviServiceObject *QIviAbstractFeatureListModel::serviceObject() const { Q_D(const QIviAbstractFeatureListModel); @@ -223,7 +219,7 @@ QIviServiceObject *QIviAbstractFeatureListModel::serviceObject() const \note If you change this property after the Feature is instantiated you need to call startAutoDiscovery() to search for a new Service Object - */ +*/ /*! \property QIviAbstractFeatureListModel::discoveryMode @@ -231,7 +227,7 @@ QIviServiceObject *QIviAbstractFeatureListModel::serviceObject() const \note If you change this property after the Feature is instantiated you need to call startAutoDiscovery() to search for a new Service Object - */ +*/ QIviAbstractFeature::DiscoveryMode QIviAbstractFeatureListModel::discoveryMode() const { Q_D(const QIviAbstractFeatureListModel); @@ -251,14 +247,14 @@ QIviAbstractFeature::DiscoveryMode QIviAbstractFeatureListModel::discoveryMode() As a result of the auto discovery a production backend was loaded. \value SimulationBackendLoaded As a result of the auto discovery a simulation backend was loaded. - */ +*/ /*! \property QIviAbstractFeatureListModel::discoveryResult \brief The result of the last autoDiscovery attempt \sa startAutoDiscovery() - */ +*/ QIviAbstractFeature::DiscoveryResult QIviAbstractFeatureListModel::discoveryResult() const { Q_D(const QIviAbstractFeatureListModel); @@ -273,8 +269,11 @@ QIviAbstractFeature::DiscoveryResult QIviAbstractFeatureListModel::discoveryResu ready usually indicates that no suitable service object could be found, or that automatic discovery has not been triggered. - \sa QIviServiceObject, discoveryMode - */ + The backend still might not have sent all properties yet and is not fully initialized. + Use isInitialized instead to know when the feature holds all correct values. + + \sa QIviServiceObject, discoveryMode, isInitialized +*/ /*! \property QIviAbstractFeatureListModel::isValid \brief Indicates whether the feature is ready to use. @@ -283,8 +282,11 @@ QIviAbstractFeature::DiscoveryResult QIviAbstractFeatureListModel::discoveryResu ready usually indicates that no suitable service object could be found, or that automatic discovery has not been triggered. - \sa QIviServiceObject, discoveryMode - */ + The backend still might not have sent all properties yet and is not fully initialized. + Use isInitialized instead to know when the feature holds all correct values. + + \sa QIviServiceObject, discoveryMode, isInitialized +*/ bool QIviAbstractFeatureListModel::isValid() const { Q_D(const QIviAbstractFeatureListModel); @@ -292,10 +294,34 @@ bool QIviAbstractFeatureListModel::isValid() const } /*! - Returns the last error code. + \qmlproperty bool AbstractFeatureListModel::isInitialized + \brief Indicates whether the feature has been initialized with all the values from the backend. - \sa QIviAbstractFeature::Error - */ + The property is \c true once the backend sends the QIviFeatureInterface::initializationDone signal + to indicate that all values have now been initialized with values from the backend. + + \sa isValid, QIviFeatureInterface::initializationDone +*/ +/*! + \property QIviAbstractFeatureListModel::isInitialized + \brief Indicates whether the feature has been initialized with all the values from the backend. + + The property is \c true once the backend sends the QIviFeatureInterface::initializationDone signal + to indicate that all values have now been initialized with values from the backend. + + \sa isValid, QIviFeatureInterface::initializationDone +*/ +bool QIviAbstractFeatureListModel::isInitialized() const +{ + Q_D(const QIviAbstractFeatureListModel); + return d->m_feature->isInitialized(); +} + +/*! + Returns the last error code. + + \sa QIviAbstractFeature::Error +*/ QIviAbstractFeature::Error QIviAbstractFeatureListModel::error() const { Q_D(const QIviAbstractFeatureListModel); @@ -303,15 +329,15 @@ QIviAbstractFeature::Error QIviAbstractFeatureListModel::error() const } /*! - \qmlproperty string AbstractFeatureListModel::error + \qmlproperty string AbstractFeatureListModel::error - Last error message of the feature. Empty if no error. - */ + Last error message of the feature. Empty if no error. +*/ /*! - \property QIviAbstractFeatureListModel::error + \property QIviAbstractFeatureListModel::error - Last error message of the feature. Empty if no error. - */ + Last error message of the feature. Empty if no error. +*/ QString QIviAbstractFeatureListModel::errorMessage() const { Q_D(const QIviAbstractFeatureListModel); @@ -336,11 +362,11 @@ void QIviAbstractFeatureListModel::setDiscoveryMode(QIviAbstractFeature::Discove Performs an automatic discovery attempt. See AbstractFeature::startAutoDiscovery() for more information - */ +*/ /*! \brief Performs an automatic discovery attempt. - */ +*/ QIviAbstractFeature::DiscoveryResult QIviAbstractFeatureListModel::startAutoDiscovery() { Q_D(QIviAbstractFeatureListModel); @@ -359,6 +385,7 @@ QIviAbstractFeatureListModel::QIviAbstractFeatureListModel(QIviAbstractFeatureLi connect(d->m_feature, &QIviAbstractFeature::discoveryModeChanged, this, &QIviAbstractFeatureListModel::discoveryModeChanged); connect(d->m_feature, &QIviAbstractFeature::discoveryResultChanged, this, &QIviAbstractFeatureListModel::discoveryResultChanged); connect(d->m_feature, &QIviAbstractFeature::isValidChanged, this, &QIviAbstractFeatureListModel::isValidChanged); + connect(d->m_feature, &QIviAbstractFeature::isInitializedChanged, this, &QIviAbstractFeatureListModel::isInitializedChanged); connect(d->m_feature, &QIviAbstractFeature::errorChanged, this, &QIviAbstractFeatureListModel::errorChanged); } @@ -375,7 +402,7 @@ QIviAbstractFeatureListModel::QIviAbstractFeatureListModel(QIviAbstractFeatureLi returned by interfaceName(); \sa connectToServiceObject(), disconnectFromServiceObject(), clearServiceObject() - */ +*/ bool QIviAbstractFeatureListModel::acceptServiceObject(QIviServiceObject *serviceObject) { Q_D(QIviAbstractFeatureListModel); @@ -385,6 +412,49 @@ bool QIviAbstractFeatureListModel::acceptServiceObject(QIviServiceObject *servic /*! This method is expected to be implemented by any class subclassing QIviAbstractFeature. + The implementation should connect to the \a serviceObject, and set up all + properties to reflect the state of the service object. + + There is no previous service object connected, as this function call is always preceded by a call to + \l disconnectFromServiceObject or \l clearServiceObject. + + It is safe to assume that the \a serviceObject, has always been accepted through the + \l acceptServiceObject method prior to being passed to this method. + + The default implementation connects to the signals offered by QIviFeatureInterface and calls + QIviFeatureInterface::initialize() afterwards. + + When reimplementing please keep in mind to connect all signals before calling this function. e.g. + + /code + void SimpleFeature::connectToServiceObject(QIviServiceObject *serviceObject) + { + SimpleFeatureBackendInterface *backend = backend(serviceObject); + if (!backend) + return; + + // connect your signals + connect(backend, &SimpleFeatureBackendInterface::propertyChanged, + this, &SimpleFeature::onPropertyChanged); + + // connects the base signals and call initialize() + QIviAbstractFeature::connectToServiceObject(serviceObject); + + // Additional initialization functions can be added here + } + /endcode + + \sa acceptServiceObject(), disconnectFromServiceObject(), clearServiceObject() +*/ +void QIviAbstractFeatureListModel::connectToServiceObject(QIviServiceObject *serviceObject) +{ + Q_D(QIviAbstractFeatureListModel); + return d->m_feature->connectToServiceObjectDefaultImpl(serviceObject); +} + +/*! + This method is expected to be implemented by any class subclassing QIviAbstractFeature. + The implementation should disconnect all connections to the \a serviceObject. There is no need to reset internal variables to safe defaults. A call to this function is @@ -397,7 +467,7 @@ bool QIviAbstractFeatureListModel::acceptServiceObject(QIviServiceObject *servic void QIviAbstractFeatureListModel::disconnectFromServiceObject(QIviServiceObject *serviceObject) { Q_D(QIviAbstractFeatureListModel); - return d->m_feature->disconnectFromServiceObject(serviceObject); + return d->m_feature->disconnectFromServiceObjectDefaultImpl(serviceObject); } /*! @@ -431,9 +501,9 @@ QString QIviAbstractFeatureListModel::interfaceName() const } /*! - Returns the current error code converted from QIviAbstractFeature::Error to QString + Returns the current error code converted from QIviAbstractFeature::Error to QString - \sa error + \sa error */ QString QIviAbstractFeatureListModel::errorText() const { @@ -442,12 +512,12 @@ QString QIviAbstractFeatureListModel::errorText() const } /*! - Sets \a error with the \a message. + Sets \a error with the \a message. - Emits errorChanged() signal. + Emits errorChanged() signal. - \sa QIviAbstractFeature::Error - */ + \sa QIviAbstractFeature::Error +*/ void QIviAbstractFeatureListModel::setError(QIviAbstractFeature::Error error, const QString &message) { Q_D(QIviAbstractFeatureListModel); @@ -455,11 +525,13 @@ void QIviAbstractFeatureListModel::setError(QIviAbstractFeature::Error error, co } /*! - Updates \a error and \a message from the backend. + Updates \a error and \a message from the backend. - This slot can be used when implementing a new Feature to report generic errors. + This slot can be used when implementing a new Feature to report generic errors. */ void QIviAbstractFeatureListModel::onErrorChanged(QIviAbstractFeature::Error error, const QString &message) { setError(error, message); } + +QT_END_NAMESPACE diff --git a/src/ivicore/qiviabstractfeaturelistmodel.h b/src/ivicore/qiviabstractfeaturelistmodel.h index 06c284d..2521a13 100644 --- a/src/ivicore/qiviabstractfeaturelistmodel.h +++ b/src/ivicore/qiviabstractfeaturelistmodel.h @@ -58,17 +58,19 @@ class Q_QTIVICORE_EXPORT QIviAbstractFeatureListModel : public QAbstractListMode Q_PROPERTY(QIviAbstractFeature::DiscoveryResult discoveryResult READ discoveryResult NOTIFY discoveryResultChanged) Q_PROPERTY(QIviServiceObject *serviceObject READ serviceObject WRITE setServiceObject NOTIFY serviceObjectChanged) Q_PROPERTY(bool isValid READ isValid NOTIFY isValidChanged) + Q_PROPERTY(bool isInitialized READ isInitialized NOTIFY isInitializedChanged) Q_PROPERTY(QString error READ errorMessage NOTIFY errorChanged) public: - explicit QIviAbstractFeatureListModel(const QString &interface, QObject *parent = Q_NULLPTR); + explicit QIviAbstractFeatureListModel(const QString &interface, QObject *parent = nullptr); ~QIviAbstractFeatureListModel(); QIviServiceObject *serviceObject() const; QIviAbstractFeature::DiscoveryMode discoveryMode() const; QIviAbstractFeature::DiscoveryResult discoveryResult() const; bool isValid() const; + bool isInitialized() const; QIviAbstractFeature::Error error() const; QString errorMessage() const; @@ -82,18 +84,19 @@ Q_SIGNALS: void discoveryModeChanged(QIviAbstractFeature::DiscoveryMode discoveryMode); void discoveryResultChanged(QIviAbstractFeature::DiscoveryResult discoveryResult); void isValidChanged(bool arg); + void isInitializedChanged(bool isInitialized); void errorChanged(QIviAbstractFeature::Error error, const QString &message); protected: - QIviAbstractFeatureListModel(QIviAbstractFeatureListModelPrivate &dd, QObject *parent = Q_NULLPTR); + QIviAbstractFeatureListModel(QIviAbstractFeatureListModelPrivate &dd, QObject *parent = nullptr); virtual bool acceptServiceObject(QIviServiceObject*); - virtual void connectToServiceObject(QIviServiceObject*) = 0; + virtual void connectToServiceObject(QIviServiceObject*); virtual void disconnectFromServiceObject(QIviServiceObject*); virtual void clearServiceObject() = 0; - virtual void classBegin() Q_DECL_OVERRIDE; - virtual void componentComplete() Q_DECL_OVERRIDE; + virtual void classBegin() override; + virtual void componentComplete() override; QString interfaceName() const; QString errorText() const; diff --git a/src/ivicore/qiviabstractfeaturelistmodel_p.h b/src/ivicore/qiviabstractfeaturelistmodel_p.h index 5f96400..72a63c5 100644 --- a/src/ivicore/qiviabstractfeaturelistmodel_p.h +++ b/src/ivicore/qiviabstractfeaturelistmodel_p.h @@ -62,14 +62,18 @@ QT_BEGIN_NAMESPACE class QIviHelperFeature : public QIviAbstractFeature { + Q_OBJECT + public: QIviHelperFeature(const QString &interface, QIviAbstractFeatureListModel *model); - bool acceptServiceObject(QIviServiceObject *so); + bool acceptServiceObject(QIviServiceObject *so) override; bool acceptServiceObjectDefaultImpl(QIviServiceObject *so); - void connectToServiceObject(QIviServiceObject *so); - void disconnectFromServiceObject(QIviServiceObject *so); - void clearServiceObject(); + void connectToServiceObject(QIviServiceObject *so) override; + void connectToServiceObjectDefaultImpl(QIviServiceObject *so); + void disconnectFromServiceObject(QIviServiceObject *so) override; + void disconnectFromServiceObjectDefaultImpl(QIviServiceObject *so); + void clearServiceObject() override; using QIviAbstractFeature::interfaceName; using QIviAbstractFeature::errorText; @@ -82,7 +86,7 @@ class Q_QTIVICORE_EXPORT QIviAbstractFeatureListModelPrivate : public QAbstractI { public: QIviAbstractFeatureListModelPrivate(const QString &interface, QIviAbstractFeatureListModel *model); - virtual ~QIviAbstractFeatureListModelPrivate(); + ~QIviAbstractFeatureListModelPrivate(); virtual void initialize(); diff --git a/src/ivicore/qiviabstractzonedfeature.cpp b/src/ivicore/qiviabstractzonedfeature.cpp index d81454c..8dac558 100644 --- a/src/ivicore/qiviabstractzonedfeature.cpp +++ b/src/ivicore/qiviabstractzonedfeature.cpp @@ -46,6 +46,8 @@ #include "qiviabstractzonedfeature_p.h" #include "qivizonedfeatureinterface.h" +QT_BEGIN_NAMESPACE + QIviAbstractZonedFeaturePrivate::QIviAbstractZonedFeaturePrivate(const QString &interface, const QString &zone, QIviAbstractFeature *parent) : QIviAbstractFeaturePrivate(interface, parent) , m_zone(zone) @@ -113,7 +115,7 @@ bool QIviAbstractZonedFeature::acceptServiceObject(QIviServiceObject *serviceObj */ void QIviAbstractZonedFeature::connectToServiceObject(QIviServiceObject *serviceObject) { - QIviZonedFeatureInterface *backend(0); + QIviZonedFeatureInterface *backend = nullptr; if (QIviAbstractZonedFeature* parentFeature = qobject_cast<QIviAbstractZonedFeature*>(parent())) backend = parentFeature->backend(); else if (serviceObject) @@ -138,10 +140,10 @@ void QIviAbstractZonedFeature::clearServiceObject() } /*! - Returns pointer to the backend \a interface + Returns pointer to the backend \a interface - Returns parent backend if parent is QIviAbstractZonedFeature type. - Returns zero if no backend connected. + Returns parent backend if parent is QIviAbstractZonedFeature type. + Returns zero if no backend connected. */ QIviZonedFeatureInterface *QIviAbstractZonedFeature::backend(const QString &interface) const { @@ -159,54 +161,54 @@ QIviZonedFeatureInterface *QIviAbstractZonedFeature::backend(const QString &inte /*! - \fn virtual QIviAbstractZonedFeature *QIviAbstractZonedFeature::createZoneFeature(const QString &zone) = 0 + \fn virtual QIviAbstractZonedFeature *QIviAbstractZonedFeature::createZoneFeature(const QString &zone) = 0 - Create new child feature to the given \a zone. + Create new child feature to the given \a zone. - Returns zero if feature can't be created for the given feature and zone. + Returns zero if feature can't be created for the given feature and zone. */ /*! - \qmlproperty QString AbstractZonedFeature::zone + \qmlproperty QString AbstractZonedFeature::zone - \brief Name of the zone of this zoned feature. + \brief Name of the zone of this zoned feature. - The zone can be given in the feature initialization. With this property it's - possible to control only a single specific feature zone. + The zone can be given in the feature initialization. With this property it's + possible to control only a single specific feature zone. - This property is writable only before the backend is connected. When the backend is - discovered and the component is verified to be valid, zone is not writable anymore. - It's not recommended to change the zone after the initialization. + This property is writable only before the backend is connected. When the backend is + discovered and the component is verified to be valid, zone is not writable anymore. + It's not recommended to change the zone after the initialization. - \qml - ClimateControl { + \qml + ClimateControl { zone: "FrontLeft" onAirConditioningChanged: { // Take action on front left A/C changes. } } - \endqml - */ + \endqml +*/ /*! - \property QIviAbstractZonedFeature::zone + \property QIviAbstractZonedFeature::zone - \brief Name of the zone of this zoned feature. + \brief Name of the zone of this zoned feature. - The zone can be given in the feature initialization. With this property it's - possible to control only a single specific feature zone. + The zone can be given in the feature initialization. With this property it's + possible to control only a single specific feature zone. - This property is writable only before the backend is connected. When the backend is - discovered and the component is verified to be valid, zone is not writable anymore. - It's not recommended to change the zone after the initialization. + This property is writable only before the backend is connected. When the backend is + discovered and the component is verified to be valid, zone is not writable anymore. + It's not recommended to change the zone after the initialization. - It's recommended to initialize the zone in the feature constructor: + It's recommended to initialize the zone in the feature constructor: - \code - QIviClimateControl *climateControl = new QIviClimateControl("FrontLeft", this); - climateControl->startAutoDiscovery(); - QString zone = climateControl->zone(); - \endcode - */ + \code + QIviClimateControl *climateControl = new QIviClimateControl("FrontLeft", this); + climateControl->startAutoDiscovery(); + QString zone = climateControl->zone(); + \endcode +*/ QString QIviAbstractZonedFeature::zone() const { Q_D(const QIviAbstractZonedFeature); @@ -248,15 +250,15 @@ void QIviAbstractZonedFeature::initializeZones() } /*! - \qmlproperty QStringList AbstractZonedFeature::availableZones + \qmlproperty QStringList AbstractZonedFeature::availableZones - List of the available zones. - */ + List of the available zones. +*/ /*! - \property QIviAbstractZonedFeature::availableZones + \property QIviAbstractZonedFeature::availableZones - List of the available zones. - */ + List of the available zones. +*/ QStringList QIviAbstractZonedFeature::availableZones() const { if (backend()) { @@ -267,7 +269,7 @@ QStringList QIviAbstractZonedFeature::availableZones() const /*! - Returns the given \a zone instance of the feature. + Returns the given \a zone instance of the feature. */ QIviAbstractZonedFeature *QIviAbstractZonedFeature::zoneAt(const QString &zone) const { @@ -279,7 +281,7 @@ QIviAbstractZonedFeature *QIviAbstractZonedFeature::zoneAt(const QString &zone) } /*! - Returns all zone instances of the feature. + Returns all zone instances of the feature. */ QList<QIviAbstractZonedFeature*> QIviAbstractZonedFeature::zones() const { @@ -293,19 +295,19 @@ QIviAbstractZonedFeature::QIviAbstractZonedFeature(QIviAbstractZonedFeaturePriva } /*! - \qmlproperty QVariantMap AbstractZonedFeature::zoneAt + \qmlproperty QVariantMap AbstractZonedFeature::zoneAt - Direct feature access to the given zone. + Direct feature access to the given zone. - \code - feature.zoneAt.FrontLeft - \endcode - */ + \code + feature.zoneAt.FrontLeft + \endcode +*/ /*! - \property QIviAbstractZonedFeature::zoneAt + \property QIviAbstractZonedFeature::zoneAt - Direct feature access to the given zone. - */ + Direct feature access to the given zone. +*/ QVariantMap QIviAbstractZonedFeature::zoneFeatureMap() const { Q_D(const QIviAbstractZonedFeature); @@ -313,21 +315,23 @@ QVariantMap QIviAbstractZonedFeature::zoneFeatureMap() const } /*! - \qmlproperty QVariantList AbstractZonedFeature::zones + \qmlproperty QVariantList AbstractZonedFeature::zones - Access to the feature zones model. + Access to the feature zones model. - \code - model: feature.zones - \endcode - */ + \code + model: feature.zones + \endcode +*/ /*! - \property QIviAbstractZonedFeature::zones + \property QIviAbstractZonedFeature::zones - Access to the feature zones model. - */ + Access to the feature zones model. +*/ QVariantList QIviAbstractZonedFeature::zoneFeatureList() const { Q_D(const QIviAbstractZonedFeature); return d->m_zoneFeatureList; } + +QT_END_NAMESPACE diff --git a/src/ivicore/qiviabstractzonedfeature.h b/src/ivicore/qiviabstractzonedfeature.h index 445e3f1..0f4a86b 100644 --- a/src/ivicore/qiviabstractzonedfeature.h +++ b/src/ivicore/qiviabstractzonedfeature.h @@ -63,8 +63,8 @@ class Q_QTIVICORE_EXPORT QIviAbstractZonedFeature : public QIviAbstractFeature public: - explicit QIviAbstractZonedFeature(const QString &interface, const QString &zone = QString(), QObject *parent = Q_NULLPTR); - virtual ~QIviAbstractZonedFeature(); + explicit QIviAbstractZonedFeature(const QString &interface, const QString &zone = QString(), QObject *parent = nullptr); + ~QIviAbstractZonedFeature(); QString zone() const; @@ -79,14 +79,14 @@ Q_SIGNALS: void zonesChanged(); protected: - QIviAbstractZonedFeature(QIviAbstractZonedFeaturePrivate &dd, QObject *parent = Q_NULLPTR); + QIviAbstractZonedFeature(QIviAbstractZonedFeaturePrivate &dd, QObject *parent = nullptr); virtual QIviAbstractZonedFeature *createZoneFeature(const QString &zone) = 0; QIviZonedFeatureInterface *backend(const QString &interface = QString()) const; - virtual bool acceptServiceObject(QIviServiceObject *serviceObject) Q_DECL_OVERRIDE; - virtual void connectToServiceObject(QIviServiceObject *serviceObject) Q_DECL_OVERRIDE; - virtual void clearServiceObject() Q_DECL_OVERRIDE; + virtual bool acceptServiceObject(QIviServiceObject *serviceObject) override; + virtual void connectToServiceObject(QIviServiceObject *serviceObject) override; + virtual void clearServiceObject() override; private Q_SLOTS: void setZone(const QString &zone); diff --git a/src/ivicore/qivifeatureinterface.cpp b/src/ivicore/qivifeatureinterface.cpp new file mode 100644 index 0000000..23ac09f --- /dev/null +++ b/src/ivicore/qivifeatureinterface.cpp @@ -0,0 +1,108 @@ +/**************************************************************************** +** +** Copyright (C) 2017 Pelagicore AG +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtIvi module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL-QTAS$ +** Commercial License Usage +** Licensees holding valid commercial Qt Automotive Suite licenses may use +** this file in accordance with the commercial license agreement provided +** with the Software or, alternatively, in accordance with the terms +** contained in a written agreement between you and The Qt Company. For +** licensing terms and conditions see https://www.qt.io/terms-conditions. +** For further information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +** SPDX-License-Identifier: LGPL-3.0 +** +****************************************************************************/ + +#include "qivifeatureinterface.h" + +QT_BEGIN_NAMESPACE + +/*! + \class QIviFeatureInterface + \inmodule QtIviCore + \ingroup backends + + \brief QIviFeatureInterface defines the base class for all backends. + + To implement a backend for a specific feature you need to derive from this class. + There's a one-to-one mapping between a spezialized feature API and its corresponding feature interface + class. + + The feature interface class specifies which functions and signals need to be implemented by a backend + to work with a specific feature. + + This base class contains the generic error handling, which is common between all interfaces. + + See the full example backend implementation from \c {src/plugins/ivivehiclefunctions/climate_simulator}. + \sa QIviAbstractFeature, QIviServiceInterface +*/ + +QIviFeatureInterface::QIviFeatureInterface(QObject *parent) + : QObject(parent) +{ +} + +QIviFeatureInterface::~QIviFeatureInterface() +{ +} + +QIviFeatureInterface::QIviFeatureInterface(QObjectPrivate &dd, QObject *parent) + : QObject(dd, parent) +{ +} + +/*! + \fn void QIviFeatureInterface::initialize() + + Initializes the backend. This function is called after a feature connected to the backend. + It is expected that this function will inform about the current state of the backend by + emitting signals with the current status. + + The last signal which needs to be sent is the initializationDone() signal. + + \sa initializationDone() +*/ + +/*! + \fn void QIviFeatureInterface::errorChanged(QIviAbstractFeature::Error error, const QString &message = QString()) + + The signal is emitted when \a error occurs in the backend. + Error \a message is optional. +*/ + +/*! + \fn void QIviFeatureInterface::initializationDone() + + The signal is emitted once the current backend state has been sent to the feature after + a call to initialize() + + \sa initialize +*/ + +QT_END_NAMESPACE diff --git a/src/ivicore/qivifeatureinterface.h b/src/ivicore/qivifeatureinterface.h new file mode 100644 index 0000000..52c3639 --- /dev/null +++ b/src/ivicore/qivifeatureinterface.h @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2017 Pelagicore AG +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the QtIvi module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL-QTAS$ +** Commercial License Usage +** Licensees holding valid commercial Qt Automotive Suite licenses may use +** this file in accordance with the commercial license agreement provided +** with the Software or, alternatively, in accordance with the terms +** contained in a written agreement between you and The Qt Company. For +** licensing terms and conditions see https://www.qt.io/terms-conditions. +** For further information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +** SPDX-License-Identifier: LGPL-3.0 +** +****************************************************************************/ + +#ifndef QIVIFEATUREINTERFACE_H +#define QIVIFEATUREINTERFACE_H + +#include <QtIviCore/QIviAbstractFeature> +#include <QtIviCore/qtiviglobal.h> + +QT_BEGIN_NAMESPACE + +class Q_QTIVICORE_EXPORT QIviFeatureInterface : public QObject +{ + Q_OBJECT + +public: + explicit QIviFeatureInterface(QObject *parent = nullptr); + ~QIviFeatureInterface(); + + virtual void initialize() = 0; + +protected: + QIviFeatureInterface(QObjectPrivate &dd, QObject *parent = nullptr); + +Q_SIGNALS: + void errorChanged(QIviAbstractFeature::Error error, const QString &message = QString()); + void initializationDone(); +}; + +QT_END_NAMESPACE + +#endif // QIVIFEATUREINTERFACE_H diff --git a/src/ivicore/qiviproperty.cpp b/src/ivicore/qiviproperty.cpp index d2db6b8..304754c 100644 --- a/src/ivicore/qiviproperty.cpp +++ b/src/ivicore/qiviproperty.cpp @@ -48,11 +48,13 @@ #include <private/qv8engine_p.h> #include <private/qv4engine_p.h> +QT_BEGIN_NAMESPACE + QIviPropertyPrivate::QIviPropertyPrivate(int userType, QtPrivate::QSlotObjectBase *attributeGetter, QtPrivate::QSlotObjectBase *valueGetter) : m_type(userType) , m_attributeGetter(attributeGetter) , m_valueGetter(valueGetter) - , m_valueSetter(Q_NULLPTR) + , m_valueSetter(nullptr) {} void QIviPropertyPrivate::throwError(QObject *object, const QString &error) @@ -67,59 +69,59 @@ void QIviPropertyPrivate::throwError(QObject *object, const QString &error) } /*! - * \class QIviProperty - * \inmodule QtIviCore - * \brief The QIviProperty combines a normal property and a QIviPropertyAttribute - * - * The QIviProperty is used to retrieve the value of a property and its corresponding - * QIviPropertyAttribute in an easy way. It's designed for QML (but is not limited to) - * and acts as a Grouped Property. - * - * Although the QIviProperty only contains QVariant properties, it still stores - * the real type of the value and checks that only values of the correct type can be - * stored in it. - * The QIviProperty doesn't store a copy of the values, instead it just acts as a - * forwarder which calls the respective getters and forwards the notification signals. - * - * By default a QIviProperty is also able to write a value change back to its origin, - * but it also supports read-only properties which don't provide a setter for the value. - * - * QIviProperty is an abstract class and can only be created by using the QIviPropertyFactory - * class. - */ + \class QIviProperty + \inmodule QtIviCore + \brief The QIviProperty combines a normal property and a QIviPropertyAttribute + + The QIviProperty is used to retrieve the value of a property and its corresponding + QIviPropertyAttribute in an easy way. It's designed for QML (but is not limited to) + and acts as a Grouped Property. + + Although the QIviProperty only contains QVariant properties, it still stores + the real type of the value and checks that only values of the correct type can be + stored in it. + The QIviProperty doesn't store a copy of the values, instead it just acts as a + forwarder which calls the respective getters and forwards the notification signals. + + By default a QIviProperty is also able to write a value change back to its origin, + but it also supports read-only properties which don't provide a setter for the value. + + QIviProperty is an abstract class and can only be created by using the QIviPropertyFactory + class. +*/ /*! - * \property QIviProperty::available - * True if this property is available. - * \sa QIviPropertyAttribute::isAvailable() - */ + \property QIviProperty::available + True if this property is available. + \sa QIviPropertyAttribute::isAvailable() +*/ /*! - * \property QIviProperty::minimumValue - * The minimum value of the property. - * \sa QIviPropertyAttribute::minimumValue() - */ + \property QIviProperty::minimumValue + The minimum value of the property. + \sa QIviPropertyAttribute::minimumValue() +*/ /*! - * \property QIviProperty::maximumValue - * The maximum value of the property. - * \sa QIviPropertyAttribute::maximumValue() - */ + \property QIviProperty::maximumValue + The maximum value of the property. + \sa QIviPropertyAttribute::maximumValue() +*/ /*! - * \property QIviProperty::availableValues - * All available Values for this property. - * This can be used when exposing for example an enum and the backend only supports some of the values. - * \sa QIviPropertyAttribute::availableValues() - */ + \property QIviProperty::availableValues + All available Values for this property. + This can be used when exposing for example an enum and the backend only supports some of the values. + \sa QIviPropertyAttribute::availableValues() +*/ /*! - * Destructor. - */ + Destructor. +*/ QIviProperty::~QIviProperty() { } /*! - * \property QIviProperty::value - * Stores the value of the property as a QVariant - */ + \property QIviProperty::value + Stores the value of the property as a QVariant +*/ void QIviProperty::setValue(const QVariant &value) { Q_D(QIviProperty); @@ -159,13 +161,13 @@ void QIviProperty::setValue(const QVariant &value) return; } - void *args[] = { Q_NULLPTR, var.data() }; + void *args[] = { nullptr, var.data() }; d->m_valueSetter->call(parent(), args); } /*! - * \internal - */ + \internal +*/ QIviProperty::QIviProperty(int userType, const QObject *receiver, QtPrivate::QSlotObjectBase *attributeGetter, QtPrivate::QSlotObjectBase *valueGetter) : QObject(const_cast<QObject*>(receiver)) , d_ptr(new QIviPropertyPrivate(userType, attributeGetter, valueGetter)) @@ -173,8 +175,8 @@ QIviProperty::QIviProperty(int userType, const QObject *receiver, QtPrivate::QS } /*! - * \internal - */ + \internal +*/ void QIviProperty::setValueSetter(QtPrivate::QSlotObjectBase *valueSetter) { Q_D(QIviProperty); @@ -182,8 +184,8 @@ void QIviProperty::setValueSetter(QtPrivate::QSlotObjectBase *valueSetter) } /*! - * \internal - */ + \internal +*/ QtPrivate::QSlotObjectBase *QIviProperty::attributeGetter() const { Q_D(const QIviProperty); @@ -191,10 +193,12 @@ QtPrivate::QSlotObjectBase *QIviProperty::attributeGetter() const } /*! - * \internal - */ + \internal +*/ QtPrivate::QSlotObjectBase *QIviProperty::valueGetter() const { Q_D(const QIviProperty); return d->m_valueGetter; } + +QT_END_NAMESPACE diff --git a/src/ivicore/qiviproperty.h b/src/ivicore/qiviproperty.h index e2478be..843cb2a 100644 --- a/src/ivicore/qiviproperty.h +++ b/src/ivicore/qiviproperty.h @@ -61,7 +61,7 @@ class Q_QTIVICORE_EXPORT QIviProperty : public QObject Q_PROPERTY(QVariantList availableValues READ availableValues NOTIFY availableValuesChanged) public: - virtual ~QIviProperty(); + ~QIviProperty(); virtual bool isAvailable() const = 0; virtual QVariant minimumValue() const = 0; diff --git a/src/ivicore/qivipropertyattribute.cpp b/src/ivicore/qivipropertyattribute.cpp index 9f98b52..0d0afbc 100644 --- a/src/ivicore/qivipropertyattribute.cpp +++ b/src/ivicore/qivipropertyattribute.cpp @@ -41,6 +41,8 @@ #include "qivipropertyattribute.h" +QT_BEGIN_NAMESPACE + QIviPropertyAttributeBase::QIviPropertyAttributeBase() { registerTypes(); @@ -59,116 +61,118 @@ void QIviPropertyAttributeBase::registerTypes() /*! - * \class QIviPropertyAttribute - * \inmodule QtIviCore - * \brief The QIviPropertyAttribute encapsulates the attributes of a property - * - * QIviPropertyAttribute sets the boundaries for a property in Qt IVI. In a - * Qt IVI backend interface, the QIviPropertyAttributes are used to control - * which properties are implemented by a backend and to set the boundaries like - * the minimum or the maximum value of a property. - * - * By default a QIviPropertyAttribute is initialized with the "Invalid" type, - * which indicates that this property is not available. This could be the case - * when the backend doesn't support this property or the property is not available - * because the current backend configuration does not support it. - * For example, a property can be supported by a specific car configuration, - * but is not part of another. - */ + \class QIviPropertyAttribute + \inmodule QtIviCore + \brief The QIviPropertyAttribute encapsulates the attributes of a property + + QIviPropertyAttribute sets the boundaries for a property in Qt IVI. In a + Qt IVI backend interface, the QIviPropertyAttributes are used to control + which properties are implemented by a backend and to set the boundaries like + the minimum or the maximum value of a property. + + By default a QIviPropertyAttribute is initialized with the "Invalid" type, + which indicates that this property is not available. This could be the case + when the backend doesn't support this property or the property is not available + because the current backend configuration does not support it. + For example, a property can be supported by a specific car configuration, + but is not part of another. +*/ /*! - * \enum QIviPropertyAttributeBase::AttributeType - * - * \value Invalid - * The attribute is invalid and is not available. - * \value NoAttributes - * No additional attributes for the property are provided. - * \value MinimumMaximum - * The attribute defines the minimum and the maximum value of the property. - * \value AvailableValues - * The attribute defines a list of values that are available for the property. - */ + \enum QIviPropertyAttributeBase::AttributeType + + \value Invalid + The attribute is invalid and is not available. + \value NoAttributes + No additional attributes for the property are provided. + \value MinimumMaximum + The attribute defines the minimum and the maximum value of the property. + \value AvailableValues + The attribute defines a list of values that are available for the property. +*/ /*! - * \fn QIviPropertyAttribute::QIviPropertyAttribute() - * Constructs an invalid QIviPropertyAttribute. - * - * This constructor can be used to indicate that the property is not available. - * For example, because the backend doesn't support this property. - */ + \fn QIviPropertyAttribute::QIviPropertyAttribute() + Constructs an invalid QIviPropertyAttribute. + + This constructor can be used to indicate that the property is not available. + For example, because the backend doesn't support this property. +*/ /*! - * \fn QIviPropertyAttribute::QIviPropertyAttribute(bool available) - * Constructs an QIviPropertyAttribute of type NoAttributes. - * - * The argument \a available defines whether the property is supported by the backend. - */ + \fn QIviPropertyAttribute::QIviPropertyAttribute(bool available) + Constructs an QIviPropertyAttribute of type NoAttributes. + + The argument \a available defines whether the property is supported by the backend. +*/ /*! - * \fn QIviPropertyAttribute::QIviPropertyAttribute(const T &minValue, const T &maxValue) - * Constructs an QIviPropertyAttribute of type MinimumMaximum. - * - * The arguments \a minValue and \a maxValue define the boundaries the value of the property. - */ + \fn QIviPropertyAttribute::QIviPropertyAttribute(const T &minValue, const T &maxValue) + Constructs an QIviPropertyAttribute of type MinimumMaximum. + + The arguments \a minValue and \a maxValue define the boundaries the value of the property. +*/ /*! - * \fn QIviPropertyAttribute::QIviPropertyAttribute(const QVector<T> &avValues) - * Constructs an QIviPropertyAttribute of type AvailableValues. - * - * The argument \a avValues defines the valid values for the property. - */ + \fn QIviPropertyAttribute::QIviPropertyAttribute(const QVector<T> &avValues) + Constructs an QIviPropertyAttribute of type AvailableValues. + + The argument \a avValues defines the valid values for the property. +*/ /*! - * \fn AttributeType QIviPropertyAttribute::type() const - * - * Returns the type of the attribute. - */ + \fn AttributeType QIviPropertyAttribute::type() const + + Returns the type of the attribute. +*/ /*! - * \fn bool QIviPropertyAttribute::isAvailable() const - * - * Returns true if the property is available for this backend. - */ + \fn bool QIviPropertyAttribute::isAvailable() const + + Returns true if the property is available for this backend. +*/ /*! - * \fn T QIviPropertyAttribute::minimumValue() const - * - * Returns the minimum value of the property. - * If the attributeType is not MinimumMaximum, a default constructed value is returned. - */ + \fn T QIviPropertyAttribute::minimumValue() const + + Returns the minimum value of the property. + If the attributeType is not MinimumMaximum, a default constructed value is returned. +*/ /*! - * \fn T QIviPropertyAttribute::maximumValue() const - * - * Returns the maximum value of the property. - * If the attributeType is not MinimumMaximum, a default constructed value is returned. - */ + \fn T QIviPropertyAttribute::maximumValue() const + + Returns the maximum value of the property. + If the attributeType is not MinimumMaximum, a default constructed value is returned. +*/ /*! - * \fn QList<T> QIviPropertyAttribute::availableValues() const - * - * Returns a list of valid values for this property. - * If the attributeType is not AvailableValues an empty list is returned. - */ + \fn QList<T> QIviPropertyAttribute::availableValues() const + + Returns a list of valid values for this property. + If the attributeType is not AvailableValues an empty list is returned. +*/ /*! - * \fn QString QIviPropertyAttribute::toString() const - * - * Returns a QString with a string representation of the attribute. - */ + \fn QString QIviPropertyAttribute::toString() const + + Returns a QString with a string representation of the attribute. +*/ /*! - * \fn bool QIviPropertyAttribute::operator==(const QIviPropertyAttribute& other) const - * - * Returns \c true if this QIviPropertyAttribute is equal to the \a other QIviPropertyAttribute; otherwise returns \c false. - * - * All elements of QIviPropertyAttribute are used for the comparison. - */ + \fn bool QIviPropertyAttribute::operator==(const QIviPropertyAttribute& other) const + + Returns \c true if this QIviPropertyAttribute is equal to the \a other QIviPropertyAttribute; otherwise returns \c false. + + All elements of QIviPropertyAttribute are used for the comparison. +*/ /*! - * \fn bool QIviPropertyAttribute::operator!=(const QIviPropertyAttribute& other) const - * - * Returns \c true if this QIviPropertyAttribute is NOT equal to the \a other QIviPropertyAttribute; otherwise returns \c false. - * - * All elements of QIviPropertyAttribute are used for the comparison. - */ + \fn bool QIviPropertyAttribute::operator!=(const QIviPropertyAttribute& other) const + + Returns \c true if this QIviPropertyAttribute is NOT equal to the \a other QIviPropertyAttribute; otherwise returns \c false. + + All elements of QIviPropertyAttribute are used for the comparison. +*/ + +QT_END_NAMESPACE diff --git a/src/ivicore/qivipropertyfactory.cpp b/src/ivicore/qivipropertyfactory.cpp index 2deb09f..7bb1bd4 100644 --- a/src/ivicore/qivipropertyfactory.cpp +++ b/src/ivicore/qivipropertyfactory.cpp @@ -41,83 +41,87 @@ #include "qivipropertyfactory.h" +QT_BEGIN_NAMESPACE + /*! - * \class QIviPropertyFactory - * \inmodule QtIviCore - * \brief The QIviPropertyFactory is used as a factory class for creating instances of QIviProperty - * - * QIviPropertyFactory will preserve the type information about the template type in QIviProperty and - * does a compile time check whether all provided functions and signals match this type and each other. - * - * The following code creates a property of type int: - * \code - * QIviPropertyFactory<int>::create(this, - * &QIviClimateControl::targetTemperatureAttribute, - * &QIviClimateControl::targetTemperatureAttributeChanged, - * &QIviClimateControl::targetTemperature, - * &QIviClimateControl::targetTemperatureChanged, - * &QIviClimateControl::setTargetTemperature) - * \endcode - * - * This Factory provides two functions, one for creating a read-write property and one for a read-only property. - */ + \class QIviPropertyFactory + \inmodule QtIviCore + \brief The QIviPropertyFactory is used as a factory class for creating instances of QIviProperty + + QIviPropertyFactory will preserve the type information about the template type in QIviProperty and + does a compile time check whether all provided functions and signals match this type and each other. + + The following code creates a property of type int: + \code + QIviPropertyFactory<int>::create(this, + &QIviClimateControl::targetTemperatureAttribute, + &QIviClimateControl::targetTemperatureAttributeChanged, + &QIviClimateControl::targetTemperature, + &QIviClimateControl::targetTemperatureChanged, + &QIviClimateControl::setTargetTemperature) + \endcode + + This Factory provides two functions, one for creating a read-write property and one for a read-only property. +*/ /*! - * \fn QIviPropertyFactory::create(const QtPrivate::FunctionPointer<attributeGetterFunc>::Object *sender, attributeGetterFunc attributeGetter, attributeSignalFunc attributeSignal, valueGetterFunc valueGetter, valueSignalFunc valueSignal, valueSlotFunc valueSlot) - * - * Returns an new QIviProperty instance for a attribute and value of type T. - * - * The \a sender argument needs to be a pointer to the QObject* instance which implements all functions and signals provided next. - * The arguments \a attributeGetter and \a attributeSignal need to be functions pointers to your attribute getter function and the attribute signal function. - * These arguments need to be of QIviPropertyAttribute<T>. - * \a valueGetter, \a valueSignal, and \a valueSlot need to be function pointers to the getter, signal, and setter for the value that should be stored in this QIviQmlProperty instance. - * The value functions need to have arguments and return values of type T. - * - * \sa QIviPropertyFactory::create(const QtPrivate::FunctionPointer<attributeGetterFunc>::Object *sender, attributeGetterFunc attributeGetter, attributeSignalFunc attributeSignal, valueGetterFunc valueGetter, valueSignalFunc valueSignal) - */ + \fn QIviPropertyFactory::create(const QtPrivate::FunctionPointer<attributeGetterFunc>::Object *sender, attributeGetterFunc attributeGetter, attributeSignalFunc attributeSignal, valueGetterFunc valueGetter, valueSignalFunc valueSignal, valueSlotFunc valueSlot) + + Returns an new QIviProperty instance for a attribute and value of type T. + + The \a sender argument needs to be a pointer to the QObject* instance which implements all functions and signals provided next. + The arguments \a attributeGetter and \a attributeSignal need to be functions pointers to your attribute getter function and the attribute signal function. + These arguments need to be of QIviPropertyAttribute<T>. + \a valueGetter, \a valueSignal, and \a valueSlot need to be function pointers to the getter, signal, and setter for the value that should be stored in this QIviQmlProperty instance. + The value functions need to have arguments and return values of type T. + + \sa QIviPropertyFactory::create(const QtPrivate::FunctionPointer<attributeGetterFunc>::Object *sender, attributeGetterFunc attributeGetter, attributeSignalFunc attributeSignal, valueGetterFunc valueGetter, valueSignalFunc valueSignal) +*/ /*! - * \fn QIviPropertyFactory::create(const QtPrivate::FunctionPointer<attributeGetterFunc>::Object *sender, attributeGetterFunc attributeGetter, attributeSignalFunc attributeSignal, valueGetterFunc valueGetter, valueSignalFunc valueSignal) - * - * Returns a new QIviProperty instance for an attribute and value of type T. - * - * The \a sender argument needs to be a pointer to the QObject* instance which implements all functions and signals provided next. - * The arguments \a attributeGetter and \a attributeSignal need to be functions pointers to your attribute getter function and the attribute signal function. - * These arguments need to be of QIviPropertyAttribute<T>. - * \a valueGetter, \a valueSignal need to be function pointers to the getter and signal for the value which should be stored in this QIviQmlProperty instance. - * The value functions need to have arguments and return values of type T. - * - * \note This factory function will create a readonly property as no value setter needs to be provided - * - * \sa QIviPropertyFactory::create(const QtPrivate::FunctionPointer<attributeGetterFunc>::Object *sender, attributeGetterFunc attributeGetter, attributeSignalFunc attributeSignal, valueGetterFunc valueGetter, valueSignalFunc valueSignal, valueSlotFunc valueSlot) - */ + \fn QIviPropertyFactory::create(const QtPrivate::FunctionPointer<attributeGetterFunc>::Object *sender, attributeGetterFunc attributeGetter, attributeSignalFunc attributeSignal, valueGetterFunc valueGetter, valueSignalFunc valueSignal) + + Returns a new QIviProperty instance for an attribute and value of type T. + + The \a sender argument needs to be a pointer to the QObject* instance which implements all functions and signals provided next. + The arguments \a attributeGetter and \a attributeSignal need to be functions pointers to your attribute getter function and the attribute signal function. + These arguments need to be of QIviPropertyAttribute<T>. + \a valueGetter, \a valueSignal need to be function pointers to the getter and signal for the value which should be stored in this QIviQmlProperty instance. + The value functions need to have arguments and return values of type T. + + \note This factory function will create a readonly property as no value setter needs to be provided + + \sa QIviPropertyFactory::create(const QtPrivate::FunctionPointer<attributeGetterFunc>::Object *sender, attributeGetterFunc attributeGetter, attributeSignalFunc attributeSignal, valueGetterFunc valueGetter, valueSignalFunc valueSignal, valueSlotFunc valueSlot) +*/ /*! - * \fn bool QIviPropertyFactory::isAvailable() const - * - * \reimp - */ + \fn bool QIviPropertyFactory::isAvailable() const + + \reimp +*/ /*! - * \fn bool QIviPropertyFactory::minimumValue() const - * - * \reimp - */ + \fn bool QIviPropertyFactory::minimumValue() const + + \reimp +*/ /*! - * \fn bool QIviPropertyFactory::maximumValue() const - * - * \reimp - */ + \fn bool QIviPropertyFactory::maximumValue() const + + \reimp +*/ /*! - * \fn bool QIviPropertyFactory::availableValues() const - * - * \reimp - */ + \fn bool QIviPropertyFactory::availableValues() const + + \reimp +*/ /*! - * \fn bool QIviPropertyFactory::value() const - * - * \reimp - */ + \fn bool QIviPropertyFactory::value() const + + \reimp +*/ + +QT_END_NAMESPACE diff --git a/src/ivicore/qivipropertyfactory.h b/src/ivicore/qivipropertyfactory.h index 3921562..066a68b 100644 --- a/src/ivicore/qivipropertyfactory.h +++ b/src/ivicore/qivipropertyfactory.h @@ -130,25 +130,25 @@ public: return prop; } - bool isAvailable() const Q_DECL_OVERRIDE + bool isAvailable() const override { return callAttributeGetter().isAvailable(); } - QVariant minimumValue() const Q_DECL_OVERRIDE + QVariant minimumValue() const override { return QVariant::fromValue<T>(callAttributeGetter().minimumValue()); } - QVariant maximumValue() const Q_DECL_OVERRIDE + QVariant maximumValue() const override { return QVariant::fromValue<T>(callAttributeGetter().maximumValue()); } - QVariantList availableValues() const Q_DECL_OVERRIDE + QVariantList availableValues() const override { return qtivi_convertAvailableValues(callAttributeGetter().availableValues()); } - QVariant value() const Q_DECL_OVERRIDE + QVariant value() const override { T val; void *args[] = { reinterpret_cast<void*>(&val), QVariant().data() }; @@ -196,7 +196,7 @@ private: template <typename F=T> Q_INLINE_TEMPLATE typename QtPrivate::QEnableIf<QtPrivate::is_flag<F>::value, void>::Type registerConverters() { if (!QMetaType::hasRegisteredConverterFunction<F, int>()) - QMetaType::registerConverter<F, int>(&F::operator int); + QMetaType::registerConverter<F, int>([](const F & f){return int(f);}); } friend struct PropertyTestData; diff --git a/src/ivicore/qiviproxyserviceobject_p.cpp b/src/ivicore/qiviproxyserviceobject_p.cpp index 677d251..94684b0 100644 --- a/src/ivicore/qiviproxyserviceobject_p.cpp +++ b/src/ivicore/qiviproxyserviceobject_p.cpp @@ -41,6 +41,8 @@ #include "qiviproxyserviceobject_p.h" +QT_BEGIN_NAMESPACE + QIviProxyServiceObject::QIviProxyServiceObject(QIviServiceInterface *interface) : QIviServiceObject() , m_interface(interface) @@ -58,8 +60,9 @@ QStringList QIviProxyServiceObject::interfaces() const return m_interface->interfaces(); } -QObject *QIviProxyServiceObject::interfaceInstance(const QString &interface) const +QIviFeatureInterface *QIviProxyServiceObject::interfaceInstance(const QString &interface) const { return m_interface->interfaceInstance(interface); } +QT_END_NAMESPACE diff --git a/src/ivicore/qiviproxyserviceobject_p.h b/src/ivicore/qiviproxyserviceobject_p.h index 146591e..23f67a5 100644 --- a/src/ivicore/qiviproxyserviceobject_p.h +++ b/src/ivicore/qiviproxyserviceobject_p.h @@ -60,12 +60,14 @@ QT_BEGIN_NAMESPACE class QIviProxyServiceObject : public QIviServiceObject { + Q_OBJECT + public: - QIviProxyServiceObject(QIviServiceInterface *interface); - virtual ~QIviProxyServiceObject(); + explicit QIviProxyServiceObject(QIviServiceInterface *interface); + ~QIviProxyServiceObject(); virtual QStringList interfaces() const; - virtual QObject *interfaceInstance(const QString &interface) const; + virtual QIviFeatureInterface *interfaceInstance(const QString &interface) const; private: diff --git a/src/ivicore/qivisearchandbrowsemodel.cpp b/src/ivicore/qivisearchandbrowsemodel.cpp index b360f92..cb71942 100644 --- a/src/ivicore/qivisearchandbrowsemodel.cpp +++ b/src/ivicore/qivisearchandbrowsemodel.cpp @@ -49,6 +49,8 @@ #include <QMetaObject> #include <QDebug> +QT_BEGIN_NAMESPACE + QIviSearchAndBrowseModelPrivate::QIviSearchAndBrowseModelPrivate(const QString &interface, QIviSearchAndBrowseModel *model) : QIviAbstractFeatureListModelPrivate(interface, model) , q_ptr(model) @@ -98,7 +100,7 @@ void QIviSearchAndBrowseModelPrivate::onCapabilitiesChanged(const QUuid &identif Q_Q(QIviSearchAndBrowseModel); m_capabilities = capabilities; - q->capabilitiesChanged(capabilities); + emit q->capabilitiesChanged(capabilities); } void QIviSearchAndBrowseModelPrivate::onDataFetched(const QUuid &identifer, const QList<QVariant> &items, int start, bool moreAvailable) @@ -124,7 +126,7 @@ void QIviSearchAndBrowseModelPrivate::onDataFetched(const QUuid &identifer, cons for (int i = 0; i < items.count(); i++) m_itemList.replace(start + i, items.at(i)); - q->dataChanged(q->index(start), q->index(start + items.count() -1)); + emit q->dataChanged(q->index(start), q->index(start + items.count() -1)); } } @@ -170,7 +172,7 @@ void QIviSearchAndBrowseModelPrivate::onDataChanged(const QUuid &identifier, con if (updateCount > 0) { for (int i = start, j=0; j < updateCount; i++, j++) m_itemList.replace(i, data.at(j)); - q->dataChanged(q->index(start), q->index(start + updateCount -1)); + emit q->dataChanged(q->index(start), q->index(start + updateCount -1)); } if (delta < 0) { //Remove @@ -257,7 +259,7 @@ void QIviSearchAndBrowseModelPrivate::checkType() if (!m_availableContentTypes.contains(m_contentType)) { QString error = QString(QLatin1String("Unsupported type: \"%1\" \n Supported types are: \n")).arg(m_contentType); - for (const QString &type : m_availableContentTypes) + for (const QString &type : qAsConst(m_availableContentTypes)) error.append(type + QLatin1String("\n")); qWarning("%s", qPrintable(error)); } @@ -372,14 +374,14 @@ void QIviSearchAndBrowseModelPrivate::updateContentType(const QString &contentTy */ /*! - \enum QIviSearchAndBrowseModel::Roles - \value NameRole + \enum QIviSearchAndBrowseModel::Roles + \value NameRole The name of the item. E.g. The name of a contact in a addressbook, or the artist-name in a list of artists. - \value TypeRole + \value TypeRole The type of the item. E.g. "artist", "track", "contact". - \value ItemRole + \value ItemRole The item itself. This provides access to the properties which are type specific. E.g. the address of a contact. - \value CanGoForwardRole + \value CanGoForwardRole True if this item can be used to go one level forward and display the next set of items. \sa goForward() */ @@ -455,10 +457,10 @@ void QIviSearchAndBrowseModelPrivate::updateContentType(const QString &contentTy */ /*! - Constructs a QIviSearchAndBrowseModel. + Constructs a QIviSearchAndBrowseModel. - The \a parent argument is passed on to the \l QIviAbstractFeatureListModel base class. - */ + The \a parent argument is passed on to the \l QIviAbstractFeatureListModel base class. +*/ QIviSearchAndBrowseModel::QIviSearchAndBrowseModel(QObject *parent) : QIviAbstractFeatureListModel(*new QIviSearchAndBrowseModelPrivate(QLatin1String(QIviSearchAndBrowseModel_iid), this), parent) { @@ -500,14 +502,14 @@ QIviSearchAndBrowseModel::~QIviSearchAndBrowseModel() The backend supports moving items within the model. \value SupportsRemove The backend supports removing items from the model. - */ +*/ /*! \property QIviSearchAndBrowseModel::capabilities \brief Holds the capabilities of the backend for the current content of the model. The capabilties controls what the current contentType supports. e.g. filtering or sorting. - */ +*/ QIviSearchAndBrowseModel::Capabilities QIviSearchAndBrowseModel::capabilities() const { @@ -523,7 +525,7 @@ QIviSearchAndBrowseModel::Capabilities QIviSearchAndBrowseModel::capabilities() See \l {Qt IVI Query Language} for more information. \sa FilteringAndSorting - */ +*/ /*! \property QIviSearchAndBrowseModel::query @@ -533,7 +535,7 @@ QIviSearchAndBrowseModel::Capabilities QIviSearchAndBrowseModel::capabilities() See \l {Qt IVI Query Language} for more information. \sa FilteringAndSorting - */ +*/ QString QIviSearchAndBrowseModel::query() const { Q_D(const QIviSearchAndBrowseModel); @@ -563,7 +565,7 @@ void QIviSearchAndBrowseModel::setQuery(const QString &query) Bigger chunks means less calls to the backend and to a potential IPC underneath, but more data to be transferred and probably longer waiting time until the request was finished. - */ +*/ /*! \property QIviSearchAndBrowseModel::chunkSize @@ -573,7 +575,7 @@ void QIviSearchAndBrowseModel::setQuery(const QString &query) Bigger chunks means less calls to the backend and to a potential IPC underneath, but more data to be transferred and probably longer waiting time until the request was finished. - */ +*/ int QIviSearchAndBrowseModel::chunkSize() const { Q_D(const QIviSearchAndBrowseModel); @@ -601,7 +603,7 @@ void QIviSearchAndBrowseModel::setChunkSize(int chunkSize) The threshold defines the number of rows before the cached rows ends. \note This property is only used when loadingType is set to FetchMore. - */ +*/ /*! \property QIviSearchAndBrowseModel::fetchMoreThreshold @@ -614,7 +616,7 @@ void QIviSearchAndBrowseModel::setChunkSize(int chunkSize) The threshold defines the number of rows before the cached rows ends. \note This property is only used when loadingType is set to FetchMore. - */ +*/ int QIviSearchAndBrowseModel::fetchMoreThreshold() const { Q_D(const QIviSearchAndBrowseModel); @@ -638,7 +640,7 @@ void QIviSearchAndBrowseModel::setFetchMoreThreshold(int fetchMoreThreshold) \note When changing this property the content will be reset. \sa SearchAndBrowseModel::availableContentTypes - */ +*/ /*! \property QIviSearchAndBrowseModel::contentType @@ -647,7 +649,7 @@ void QIviSearchAndBrowseModel::setFetchMoreThreshold(int fetchMoreThreshold) \note When changing this property the content will be reset. \sa availableContentTypes - */ +*/ QString QIviSearchAndBrowseModel::contentType() const { Q_D(const QIviSearchAndBrowseModel); @@ -668,14 +670,14 @@ void QIviSearchAndBrowseModel::setContentType(const QString &contentType) \brief Holds all the available content types \sa contentType - */ +*/ /*! \property QIviSearchAndBrowseModel::availableContentTypes \brief Holds all the available content types \sa contentType - */ +*/ QStringList QIviSearchAndBrowseModel::availableContentTypes() const { Q_D(const QIviSearchAndBrowseModel); @@ -687,14 +689,14 @@ QStringList QIviSearchAndBrowseModel::availableContentTypes() const \brief Holds whether the goBack() function can be used to return to the previous content. See \l Browsing for more information. - */ +*/ /*! \property QIviSearchAndBrowseModel::canGoBack \brief Holds whether the goBack() function can be used to return to the previous content. See \l Browsing for more information. - */ +*/ bool QIviSearchAndBrowseModel::canGoBack() const { Q_D(const QIviSearchAndBrowseModel); @@ -706,14 +708,14 @@ bool QIviSearchAndBrowseModel::canGoBack() const \brief Holds the currently used loading type used for loading the data. \note When changing this property the content will be reset. - */ +*/ /*! \property QIviSearchAndBrowseModel::loadingType \brief Holds the currently used loading type used for loading the data. \note When changing this property the content will be reset. - */ +*/ QIviSearchAndBrowseModel::LoadingType QIviSearchAndBrowseModel::loadingType() const { Q_D(const QIviSearchAndBrowseModel); @@ -740,11 +742,11 @@ void QIviSearchAndBrowseModel::setLoadingType(QIviSearchAndBrowseModel::LoadingT /*! \qmlproperty int SearchAndBrowseModel::count \brief Holds the current number of rows in this model. - */ +*/ /*! \property QIviSearchAndBrowseModel::count \brief Holds the current number of rows in this model. - */ +*/ int QIviSearchAndBrowseModel::rowCount(const QModelIndex &parent) const { Q_D(const QIviSearchAndBrowseModel); @@ -756,7 +758,7 @@ int QIviSearchAndBrowseModel::rowCount(const QModelIndex &parent) const /*! \reimp - */ +*/ QVariant QIviSearchAndBrowseModel::data(const QModelIndex &index, int role) const { Q_D(const QIviSearchAndBrowseModel); @@ -795,7 +797,7 @@ QVariant QIviSearchAndBrowseModel::data(const QModelIndex &index, int role) cons \qmlmethod object SearchAndBrowseModel::get(i) Returns the item at index \a i. - */ +*/ /*! Returns the item at index \a i as QVariant. @@ -812,12 +814,12 @@ QVariant QIviSearchAndBrowseModel::get(int i) const Goes one level back in the navigation history. See also \l Browsing for more information. - */ +*/ /*! Goes one level back in the navigation history. See also \l Browsing for more information. - */ +*/ void QIviSearchAndBrowseModel::goBack() { Q_D(QIviSearchAndBrowseModel); @@ -843,12 +845,12 @@ void QIviSearchAndBrowseModel::goBack() Returns true when the item at index \a i can be used to show the next set of elements. See also \l Browsing for more information. - */ +*/ /*! Returns true when the item at index \a i can be used to show the next set of elements. See also \l Browsing for more information. - */ +*/ bool QIviSearchAndBrowseModel::canGoForward(int i) const { Q_D(const QIviSearchAndBrowseModel); @@ -883,7 +885,7 @@ bool QIviSearchAndBrowseModel::canGoForward(int i) const \note Whether the OutOfModelNavigation navigation type is supported is decided by the backend. See also \l Browsing for more information. - */ +*/ /*! Returns true when the item at index \a i can be used to show the next set of elements. @@ -895,7 +897,7 @@ bool QIviSearchAndBrowseModel::canGoForward(int i) const \note Whether the OutOfModelNavigation navigation type is supported is decided by the backend. See also \l Browsing for more information. - */ +*/ QIviSearchAndBrowseModel *QIviSearchAndBrowseModel::goForward(int i, NavigationType navigationType) { Q_D(QIviSearchAndBrowseModel); @@ -1155,8 +1157,6 @@ bool QIviSearchAndBrowseModel::acceptServiceObject(QIviServiceObject *serviceObj */ void QIviSearchAndBrowseModel::connectToServiceObject(QIviServiceObject *serviceObject) { - Q_UNUSED(serviceObject); - Q_D(QIviSearchAndBrowseModel); QIviSearchAndBrowseModelInterface *backend = d->searchBackend(); @@ -1175,6 +1175,8 @@ void QIviSearchAndBrowseModel::connectToServiceObject(QIviServiceObject *service d, &QIviSearchAndBrowseModelPrivate::onIndexOfCallResult, Qt::QueuedConnection); + QIviAbstractFeatureListModel::connectToServiceObject(serviceObject); + d->setCanGoBack(backend->canGoBack(d->m_identifier, d->m_contentType)); d->resetModel(); @@ -1212,4 +1214,6 @@ void QIviSearchAndBrowseModel::clearServiceObject() This signal is emitted whenever the fetchMoreThreshold is reached and new data is requested from the backend. */ +QT_END_NAMESPACE + #include "moc_qivisearchandbrowsemodel.cpp" diff --git a/src/ivicore/qivisearchandbrowsemodel.h b/src/ivicore/qivisearchandbrowsemodel.h index cea275f..ed901b6 100644 --- a/src/ivicore/qivisearchandbrowsemodel.h +++ b/src/ivicore/qivisearchandbrowsemodel.h @@ -105,8 +105,8 @@ public: Q_DECLARE_FLAGS(Capabilities, Capability) Q_FLAG(Capabilities) - QIviSearchAndBrowseModel(QObject *parent = Q_NULLPTR); - virtual ~QIviSearchAndBrowseModel(); + explicit QIviSearchAndBrowseModel(QObject *parent = nullptr); + ~QIviSearchAndBrowseModel(); QIviSearchAndBrowseModel::Capabilities capabilities() const; @@ -129,13 +129,13 @@ public: QIviSearchAndBrowseModel::LoadingType loadingType() const; void setLoadingType(QIviSearchAndBrowseModel::LoadingType loadingType); - int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; - QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE; + int rowCount(const QModelIndex &parent = QModelIndex()) const override; + QVariant data(const QModelIndex &index, int role) const override; - bool canFetchMore(const QModelIndex &parent) const Q_DECL_OVERRIDE; - void fetchMore(const QModelIndex &parent) Q_DECL_OVERRIDE; + bool canFetchMore(const QModelIndex &parent) const override; + void fetchMore(const QModelIndex &parent) override; - QHash<int, QByteArray> roleNames() const Q_DECL_OVERRIDE; + QHash<int, QByteArray> roleNames() const override; Q_INVOKABLE QVariant get(int index) const; Q_INVOKABLE void goBack(); @@ -164,12 +164,12 @@ Q_SIGNALS: void loadingTypeChanged(QIviSearchAndBrowseModel::LoadingType loadingType); protected: - QIviSearchAndBrowseModel(QIviServiceObject *serviceObject, const QString &contentType, QObject *parent = Q_NULLPTR); + QIviSearchAndBrowseModel(QIviServiceObject *serviceObject, const QString &contentType, QObject *parent = nullptr); QIviSearchAndBrowseModel(QIviSearchAndBrowseModelPrivate &dd, QObject *parent); - virtual bool acceptServiceObject(QIviServiceObject *serviceObject) Q_DECL_OVERRIDE; - virtual void connectToServiceObject(QIviServiceObject *serviceObject) Q_DECL_OVERRIDE; - virtual void disconnectFromServiceObject(QIviServiceObject *serviceObject) Q_DECL_OVERRIDE; - virtual void clearServiceObject() Q_DECL_OVERRIDE; + virtual bool acceptServiceObject(QIviServiceObject *serviceObject) override; + virtual void connectToServiceObject(QIviServiceObject *serviceObject) override; + virtual void disconnectFromServiceObject(QIviServiceObject *serviceObject) override; + virtual void clearServiceObject() override; private: Q_DECLARE_PRIVATE(QIviSearchAndBrowseModel) diff --git a/src/ivicore/qivisearchandbrowsemodel_p.h b/src/ivicore/qivisearchandbrowsemodel_p.h index b7d4433..f8ef7a6 100644 --- a/src/ivicore/qivisearchandbrowsemodel_p.h +++ b/src/ivicore/qivisearchandbrowsemodel_p.h @@ -71,7 +71,7 @@ public: QIviSearchAndBrowseModelPrivate(const QString &interface, QIviSearchAndBrowseModel *model); ~QIviSearchAndBrowseModelPrivate(); - virtual void initialize() Q_DECL_OVERRIDE; + virtual void initialize() override; void onCapabilitiesChanged(const QUuid &identifier, QIviSearchAndBrowseModel::Capabilities capabilities); void onDataFetched(const QUuid &identifer, const QList<QVariant> &items, int start, bool moreAvailable); void onCountChanged(const QUuid &identifier, int new_length); diff --git a/src/ivicore/qivisearchandbrowsemodelinterface.cpp b/src/ivicore/qivisearchandbrowsemodelinterface.cpp index 5df0bdf..602de7c 100644 --- a/src/ivicore/qivisearchandbrowsemodelinterface.cpp +++ b/src/ivicore/qivisearchandbrowsemodelinterface.cpp @@ -42,6 +42,8 @@ #include "qivisearchandbrowsemodelinterface.h" #include "qivisearchandbrowsemodelinterface_p.h" +QT_BEGIN_NAMESPACE + QIviSearchAndBrowseModelInterfacePrivate::QIviSearchAndBrowseModelInterfacePrivate() { } @@ -51,6 +53,7 @@ QIviSearchAndBrowseModelInterfacePrivate::QIviSearchAndBrowseModelInterfacePriva \inmodule QtIviCore \ingroup backends \inherits QObject + \keyword org.qt-project.qtivi.SearchAndBrowseModel/1.0 \brief The QIviSearchAndBrowseModelInterface defines the interface for backends to the QIviSearchAndBrowseModel feature class. @@ -68,14 +71,14 @@ QIviSearchAndBrowseModelInterfacePrivate::QIviSearchAndBrowseModelInterfacePriva */ /*! - \fn QIviSearchAndBrowseModelInterface::QIviSearchAndBrowseModelInterface(QObject *parent=0) + \fn QIviSearchAndBrowseModelInterface::QIviSearchAndBrowseModelInterface(QObject *parent = nullptr) Constructs a backend interface. The \a parent is sent to the QObject constructor. */ QIviSearchAndBrowseModelInterface::QIviSearchAndBrowseModelInterface(QObject *parent) - : QObject(*new QIviSearchAndBrowseModelInterfacePrivate(), parent) + : QIviFeatureInterface(*new QIviSearchAndBrowseModelInterfacePrivate(), parent) {} QIviSearchAndBrowseModelInterface::~QIviSearchAndBrowseModelInterface() @@ -288,3 +291,5 @@ void QIviSearchAndBrowseModelInterface::registerContentType(const QMetaObject &o \sa indexOf() */ + +QT_END_NAMESPACE diff --git a/src/ivicore/qivisearchandbrowsemodelinterface.h b/src/ivicore/qivisearchandbrowsemodelinterface.h index b913d1a..1e6aabb 100644 --- a/src/ivicore/qivisearchandbrowsemodelinterface.h +++ b/src/ivicore/qivisearchandbrowsemodelinterface.h @@ -50,18 +50,19 @@ #include <QtIviCore/QIviSearchAndBrowseModelItem> #include <QtIviCore/QIviSearchAndBrowseModel> #include <QtIviCore/QIviAbstractQueryTerm> +#include <QtIviCore/QIviFeatureInterface> QT_BEGIN_NAMESPACE class QIviSearchAndBrowseModelInterfacePrivate; -class Q_QTIVICORE_EXPORT QIviSearchAndBrowseModelInterface : public QObject +class Q_QTIVICORE_EXPORT QIviSearchAndBrowseModelInterface : public QIviFeatureInterface { Q_OBJECT public: - QIviSearchAndBrowseModelInterface(QObject *parent = Q_NULLPTR); - virtual ~QIviSearchAndBrowseModelInterface(); + explicit QIviSearchAndBrowseModelInterface(QObject *parent = nullptr); + ~QIviSearchAndBrowseModelInterface(); virtual QSet<QString> availableContentTypes() const; virtual QSet<QString> supportedIdentifiers(const QString &contentType) const; diff --git a/src/ivicore/qivisearchandbrowsemodelitem.cpp b/src/ivicore/qivisearchandbrowsemodelitem.cpp index 3a14818..e304bbb 100644 --- a/src/ivicore/qivisearchandbrowsemodelitem.cpp +++ b/src/ivicore/qivisearchandbrowsemodelitem.cpp @@ -59,8 +59,6 @@ public: QVariantMap m_data; }; -QT_END_NAMESPACE - /*! \class QIviSearchAndBrowseModelItem \inmodule QtIviCore @@ -197,3 +195,5 @@ bool QIviSearchAndBrowseModelItem::operator==(const QIviSearchAndBrowseModelItem \sa operator==() */ + +QT_END_NAMESPACE diff --git a/src/ivicore/qiviserviceinterface.h b/src/ivicore/qiviserviceinterface.h index a6285ee..f45c15c 100644 --- a/src/ivicore/qiviserviceinterface.h +++ b/src/ivicore/qiviserviceinterface.h @@ -43,6 +43,7 @@ #define QIVISERVICEINTERFACE_H #include <QtIviCore/qtiviglobal.h> +#include <QtIviCore/qivifeatureinterface.h> #include <QtCore/QtPlugin> @@ -54,7 +55,7 @@ public: virtual ~QIviServiceInterface(); virtual QStringList interfaces() const = 0; - virtual QObject *interfaceInstance(const QString &interface) const = 0; + virtual QIviFeatureInterface *interfaceInstance(const QString &interface) const = 0; }; #define QIviServiceInterface_iid "org.qt-project.qtivi.QIviServiceInterface/1.0" diff --git a/src/ivicore/qiviservicemanager.cpp b/src/ivicore/qiviservicemanager.cpp index 9bced91..6bda40a 100644 --- a/src/ivicore/qiviservicemanager.cpp +++ b/src/ivicore/qiviservicemanager.cpp @@ -59,8 +59,6 @@ QT_BEGIN_NAMESPACE Q_LOGGING_CATEGORY(qLcIviServiceManagement, "qt.ivi.servicemanagement"); -QT_END_NAMESPACE - namespace qtivi_helper { #ifdef QT_DEBUG static const bool loadDebug = true; @@ -158,10 +156,10 @@ void QIviServiceManagerPrivate::registerBackend(const QString &fileName, const Q Backend* backend = new Backend; backend->metaData = backendMetaData; - backend->interface = 0; - backend->interfaceObject = 0; - backend->loader = 0; - backend->proxyServiceObject = 0; + backend->interface = nullptr; + backend->interfaceObject = nullptr; + backend->loader = nullptr; + backend->proxyServiceObject = nullptr; addBackend(backend); } @@ -187,8 +185,8 @@ bool QIviServiceManagerPrivate::registerBackend(QObject *serviceBackendInterface backend->metaData = metaData; backend->interface = interface; backend->interfaceObject = serviceBackendInterface; - backend->loader = 0; - backend->proxyServiceObject = 0; + backend->loader = nullptr; + backend->proxyServiceObject = nullptr; addBackend(backend); return true; @@ -242,7 +240,7 @@ static QIviServiceInterface *warn(const char *what, const QPluginLoader *loader) qWarning("ServiceManager::serviceObjects - failed to %s '%s'", what, qPrintable(loader->fileName())); delete loader; - return Q_NULLPTR; + return nullptr; } } // unnamed namespace @@ -267,53 +265,61 @@ QIviServiceInterface *QIviServiceManagerPrivate::loadServiceBackendInterface(str } /*! - * \class QIviServiceManager - * \inmodule QtIviCore - * \brief QIviServiceManager provides the Backends to QIviAbstractFeature - * - * QIviServiceManager is the heart of QtIvi and provides you with an easy way to detect which - * backends and interfaces are available. - * - * By default QIviServiceManager reads the metaData of all plugins within the "qtivi" folder - * of your plugin path. The plugin itself will be loaded once it's explictly requested by - * the developer by using findServiceByInterface(). - * - * The registerService() function can be used to add Backend classes without putting them into - * a plugin. - * - * The service manager is a process wide singleton and can be accessed through the \l instance method. - */ + \class QIviServiceManager + \inmodule QtIviCore + \brief QIviServiceManager provides the Backends to QIviAbstractFeature + + QIviServiceManager is the heart of QtIvi and provides you with an easy way to detect which + backends and interfaces are available. + + By default QIviServiceManager reads the metaData of all plugins within the "qtivi" folder + of your plugin path. The plugin itself will be loaded once it's explictly requested by + the developer by using findServiceByInterface(). + + The registerService() function can be used to add Backend classes without putting them into + a plugin. + + The service manager is a process wide singleton and can be accessed through the \l instance method. + + For more detailed information on which plugins are recognized, enable the "qt.ivi.servicemanagement" + logging category. + + See \l {Dynamic Backend System} for more information about how backend loading works. + + \note The QIviServiceManager will only accept plugins, which match the build configuration used + for building qtivicore. This means qtivicore "release" build, doesn't accept plugins from a "debug" build. +*/ /*! - * \enum QIviServiceManager::SearchFlag - * - * \value IncludeProductionBackends - * Include production backends in the search result. \sa ProductionBackend - * \value IncludeSimulationBackends - * Include simulation backends in the search result. \sa SimulationBackend - * \value IncludeAll - * Include production and simulation backends in the search result - */ + \enum QIviServiceManager::SearchFlag + + \value IncludeProductionBackends + Include production backends in the search result. \sa ProductionBackend + \value IncludeSimulationBackends + Include simulation backends in the search result. \sa SimulationBackend + \value IncludeAll + Include production and simulation backends in the search result +*/ /*! - * \enum QIviServiceManager::BackendType - * - * \value ProductionBackend - * A backend controlling a real automotive interface (e.g. a climate control connected over the CAN bus) - * \value SimulationBackend - * A backend used for development as it's only returning simulation values and won't be deployed to the final hardware - */ + \enum QIviServiceManager::BackendType + + \value ProductionBackend + A backend controlling a real automotive interface (e.g. a climate control connected over the CAN bus) + \value SimulationBackend + A backend used for development as it's only returning simulation values and won't be deployed to the final hardware +*/ QIviServiceManager::QIviServiceManager() - : QAbstractListModel(0) + : QAbstractListModel(nullptr) , d_ptr(new QIviServiceManagerPrivate(this)) { d_ptr->searchPlugins(); } /*! - * Returns the global service manager instance. - */ + Returns the global service manager instance. +*/ QIviServiceManager *QIviServiceManager::instance() { static QIviServiceManager *instance = new QIviServiceManager(); @@ -321,18 +327,18 @@ QIviServiceManager *QIviServiceManager::instance() } /*! - * Destructor. - */ + Destructor. +*/ QIviServiceManager::~QIviServiceManager() { } /*! - * Returns a list of backends implementing the specified \a interface. - * - * The \a searchFlags argument can be used to control which type of backends are included in the search result. - */ + Returns a list of backends implementing the specified \a interface. + + The \a searchFlags argument can be used to control which type of backends are included in the search result. +*/ QList<QIviServiceObject *> QIviServiceManager::findServiceByInterface(const QString &interface, SearchFlags searchFlags) { Q_D(QIviServiceManager); @@ -340,16 +346,16 @@ QList<QIviServiceObject *> QIviServiceManager::findServiceByInterface(const QStr } /*! - * Register a backend. The provided \a serviceBackendInterface must implement the - * QIviServiceInterface else the registration will fail. \a interfaces is a list - * with interfaces (at least one) supported by the backend. The \a backendType - * indicates the type of the backend and has influence on whether the backend is - * found by the auto discovery of the Feature. - * - * Returns true if the backend was successfully registered else false. - * - * \sa QIviServiceInterface - */ + Register a backend. The provided \a serviceBackendInterface must implement the + QIviServiceInterface else the registration will fail. \a interfaces is a list + with interfaces (at least one) supported by the backend. The \a backendType + indicates the type of the backend and has influence on whether the backend is + found by the auto discovery of the Feature. + + Returns true if the backend was successfully registered else false. + + \sa QIviServiceInterface +*/ bool QIviServiceManager::registerService(QObject *serviceBackendInterface, const QStringList &interfaces, BackendType backendType) { Q_D(QIviServiceManager); @@ -357,10 +363,10 @@ bool QIviServiceManager::registerService(QObject *serviceBackendInterface, const } /*! - * \internal - * - * Unloads all currently loaded backends. Commonly only used for unit testing. - */ + \internal + + Unloads all currently loaded backends. Commonly only used for unit testing. +*/ void QIviServiceManager::unloadAllBackends() { Q_D(QIviServiceManager); @@ -368,8 +374,8 @@ void QIviServiceManager::unloadAllBackends() } /*! - * Returns true if the specified \a interface has been registered. - */ + Returns true if the specified \a interface has been registered. +*/ bool QIviServiceManager::hasInterface(const QString &interface) const { Q_D(const QIviServiceManager); @@ -377,10 +383,10 @@ bool QIviServiceManager::hasInterface(const QString &interface) const } /*! - * Returns the number of rows for the given \a parent. Typically \a parent is an empty model index. - * - * \sa QAbstractListModel::data() - */ + Returns the number of rows for the given \a parent. Typically \a parent is an empty model index. + + \sa QAbstractListModel::data() +*/ int QIviServiceManager::rowCount(const QModelIndex &parent) const { Q_D(const QIviServiceManager); @@ -388,10 +394,10 @@ int QIviServiceManager::rowCount(const QModelIndex &parent) const } /*! - * Returns the data for \a index and \a role. - * - * \sa QAbstractListModel::data() - */ + Returns the data for \a index and \a role. + + \sa QAbstractListModel::data() +*/ QVariant QIviServiceManager::data(const QModelIndex &index, int role) const { Q_D(const QIviServiceManager); @@ -407,3 +413,5 @@ QVariant QIviServiceManager::data(const QModelIndex &index, int role) const return QVariant(); } + +QT_END_NAMESPACE diff --git a/src/ivicore/qiviservicemanager.h b/src/ivicore/qiviservicemanager.h index 1f3d393..c3ca952 100644 --- a/src/ivicore/qiviservicemanager.h +++ b/src/ivicore/qiviservicemanager.h @@ -69,7 +69,7 @@ public: Q_ENUM(BackendType) static QIviServiceManager *instance(); - virtual ~QIviServiceManager(); + ~QIviServiceManager(); QList<QIviServiceObject*> findServiceByInterface(const QString &interface, SearchFlags searchFlags = IncludeAll); bool hasInterface(const QString &interface) const; diff --git a/src/ivicore/qiviserviceobject.cpp b/src/ivicore/qiviserviceobject.cpp index c03e411..697c479 100644 --- a/src/ivicore/qiviserviceobject.cpp +++ b/src/ivicore/qiviserviceobject.cpp @@ -43,26 +43,28 @@ #include <QUuid> +QT_BEGIN_NAMESPACE + /*! - * \class QIviServiceObject - * \inmodule QtIviCore - * \brief QIviServiceObject is the connection point to a Backend Service. - * - * QIviServiceObject provides you with a list of interfaces the Backend implements. - * - * By using interfaceInstance() a QObject implementing this interface will be returned. - * The returned interface can contain signals that need to be connected to by the Feature - * implementing this interface. - * - * \sa QIviAbstractFeature - */ + \class QIviServiceObject + \inmodule QtIviCore + \brief QIviServiceObject is the connection point to a Backend Service. + + QIviServiceObject provides you with a list of interfaces the Backend implements. + + By using interfaceInstance() a QObject implementing this interface will be returned. + The returned interface can contain signals that need to be connected to by the Feature + implementing this interface. + + \sa QIviAbstractFeature +*/ /*! - * Constructor. - * - * \a parent is passed on to \l QObject. - */ + Constructor. + + \a parent is passed on to \l QObject. +*/ QIviServiceObject::QIviServiceObject(QObject *parent) : QObject(parent) { @@ -70,27 +72,27 @@ QIviServiceObject::QIviServiceObject(QObject *parent) } /*! - * Destructor. - */ + Destructor. +*/ QIviServiceObject::~QIviServiceObject() { } /*! - * \property QIviServiceObject::id - * \brief A unique ID for the service object instance. - * - * Each service object has a unique ID. When subclassing, the id() - * function can be overloaded to control the generation of the ID. - */ + \property QIviServiceObject::id + \brief A unique ID for the service object instance. + + Each service object has a unique ID. When subclassing, the id() + function can be overloaded to control the generation of the ID. +*/ /*! - * The id() function can be overloaded to control the generation of - * the unique ID used by this service object. - * - * By default, QUuid::createUuid() is used. - */ + The id() function can be overloaded to control the generation of + the unique ID used by this service object. + + By default, QUuid::createUuid() is used. +*/ QString QIviServiceObject::id() const { static QUuid id = QUuid::createUuid(); @@ -98,31 +100,33 @@ QString QIviServiceObject::id() const } /*! - * \class QIviServiceInterface - * \inmodule QtIviCore - * \brief Interface class for services. - * - * The QIviServiceInterface class defines the interface of services registered with QIviServiceManager. - * - * Commonly, service objects inherit the concrete class QIviServiceObject instead of using QIviServiceInterface directly. - * - * \sa QIviServiceObject - */ + \class QIviServiceInterface + \inmodule QtIviCore + \brief Interface class for services. + + The QIviServiceInterface class defines the interface of services registered with QIviServiceManager. + + Commonly, service objects inherit the concrete class QIviServiceObject instead of using QIviServiceInterface directly. + + \sa QIviServiceObject +*/ /*! - * \fn QIviServiceInterface::~QIviServiceInterface() - * - * Destructs the QIviServiceInterface instance. - */ + \fn QIviServiceInterface::~QIviServiceInterface() + + Destructs the QIviServiceInterface instance. +*/ /*! - * \fn QStringList QIviServiceInterface::interfaces() const - * - * Returns a list of service interface names supported by the service object instance. - */ + \fn QStringList QIviServiceInterface::interfaces() const + + Returns a list of service interface names supported by the service object instance. +*/ /*! - * \fn QObject* QIviServiceInterface::interfaceInstance(const QString& interface) const - * - * Returns an object implementing the service interface requested through \a interface. - */ + \fn QObject* QIviServiceInterface::interfaceInstance(const QString& interface) const + + Returns an object implementing the service interface requested through \a interface. +*/ + +QT_END_NAMESPACE diff --git a/src/ivicore/qiviserviceobject.h b/src/ivicore/qiviserviceobject.h index f7a4e97..a1495ce 100644 --- a/src/ivicore/qiviserviceobject.h +++ b/src/ivicore/qiviserviceobject.h @@ -56,8 +56,8 @@ class Q_QTIVICORE_EXPORT QIviServiceObject : public QObject, public QIviServiceI Q_PROPERTY(QString id READ id CONSTANT) public: - explicit QIviServiceObject(QObject *parent = Q_NULLPTR); - virtual ~QIviServiceObject(); + explicit QIviServiceObject(QObject *parent = nullptr); + ~QIviServiceObject(); virtual QString id() const; diff --git a/src/ivicore/qivizonedfeatureinterface.cpp b/src/ivicore/qivizonedfeatureinterface.cpp index 9ab2d45..ccd926b 100644 --- a/src/ivicore/qivizonedfeatureinterface.cpp +++ b/src/ivicore/qivizonedfeatureinterface.cpp @@ -41,66 +41,69 @@ #include "qivizonedfeatureinterface.h" +QT_BEGIN_NAMESPACE + /*! - \class QIviZonedFeatureInterface - \inmodule QtIviCore - \ingroup backends - - \brief QIviZonedFeatureInterface defines the base interface for the - feature backend classes. - - Vehicle feature can be zoned or be just generic depending of the vehicle. - For example some vehicles can contain only one climate fan and some other - may have one fan for the front seats and one for the back seat. To fill both - requirements, a backend developer can specify each feature attribute to be - generic or zone specific. If the backend doesn't specify a zone for an - attribute, then the attribute is generic. There can be multiple zone - attributes, but only a single generic one. The zone value for a generic - attribute is an empty string, and it can be omitted from the signals. The - code snippets below describes how to implement zone specific fanSpeedlevel - and generic steeringWheelHeater support in the backend. - - \section2 Providing Available Zones - - Before making any further calls to the backend, VehicleFunctions will query - the list of available zones. Zones are string keys and can be anything - defined by the backend developer. In this case we have two zones: "Front" - and "Rear". - - The backend must return all available zones via - \l {QIviZonedFeatureInterface::}{availableZones}: - \code - QStringList backend::availableZones() const { + \class QIviZonedFeatureInterface + \inmodule QtIviCore + \ingroup backends + + \brief QIviZonedFeatureInterface defines the base interface for the + feature backend classes. + + Vehicle feature can be zoned or be just generic depending of the vehicle. + For example some vehicles can contain only one climate fan and some other + may have one fan for the front seats and one for the back seat. To fill both + requirements, a backend developer can specify each feature attribute to be + generic or zone specific. If the backend doesn't specify a zone for an + attribute, then the attribute is generic. There can be multiple zone + attributes, but only a single generic one. The zone value for a generic + attribute is an empty string, and it can be omitted from the signals. The + code snippets below describes how to implement zone specific fanSpeedlevel + and generic steeringWheelHeater support in the backend. + + \section2 Providing Available Zones + + Before making any further calls to the backend, VehicleFunctions will query + the list of available zones. Zones are string keys and can be anything + defined by the backend developer. In this case we have two zones: "Front" + and "Rear". + + The backend must return all available zones via + \l {QIviZonedFeatureInterface::}{availableZones}: + \code + QStringList backend::availableZones() const { QStringList zones; zones << "Front"; zones << "Rear"; return zones; } - \endcode + \endcode - \section2 Initializing Attributes + \section2 Initializing Attributes - VehicleFunctions calls the backend to initialize all attributes. Backend - implementation has to emit all supported attribute signals, passing the - zone as a parameter. Zone is not needed if attribute is generic. + VehicleFunctions calls the backend to initialize all attributes. Backend + implementation has to emit all supported attribute signals, passing the + zone as a parameter. Zone is not needed if attribute is generic. - Initialization signals are emitted in the - \l {QIviZonedFeatureInterface::}{initializeAttributes}: - \code - void backend::initializeAttributes() { + Initialization signals are emitted in the + \l {QIviZonedFeatureInterface::}{initialize}: + \code + void backend::initialize() { emit fanSpeedLevelChanged(2, "Front"); emit fanSpeedLevelChanged(2, "Rear"); emit steeringWheelHeaterChanged(0); // Generic, no zone specified + emit initializationDone(); } - \endcode + \endcode - \section2 Implementing Feature-specific Attributes + \section2 Implementing Feature-specific Attributes - Fan speed is zoned, validating requested zones is the responsibility - of the backend. If zone is valid, the vehicle's actual fan speed level - can be adjusted. The backend has to emit a signal for the changed zone. - \code - void backend::setFanSpeedLevel(int value, const QString &zone) { + Fan speed is zoned, validating requested zones is the responsibility + of the backend. If zone is valid, the vehicle's actual fan speed level + can be adjusted. The backend has to emit a signal for the changed zone. + \code + void backend::setFanSpeedLevel(int value, const QString &zone) { if (!m_fanSpeedZones.contains(zone)) { emit errorChanged(QIviAbstractFeature::InvalidZone); } else { @@ -110,7 +113,7 @@ } } - int backend::fanSpeedLevel(const QString &zone) { + int backend::fanSpeedLevel(const QString &zone) { if (!m_fanSpeedZones.contains(zone)) { emit errorChanged(QIviAbstractFeature::InvalidZone); return -1; @@ -119,14 +122,14 @@ return value; } } - \endcode - - Steering wheel heater is not zone specific, so zone attribute should be - empty. If zone is empty, the vehicle's actual steering wheel heater can - be controlled. The backend has to emit a signal for the changed value. - Because the attribute is generic, zone is omitted from the signal. - \code - void backend::setSteeringWheelHeater(int value, const QString &zone) { + \endcode + + Steering wheel heater is not zone specific, so zone attribute should be + empty. If zone is empty, the vehicle's actual steering wheel heater can + be controlled. The backend has to emit a signal for the changed value. + Because the attribute is generic, zone is omitted from the signal. + \code + void backend::setSteeringWheelHeater(int value, const QString &zone) { if (!zone.isEmpty()) { // zone must be empty for a generic attribute emit errorChanged(QIviAbstractFeature::InvalidZone); return; @@ -137,7 +140,7 @@ } } - int backend::steeringWheelHeater(const QString &zone) { + int backend::steeringWheelHeater(const QString &zone) { if (!zone.isEmpty()) { // zone must be empty for a generic attribute emit errorChanged(QIviAbstractFeature::InvalidZone); return -1; @@ -146,53 +149,39 @@ return value; } } - \endcode + \endcode - To implement a backend plugin you need also to implement QIviServiceInterface from the QtIviCore module. + To implement a backend plugin you need also to implement QIviServiceInterface from the QtIviCore module. - See the full example backend implementation from \c {src/plugins/ivivehiclefunctions/climate_simulator}. - \sa QIviAbstractZonedFeature, QIviServiceInterface - */ + See the full example backend implementation from \c {src/plugins/ivivehiclefunctions/climate_simulator}. + \sa QIviAbstractZonedFeature, QIviServiceInterface +*/ /*! - * \fn QIviZonedFeatureInterface::QIviZonedFeatureInterface(QObject *parent=0) - * - * Constructs a backend base interface. - * - * The \a parent is sent to the QObject constructor. - */ + \fn QIviZonedFeatureInterface::QIviZonedFeatureInterface(QObject *parent = nullptr) + + Constructs a backend base interface. + + The \a parent is sent to the QObject constructor. +*/ QIviZonedFeatureInterface::QIviZonedFeatureInterface(QObject *parent) - : QObject(parent) + : QIviFeatureInterface(parent) { } -/*! - * \fn QStringList QIviZonedFeatureInterface::availableZones() const - * - * Returns a list of supported zone names. This is called from the client - * after having connected. - * - * The returned names must be valid QML property names, i.e. \c {[a-z_][A-Za-z0-9_]*}. - * - * \sa {Providing Available Zones} - */ +QIviZonedFeatureInterface::~QIviZonedFeatureInterface() +{ +} /*! - * \fn void QIviZonedFeatureInterface::initializeAttributes() - * - * Called from the client to initialize attributes. This is called after - * client is connected and available zones are fetched. - * - * In this function all supported attributes for each zone need to be emitted with - * the initialized value. - * - * \sa {Initializing Attributes} - */ + \fn QStringList QIviZonedFeatureInterface::availableZones() const -/*! - * \fn void errorChanged(QIviAbstractFeature::Error error, const QString &message = QString()) - * - * The signal is emitted when \a error occurs in the backend. - * Error \a message is optional. - */ + Returns a list of supported zone names. This is called from the client + after having connected. + + The returned names must be valid QML property names, i.e. \c {[a-z_][A-Za-z0-9_]*}. + + \sa {Providing Available Zones} +*/ +QT_END_NAMESPACE diff --git a/src/ivicore/qivizonedfeatureinterface.h b/src/ivicore/qivizonedfeatureinterface.h index f7ac021..a55414b 100644 --- a/src/ivicore/qivizonedfeatureinterface.h +++ b/src/ivicore/qivizonedfeatureinterface.h @@ -43,22 +43,19 @@ #define QIVIZONEDFEATUREINTERFACE_H #include <QtIviCore/QIviAbstractZonedFeature> +#include <QtIviCore/QIviFeatureInterface> QT_BEGIN_NAMESPACE -class Q_QTIVICORE_EXPORT QIviZonedFeatureInterface : public QObject +class Q_QTIVICORE_EXPORT QIviZonedFeatureInterface : public QIviFeatureInterface { Q_OBJECT public: - QIviZonedFeatureInterface(QObject *parent = Q_NULLPTR); + explicit QIviZonedFeatureInterface(QObject *parent = nullptr); + ~QIviZonedFeatureInterface(); virtual QStringList availableZones() const = 0; - - virtual void initializeAttributes() = 0; - -Q_SIGNALS: - void errorChanged(QIviAbstractFeature::Error error, const QString &message = QString()); }; QT_END_NAMESPACE diff --git a/src/ivicore/queryparser/qiviqueryparser.g b/src/ivicore/queryparser/qiviqueryparser.g index 4d02530..8e481dc 100644 --- a/src/ivicore/queryparser/qiviqueryparser.g +++ b/src/ivicore/queryparser/qiviqueryparser.g @@ -91,8 +91,8 @@ QT_BEGIN_NAMESPACE //TODO Find a better way of doing it, this is not reentrant -QString* currentQuery = 0; -unsigned int *currentOffset = 0; +QString* currentQuery = nullptr; +unsigned int *currentOffset = nullptr; void readQueryBuffer(char *buffer, unsigned int &numBytesRead,int maxBytesToRead) { if (!currentQuery) { @@ -126,7 +126,7 @@ public: public: QIviQueryParser(); - virtual ~QIviQueryParser(); + ~QIviQueryParser(); QIviAbstractQueryTerm *parse(); @@ -227,11 +227,11 @@ typedef int yy_size_t; QIviQueryParser::~QIviQueryParser() { - currentOffset = 0; - currentQuery = 0; + currentOffset = nullptr; + currentQuery = nullptr; //We need to reset the lexer to reinitialize it when needed - yy_init = 0; + yy_init = nullptr; //Get rid of the unused warning if (0) @@ -266,8 +266,8 @@ void QIviQueryParser::handleConjunction(bool bangOperator) list.prepend(m_termStack.pop()); list.prepend(m_termStack.pop()); - QIviConjunctionTerm *conjunction1 = 0; - QIviConjunctionTerm *conjunction2 = 0; + QIviConjunctionTerm *conjunction1 = nullptr; + QIviConjunctionTerm *conjunction2 = nullptr; int i = 0; for (QIviAbstractQueryTerm *term : list) { if (term->type() == QIviAbstractQueryTerm::ConjunctionTerm) { @@ -323,7 +323,7 @@ bool QIviQueryParser::checkIdentifier(const QString &identifer) { if (!m_identifierList.isEmpty() && !m_identifierList.contains(identifer)) { QString errorMessage = QString(QLatin1String("Got %1 but expected on of the following identifiers:\n")).arg(identifer); - for (QString ident : m_identifierList) + for (const QString &ident : qAsConst(m_identifierList)) errorMessage.append(QString(QLatin1String(" %1\n")).arg(ident)); setErrorString(errorMessage); diff --git a/src/ivicore/queryparser/qiviqueryparser_flex_p.h b/src/ivicore/queryparser/qiviqueryparser_flex_p.h index f7e09cd..03cf51c 100644 --- a/src/ivicore/queryparser/qiviqueryparser_flex_p.h +++ b/src/ivicore/queryparser/qiviqueryparser_flex_p.h @@ -186,8 +186,8 @@ int isatty (int ) { #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, - * if you want the limit (max/min) macros for int types. - */ + if you want the limit (max/min) macros for int types. +*/ #ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS 1 #endif @@ -274,10 +274,10 @@ typedef unsigned int flex_uint32_t; /* Promotes a possibly negative, possibly signed char to an unsigned - * integer for use as an array index. If the signed char is negative, - * we want to instead treat it as an 8-bit unsigned char, hence the - * double cast. - */ + integer for use as an array index. If the signed char is negative, + we want to instead treat it as an 8-bit unsigned char, hence the + double cast. +*/ #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) @@ -315,17 +315,17 @@ typedef unsigned int flex_uint32_t; /* Enter a start condition. This macro really ought to take a parameter, - * but we do it the disgusting crufty way forced on us by the ()-less - * definition of BEGIN. - */ + but we do it the disgusting crufty way forced on us by the ()-less + definition of BEGIN. +*/ #define BEGIN (yy_start) = 1 + 2 * /* Translate the current start state into a value that can be later handed - * to BEGIN to return to the state. The YYSTATE alias is for lex - * compatibility. - */ + to BEGIN to return to the state. The YYSTATE alias is for lex + compatibility. +*/ #define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START @@ -348,9 +348,9 @@ typedef unsigned int flex_uint32_t; #ifndef YY_BUF_SIZE #ifdef __ia64__ /* On IA-64, the buffer size is 16k, not 8k. - * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. - * Ditto for the __ia64__ case accordingly. - */ + Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + Ditto for the __ia64__ case accordingly. +*/ #define YY_BUF_SIZE 32768 #else #define YY_BUF_SIZE 16384 @@ -359,7 +359,7 @@ typedef unsigned int flex_uint32_t; /* The state buf must be large enough to hold one state per character in the main buffer. - */ +*/ #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) @@ -508,11 +508,11 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the - * future we want to put the buffer states in a more general - * "scanner state". - * - * Returns the top of the stack, or NULL. - */ + future we want to put the buffer states in a more general + "scanner state". + + Returns the top of the stack, or NULL. +*/ #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ : NULL) @@ -520,8 +520,8 @@ static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ /* Same as previous macro, but useful when we know that the buffer stack is not - * NULL or when we need an lvalue. For internal use only. - */ + NULL or when we need an lvalue. For internal use only. +*/ #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] @@ -538,8 +538,8 @@ static int yy_init = 0; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ /* Flag which is used to allow yywrap()'s to do buffer switches - * instead of setting up a fresh yyin. A bit of a hack ... - */ + instead of setting up a fresh yyin. A bit of a hack ... +*/ static int yy_did_buffer_switch_on_eof; @@ -642,8 +642,8 @@ static void yy_fatal_error (yyconst char msg[] ); /* Done after the current pattern has been matched and before the - * corresponding action - sets up yytext. - */ + corresponding action - sets up yytext. +*/ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ yyleng = (size_t) (yy_cp - yy_bp); \ @@ -656,7 +656,7 @@ static void yy_fatal_error (yyconst char msg[] ); #define YY_NUM_RULES 30 #define YY_END_OF_BUFFER 31 /* This struct is not used in this scanner, - but its presence is necessary. */ + but its presence is necessary. */ struct yy_trans_info { flex_int32_t yy_verify; @@ -811,8 +811,8 @@ extern int yy_flex_debug; int yy_flex_debug = 0; /* The intent behind this definition is that it'll catch - * any uses of REJECT which flex missed. - */ + any uses of REJECT which flex missed. +*/ #define REJECT reject_used_but_not_detected #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 @@ -841,7 +841,7 @@ static int yy_init_globals (void ); /* Accessor methods to globals. - These are made visible to non-reentrant scanners for convenience. */ + These are made visible to non-reentrant scanners for convenience. */ int yylex_destroy (void ); @@ -901,8 +901,8 @@ void yyset_lineno (int _line_number ); /* Macros after this point can all be overridden by user definitions in - * section 1. - */ + section 1. +*/ #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus @@ -959,16 +959,16 @@ static int input (void ); /* Copy whatever the last rule matched to the standard output. */ #ifndef ECHO /* This used to be an fputs(), but since the string might contain NUL's, - * we now use fwrite(). - */ + we now use fwrite(). +*/ #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, - * is returned in "result". - */ + is returned in "result". +*/ #ifndef YY_INPUT #define YY_INPUT(buf,result,max_size) \ if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ @@ -1005,9 +1005,9 @@ static int input (void ); /* No semi-colon after return; correct usage is to write "yyterminate();" - - * we don't want an extra ';' after the "return" because that will cause - * some compilers to complain about unreachable statements. - */ + we don't want an extra ';' after the "return" because that will cause + some compilers to complain about unreachable statements. +*/ #ifndef yyterminate #define yyterminate() return YY_NULL #endif @@ -1033,8 +1033,8 @@ static int input (void ); /* Default declaration of generated scanner - a define so the user can - * easily add parameters. - */ + easily add parameters. +*/ #ifndef YY_DECL #define YY_DECL_IS_OURS 1 @@ -1053,8 +1053,8 @@ extern int yylex (void); /* Code executed at the beginning of each rule, after yytext and yyleng - * have been set up. - */ + have been set up. +*/ #ifndef YY_USER_ACTION #define YY_USER_ACTION #endif @@ -1074,7 +1074,7 @@ extern int yylex (void); /** The main scanner function which does all the work. - */ +*/ YY_DECL { yy_state_type yy_current_state; @@ -1487,12 +1487,12 @@ case YY_STATE_EOF(INITIAL): /* yy_get_next_buffer - try to read in a new buffer - * - * Returns a code representing an action: + + Returns a code representing an action: * EOB_ACT_LAST_MATCH - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file - */ +*/ static int yy_get_next_buffer (void) { char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; @@ -1658,10 +1658,10 @@ static int yy_get_next_buffer (void) /* yy_try_NUL_trans - try to make a transition on the NUL character - * - * synopsis + + synopsis * next_state = yy_try_NUL_trans( current_state ); - */ +*/ static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) { int yy_is_jam; @@ -1813,10 +1813,10 @@ static int yy_get_next_buffer (void) #endif /* ifndef YY_NO_INPUT */ /** Immediately switch to a different input stream. - * @param input_file A readable stream. - * - * @note This function does not reset the start condition to @c INITIAL . - */ + @param input_file A readable stream. + + @note This function does not reset the start condition to @c INITIAL . +*/ void yyrestart (FILE * input_file ) { @@ -1832,9 +1832,9 @@ static int yy_get_next_buffer (void) /** Switch to a different input buffer. - * @param new_buffer The new input buffer. - * - */ + @param new_buffer The new input buffer. + +*/ void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) { @@ -1876,11 +1876,11 @@ static void yy_load_buffer_state (void) } /** Allocate and initialize an input buffer state. - * @param file A readable stream. - * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. - * - * @return the allocated buffer state. - */ + @param file A readable stream. + @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. + + @return the allocated buffer state. +*/ YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) { YY_BUFFER_STATE b; @@ -1907,9 +1907,9 @@ static void yy_load_buffer_state (void) /** Destroy the buffer. - * @param b a buffer created with yy_create_buffer() - * - */ + @param b a buffer created with yy_create_buffer() + +*/ void yy_delete_buffer (YY_BUFFER_STATE b ) { @@ -1927,9 +1927,9 @@ static void yy_load_buffer_state (void) /* Initializes or reinitializes a buffer. - * This function is sometimes called more than once on the same buffer, - * such as during a yyrestart() or at EOF. - */ + This function is sometimes called more than once on the same buffer, + such as during a yyrestart() or at EOF. +*/ static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) { @@ -1958,9 +1958,9 @@ static void yy_load_buffer_state (void) } /** Discard all buffered characters. On the next scan, YY_INPUT will be called. - * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. - * - */ + @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. + +*/ void yy_flush_buffer (YY_BUFFER_STATE b ) { if ( ! b ) @@ -1985,11 +1985,11 @@ static void yy_load_buffer_state (void) } /** Pushes the new state onto the stack. The new state becomes - * the current state. This function will allocate the stack - * if necessary. - * @param new_buffer The new state. - * - */ + the current state. This function will allocate the stack + if necessary. + @param new_buffer The new state. + +*/ void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) { if (new_buffer == NULL) @@ -2018,9 +2018,9 @@ void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) /** Removes and deletes the top of the stack, if present. - * The next element becomes the new top. - * - */ + The next element becomes the new top. + +*/ void yypop_buffer_state (void) { if (!YY_CURRENT_BUFFER) @@ -2039,8 +2039,8 @@ void yypop_buffer_state (void) /* Allocates the stack if it does not exist. - * Guarantees space for at least one push. - */ + Guarantees space for at least one push. +*/ static void yyensure_buffer_stack (void) { yy_size_t num_to_alloc; @@ -2090,11 +2090,11 @@ static void yyensure_buffer_stack (void) /** Setup the input buffer state to scan directly from a user-specified character buffer. - * @param base the character buffer - * @param size the size in bytes of the character buffer - * - * @return the newly allocated buffer state object. - */ + @param base the character buffer + @param size the size in bytes of the character buffer + + @return the newly allocated buffer state object. +*/ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) { YY_BUFFER_STATE b; @@ -2128,13 +2128,13 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) /** Setup the input buffer state to scan a string. The next call to yylex() will - * scan from a @e copy of @a str. - * @param yystr a NUL-terminated string to scan - * - * @return the newly allocated buffer state object. - * @note If you want to scan bytes that may contain NUL values, then use - * yy_scan_bytes() instead. - */ + scan from a @e copy of @a str. + @param yystr a NUL-terminated string to scan + + @return the newly allocated buffer state object. + @note If you want to scan bytes that may contain NUL values, then use + yy_scan_bytes() instead. +*/ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) { @@ -2145,12 +2145,12 @@ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) /** Setup the input buffer state to scan the given bytes. The next call to yylex() will - * scan from a @e copy of @a bytes. - * @param yybytes the byte buffer to scan - * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. - * - * @return the newly allocated buffer state object. - */ + scan from a @e copy of @a bytes. + @param yybytes the byte buffer to scan + @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. + + @return the newly allocated buffer state object. +*/ YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) { YY_BUFFER_STATE b; @@ -2225,8 +2225,8 @@ static void yy_fatal_error (yyconst char* msg ) /** Get the current line number. - * - */ + +*/ int yyget_lineno (void) { @@ -2239,8 +2239,8 @@ int yyget_lineno (void) /** Get the input stream. - * - */ + +*/ FILE *yyget_in (void) { return yyin; @@ -2249,8 +2249,8 @@ FILE *yyget_in (void) /** Get the output stream. - * - */ + +*/ FILE *yyget_out (void) { return yyout; @@ -2259,8 +2259,8 @@ FILE *yyget_out (void) /** Get the length of the current token. - * - */ + +*/ yy_size_t yyget_leng (void) { return yyleng; @@ -2268,8 +2268,8 @@ yy_size_t yyget_leng (void) /** Get the current token. - * - */ + +*/ char *yyget_text (void) { @@ -2280,9 +2280,9 @@ char *yyget_text (void) /** Set the current line number. - * @param _line_number line number - * - */ + @param _line_number line number + +*/ void yyset_lineno (int _line_number ) { @@ -2296,11 +2296,11 @@ void yyset_lineno (int _line_number ) /** Set the input stream. This does not discard the current - * input buffer. - * @param _in_str A readable stream. - * - * @see yy_switch_to_buffer - */ + input buffer. + @param _in_str A readable stream. + + @see yy_switch_to_buffer +*/ void yyset_in (FILE * _in_str ) { yyin = _in_str ; @@ -2400,8 +2400,8 @@ int yylex_destroy (void) /* - * Internal utility routines. - */ + Internal utility routines. +*/ diff --git a/src/ivicore/queryparser/qiviqueryparser_p.h b/src/ivicore/queryparser/qiviqueryparser_p.h index 76156e7..7fba11c 100644 --- a/src/ivicore/queryparser/qiviqueryparser_p.h +++ b/src/ivicore/queryparser/qiviqueryparser_p.h @@ -447,7 +447,7 @@ bool QIviQueryParser::checkIdentifier(const QString &identifer) { if (!m_identifierList.isEmpty() && !m_identifierList.contains(identifer)) { QString errorMessage = QString(QLatin1String("Got %1 but expected on of the following identifiers:\n")).arg(identifer); - for (QString ident : m_identifierList) + for (const QString &ident : qAsConst(m_identifierList)) errorMessage.append(QString(QLatin1String(" %1\n")).arg(ident)); setErrorString(errorMessage); diff --git a/src/ivicore/queryparser/qiviqueryterm.h b/src/ivicore/queryparser/qiviqueryterm.h index 14f837c..902a823 100644 --- a/src/ivicore/queryparser/qiviqueryterm.h +++ b/src/ivicore/queryparser/qiviqueryterm.h @@ -74,11 +74,11 @@ public: Or }; - QIviConjunctionTerm(); - virtual ~QIviConjunctionTerm(); + explicit QIviConjunctionTerm(); + ~QIviConjunctionTerm(); - QIviAbstractQueryTerm::Type type() const Q_DECL_OVERRIDE; - QString toString() const Q_DECL_OVERRIDE; + QIviAbstractQueryTerm::Type type() const override; + QString toString() const override; Conjunction conjunction() const; QList<QIviAbstractQueryTerm*> terms() const; @@ -95,10 +95,10 @@ class Q_QTIVICORE_EXPORT QIviScopeTerm : public QIviAbstractQueryTerm public: explicit QIviScopeTerm(); - virtual ~QIviScopeTerm(); + ~QIviScopeTerm(); - QIviAbstractQueryTerm::Type type() const Q_DECL_OVERRIDE; - QString toString() const Q_DECL_OVERRIDE; + QIviAbstractQueryTerm::Type type() const override; + QString toString() const override; bool isNegated() const; QIviAbstractQueryTerm* term() const; @@ -124,10 +124,10 @@ public: }; explicit QIviFilterTerm(); - virtual ~QIviFilterTerm(); + ~QIviFilterTerm(); - QIviAbstractQueryTerm::Type type() const Q_DECL_OVERRIDE; - QString toString() const Q_DECL_OVERRIDE; + QIviAbstractQueryTerm::Type type() const override; + QString toString() const override; Operator operatorType() const; QVariant value() const; QString propertyName() const; diff --git a/src/ivimedia/qiviamfmtuner.cpp b/src/ivimedia/qiviamfmtuner.cpp index fe0e760..9fee33d 100644 --- a/src/ivimedia/qiviamfmtuner.cpp +++ b/src/ivimedia/qiviamfmtuner.cpp @@ -44,6 +44,8 @@ #include <QtIviCore/QIviServiceObject> #include <QtDebug> +QT_BEGIN_NAMESPACE + QIviAmFmTunerPrivate::QIviAmFmTunerPrivate(const QString &interface, QIviAmFmTuner *parent) : QIviAbstractFeaturePrivate(interface, parent) , q_ptr(parent) @@ -172,19 +174,19 @@ QIviAmFmTunerBackendInterface *QIviAmFmTunerPrivate::tunerBackend() const */ /*! - \enum QIviAmFmTuner::Band - \value AMBand + \enum QIviAmFmTuner::Band + \value AMBand The AM Band is based on the Amplitude Modulation technique and can range from 520 to 1610 kHz (1710 kHz). The step size is usually between 9 or 10 kHz. - \value FMBand + \value FMBand The FM Band is based on the Frequency Modulation technique and can range from 87.5 to 108.0 MHz. The step size is usually 100 kHz. */ /*! - Constructs a QIviAmFmTuner. + Constructs a QIviAmFmTuner. - The \a parent argument is passed on to the \l QIviAbstractFeature base class. + The \a parent argument is passed on to the \l QIviAbstractFeature base class. */ QIviAmFmTuner::QIviAmFmTuner(QObject *parent) : QIviAbstractFeature(*new QIviAmFmTunerPrivate(QLatin1String(QIviAmFmTuner_iid), this), parent) @@ -194,11 +196,11 @@ QIviAmFmTuner::QIviAmFmTuner(QObject *parent) /*! \qmlproperty int AmFmTuner::frequency \brief The current frequency of the tuner. - */ +*/ /*! \property QIviAmFmTuner::frequency \brief The current frequency of the tuner. - */ +*/ int QIviAmFmTuner::frequency() const { Q_D(const QIviAmFmTuner); @@ -208,11 +210,11 @@ int QIviAmFmTuner::frequency() const /*! \qmlproperty int AmFmTuner::minimumFrequency \brief The minimum frequency of the current band. - */ +*/ /*! \property QIviAmFmTuner::minimumFrequency \brief The minimum frequency of the current band. - */ +*/ int QIviAmFmTuner::minimumFrequency() const { Q_D(const QIviAmFmTuner); @@ -222,11 +224,11 @@ int QIviAmFmTuner::minimumFrequency() const /*! \qmlproperty int AmFmTuner::maximumFrequency \brief The maximum frequency of the current band. - */ +*/ /*! \property QIviAmFmTuner::maximumFrequency \brief The maximum frequency of the current band. - */ +*/ int QIviAmFmTuner::maximumFrequency() const { Q_D(const QIviAmFmTuner); @@ -238,13 +240,13 @@ int QIviAmFmTuner::maximumFrequency() const \brief The frequency step size of the current band. \sa stepUp() stepDown() - */ +*/ /*! \property QIviAmFmTuner::stepSize \brief The frequency step size of the current band. \sa stepUp() stepDown() - */ +*/ int QIviAmFmTuner::stepSize() const { Q_D(const QIviAmFmTuner); @@ -262,11 +264,11 @@ int QIviAmFmTuner::stepSize() const \value FMBand The FM Band is based on the Frequency Modulation technique and can range from 87.5 to 108.0 MHz. The step size is usually 100 kHz. - */ +*/ /*! \property QIviAmFmTuner::band \brief The current band of the tuner. - */ +*/ QIviAmFmTuner::Band QIviAmFmTuner::band() const { Q_D(const QIviAmFmTuner); @@ -276,11 +278,11 @@ QIviAmFmTuner::Band QIviAmFmTuner::band() const /*! \qmlproperty AmFmTunerStation AmFmTuner::station \brief The currently tuned station. - */ +*/ /*! \property QIviAmFmTuner::station \brief The currently tuned station. - */ +*/ QIviAmFmTunerStation QIviAmFmTuner::station() const { Q_D(const QIviAmFmTuner); @@ -292,13 +294,13 @@ QIviAmFmTunerStation QIviAmFmTuner::station() const \c true while a scan is in progress, \c false otherwise. \sa startScan() stopScan() scanStarted() scanStopped() - */ +*/ /*! \property QIviAmFmTuner::scanRunning \c true while a scan is in progress, \c false otherwise. \sa startScan() stopScan() scanStarted() scanStopped() - */ +*/ bool QIviAmFmTuner::isScanRunning() const { Q_D(const QIviAmFmTuner); @@ -486,7 +488,7 @@ void QIviAmFmTuner::stopScan() /*! \internal - */ +*/ QIviAmFmTuner::QIviAmFmTuner(QIviAmFmTunerPrivate &dd, QObject *parent) : QIviAbstractFeature(dd, parent) { @@ -494,7 +496,7 @@ QIviAmFmTuner::QIviAmFmTuner(QIviAmFmTunerPrivate &dd, QObject *parent) /*! \reimp - */ +*/ void QIviAmFmTuner::connectToServiceObject(QIviServiceObject *serviceObject) { Q_UNUSED(serviceObject); @@ -519,12 +521,13 @@ void QIviAmFmTuner::connectToServiceObject(QIviServiceObject *serviceObject) d, &QIviAmFmTunerPrivate::onStationChanged); QObjectPrivate::connect(backend, &QIviAmFmTunerBackendInterface::scanStatusChanged, d, &QIviAmFmTunerPrivate::onScanStatusChanged); - backend->initialize(); + + QIviAbstractFeature::connectToServiceObject(serviceObject); } /*! \reimp - */ +*/ void QIviAmFmTuner::clearServiceObject() { Q_D(QIviAmFmTuner); @@ -563,4 +566,6 @@ void QIviAmFmTuner::clearServiceObject() \sa startScan stopScan scanRunning scanStarted */ +QT_END_NAMESPACE + #include "moc_qiviamfmtuner.cpp" diff --git a/src/ivimedia/qiviamfmtuner.h b/src/ivimedia/qiviamfmtuner.h index 0322ff9..0667e7a 100644 --- a/src/ivimedia/qiviamfmtuner.h +++ b/src/ivimedia/qiviamfmtuner.h @@ -64,7 +64,7 @@ class Q_QTIVIMEDIA_EXPORT QIviAmFmTuner : public QIviAbstractFeature Q_PROPERTY(bool scanRunning READ isScanRunning NOTIFY scanRunningChanged) public: - explicit QIviAmFmTuner(QObject *parent = Q_NULLPTR); + explicit QIviAmFmTuner(QObject *parent = nullptr); enum Band { AMBand, @@ -105,10 +105,10 @@ Q_SIGNALS: void scanStopped(); protected: - QIviAmFmTuner(QIviAmFmTunerPrivate &dd, QObject *parent = Q_NULLPTR); + QIviAmFmTuner(QIviAmFmTunerPrivate &dd, QObject *parent = nullptr); - virtual void connectToServiceObject(QIviServiceObject *serviceObject) Q_DECL_OVERRIDE; - virtual void clearServiceObject() Q_DECL_OVERRIDE; + virtual void connectToServiceObject(QIviServiceObject *serviceObject) override; + virtual void clearServiceObject() override; private: Q_DECLARE_PRIVATE(QIviAmFmTuner) diff --git a/src/ivimedia/qiviamfmtunerbackendinterface.cpp b/src/ivimedia/qiviamfmtunerbackendinterface.cpp index fcdf6c5..54e32ff 100644 --- a/src/ivimedia/qiviamfmtunerbackendinterface.cpp +++ b/src/ivimedia/qiviamfmtunerbackendinterface.cpp @@ -41,11 +41,14 @@ #include "qiviamfmtunerbackendinterface.h" +QT_BEGIN_NAMESPACE + /*! \class QIviAmFmTunerBackendInterface \inmodule QtIviMedia \ingroup backends \inherits QObject + \keyword org.qt-project.qtivi.AmFmTuner/1.0 \brief The QIviAmFmTunerBackendInterface defines the interface for backends to the QIviAmFmTuner feature class. @@ -62,18 +65,11 @@ The \a parent is sent to the QObject constructor. */ QIviAmFmTunerBackendInterface::QIviAmFmTunerBackendInterface(QObject *parent) - : QObject(parent) + : QIviFeatureInterface(parent) { } /*! - \fn QIviAmFmTunerBackendInterface::initialize() - - Initializes the backend. This function is called, after a feature connected to the backend. - It is expected that this function will inform about the current state of the backend by emitting signals with the current status. -*/ - -/*! \fn QIviAmFmTunerBackendInterface::setFrequency(int frequency) Changes the frequency to the new value passed as \a frequency. @@ -199,3 +195,5 @@ QIviAmFmTunerBackendInterface::QIviAmFmTunerBackendInterface(QObject *parent) \sa startScan() stopScan() */ + +QT_END_NAMESPACE diff --git a/src/ivimedia/qiviamfmtunerbackendinterface.h b/src/ivimedia/qiviamfmtunerbackendinterface.h index b7136e6..d8ca8cb 100644 --- a/src/ivimedia/qiviamfmtunerbackendinterface.h +++ b/src/ivimedia/qiviamfmtunerbackendinterface.h @@ -42,22 +42,21 @@ #ifndef QIVIAMFMTUNERBACKENDINTERFACE_H #define QIVIAMFMTUNERBACKENDINTERFACE_H +#include <QtIviCore/QIviFeatureInterface> #include <QtIviMedia/qtivimediaglobal.h> #include <QtIviMedia/QIviAmFmTuner> -#include <QtCore/QObject> QT_BEGIN_NAMESPACE class QIviPlayableItem; -class Q_QTIVIMEDIA_EXPORT QIviAmFmTunerBackendInterface : public QObject +class Q_QTIVIMEDIA_EXPORT QIviAmFmTunerBackendInterface : public QIviFeatureInterface { Q_OBJECT public: - explicit QIviAmFmTunerBackendInterface(QObject *parent = Q_NULLPTR); + explicit QIviAmFmTunerBackendInterface(QObject *parent = nullptr); - virtual void initialize() = 0; virtual void setFrequency(int frequency) = 0; virtual void setBand(QIviAmFmTuner::Band band) = 0; virtual void stepUp() = 0; diff --git a/src/ivimedia/qivimediadevice.cpp b/src/ivimedia/qivimediadevice.cpp index f7896be..3ddca4f 100644 --- a/src/ivimedia/qivimediadevice.cpp +++ b/src/ivimedia/qivimediadevice.cpp @@ -41,6 +41,8 @@ #include "qivimediadevice.h" +QT_BEGIN_NAMESPACE + /*! \class QIviMediaDevice \inmodule QtIviMedia @@ -162,3 +164,5 @@ QString QIviMediaUsbDevice::type() const Ejects the USB media device and makes sure all data is written to the thumb-drive so it can safely be removed. */ + +QT_END_NAMESPACE diff --git a/src/ivimedia/qivimediadevice.h b/src/ivimedia/qivimediadevice.h index 42a8c08..266c548 100644 --- a/src/ivimedia/qivimediadevice.h +++ b/src/ivimedia/qivimediadevice.h @@ -55,7 +55,7 @@ class Q_QTIVIMEDIA_EXPORT QIviMediaDevice : public QIviServiceObject Q_PROPERTY(QString name READ name NOTIFY nameChanged) public: - explicit QIviMediaDevice(QObject *parent = Q_NULLPTR); + explicit QIviMediaDevice(QObject *parent = nullptr); virtual QString type() const = 0; virtual QString name() const = 0; @@ -68,9 +68,9 @@ class Q_QTIVIMEDIA_EXPORT QIviMediaUsbDevice : public QIviMediaDevice Q_OBJECT public: - explicit QIviMediaUsbDevice(QObject *parent = Q_NULLPTR); + explicit QIviMediaUsbDevice(QObject *parent = nullptr); - virtual QString type() const Q_DECL_OVERRIDE; + virtual QString type() const override; //TODO add a signal to indicate that the stick can be removed now. public Q_SLOTS: diff --git a/src/ivimedia/qivimediadevicediscoverymodel.cpp b/src/ivimedia/qivimediadevicediscoverymodel.cpp index f731a0c..1eae994 100644 --- a/src/ivimedia/qivimediadevicediscoverymodel.cpp +++ b/src/ivimedia/qivimediadevicediscoverymodel.cpp @@ -46,6 +46,8 @@ #include <QtIviMedia/QIviMediaDevice> #include <QtDebug> +QT_BEGIN_NAMESPACE + QIviMediaDeviceDiscoveryModelPrivate::QIviMediaDeviceDiscoveryModelPrivate(const QString &interface, QIviMediaDeviceDiscoveryModel *parent) : QIviAbstractFeatureListModelPrivate(interface, parent) , q_ptr(parent) @@ -94,7 +96,7 @@ void QIviMediaDeviceDiscoveryModelPrivate::onDeviceAdded(QIviServiceObject *devi m_deviceList += device; q->endInsertRows(); - q->deviceAdded(mdevice); + emit q->deviceAdded(mdevice); } void QIviMediaDeviceDiscoveryModelPrivate::onDeviceRemoved(QIviServiceObject *device) @@ -115,7 +117,7 @@ void QIviMediaDeviceDiscoveryModelPrivate::onDeviceRemoved(QIviServiceObject *de m_deviceList.takeAt(index); q->endRemoveRows(); - q->deviceRemoved(mdevice); + emit q->deviceRemoved(mdevice); delete device; } @@ -183,19 +185,19 @@ QIviMediaDeviceDiscoveryModelBackendInterface *QIviMediaDeviceDiscoveryModelPriv */ /*! - \enum QIviMediaDeviceDiscoveryModel::Roles - \value NameRole + \enum QIviMediaDeviceDiscoveryModel::Roles + \value NameRole The name of the media device. E.g. The name of the connected USB-Thumbdrive/SDCard or a connected Ipod. - \value TypeRole + \value TypeRole The type of the media device. See \l SupportedMediaDevices for a detailed listing. - \value ServiceObjectRole + \value ServiceObjectRole A pointer to the media device itself. This pointer can be used as the ServiceObject for other Features. E.g. The QIviSearchAndBrowseModel. */ /*! - Constructs a QIviMediaDeviceDiscoveryModel. + Constructs a QIviMediaDeviceDiscoveryModel. - The \a parent argument is passed on to the \l QIviAbstractFeatureListModel base class. + The \a parent argument is passed on to the \l QIviAbstractFeatureListModel base class. */ QIviMediaDeviceDiscoveryModel::QIviMediaDeviceDiscoveryModel(QObject *parent) : QIviAbstractFeatureListModel(*new QIviMediaDeviceDiscoveryModelPrivate(QLatin1String(QIviMediaDeviceDiscovery_iid), this), parent) @@ -205,11 +207,11 @@ QIviMediaDeviceDiscoveryModel::QIviMediaDeviceDiscoveryModel(QObject *parent) /*! \qmlproperty int MediaDeviceDiscoveryModel::count \brief Holds the current number of rows in this model. - */ +*/ /*! \property QIviMediaDeviceDiscoveryModel::count \brief Holds the current number of rows in this model. - */ +*/ int QIviMediaDeviceDiscoveryModel::rowCount(const QModelIndex &parent) const { Q_D(const QIviMediaDeviceDiscoveryModel); @@ -253,7 +255,7 @@ QVariant QIviMediaDeviceDiscoveryModel::data(const QModelIndex &index, int role) \note The returned device is owned by the model and can be deleted at any time. If stored in a property or a var, this could lead to a dangling pointer. - */ +*/ /*! Returns the media device at index \a i. @@ -320,6 +322,8 @@ void QIviMediaDeviceDiscoveryModel::connectToServiceObject(QIviServiceObject *se QObjectPrivate::connect(backend, &QIviMediaDeviceDiscoveryModelBackendInterface::deviceRemoved, d, &QIviMediaDeviceDiscoveryModelPrivate::onDeviceRemoved); + QIviAbstractFeatureListModel::connectToServiceObject(serviceObject); + backend->initialize(); } @@ -358,4 +362,6 @@ void QIviMediaDeviceDiscoveryModel::clearServiceObject() Afterwards the device will be deleted. */ +QT_END_NAMESPACE + #include "moc_qivimediadevicediscoverymodel.cpp" diff --git a/src/ivimedia/qivimediadevicediscoverymodel.h b/src/ivimedia/qivimediadevicediscoverymodel.h index af54088..cecd649 100644 --- a/src/ivimedia/qivimediadevicediscoverymodel.h +++ b/src/ivimedia/qivimediadevicediscoverymodel.h @@ -64,14 +64,14 @@ public: ServiceObjectRole = Qt::UserRole + 1 }; - explicit QIviMediaDeviceDiscoveryModel(QObject *parent = Q_NULLPTR); + explicit QIviMediaDeviceDiscoveryModel(QObject *parent = nullptr); - int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; - virtual QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE; + int rowCount(const QModelIndex &parent = QModelIndex()) const override; + virtual QVariant data(const QModelIndex &index, int role) const override; Q_INVOKABLE QIviMediaDevice *get(int i) const; QIviMediaDevice *at(int i) const; - virtual QHash<int, QByteArray> roleNames() const Q_DECL_OVERRIDE; + virtual QHash<int, QByteArray> roleNames() const override; Q_SIGNALS: void countChanged(); @@ -79,10 +79,10 @@ Q_SIGNALS: void deviceRemoved(QIviMediaDevice *device); protected: - QIviMediaDeviceDiscoveryModel(QIviMediaDeviceDiscoveryModelPrivate &dd, QObject *parent = Q_NULLPTR); + QIviMediaDeviceDiscoveryModel(QIviMediaDeviceDiscoveryModelPrivate &dd, QObject *parent = nullptr); - virtual void connectToServiceObject(QIviServiceObject *serviceObject) Q_DECL_OVERRIDE; - virtual void clearServiceObject() Q_DECL_OVERRIDE; + virtual void connectToServiceObject(QIviServiceObject *serviceObject) override; + virtual void clearServiceObject() override; private: Q_DECLARE_PRIVATE(QIviMediaDeviceDiscoveryModel) diff --git a/src/ivimedia/qivimediadevicediscoverymodel_p.h b/src/ivimedia/qivimediadevicediscoverymodel_p.h index 892fa8b..d52e364 100644 --- a/src/ivimedia/qivimediadevicediscoverymodel_p.h +++ b/src/ivimedia/qivimediadevicediscoverymodel_p.h @@ -66,7 +66,7 @@ class QIviMediaDeviceDiscoveryModelPrivate : public QIviAbstractFeatureListModel public: QIviMediaDeviceDiscoveryModelPrivate(const QString &interface, QIviMediaDeviceDiscoveryModel *parent); - virtual void initialize() Q_DECL_OVERRIDE; + virtual void initialize() override; void clearToDefaults(); void resetModel(const QList<QIviServiceObject *> deviceList); void onDeviceAdded(QIviServiceObject *device); diff --git a/src/ivimedia/qivimediadevicediscoverymodelbackendinterface.cpp b/src/ivimedia/qivimediadevicediscoverymodelbackendinterface.cpp index 82a8b7a..439d6c4 100644 --- a/src/ivimedia/qivimediadevicediscoverymodelbackendinterface.cpp +++ b/src/ivimedia/qivimediadevicediscoverymodelbackendinterface.cpp @@ -41,11 +41,14 @@ #include "qivimediadevicediscoverymodelbackendinterface.h" +QT_BEGIN_NAMESPACE + /*! \class QIviMediaDeviceDiscoveryModelBackendInterface \inmodule QtIviMedia \ingroup backends \inherits QObject + \keyword org.qt-project.qtivi.MediaDiscovery/1.0 \brief The QIviMediaDeviceDiscoveryModelBackendInterface defines the interface for backends to the QIviMediaDeviceDiscoveryModel feature class. @@ -62,7 +65,7 @@ The \a parent is sent to the QObject constructor. */ QIviMediaDeviceDiscoveryModelBackendInterface::QIviMediaDeviceDiscoveryModelBackendInterface(QObject *parent) - : QObject(parent) + : QIviFeatureInterface(parent) { } @@ -102,3 +105,5 @@ QIviMediaDeviceDiscoveryModelBackendInterface::QIviMediaDeviceDiscoveryModelBack This signal is emitted when a \a device has been removed from the system and cannot be used anymore. */ + +QT_END_NAMESPACE diff --git a/src/ivimedia/qivimediadevicediscoverymodelbackendinterface.h b/src/ivimedia/qivimediadevicediscoverymodelbackendinterface.h index 9f47564..96b92c5 100644 --- a/src/ivimedia/qivimediadevicediscoverymodelbackendinterface.h +++ b/src/ivimedia/qivimediadevicediscoverymodelbackendinterface.h @@ -42,17 +42,17 @@ #ifndef QIVIMEDIADEVICEDISCOVERYMODELBACKENDINTERFACE_H #define QIVIMEDIADEVICEDISCOVERYMODELBACKENDINTERFACE_H -#include <QtCore/QObject> +#include <QtIviCore/QIviFeatureInterface> #include <QtIviCore/QIviServiceObject> #include <QtIviMedia/qtivimediaglobal.h> QT_BEGIN_NAMESPACE -class Q_QTIVIMEDIA_EXPORT QIviMediaDeviceDiscoveryModelBackendInterface : public QObject +class Q_QTIVIMEDIA_EXPORT QIviMediaDeviceDiscoveryModelBackendInterface : public QIviFeatureInterface { Q_OBJECT public: - explicit QIviMediaDeviceDiscoveryModelBackendInterface(QObject *parent = Q_NULLPTR); + explicit QIviMediaDeviceDiscoveryModelBackendInterface(QObject *parent = nullptr); virtual void initialize() = 0; diff --git a/src/ivimedia/qivimediaindexercontrol.cpp b/src/ivimedia/qivimediaindexercontrol.cpp index 89423bc..baae4bb 100644 --- a/src/ivimedia/qivimediaindexercontrol.cpp +++ b/src/ivimedia/qivimediaindexercontrol.cpp @@ -45,6 +45,8 @@ #include <QIviServiceObject> #include <QtDebug> +QT_BEGIN_NAMESPACE + QIviMediaIndexerControlPrivate::QIviMediaIndexerControlPrivate(const QString &interface, QIviMediaIndexerControl *parent) : QIviAbstractFeaturePrivate(interface, parent) , q_ptr(parent) @@ -128,9 +130,9 @@ QIviMediaIndexerControlBackendInterface *QIviMediaIndexerControlPrivate::indexer */ /*! - Constructs a QIviMediaIndexerControl. + Constructs a QIviMediaIndexerControl. - The \a parent argument is passed on to the \l QIviAbstractFeature base class. + The \a parent argument is passed on to the \l QIviAbstractFeature base class. */ QIviMediaIndexerControl::QIviMediaIndexerControl(QObject *parent) : QIviAbstractFeature(*new QIviMediaIndexerControlPrivate(QLatin1String(QIviMediaIndexer_iid), this), parent) @@ -142,13 +144,13 @@ QIviMediaIndexerControl::QIviMediaIndexerControl(QObject *parent) \brief Holds the progress of the indexing operation. The value is between \e 0 and \e 1. - */ +*/ /*! \property QIviMediaIndexerControl::progress \brief Holds the progress of the indexing operation. The value is between \e 0 and \e 1. - */ +*/ qreal QIviMediaIndexerControl::progress() const { Q_D(const QIviMediaIndexerControl); @@ -168,11 +170,11 @@ qreal QIviMediaIndexerControl::progress() const The indexer is paused, due to a call to pause(). \value Error An error has occurred during the indexing operation. - */ +*/ /*! \property QIviMediaIndexerControl::state \brief Holds the current state of the indexer. - */ +*/ QIviMediaIndexerControl::State QIviMediaIndexerControl::state() const { Q_D(const QIviMediaIndexerControl); @@ -249,6 +251,8 @@ void QIviMediaIndexerControl::connectToServiceObject(QIviServiceObject *serviceO QObjectPrivate::connect(backend, &QIviMediaIndexerControlBackendInterface::stateChanged, d, &QIviMediaIndexerControlPrivate::onStateChanged); + QIviAbstractFeature::connectToServiceObject(serviceObject); + backend->initialize(); } @@ -261,4 +265,6 @@ void QIviMediaIndexerControl::clearServiceObject() d->clearToDefaults(); } +QT_END_NAMESPACE + #include "moc_qivimediaindexercontrol.cpp" diff --git a/src/ivimedia/qivimediaindexercontrol.h b/src/ivimedia/qivimediaindexercontrol.h index 93f736d..bb99c0c 100644 --- a/src/ivimedia/qivimediaindexercontrol.h +++ b/src/ivimedia/qivimediaindexercontrol.h @@ -65,7 +65,7 @@ public: }; Q_ENUM(State) - explicit QIviMediaIndexerControl(QObject *parent = Q_NULLPTR); + explicit QIviMediaIndexerControl(QObject *parent = nullptr); qreal progress() const; QIviMediaIndexerControl::State state() const; @@ -79,10 +79,10 @@ Q_SIGNALS: void stateChanged(QIviMediaIndexerControl::State state); protected: - QIviMediaIndexerControl(QIviMediaIndexerControlPrivate &dd, QObject *parent = Q_NULLPTR); + QIviMediaIndexerControl(QIviMediaIndexerControlPrivate &dd, QObject *parent = nullptr); - virtual void connectToServiceObject(QIviServiceObject *serviceObject) Q_DECL_OVERRIDE; - virtual void clearServiceObject() Q_DECL_OVERRIDE; + virtual void connectToServiceObject(QIviServiceObject *serviceObject) override; + virtual void clearServiceObject() override; private: Q_DECLARE_PRIVATE(QIviMediaIndexerControl) diff --git a/src/ivimedia/qivimediaindexercontrolbackendinterface.cpp b/src/ivimedia/qivimediaindexercontrolbackendinterface.cpp index 90cee8f..fca7050 100644 --- a/src/ivimedia/qivimediaindexercontrolbackendinterface.cpp +++ b/src/ivimedia/qivimediaindexercontrolbackendinterface.cpp @@ -41,11 +41,14 @@ #include "qivimediaindexercontrolbackendinterface.h" +QT_BEGIN_NAMESPACE + /*! \class QIviMediaIndexerControlBackendInterface \inmodule QtIviMedia \ingroup backends \inherits QObject + \keyword org.qt-project.qtivi.MediaIndexer/1.0 \brief The QIviMediaIndexerControlBackendInterface defines the interface for backends to the QIviMediaIndexerControl feature class. @@ -62,7 +65,7 @@ The \a parent is sent to the QObject constructor. */ QIviMediaIndexerControlBackendInterface::QIviMediaIndexerControlBackendInterface(QObject *parent) - : QObject(parent) + : QIviFeatureInterface(parent) { } @@ -106,3 +109,5 @@ QIviMediaIndexerControlBackendInterface::QIviMediaIndexerControlBackendInterface This signal is emitted whenever the indexing state changed. The \a state argument holds the new state of the indexer. */ + +QT_END_NAMESPACE diff --git a/src/ivimedia/qivimediaindexercontrolbackendinterface.h b/src/ivimedia/qivimediaindexercontrolbackendinterface.h index c31c1d0..b261a7c 100644 --- a/src/ivimedia/qivimediaindexercontrolbackendinterface.h +++ b/src/ivimedia/qivimediaindexercontrolbackendinterface.h @@ -42,17 +42,17 @@ #ifndef QIVIMEDIAINDEXERCONTROLBACKENDINTERFACE_H #define QIVIMEDIAINDEXERCONTROLBACKENDINTERFACE_H -#include <QObject> +#include <QtIviCore/QIviFeatureInterface> #include <QtIviMedia/qtivimediaglobal.h> #include <QtIviMedia/QIviMediaIndexerControl> QT_BEGIN_NAMESPACE -class Q_QTIVIMEDIA_EXPORT QIviMediaIndexerControlBackendInterface : public QObject +class Q_QTIVIMEDIA_EXPORT QIviMediaIndexerControlBackendInterface : public QIviFeatureInterface { Q_OBJECT public: - explicit QIviMediaIndexerControlBackendInterface(QObject *parent = Q_NULLPTR); + explicit QIviMediaIndexerControlBackendInterface(QObject *parent = nullptr); virtual void initialize() = 0; virtual void pause() = 0; diff --git a/src/ivimedia/qivimediaplayer.cpp b/src/ivimedia/qivimediaplayer.cpp index ff0aa0e..11b2110 100644 --- a/src/ivimedia/qivimediaplayer.cpp +++ b/src/ivimedia/qivimediaplayer.cpp @@ -47,13 +47,15 @@ #include <QtIviCore/QIviServiceObject> #include <QtDebug> +QT_BEGIN_NAMESPACE + QIviMediaPlayerPrivate::QIviMediaPlayerPrivate(const QString &interface, QIviMediaPlayer *parent) : QIviAbstractFeaturePrivate(interface, parent) , q_ptr(parent) , m_playQueue(nullptr) , m_playMode(QIviMediaPlayer::Normal) , m_playState(QIviMediaPlayer::Stopped) - , m_currentTrack(0) + , m_currentTrack(nullptr) , m_position(-1) , m_duration(-1) { @@ -172,33 +174,33 @@ QIviMediaPlayerBackendInterface *QIviMediaPlayerPrivate::playerBackend() const */ /*! - \enum QIviMediaPlayer::PlayMode - \value Normal + \enum QIviMediaPlayer::PlayMode + \value Normal Each item in the queue is played in sequential order. Usually the playback stops when the end of the queue is reached. - \value RepeatTrack + \value RepeatTrack Always repeat the current item. It should still be possible to change the current item using next() and previous(), but this depends on the implementation of the backend. - \value RepeatAll + \value RepeatAll When the end of the queue is reached, the first item starts to play. - \value Shuffle + \value Shuffle The item in the queue are played in an random order. */ /*! - \enum QIviMediaPlayer::PlayState - \value Playing + \enum QIviMediaPlayer::PlayState + \value Playing The media player is currently playing an item. - \value Paused + \value Paused The playback is paused and can be continued at the same position. - \value Stopped + \value Stopped The playback hasn't been started yet. Starting it, will always start from the beginning. */ /*! - Constructs a QIviMediaPlayer. + Constructs a QIviMediaPlayer. - The \a parent argument is passed on to the \l QIviAbstractFeature base class. + The \a parent argument is passed on to the \l QIviAbstractFeature base class. */ QIviMediaPlayer::QIviMediaPlayer(QObject *parent) : QIviAbstractFeature(*new QIviMediaPlayerPrivate(QLatin1String(QIviMediaPlayer_iid), this), parent) @@ -210,13 +212,13 @@ QIviMediaPlayer::QIviMediaPlayer(QObject *parent) \brief Holds the play queue of this media player. \sa PlayQueue - */ +*/ /*! \property QIviMediaPlayer::playQueue \brief Holds the play queue of this media player. \sa QIviPlayQueue - */ +*/ QIviPlayQueue *QIviMediaPlayer::playQueue() const { Q_D(const QIviMediaPlayer); @@ -237,11 +239,11 @@ QIviPlayQueue *QIviMediaPlayer::playQueue() const When the end of the queue is reached, the first item starts to play. \value Shuffle The item in the queue are played in an random order. - */ +*/ /*! \property QIviMediaPlayer::playMode \brief Holds the current playback mode of the media player. - */ +*/ QIviMediaPlayer::PlayMode QIviMediaPlayer::playMode() const { Q_D(const QIviMediaPlayer); @@ -258,11 +260,11 @@ QIviMediaPlayer::PlayMode QIviMediaPlayer::playMode() const The playback is paused and can be continued at the same position. \value Stopped The playback hasn't been started yet. Starting it, will always start from the beginning. - */ +*/ /*! \property QIviMediaPlayer::playState \brief Holds the current playback state of the media player. - */ +*/ QIviMediaPlayer::PlayState QIviMediaPlayer::playState() const { Q_D(const QIviMediaPlayer); @@ -274,13 +276,13 @@ QIviMediaPlayer::PlayState QIviMediaPlayer::playState() const \brief Holds the current track represented as QVariant. \note This will be replaced by soon. - */ +*/ /*! \property QIviMediaPlayer::currentTrack \brief Holds the current track represented as QVariant. \note This will be replaced by soon. - */ +*/ QVariant QIviMediaPlayer::currentTrack() const { Q_D(const QIviMediaPlayer); @@ -290,11 +292,11 @@ QVariant QIviMediaPlayer::currentTrack() const /*! \qmlproperty int MediaPlayer::position \brief Holds the position of the current song of the media player in seconds. - */ +*/ /*! \property QIviMediaPlayer::position \brief Holds the position of the current song of the media player in seconds. - */ +*/ qint64 QIviMediaPlayer::position() const { Q_D(const QIviMediaPlayer); @@ -304,11 +306,11 @@ qint64 QIviMediaPlayer::position() const /*! \qmlproperty int MediaPlayer::duration \brief Holds the total duration of the current song in seconds. - */ +*/ /*! \property QIviMediaPlayer::duration \brief Holds the total duration of the current song in seconds. - */ +*/ qint64 QIviMediaPlayer::duration() const { Q_D(const QIviMediaPlayer); @@ -479,7 +481,7 @@ void QIviMediaPlayer::previous() /*! \internal - */ +*/ QIviMediaPlayer::QIviMediaPlayer(QIviMediaPlayerPrivate &dd, QObject *parent) : QIviAbstractFeature(dd, parent) { @@ -487,7 +489,7 @@ QIviMediaPlayer::QIviMediaPlayer(QIviMediaPlayerPrivate &dd, QObject *parent) /*! \reimp - */ +*/ void QIviMediaPlayer::connectToServiceObject(QIviServiceObject *serviceObject) { Q_UNUSED(serviceObject); @@ -517,17 +519,20 @@ void QIviMediaPlayer::connectToServiceObject(QIviServiceObject *serviceObject) QObjectPrivate::connect(backend, &QIviMediaPlayerBackendInterface::currentIndexChanged, d->m_playQueue->d_func(), &QIviPlayQueuePrivate::onCurrentIndexChanged); - backend->initialize(); + QIviAbstractFeature::connectToServiceObject(serviceObject); + d->m_playQueue->d_func()->resetModel(); } /*! \reimp - */ +*/ void QIviMediaPlayer::clearServiceObject() { Q_D(QIviMediaPlayer); d->clearToDefaults(); } +QT_END_NAMESPACE + #include "moc_qivimediaplayer.cpp" diff --git a/src/ivimedia/qivimediaplayer.h b/src/ivimedia/qivimediaplayer.h index 6ecd12a..7f32e05 100644 --- a/src/ivimedia/qivimediaplayer.h +++ b/src/ivimedia/qivimediaplayer.h @@ -79,7 +79,7 @@ public: }; Q_ENUM(PlayState) - explicit QIviMediaPlayer(QObject *parent = Q_NULLPTR); + explicit QIviMediaPlayer(QObject *parent = nullptr); QIviPlayQueue *playQueue() const; PlayMode playMode() const; @@ -106,10 +106,10 @@ Q_SIGNALS: void durationChanged(qint64 duration); protected: - QIviMediaPlayer(QIviMediaPlayerPrivate &dd, QObject *parent = Q_NULLPTR); + QIviMediaPlayer(QIviMediaPlayerPrivate &dd, QObject *parent = nullptr); - virtual void connectToServiceObject(QIviServiceObject *serviceObject) Q_DECL_OVERRIDE; - virtual void clearServiceObject() Q_DECL_OVERRIDE; + virtual void connectToServiceObject(QIviServiceObject *serviceObject) override; + virtual void clearServiceObject() override; private: Q_DECLARE_PRIVATE(QIviMediaPlayer) diff --git a/src/ivimedia/qivimediaplayer_p.h b/src/ivimedia/qivimediaplayer_p.h index 0053d1d..619ec95 100644 --- a/src/ivimedia/qivimediaplayer_p.h +++ b/src/ivimedia/qivimediaplayer_p.h @@ -66,7 +66,7 @@ class QIviMediaPlayerPrivate : public QIviAbstractFeaturePrivate public: QIviMediaPlayerPrivate(const QString &interface, QIviMediaPlayer *parent); - virtual void initialize() Q_DECL_OVERRIDE; + virtual void initialize() override; void clearToDefaults(); void onPlayModeChanged(QIviMediaPlayer::PlayMode playMode); void onPlayStateChanged(QIviMediaPlayer::PlayState playState); diff --git a/src/ivimedia/qivimediaplayerbackendinterface.cpp b/src/ivimedia/qivimediaplayerbackendinterface.cpp index e0efe5e..d9f7320 100644 --- a/src/ivimedia/qivimediaplayerbackendinterface.cpp +++ b/src/ivimedia/qivimediaplayerbackendinterface.cpp @@ -41,11 +41,14 @@ #include "qivimediaplayerbackendinterface.h" +QT_BEGIN_NAMESPACE + /*! \class QIviMediaPlayerBackendInterface \inmodule QtIviMedia \ingroup backends \inherits QObject + \keyword org.qt-project.qtivi.MediaPlayer/1.0 \brief The QIviMediaPlayerBackendInterface defines the interface for backends to the QIviMediaPlayer feature class. @@ -62,19 +65,12 @@ The \a parent is sent to the QObject constructor. */ QIviMediaPlayerBackendInterface::QIviMediaPlayerBackendInterface(QObject *parent) - : QObject(parent) + : QIviFeatureInterface(parent) { } /*! - \fn QIviMediaPlayerBackendInterface::initialize() - - Initializes the backend. This function is called, after a feature connected to the backend. - It is expected that this function will inform about the current state of the backend by emitting signals with the current status. -*/ - -/*! \fn QIviMediaPlayerBackendInterface::play() Starts playing the current playable item. @@ -274,3 +270,5 @@ QIviMediaPlayerBackendInterface::QIviMediaPlayerBackendInterface(QObject *parent \sa insert() remove() move() */ + +QT_END_NAMESPACE diff --git a/src/ivimedia/qivimediaplayerbackendinterface.h b/src/ivimedia/qivimediaplayerbackendinterface.h index ab33505..8ad42aa 100644 --- a/src/ivimedia/qivimediaplayerbackendinterface.h +++ b/src/ivimedia/qivimediaplayerbackendinterface.h @@ -42,22 +42,21 @@ #ifndef QIVIMEDIAPLAYERBACKENDINTERFACE_H #define QIVIMEDIAPLAYERBACKENDINTERFACE_H +#include <QtIviCore/QIviFeatureInterface> #include <QtIviMedia/qtivimediaglobal.h> #include <QtIviMedia/QIviMediaPlayer> -#include <QtCore/QObject> QT_BEGIN_NAMESPACE class QIviPlayableItem; -class Q_QTIVIMEDIA_EXPORT QIviMediaPlayerBackendInterface : public QObject +class Q_QTIVIMEDIA_EXPORT QIviMediaPlayerBackendInterface : public QIviFeatureInterface { Q_OBJECT public: - explicit QIviMediaPlayerBackendInterface(QObject *parent = Q_NULLPTR); + explicit QIviMediaPlayerBackendInterface(QObject *parent = nullptr); - virtual void initialize() = 0; virtual void play() = 0; virtual void pause() = 0; virtual void stop() = 0; diff --git a/src/ivimedia/qiviplayableitem.cpp b/src/ivimedia/qiviplayableitem.cpp index 91c8a31..8f6cd62 100644 --- a/src/ivimedia/qiviplayableitem.cpp +++ b/src/ivimedia/qiviplayableitem.cpp @@ -91,8 +91,6 @@ public: int m_rating; }; -QT_END_NAMESPACE - /*! \class QIviPlayableItem \inmodule QtIviMedia @@ -474,3 +472,5 @@ bool QIviAudioTrackItem::operator==(const QIviAudioTrackItem &other) \sa operator==() */ + +QT_END_NAMESPACE diff --git a/src/ivimedia/qiviplayableitem.h b/src/ivimedia/qiviplayableitem.h index ad70cb7..aadb0c9 100644 --- a/src/ivimedia/qiviplayableitem.h +++ b/src/ivimedia/qiviplayableitem.h @@ -59,14 +59,14 @@ class Q_QTIVIMEDIA_EXPORT QIviPlayableItem : public QIviSearchAndBrowseModelItem Q_PROPERTY(QUrl url READ url WRITE setUrl) public: - QIviPlayableItem(); - QIviPlayableItem(const QIviPlayableItem &); + explicit QIviPlayableItem(); + explicit QIviPlayableItem(const QIviPlayableItem &); QIviPlayableItem &operator=(const QIviPlayableItem &); - virtual ~QIviPlayableItem(); + ~QIviPlayableItem(); virtual QUrl url() const; virtual void setUrl(const QUrl &url); - virtual QString type() const Q_DECL_OVERRIDE; + virtual QString type() const override; bool operator==(const QIviPlayableItem &other); inline bool operator!=(const QIviPlayableItem &other) { return !(*this == other); } @@ -94,7 +94,7 @@ public: QIviAudioTrackItem(); QIviAudioTrackItem(const QIviAudioTrackItem &); QIviAudioTrackItem &operator=(const QIviAudioTrackItem &); - virtual ~QIviAudioTrackItem(); + ~QIviAudioTrackItem(); virtual QString title(); virtual void setTitle(const QString &title); @@ -114,8 +114,8 @@ public: virtual void setCoverArtUrl(const QUrl &url); virtual int rating(); virtual void setRating(int rating); - virtual QString name() const Q_DECL_OVERRIDE; - virtual QString type() const Q_DECL_OVERRIDE; + virtual QString name() const override; + virtual QString type() const override; bool operator==(const QIviAudioTrackItem &other); inline bool operator!=(const QIviAudioTrackItem &other) { return !(*this == other); } diff --git a/src/ivimedia/qiviplayqueue.cpp b/src/ivimedia/qiviplayqueue.cpp index a6cbbb6..7a34bd0 100644 --- a/src/ivimedia/qiviplayqueue.cpp +++ b/src/ivimedia/qiviplayqueue.cpp @@ -46,6 +46,8 @@ #include <QtDebug> +QT_BEGIN_NAMESPACE + QIviPlayQueuePrivate::QIviPlayQueuePrivate(QIviMediaPlayer *player, QIviPlayQueue *model) : QAbstractItemModelPrivate() , q_ptr(model) @@ -110,7 +112,7 @@ void QIviPlayQueuePrivate::onDataFetched(const QList<QVariant> &items, int start for (int i = 0; i < items.count(); i++) m_itemList.replace(start + i, items.at(i)); - q->dataChanged(q->index(start), q->index(start + items.count() -1)); + emit q->dataChanged(q->index(start), q->index(start + items.count() -1)); } } @@ -153,7 +155,7 @@ void QIviPlayQueuePrivate::onDataChanged(const QList<QVariant> &data, int start, if (updateCount > 0) { for (int i = start, j=0; j < updateCount; i++, j++) m_itemList.replace(i, data.at(j)); - q->dataChanged(q->index(start), q->index(start + updateCount -1)); + emit q->dataChanged(q->index(start), q->index(start + updateCount -1)); } if (delta < 0) { //Remove @@ -248,12 +250,12 @@ QIviMediaPlayerBackendInterface *QIviPlayQueuePrivate::playerBackend() const */ /*! - \enum QIviPlayQueue::Roles - \value NameRole + \enum QIviPlayQueue::Roles + \value NameRole The name of the playable item. E.g. The track name or the name of the web-stream. - \value TypeRole + \value TypeRole The type of the playable item. E.g. \e "track" or \e "web-stream" - \value ItemRole + \value ItemRole The playable item instance. This can be used to access type specific properties like the artist. */ @@ -297,14 +299,14 @@ QIviPlayQueue::~QIviPlayQueue() \brief Holds the index of the currently active track. Use the get() method to retrieve more information about the active track. - */ +*/ /*! \property QIviPlayQueue::currentIndex \brief Holds the index of the currently active track. Use the get() method to retrieve more information about the active track. - */ +*/ int QIviPlayQueue::currentIndex() const { Q_D(const QIviPlayQueue); @@ -326,7 +328,7 @@ void QIviPlayQueue::setCurrentIndex(int currentIndex) Bigger chunks means less calls to the backend and to a potential IPC underneath, but more data to be transferred and probably longer waiting time until the request was finished. - */ +*/ /*! \property QIviPlayQueue::chunkSize @@ -336,7 +338,7 @@ void QIviPlayQueue::setCurrentIndex(int currentIndex) Bigger chunks means less calls to the backend and to a potential IPC underneath, but more data to be transferred and probably longer waiting time until the request was finished. - */ +*/ int QIviPlayQueue::chunkSize() const { Q_D(const QIviPlayQueue); @@ -364,7 +366,7 @@ void QIviPlayQueue::setChunkSize(int chunkSize) The threshold defines the number of rows before the cached rows ends. \note This property is only used when loadingType is set to FetchMore. - */ +*/ /*! \property QIviPlayQueue::fetchMoreThreshold @@ -377,7 +379,7 @@ void QIviPlayQueue::setChunkSize(int chunkSize) The threshold defines the number of rows before the cached rows ends. \note This property is only used when loadingType is set to FetchMore. - */ +*/ int QIviPlayQueue::fetchMoreThreshold() const { Q_D(const QIviPlayQueue); @@ -399,14 +401,14 @@ void QIviPlayQueue::setFetchMoreThreshold(int fetchMoreThreshold) \brief Holds the currently used loading type used for loading the data. \note When changing this property the content will be reset. - */ +*/ /*! \property QIviPlayQueue::loadingType \brief Holds the currently used loading type used for loading the data. \note When changing this property the content will be reset. - */ +*/ QIviPlayQueue::LoadingType QIviPlayQueue::loadingType() const { Q_D(const QIviPlayQueue); @@ -433,11 +435,11 @@ void QIviPlayQueue::setLoadingType(QIviPlayQueue::LoadingType loadingType) /*! \qmlproperty int PlayQueue::count \brief Holds the current number of rows in this model. - */ +*/ /*! \property QIviPlayQueue::count \brief Holds the current number of rows in this model. - */ +*/ int QIviPlayQueue::rowCount(const QModelIndex &parent) const { Q_D(const QIviPlayQueue); @@ -449,7 +451,7 @@ int QIviPlayQueue::rowCount(const QModelIndex &parent) const /*! \reimp - */ +*/ QVariant QIviPlayQueue::data(const QModelIndex &index, int role) const { Q_D(const QIviPlayQueue); @@ -486,7 +488,7 @@ QVariant QIviPlayQueue::data(const QModelIndex &index, int role) const \qmlmethod object PlayQueue::get(i) Returns the item at index \a i. - */ +*/ /*! Returns the item at index \a i. @@ -562,7 +564,7 @@ void QIviPlayQueue::move(int cur_index, int new_index) /*! \reimp - */ +*/ bool QIviPlayQueue::canFetchMore(const QModelIndex &parent) const { Q_D(const QIviPlayQueue); @@ -574,7 +576,7 @@ bool QIviPlayQueue::canFetchMore(const QModelIndex &parent) const /*! \reimp - */ +*/ void QIviPlayQueue::fetchMore(const QModelIndex &parent) { Q_D(QIviPlayQueue); @@ -590,7 +592,7 @@ void QIviPlayQueue::fetchMore(const QModelIndex &parent) /*! \reimp - */ +*/ QHash<int, QByteArray> QIviPlayQueue::roleNames() const { static QHash<int, QByteArray> roles; @@ -604,7 +606,7 @@ QHash<int, QByteArray> QIviPlayQueue::roleNames() const /*! Creates a play queue for the QIviMediaPlayer instance \a parent. - */ +*/ QIviPlayQueue::QIviPlayQueue(QIviMediaPlayer *parent) : QAbstractListModel(*new QIviPlayQueuePrivate(parent, this), parent) { @@ -624,4 +626,6 @@ QIviPlayQueue::QIviPlayQueue(QIviMediaPlayer *parent) This signal is emitted whenever the fetchMoreThreshold is reached and new data is requested from the backend. */ +QT_END_NAMESPACE + #include "moc_qiviplayqueue.cpp" diff --git a/src/ivimedia/qiviplayqueue.h b/src/ivimedia/qiviplayqueue.h index 0600437..db20745 100644 --- a/src/ivimedia/qiviplayqueue.h +++ b/src/ivimedia/qiviplayqueue.h @@ -89,13 +89,13 @@ public: QIviPlayQueue::LoadingType loadingType() const; void setLoadingType(QIviPlayQueue::LoadingType loadingType); - int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE; - QVariant data(const QModelIndex &index, int role) const Q_DECL_OVERRIDE; + int rowCount(const QModelIndex &parent = QModelIndex()) const override; + QVariant data(const QModelIndex &index, int role) const override; - bool canFetchMore(const QModelIndex &parent) const Q_DECL_OVERRIDE; - void fetchMore(const QModelIndex &parent) Q_DECL_OVERRIDE; + bool canFetchMore(const QModelIndex &parent) const override; + void fetchMore(const QModelIndex &parent) override; - QHash<int, QByteArray> roleNames() const Q_DECL_OVERRIDE; + QHash<int, QByteArray> roleNames() const override; Q_INVOKABLE QVariant get(int index) const; @@ -117,7 +117,7 @@ Q_SIGNALS: void currentIndexChanged(int currentIndex); protected: - explicit QIviPlayQueue(QIviMediaPlayer *parent = Q_NULLPTR); + explicit QIviPlayQueue(QIviMediaPlayer *parent = nullptr); private: Q_DECLARE_PRIVATE(QIviPlayQueue) diff --git a/src/ivimedia/qivitunerstation.cpp b/src/ivimedia/qivitunerstation.cpp index 9a22305..9898e3c 100644 --- a/src/ivimedia/qivitunerstation.cpp +++ b/src/ivimedia/qivitunerstation.cpp @@ -84,8 +84,6 @@ public: QIviAmFmTuner::Band m_band; }; -QT_END_NAMESPACE - /*! \class QIviTunerStation \inmodule QtIviMedia @@ -414,3 +412,5 @@ bool QIviAmFmTunerStation::operator==(const QIviAmFmTunerStation &other) \sa operator==() */ + +QT_END_NAMESPACE diff --git a/src/ivimedia/qivitunerstation.h b/src/ivimedia/qivitunerstation.h index ea29dfb..1e028fb 100644 --- a/src/ivimedia/qivitunerstation.h +++ b/src/ivimedia/qivitunerstation.h @@ -66,7 +66,7 @@ public: QIviTunerStation(); QIviTunerStation(const QIviTunerStation &); QIviTunerStation &operator=(const QIviTunerStation &); - virtual ~QIviTunerStation(); + ~QIviTunerStation(); virtual QString stationName() const; virtual void setStationName(const QString &stationName); @@ -80,8 +80,8 @@ public: void setRadioText(QString radioText); int receptionQuality() const; void setReceptionQuality(int receptionQuality); - virtual QString name() const Q_DECL_OVERRIDE; - virtual QString type() const Q_DECL_OVERRIDE; + virtual QString name() const override; + virtual QString type() const override; bool operator==(const QIviTunerStation &other); inline bool operator!=(const QIviTunerStation &other) { return !(*this == other); } @@ -105,7 +105,7 @@ public: virtual QIviAmFmTuner::Band band() const; virtual void setBand(QIviAmFmTuner::Band band); - virtual QString type() const Q_DECL_OVERRIDE; + virtual QString type() const override; bool operator==(const QIviAmFmTunerStation &other); inline bool operator!=(const QIviAmFmTunerStation &other) { return !(*this == other); } diff --git a/src/ivivehiclefunctions/doc/src/qtivivehiclefunctions.qdoc b/src/ivivehiclefunctions/doc/src/qtivivehiclefunctions.qdoc index bf25cc2..b343467 100644 --- a/src/ivivehiclefunctions/doc/src/qtivivehiclefunctions.qdoc +++ b/src/ivivehiclefunctions/doc/src/qtivivehiclefunctions.qdoc @@ -55,57 +55,57 @@ To use feature elements, simply include the header file and instantiate the element: - \code + \code #include <QtIviVehicleFunctions/QIviClimateControl> ... - QIviClimateControl* m_climateControl; - m_climateControl = new QIviClimateControl(this); - \endcode + QIviClimateControl* m_climateControl; + m_climateControl = new QIviClimateControl(this); + \endcode - In order to trigger the auto discovery mechanism, call the startAutoDiscovery method. This will - load the appropriate backend and set a service object for the feature element. Please notice - that calling this method sets the autoDiscovery property to true. To use dynamic services, - simply do not call this method. + In order to trigger the auto discovery mechanism, call the startAutoDiscovery method. This will + load the appropriate backend and set a service object for the feature element. Please notice + that calling this method sets the autoDiscovery property to true. To use dynamic services, + simply do not call this method. - \code - m_climateControl->startAutoDiscovery(); - \endcode + \code + m_climateControl->startAutoDiscovery(); + \endcode - After the startAutoDiscovery method has been called, the isValid property can be used to - determine if a backend was found or not. + After the startAutoDiscovery method has been called, the isValid property can be used to + determine if a backend was found or not. - \code - if (!m_climateControl->isValid()) + \code + if (!m_climateControl->isValid()) QMessageBox::critical( ... ); // Take action here - \endcode + \endcode - Climate general values can be get and set directly by the feature instance: - \code - if (!m_climateControl->airConditioningEnabled()); + Climate general values can be get and set directly by the feature instance: + \code + if (!m_climateControl->airConditioningEnabled()); m_climateControl->setAirConditioningEnabled(true); - \endcode + \endcode - Some features, like climate control, are divided into several climate zones. The names - of the available zones can be checked using QIviAbstractZonedFeature::availableZones(): + Some features, like climate control, are divided into several climate zones. The names + of the available zones can be checked using QIviAbstractZonedFeature::availableZones(): - \code - QStringList zones = m_climateControl->availableZones(); - \endcode + \code + QStringList zones = m_climateControl->availableZones(); + \endcode - You can use QIviAbstractZonedFeature::zoneAt() to access zone functions: + You can use QIviAbstractZonedFeature::zoneAt() to access zone functions: - \code - m_climateControl->zoneAt("FrontSeat")->setSeatHeater(false); - \endcode + \code + m_climateControl->zoneAt("FrontSeat")->setSeatHeater(false); + \endcode - Looping zones is done with QIviAbstractZonedFeature::zones(): + Looping zones is done with QIviAbstractZonedFeature::zones(): - \code + \code const auto zones = m_climateControl->zones(); for (QClimateControl *z : zones) if (z->zone() == "FrontSeat") z->setSeatHeater(true); - \endcode + \endcode */ /*! @@ -129,54 +129,54 @@ \snippet doc_src_qmlivivehiclefunctions.cpp 0 - Then instantiate the feature element. For most elements, autoDiscovery is set to true when - applicable, but in this example we set it explicitly. + Then instantiate the feature element. For most elements, autoDiscovery is set to true when + applicable, but in this example we set it explicitly. - \code - ClimateControl { + \code + ClimateControl { id: climateControl autoDiscovery: true } - \endcode + \endcode - When the top-level component has been completed, the isValid property of the feature elements - can be used to determine if any of the backends are missing. In some situations this is expected - behavior; the isValid property can be used to enable or disable parts of the user - interface. + When the top-level component has been completed, the isValid property of the feature elements + can be used to determine if any of the backends are missing. In some situations this is expected + behavior; the isValid property can be used to enable or disable parts of the user + interface. - \code - Component.onCompleted: { + \code + Component.onCompleted: { if (!climateControl.isValid) ; // Take action here } - \endcode + \endcode - Some features, like climate control, are divided into zones. The names of the available zones - can be fetched with AbstractZonedFeature::availableZones. Zones are available only - when the feature is valid. - \code - ComboBox { + Some features, like climate control, are divided into zones. The names of the available zones + can be fetched with AbstractZonedFeature::availableZones. Zones are available only + when the feature is valid. + \code + ComboBox { model: climateControl.availableZones } - \endcode + \endcode - With the AbstractZonedFeature::zoneAt property you can access the climate control zone-specific functions. - \code - climateControl.zoneAt.FrontSeat.seatheater = true - \endcode + With the AbstractZonedFeature::zoneAt property you can access the climate control zone-specific functions. + \code + climateControl.zoneAt.FrontSeat.seatheater = true + \endcode - An example of how to use the AbstractZonedFeature::zones property: - \code - Repeater { + An example of how to use the AbstractZonedFeature::zones property: + \code + Repeater { model: climateControl.zones Text { text: modelData.zone + " seat heater level: " + modelData.seatHeater} } - \endcode + \endcode - Interactions with the feature element are described in the feature documentation. It is possible - to bind properties, call methods, and listen to signals. + Interactions with the feature element are described in the feature documentation. It is possible + to bind properties, call methods, and listen to signals. - \section1 QML Types + \section1 QML Types */ /*! diff --git a/src/ivivehiclefunctions/qiviclimatecontrol.cpp b/src/ivivehiclefunctions/qiviclimatecontrol.cpp index 6c4cf7f..4e5f3ac 100644 --- a/src/ivivehiclefunctions/qiviclimatecontrol.cpp +++ b/src/ivivehiclefunctions/qiviclimatecontrol.cpp @@ -45,6 +45,8 @@ #include <QtIviCore/QIviServiceObject> #include <QtIviCore/QIviPropertyFactory> +QT_BEGIN_NAMESPACE + QIviClimateControlPrivate::QIviClimateControlPrivate(const QString &interface, const QString &zone, QIviClimateControl *parent) : QIviAbstractZonedFeaturePrivate(interface, zone, parent) , m_airflowDirections(0) @@ -584,18 +586,18 @@ QIviClimateControlBackendInterface *QIviClimateControlPrivate::climateControlBac } /*! - \class QIviClimateControl - \inmodule QtIviVehicleFunctions - \brief Provides an interface to the climate control. + \class QIviClimateControl + \inmodule QtIviVehicleFunctions + \brief Provides an interface to the climate control. - The QIviClimateControl provides an interface to the climate control of the vehicle. + The QIviClimateControl provides an interface to the climate control of the vehicle. - The climate control properties are divided into two categories: central or zoned. The central - properties are exposed directly through the QIviClimateControl and the zoned properties are - exposed through zone objects. The zones are retrieved using the \l zoneAt method. + The climate control properties are divided into two categories: central or zoned. The central + properties are exposed directly through the QIviClimateControl and the zoned properties are + exposed through zone objects. The zones are retrieved using the \l zoneAt method. - The QIviClimateControl expects a single backend to be available. It is recommended to use it - with \l {QIviAbstractFeature::}{discoveryMode} set to \l AutoDiscovery. + The QIviClimateControl expects a single backend to be available. It is recommended to use it + with \l {QIviAbstractFeature::}{discoveryMode} set to \l AutoDiscovery. */ /*! @@ -607,41 +609,41 @@ QIviClimateControlBackendInterface *QIviClimateControlPrivate::climateControlBac */ /*! - \enum QIviClimateControl::AirflowDirection - \value Windshield + \enum QIviClimateControl::AirflowDirection + \value Windshield Direct airflow along the windshield. - \value Dashboard + \value Dashboard Direct airflow through the dashboard. - \value Floor + \value Floor Direct airflow to the floor. */ /*! - \enum QIviClimateControl::RecirculationMode - \value RecirculationOff + \enum QIviClimateControl::RecirculationMode + \value RecirculationOff The recirculation is turned off. - \value RecirculationOn + \value RecirculationOn The recirculation is turned on. - \value AutoRecirculation + \value AutoRecirculation The recirculation is turning off and on automatically depending on the air quality. */ /*! - \enum QIviClimateControl::ClimateMode - \value ClimateOff + \enum QIviClimateControl::ClimateMode + \value ClimateOff The climate system is turned off. - \value ClimateOn + \value ClimateOn The climate system is turned on. - \value AutoClimate + \value AutoClimate The climate system is in automatic mode and is adjusting some parts of the system automatically. E.g. lower the fan speed when the targetTemperature is reached. */ /*! - Constructs a climate control object to the given \a zone. + Constructs a climate control object to the given \a zone. - If \a zone is not provided the General zone will be created. + If \a zone is not provided the General zone will be created. - The \a parent argument is passed on to the \l QIviAbstractZonedFeature base class. + The \a parent argument is passed on to the \l QIviAbstractZonedFeature base class. */ QIviClimateControl::QIviClimateControl(const QString &zone, QObject *parent) : QIviAbstractZonedFeature(*new QIviClimateControlPrivate(QLatin1String(QIviClimateControl_iid), zone, this), parent) @@ -656,7 +658,7 @@ QIviClimateControl::~QIviClimateControl() } /*! - \reimp + \reimp */ void QIviClimateControl::connectToServiceObject(QIviServiceObject *serviceObject) { @@ -732,11 +734,11 @@ void QIviClimateControl::connectToServiceObject(QIviServiceObject *serviceObject QObjectPrivate::connect(backend, &QIviClimateControlBackendInterface::automaticClimateFanIntensityLevelAttributeChanged, d, &QIviClimateControlPrivate::onAutomaticClimateFanIntensityLevelAttributeChanged); - backend->initializeAttributes(); + QIviAbstractFeature::connectToServiceObject(serviceObject); } /*! - \reimp + \reimp */ void QIviClimateControl::clearServiceObject() { @@ -751,30 +753,30 @@ QIviClimateControl::QIviClimateControl(QIviClimateControlPrivate &dd, QObject *p } /*! - \reimp + \reimp */ QIviAbstractZonedFeature *QIviClimateControl::createZoneFeature(const QString &zone) { return new QIviClimateControl(zone, this); } /*! - \qmlqtivipropertyBool {QtIvi.VehicleFunctions::ClimateControl::airConditioning} + \qmlqtivipropertyBool {QtIvi.VehicleFunctions::ClimateControl::airConditioning} - \e value is true if the air conditioning is enabled. + \e value is true if the air conditioning is enabled. */ /*! - \property QIviClimateControl::airConditioning + \property QIviClimateControl::airConditioning - Holds a QIviProperty of type \e bool where the QIviProperty::value() function indicates if air conditioning is enabled. + Holds a QIviProperty of type \e bool where the QIviProperty::value() function indicates if air conditioning is enabled. - \sa AttributeSystem - \sa isAirConditioningEnabled() setAirConditioningEnabled() airConditioningAttribute() - */ + \sa AttributeSystem + \sa isAirConditioningEnabled() setAirConditioningEnabled() airConditioningAttribute() +*/ /*! - * Returns true if air conditioning is enabled. - * - * \sa setAirConditioningEnabled() airConditioningEnabledChanged() airConditioningAttribute() - */ + Returns true if air conditioning is enabled. + + \sa setAirConditioningEnabled() airConditioningEnabledChanged() airConditioningAttribute() +*/ bool QIviClimateControl::isAirConditioningEnabled() const { Q_D(const QIviClimateControl); @@ -782,10 +784,10 @@ bool QIviClimateControl::isAirConditioningEnabled() const } /*! - * Returns the attribute defining the boundaries and availability of the air conditioning property. - * - * \sa setAirConditioningEnabled() isAirConditioningEnabled() airConditioningEnabledChanged() - */ + Returns the attribute defining the boundaries and availability of the air conditioning property. + + \sa setAirConditioningEnabled() isAirConditioningEnabled() airConditioningEnabledChanged() +*/ QIviPropertyAttribute<bool> QIviClimateControl::airConditioningAttribute() const { Q_D(const QIviClimateControl); @@ -799,30 +801,30 @@ QIviProperty *QIviClimateControl::airConditioningProperty() const } /*! - \qmlqtivipropertyEnum {QtIvi.VehicleFunctions::ClimateControl::airflowDirections} + \qmlqtivipropertyEnum {QtIvi.VehicleFunctions::ClimateControl::airflowDirections} - \e value holds the airflow directions. - Available values are: - \value Windshield + \e value holds the airflow directions. + Available values are: + \value Windshield Direct airflow along the windshield. - \value Dashboard + \value Dashboard Direct airflow through the dashboard. - \value Floor + \value Floor Direct airflow to the floor. - */ +*/ /*! - \property QIviClimateControl::airflowDirections + \property QIviClimateControl::airflowDirections - Holds a QIviProperty of type \e QIviClimateControl::AirflowDirections where the QIviProperty::value() function returns the current air flow directions. + Holds a QIviProperty of type \e QIviClimateControl::AirflowDirections where the QIviProperty::value() function returns the current air flow directions. - \sa AttributeSystem - \sa airflowDirections() setAirflowDirections() airflowDirectionsAttribute() - */ + \sa AttributeSystem + \sa airflowDirections() setAirflowDirections() airflowDirectionsAttribute() +*/ /*! - * Returns the current air flow direction. - * - * \sa setAirflowDirections() airflowDirectionsChanged() airflowDirectionsAttribute() - */ + Returns the current air flow direction. + + \sa setAirflowDirections() airflowDirectionsChanged() airflowDirectionsAttribute() +*/ QIviClimateControl::AirflowDirections QIviClimateControl::airflowDirections() const { Q_D(const QIviClimateControl); @@ -830,10 +832,10 @@ QIviClimateControl::AirflowDirections QIviClimateControl::airflowDirections() co } /*! - * Returns the attribute defining the boundaries and availability of the air flow property - * - * \sa setAirflowDirections() airflowDirections() airflowDirectionsChanged() - */ + Returns the attribute defining the boundaries and availability of the air flow property + + \sa setAirflowDirections() airflowDirections() airflowDirectionsChanged() +*/ QIviPropertyAttribute<QIviClimateControl::AirflowDirections> QIviClimateControl::airflowDirectionsAttribute() const { Q_D(const QIviClimateControl); @@ -847,24 +849,24 @@ QIviProperty *QIviClimateControl::airflowDirectionsProperty() const } /*! - \qmlqtivipropertyBool {QtIvi.VehicleFunctions::ClimateControl::heater} + \qmlqtivipropertyBool {QtIvi.VehicleFunctions::ClimateControl::heater} - \e value is true if the heater is enabled. + \e value is true if the heater is enabled. */ /*! - \property QIviClimateControl::heater + \property QIviClimateControl::heater - Holds a QIviProperty of type \e bool where the QIviProperty::value() function indicates if the heater is enabled. + Holds a QIviProperty of type \e bool where the QIviProperty::value() function indicates if the heater is enabled. - \sa AttributeSystem - \sa isHeaterEnabled() setHeaterEnabled() heaterAttribute() - */ + \sa AttributeSystem + \sa isHeaterEnabled() setHeaterEnabled() heaterAttribute() +*/ /*! - * Returns true if the heater is enabled. - * - * \sa setHeaterEnabled() heaterEnabledChanged() heaterAttribute() - */ + Returns true if the heater is enabled. + + \sa setHeaterEnabled() heaterEnabledChanged() heaterAttribute() +*/ bool QIviClimateControl::isHeaterEnabled() const { Q_D(const QIviClimateControl); @@ -872,10 +874,10 @@ bool QIviClimateControl::isHeaterEnabled() const } /*! - * Returns the attribute defining the boundaries and availability of the heater property. - * - * \sa setHeaterEnabled() isHeaterEnabled() heaterEnabledChanged() - */ + Returns the attribute defining the boundaries and availability of the heater property. + + \sa setHeaterEnabled() isHeaterEnabled() heaterEnabledChanged() +*/ QIviPropertyAttribute<bool> QIviClimateControl::heaterAttribute() const { Q_D(const QIviClimateControl); @@ -889,24 +891,24 @@ QIviProperty *QIviClimateControl::heaterProperty() const } /*! - \qmlqtiviproperty {int} {QtIvi.VehicleFunctions::ClimateControl::steeringWheelHeater} + \qmlqtiviproperty {int} {QtIvi.VehicleFunctions::ClimateControl::steeringWheelHeater} \e value holds the steering wheel heater level, where the level can be between \c minimumValue(off) to \c maximumValue (warmest). - */ +*/ /*! - \property QIviClimateControl::steeringWheelHeater + \property QIviClimateControl::steeringWheelHeater - Holds a QIviProperty of type \e int where the QIviProperty::value() function returns the current steering wheel heater level. + Holds a QIviProperty of type \e int where the QIviProperty::value() function returns the current steering wheel heater level. - \sa AttributeSystem - \sa steeringWheelHeater() setSteeringWheelHeater() steeringWheelHeaterAttribute() - */ + \sa AttributeSystem + \sa steeringWheelHeater() setSteeringWheelHeater() steeringWheelHeaterAttribute() +*/ /*! - * Returns the current steering wheel heater level, where the level can be between \c minimumValue(off) and \c maximumValue (warmest). - * - * \sa setSteeringWheelHeater() steeringWheelHeaterChanged() steeringWheelHeaterAttribute() - */ + Returns the current steering wheel heater level, where the level can be between \c minimumValue(off) and \c maximumValue (warmest). + + \sa setSteeringWheelHeater() steeringWheelHeaterChanged() steeringWheelHeaterAttribute() +*/ int QIviClimateControl::steeringWheelHeater() const { Q_D(const QIviClimateControl); @@ -914,10 +916,10 @@ int QIviClimateControl::steeringWheelHeater() const } /*! - * Returns the attribute defining the boundaries and availability of the steering wheel heater property. - * - * \sa setSteeringWheelHeater() steeringWheelHeater() steeringWheelHeaterChanged() - */ + Returns the attribute defining the boundaries and availability of the steering wheel heater property. + + \sa setSteeringWheelHeater() steeringWheelHeater() steeringWheelHeaterChanged() +*/ QIviPropertyAttribute<int> QIviClimateControl::steeringWheelHeaterAttribute() const { Q_D(const QIviClimateControl); @@ -931,24 +933,24 @@ QIviProperty *QIviClimateControl::steeringWheelHeaterProperty() const } /*! - \qmlqtiviproperty {int} {QtIvi.VehicleFunctions::ClimateControl::fanSpeedLevel} + \qmlqtiviproperty {int} {QtIvi.VehicleFunctions::ClimateControl::fanSpeedLevel} \e value holds the fan speed level, where the level can be between \c minimumValue(off) to \c maximumValue (strongest). - */ +*/ /*! - \property QIviClimateControl::fanSpeedLevel + \property QIviClimateControl::fanSpeedLevel - Holds a QIviProperty of type \e int where the QIviProperty::value() function returns the current fan speed level. + Holds a QIviProperty of type \e int where the QIviProperty::value() function returns the current fan speed level. - \sa AttributeSystem - \sa fanSpeedLevel() setFanSpeedLevel() fanSpeedLevelAttribute() - */ + \sa AttributeSystem + \sa fanSpeedLevel() setFanSpeedLevel() fanSpeedLevelAttribute() +*/ /*! - * Returns the current fan speed level, where the level can be between \c miniumValue(off) and \c maximumValue(strongest). - * - * \sa setFanSpeedLevel() fanSpeedLevelChanged() fanSpeedLevelAttribute() - */ + Returns the current fan speed level, where the level can be between \c miniumValue(off) and \c maximumValue(strongest). + + \sa setFanSpeedLevel() fanSpeedLevelChanged() fanSpeedLevelAttribute() +*/ int QIviClimateControl::fanSpeedLevel() const { Q_D(const QIviClimateControl); @@ -956,10 +958,10 @@ int QIviClimateControl::fanSpeedLevel() const } /*! - * Returns the attribute defining the boundaries and availability of the fan speed level property - * - * \sa setFanSpeedLevel() fanSpeedLevel() fanSpeedLevelChanged() - */ + Returns the attribute defining the boundaries and availability of the fan speed level property + + \sa setFanSpeedLevel() fanSpeedLevel() fanSpeedLevelChanged() +*/ QIviPropertyAttribute<int> QIviClimateControl::fanSpeedLevelAttribute() const { Q_D(const QIviClimateControl); @@ -973,24 +975,24 @@ QIviProperty *QIviClimateControl::fanSpeedLevelProperty() const } /*! - \qmlqtiviproperty {int} {QtIvi.VehicleFunctions::ClimateControl::targetTemperature} + \qmlqtiviproperty {int} {QtIvi.VehicleFunctions::ClimateControl::targetTemperature} - \e value holds the target temperature of the zone expressed in centigrades, where the temperature can be between \c minimumValue(coolest) - to \c maximumValue (warmest). - */ + \e value holds the target temperature of the zone expressed in centigrades, where the temperature can be between \c minimumValue(coolest) + to \c maximumValue (warmest). +*/ /*! - \property QIviClimateControl::targetTemperature + \property QIviClimateControl::targetTemperature - Holds a QIviProperty of type \e int where the QIviProperty::value() function returns the current target temperature. + Holds a QIviProperty of type \e int where the QIviProperty::value() function returns the current target temperature. - \sa AttributeSystem - \sa targetTemperature() setTargetTemperature() targetTemperatureAttribute() - */ + \sa AttributeSystem + \sa targetTemperature() setTargetTemperature() targetTemperatureAttribute() +*/ /*! - * Returns the current target temperature expressed in centigrates. - * - * \sa setTargetTemperature() targetTemperatureChanged() targetTemperatureAttribute() - */ + Returns the current target temperature expressed in centigrates. + + \sa setTargetTemperature() targetTemperatureChanged() targetTemperatureAttribute() +*/ int QIviClimateControl::targetTemperature() const { Q_D(const QIviClimateControl); @@ -998,10 +1000,10 @@ int QIviClimateControl::targetTemperature() const } /*! - * Returns the attribute defining the boundaries and availability of the target temperature property. - * - * \sa setTargetTemperature() targetTemperature() targetTemperatureChanged() - */ + Returns the attribute defining the boundaries and availability of the target temperature property. + + \sa setTargetTemperature() targetTemperature() targetTemperatureChanged() +*/ QIviPropertyAttribute<int> QIviClimateControl::targetTemperatureAttribute() const { Q_D(const QIviClimateControl); @@ -1015,24 +1017,24 @@ QIviProperty *QIviClimateControl::targetTemperatureProperty() const } /*! - \qmlqtiviproperty {int} {QtIvi.VehicleFunctions::ClimateControl::seatCooler} + \qmlqtiviproperty {int} {QtIvi.VehicleFunctions::ClimateControl::seatCooler} \e value holds the seat cooler level, where the level can be between \c minimumValue(off) to \c maximumValue (coolest). - */ +*/ /*! - \property QIviClimateControl::seatCooler + \property QIviClimateControl::seatCooler - Holds a QIviProperty of type \e int where the QIviProperty::value() function returns the current seat cooler level. + Holds a QIviProperty of type \e int where the QIviProperty::value() function returns the current seat cooler level. - \sa AttributeSystem - \sa seatCooler() setSeatCooler() seatCoolerAttribute() - */ + \sa AttributeSystem + \sa seatCooler() setSeatCooler() seatCoolerAttribute() +*/ /*! - * Returns the current seat cooler level, where the level can be between \c minimumValue(off) and \c maximumValue(coolest). - * - * \sa seatCooler() seatCoolerChanged() seatCoolerAttribute() - */ + Returns the current seat cooler level, where the level can be between \c minimumValue(off) and \c maximumValue(coolest). + + \sa seatCooler() seatCoolerChanged() seatCoolerAttribute() +*/ int QIviClimateControl::seatCooler() const { Q_D(const QIviClimateControl); @@ -1040,10 +1042,10 @@ int QIviClimateControl::seatCooler() const } /*! - * Returns the attribute defining the boundaries and availability of the seat cooler property. - * - * \sa setSeatCooler() seatCooler() seatCoolerChanged() - */ + Returns the attribute defining the boundaries and availability of the seat cooler property. + + \sa setSeatCooler() seatCooler() seatCoolerChanged() +*/ QIviPropertyAttribute<int> QIviClimateControl::seatCoolerAttribute() const { Q_D(const QIviClimateControl); @@ -1057,24 +1059,24 @@ QIviProperty *QIviClimateControl::seatCoolerProperty() const } /*! - \qmlqtiviproperty {int} {QtIvi.VehicleFunctions::ClimateControl::seatHeater} + \qmlqtiviproperty {int} {QtIvi.VehicleFunctions::ClimateControl::seatHeater} \e value holds the seat heater level, where the level can be between \c minimumValue(off) to \c maximumValue (warmest). - */ +*/ /*! - \property QIviClimateControl::seatHeater + \property QIviClimateControl::seatHeater - Holds a QIviProperty of type \e int where the QIviProperty::value() function returns the current seat heater level. + Holds a QIviProperty of type \e int where the QIviProperty::value() function returns the current seat heater level. - \sa AttributeSystem - \sa seatHeater() setSeatHeater() seatHeaterAttribute() - */ + \sa AttributeSystem + \sa seatHeater() setSeatHeater() seatHeaterAttribute() +*/ /*! - * Returns the current seat heater level, where the level can be between \c minimumValue(off) and \c maximumValue(warmest). - * - * \sa seatHeater() seatHeaterChanged() seatHeaterAttribute() - */ + Returns the current seat heater level, where the level can be between \c minimumValue(off) and \c maximumValue(warmest). + + \sa seatHeater() seatHeaterChanged() seatHeaterAttribute() +*/ int QIviClimateControl::seatHeater() const { Q_D(const QIviClimateControl); @@ -1082,10 +1084,10 @@ int QIviClimateControl::seatHeater() const } /*! - * Returns the attribute defining the boundaries and availability of the seat heater property. - * - * \sa setSeatHeater() seatHeater() seatHeaterChanged() - */ + Returns the attribute defining the boundaries and availability of the seat heater property. + + \sa setSeatHeater() seatHeater() seatHeaterChanged() +*/ QIviPropertyAttribute<int> QIviClimateControl::seatHeaterAttribute() const { Q_D(const QIviClimateControl); @@ -1099,24 +1101,24 @@ QIviProperty *QIviClimateControl::seatHeaterProperty() const } /*! - \qmlqtiviproperty {int} {QtIvi.VehicleFunctions::ClimateControl::outsideTemperature} + \qmlqtiviproperty {int} {QtIvi.VehicleFunctions::ClimateControl::outsideTemperature} - \e value holds the outside temperature of the zone expressed in centigrades, where the temperature can be between \c minimumValue(coolest) - to \c maximumValue (warmest). - */ + \e value holds the outside temperature of the zone expressed in centigrades, where the temperature can be between \c minimumValue(coolest) + to \c maximumValue (warmest). +*/ /*! - \property QIviClimateControl::outsideTemperature + \property QIviClimateControl::outsideTemperature - Holds a QIviProperty of type \e int where the QIviProperty::value() function returns the current outside temperature. + Holds a QIviProperty of type \e int where the QIviProperty::value() function returns the current outside temperature. - \sa AttributeSystem - \sa outsideTemperature() outsideTemperatureAttribute() - */ + \sa AttributeSystem + \sa outsideTemperature() outsideTemperatureAttribute() +*/ /*! - * Returns the current outside temperature expressed in centigrates. - * - * \sa outsideTemperatureChanged() outsideTemperatureAttribute() - */ + Returns the current outside temperature expressed in centigrates. + + \sa outsideTemperatureChanged() outsideTemperatureAttribute() +*/ int QIviClimateControl::outsideTemperature() const { Q_D(const QIviClimateControl); @@ -1124,10 +1126,10 @@ int QIviClimateControl::outsideTemperature() const } /*! - * Returns the attribute defining the boundaries and availability of the outside temperature property. - * - * \sa outsideTemperature() outsideTemperatureChanged() - */ + Returns the attribute defining the boundaries and availability of the outside temperature property. + + \sa outsideTemperature() outsideTemperatureChanged() +*/ QIviPropertyAttribute<int> QIviClimateControl::outsideTemperatureAttribute() const { Q_D(const QIviClimateControl); @@ -1141,27 +1143,27 @@ QIviProperty *QIviClimateControl::outsideTemperatureProperty() const } /*! - \qmlqtivipropertyBool {QtIvi.VehicleFunctions::ClimateControl::zoneSynchronization} + \qmlqtivipropertyBool {QtIvi.VehicleFunctions::ClimateControl::zoneSynchronization} - \e value is true if the zone synchronization is enabled. + \e value is true if the zone synchronization is enabled. - Which zones and properties are synchronized is controlled by the backend implementing it. + Which zones and properties are synchronized is controlled by the backend implementing it. */ /*! - \property QIviClimateControl::zoneSynchronization + \property QIviClimateControl::zoneSynchronization - Holds a QIviProperty of type \e bool where the QIviProperty::value() function indicates if zone synchronization is enabled. + Holds a QIviProperty of type \e bool where the QIviProperty::value() function indicates if zone synchronization is enabled. - Which zones and properties are synchronized is controlled by the backend implementing it. + Which zones and properties are synchronized is controlled by the backend implementing it. - \sa AttributeSystem - \sa isZoneSynchronizationEnabled() setZoneSynchronizationEnabled() zoneSynchronizationAttribute() - */ + \sa AttributeSystem + \sa isZoneSynchronizationEnabled() setZoneSynchronizationEnabled() zoneSynchronizationAttribute() +*/ /*! - * Returns true if zone synchronization is enabled. - * - * \sa setZoneSynchronizationEnabled() zoneSynchronizationEnabledChanged() zoneSynchronizationAttribute() - */ + Returns true if zone synchronization is enabled. + + \sa setZoneSynchronizationEnabled() zoneSynchronizationEnabledChanged() zoneSynchronizationAttribute() +*/ bool QIviClimateControl::isZoneSynchronizationEnabled() const { Q_D(const QIviClimateControl); @@ -1169,10 +1171,10 @@ bool QIviClimateControl::isZoneSynchronizationEnabled() const } /*! - * Returns the attribute defining the boundaries and availability of the zone synchronization property. - * - * \sa setZoneSynchronizationEnabled() isZoneSynchronizationEnabled() zoneSynchronizationEnabledChanged() - */ + Returns the attribute defining the boundaries and availability of the zone synchronization property. + + \sa setZoneSynchronizationEnabled() isZoneSynchronizationEnabled() zoneSynchronizationEnabledChanged() +*/ QIviPropertyAttribute<bool> QIviClimateControl::zoneSynchronizationAttribute() const { Q_D(const QIviClimateControl); @@ -1186,23 +1188,23 @@ QIviProperty *QIviClimateControl::zoneSynchronizationProperty() const } /*! - \qmlqtivipropertyBool {QtIvi.VehicleFunctions::ClimateControl::defrost} + \qmlqtivipropertyBool {QtIvi.VehicleFunctions::ClimateControl::defrost} - \e value is true if defrost is enabled. Usually that means that the fans are on the highest level to remove ice from the windshield. + \e value is true if defrost is enabled. Usually that means that the fans are on the highest level to remove ice from the windshield. */ /*! - \property QIviClimateControl::defrost + \property QIviClimateControl::defrost - Holds a QIviProperty of type \e bool where the QIviProperty::value() function indicates if defrost is enabled. + Holds a QIviProperty of type \e bool where the QIviProperty::value() function indicates if defrost is enabled. - \sa AttributeSystem - \sa isDefrostEnabled() setDefrostEnabled() defrostAttribute() - */ + \sa AttributeSystem + \sa isDefrostEnabled() setDefrostEnabled() defrostAttribute() +*/ /*! - * Returns true if defrost is enabled. - * - * \sa setDefrostEnabled() defrostEnabledChanged() defrostAttribute() - */ + Returns true if defrost is enabled. + + \sa setDefrostEnabled() defrostEnabledChanged() defrostAttribute() +*/ bool QIviClimateControl::isDefrostEnabled() const { Q_D(const QIviClimateControl); @@ -1210,10 +1212,10 @@ bool QIviClimateControl::isDefrostEnabled() const } /*! - * Returns the attribute defining the boundaries and availability of the defrost property. - * - * \sa setDefrostEnabled() isDefrostEnabled() defrostEnabledChanged() - */ + Returns the attribute defining the boundaries and availability of the defrost property. + + \sa setDefrostEnabled() isDefrostEnabled() defrostEnabledChanged() +*/ QIviPropertyAttribute<bool> QIviClimateControl::defrostAttribute() const { Q_D(const QIviClimateControl); @@ -1227,30 +1229,30 @@ QIviProperty *QIviClimateControl::defrostProperty() const } /*! - \qmlqtivipropertyEnum {QtIvi.VehicleFunctions::ClimateControl::recirculationMode} + \qmlqtivipropertyEnum {QtIvi.VehicleFunctions::ClimateControl::recirculationMode} - \e value holds the recirculation mode. - Available values are: - \value RecirculationOff + \e value holds the recirculation mode. + Available values are: + \value RecirculationOff The recirculation is turned off. - \value RecirculationOn + \value RecirculationOn The recirculation is turned on. - \value AutoRecirculation + \value AutoRecirculation The recirculation is turning off and on automatically depending on the air quality. - */ +*/ /*! - \property QIviClimateControl::recirculationMode + \property QIviClimateControl::recirculationMode - Holds a QIviProperty of type \e QIviClimateControl::RecirculationMode where the QIviProperty::value() function returns the current recirculation mode. + Holds a QIviProperty of type \e QIviClimateControl::RecirculationMode where the QIviProperty::value() function returns the current recirculation mode. - \sa AttributeSystem - \sa recirculationMode() setRecirculationMode() recirculationModeAttribute() - */ + \sa AttributeSystem + \sa recirculationMode() setRecirculationMode() recirculationModeAttribute() +*/ /*! - * Returns the current recirculation mode. - * - * \sa setRecirculationMode() recirculationModeChanged() recirculationModeAttribute() - */ + Returns the current recirculation mode. + + \sa setRecirculationMode() recirculationModeChanged() recirculationModeAttribute() +*/ QIviClimateControl::RecirculationMode QIviClimateControl::recirculationMode() const { Q_D(const QIviClimateControl); @@ -1258,10 +1260,10 @@ QIviClimateControl::RecirculationMode QIviClimateControl::recirculationMode() co } /*! - * Returns the attribute defining the boundaries and availability of the recirculationMode property. - * - * \sa setRecirculationMode() recirculationMode() recirculationModeChanged() - */ + Returns the attribute defining the boundaries and availability of the recirculationMode property. + + \sa setRecirculationMode() recirculationMode() recirculationModeChanged() +*/ QIviPropertyAttribute<QIviClimateControl::RecirculationMode> QIviClimateControl::recirculationModeAttribute() const { Q_D(const QIviClimateControl); @@ -1275,23 +1277,23 @@ QIviProperty *QIviClimateControl::recirculationModeProperty() const } /*! - \qmlqtivipropertyBool {QtIvi.VehicleFunctions::ClimateControl::recirculation} + \qmlqtivipropertyBool {QtIvi.VehicleFunctions::ClimateControl::recirculation} - \e value is true if the recirculation is currently running. + \e value is true if the recirculation is currently running. */ /*! - \property QIviClimateControl::recirculation + \property QIviClimateControl::recirculation - Holds a QIviProperty of type \e bool where the QIviProperty::value() function indicates if recirculation is running. + Holds a QIviProperty of type \e bool where the QIviProperty::value() function indicates if recirculation is running. - \sa AttributeSystem - \sa isRecirculationEnabled() recirculationAttribute() - */ + \sa AttributeSystem + \sa isRecirculationEnabled() recirculationAttribute() +*/ /*! - * Returns true if defrost is enabled. - * - * \sa recirculationEnabledChanged() recirculationAttribute() - */ + Returns true if defrost is enabled. + + \sa recirculationEnabledChanged() recirculationAttribute() +*/ bool QIviClimateControl::isRecirculationEnabled() const { Q_D(const QIviClimateControl); @@ -1299,10 +1301,10 @@ bool QIviClimateControl::isRecirculationEnabled() const } /*! - * Returns the attribute defining the boundaries and availability of the recirculation property. - * - * \sa isRecirculationEnabled() recirculationEnabledChanged() - */ + Returns the attribute defining the boundaries and availability of the recirculation property. + + \sa isRecirculationEnabled() recirculationEnabledChanged() +*/ QIviPropertyAttribute<bool> QIviClimateControl::recirculationAttribute() const { Q_D(const QIviClimateControl); @@ -1316,24 +1318,24 @@ QIviProperty *QIviClimateControl::recirculationProperty() const } /*! - \qmlqtiviproperty {int} {QtIvi.VehicleFunctions::ClimateControl::recirculationSensitivityLevel} + \qmlqtiviproperty {int} {QtIvi.VehicleFunctions::ClimateControl::recirculationSensitivityLevel} \e value holds the sensitivity level of the recirculation system when the recirculationMode is set to AutoRecirculation, where the level can be between \c minimumValue(least sensitive) to \c maximumValue(most sensitive). - */ +*/ /*! - \property QIviClimateControl::recirculationSensitivityLevel + \property QIviClimateControl::recirculationSensitivityLevel - Holds a QIviProperty of type \e int where the QIviProperty::value() function returns the current sensitivity level of the recicurlcation system when the recirculationMode is set to AutoRecirculation. + Holds a QIviProperty of type \e int where the QIviProperty::value() function returns the current sensitivity level of the recicurlcation system when the recirculationMode is set to AutoRecirculation. - \sa AttributeSystem - \sa recirculationSensitivityLevel() setRecirculationSensitivityLevel() recirculationSensitivityLevelAttribute() - */ + \sa AttributeSystem + \sa recirculationSensitivityLevel() setRecirculationSensitivityLevel() recirculationSensitivityLevelAttribute() +*/ /*! - * Returns the current sensitivity level of recicurlcation system when the recirculationMode is set to AutoRecirculation, where the level can be between \c minimumValue(least sensitive) and \c maximumValue(most sensitive). - * - * \sa setRecirculationSensitivityLevel() recirculationSensitivityLevelChanged() recirculationSensitivityLevelAttribute() - */ + Returns the current sensitivity level of recicurlcation system when the recirculationMode is set to AutoRecirculation, where the level can be between \c minimumValue(least sensitive) and \c maximumValue(most sensitive). + + \sa setRecirculationSensitivityLevel() recirculationSensitivityLevelChanged() recirculationSensitivityLevelAttribute() +*/ int QIviClimateControl::recirculationSensitivityLevel() const { Q_D(const QIviClimateControl); @@ -1341,10 +1343,10 @@ int QIviClimateControl::recirculationSensitivityLevel() const } /*! - * Returns the attribute defining the boundaries and availability of the recirculationSensitivityLevel property. - * - * \sa setRecirculationSensitivityLevel() recirculationSensitivityLevel() recirculationSensitivityLevelChanged() - */ + Returns the attribute defining the boundaries and availability of the recirculationSensitivityLevel property. + + \sa setRecirculationSensitivityLevel() recirculationSensitivityLevel() recirculationSensitivityLevelChanged() +*/ QIviPropertyAttribute<int> QIviClimateControl::recirculationSensitivityLevelAttribute() const { Q_D(const QIviClimateControl); @@ -1358,30 +1360,30 @@ QIviProperty *QIviClimateControl::recirculationSensitivityLevelProperty() const } /*! - \qmlqtivipropertyEnum {QtIvi.VehicleFunctions::ClimateControl::climateMode} + \qmlqtivipropertyEnum {QtIvi.VehicleFunctions::ClimateControl::climateMode} - \e value holds the climate mode. - Available values are: - \value ClimateOff + \e value holds the climate mode. + Available values are: + \value ClimateOff The climate system is turned off. - \value ClimateOn + \value ClimateOn The climate system is turned on. - \value AutoClimate + \value AutoClimate The climate system is in automatic mode and is adjusting some parts of the system automatically. e.g. lower the fan speed when the targetTemperature is reached. - */ +*/ /*! - \property QIviClimateControl::climateMode + \property QIviClimateControl::climateMode - Holds a QIviProperty of type \e QIviClimateControl::ClimateMode where the QIviProperty::value() function returns the current climate mode. + Holds a QIviProperty of type \e QIviClimateControl::ClimateMode where the QIviProperty::value() function returns the current climate mode. - \sa AttributeSystem - \sa climateMode() setClimateMode() climateModeAttribute() - */ + \sa AttributeSystem + \sa climateMode() setClimateMode() climateModeAttribute() +*/ /*! - * Returns the current climate mode. - * - * \sa setClimateMode() climateModeChanged() climateModeAttribute() - */ + Returns the current climate mode. + + \sa setClimateMode() climateModeChanged() climateModeAttribute() +*/ QIviClimateControl::ClimateMode QIviClimateControl::climateMode() const { Q_D(const QIviClimateControl); @@ -1389,10 +1391,10 @@ QIviClimateControl::ClimateMode QIviClimateControl::climateMode() const } /*! - * Returns the attribute defining the boundaries and availability of the climateMode property. - * - * \sa isRecirculationEnabled() recirculationEnabledChanged() - */ + Returns the attribute defining the boundaries and availability of the climateMode property. + + \sa isRecirculationEnabled() recirculationEnabledChanged() +*/ QIviPropertyAttribute<QIviClimateControl::ClimateMode> QIviClimateControl::climateModeAttribute() const { Q_D(const QIviClimateControl); @@ -1406,24 +1408,24 @@ QIviProperty *QIviClimateControl::climateModeProperty() const } /*! - \qmlqtiviproperty {int} {QtIvi.VehicleFunctions::ClimateControl::automaticClimateFanIntensityLevel} + \qmlqtiviproperty {int} {QtIvi.VehicleFunctions::ClimateControl::automaticClimateFanIntensityLevel} \e value holds the intensity level of the fan when the climateMode is set to AutoClimate, where the level can be between \c minimumValue(least intensity) to \c maximumValue(most intensity). - */ +*/ /*! - \property QIviClimateControl::automaticClimateFanIntensityLevel + \property QIviClimateControl::automaticClimateFanIntensityLevel - Holds a QIviProperty of type \e int where the QIviProperty::value() function returns the current intensity level of the fan when the climateMode is set to AutoClimate. + Holds a QIviProperty of type \e int where the QIviProperty::value() function returns the current intensity level of the fan when the climateMode is set to AutoClimate. - \sa AttributeSystem - \sa automaticClimateFanIntensityLevel() setAutomaticClimateFanIntensityLevel() automaticClimateFanIntensityLevelAttribute() - */ + \sa AttributeSystem + \sa automaticClimateFanIntensityLevel() setAutomaticClimateFanIntensityLevel() automaticClimateFanIntensityLevelAttribute() +*/ /*! - * Returns the current intensity level of the fan when the climateMode is set to AutoClimate, where the level can be between \c minimumValue(least intensity) and \c maximumValue(most intensity). - * - * \sa setAutomaticClimateFanIntensityLevel() automaticClimateFanIntensityLevelChanged() automaticClimateFanIntensityLevelAttribute() - */ + Returns the current intensity level of the fan when the climateMode is set to AutoClimate, where the level can be between \c minimumValue(least intensity) and \c maximumValue(most intensity). + + \sa setAutomaticClimateFanIntensityLevel() automaticClimateFanIntensityLevelChanged() automaticClimateFanIntensityLevelAttribute() +*/ int QIviClimateControl::automaticClimateFanIntensityLevel() const { Q_D(const QIviClimateControl); @@ -1431,10 +1433,10 @@ int QIviClimateControl::automaticClimateFanIntensityLevel() const } /*! - * Returns the attribute defining the boundaries and availability of the climateMode property. - * - * \sa setAutomaticClimateFanIntensityLevel() automaticClimateFanIntensityLevel() automaticClimateFanIntensityLevelChanged() - */ + Returns the attribute defining the boundaries and availability of the climateMode property. + + \sa setAutomaticClimateFanIntensityLevel() automaticClimateFanIntensityLevel() automaticClimateFanIntensityLevelChanged() +*/ QIviPropertyAttribute<int> QIviClimateControl::automaticClimateFanIntensityLevelAttribute() const { Q_D(const QIviClimateControl); @@ -1448,10 +1450,10 @@ QIviProperty *QIviClimateControl::automaticClimateFanIntensityLevelProperty() co } /*! - * Sets the air conditioning system enabled, if \a enabled is true, otherwise it will be disabled. - * - * \sa isAirConditioningEnabled() airConditioningEnabledChanged() airConditioningAttribute() - */ + Sets the air conditioning system enabled, if \a enabled is true, otherwise it will be disabled. + + \sa isAirConditioningEnabled() airConditioningEnabledChanged() airConditioningAttribute() +*/ void QIviClimateControl::setAirConditioningEnabled(bool enabled) { Q_D(QIviClimateControl); @@ -1460,10 +1462,10 @@ void QIviClimateControl::setAirConditioningEnabled(bool enabled) } /*! - * Sets the air flow direction to \a direction. - * - * \sa airflowDirections() airflowDirectionsChanged() airflowDirectionsAttribute() - */ + Sets the air flow direction to \a direction. + + \sa airflowDirections() airflowDirectionsChanged() airflowDirectionsAttribute() +*/ void QIviClimateControl::setAirflowDirections(QIviClimateControl::AirflowDirections direction) { Q_D(QIviClimateControl); @@ -1472,10 +1474,10 @@ void QIviClimateControl::setAirflowDirections(QIviClimateControl::AirflowDirecti } /*! - * Enables the heater, if \a enabled is true, otherwise it will be disabled. - * - * \sa isHeaterEnabled() heaterEnabledChanged() heaterAttribute() - */ + Enables the heater, if \a enabled is true, otherwise it will be disabled. + + \sa isHeaterEnabled() heaterEnabledChanged() heaterAttribute() +*/ void QIviClimateControl::setHeaterEnabled(bool enabled) { Q_D(QIviClimateControl); @@ -1484,10 +1486,10 @@ void QIviClimateControl::setHeaterEnabled(bool enabled) } /*! - * Sets the current steering wheel heater level to \a value, where the level can be between \c minimumValue(off) and \c maximumValue(warmest). - * - * \sa steeringWheelHeater() steeringWheelHeaterChanged() steeringWheelHeaterAttribute() - */ + Sets the current steering wheel heater level to \a value, where the level can be between \c minimumValue(off) and \c maximumValue(warmest). + + \sa steeringWheelHeater() steeringWheelHeaterChanged() steeringWheelHeaterAttribute() +*/ void QIviClimateControl::setSteeringWheelHeater(int value) { Q_D(QIviClimateControl); @@ -1496,10 +1498,10 @@ void QIviClimateControl::setSteeringWheelHeater(int value) } /*! - * Sets the current fan speed level to \a value, where the level can be between \c minimumValue(off) and \c maximumValue(strongest). - * - * \sa fanSpeedLevel() fanSpeedLevelChanged() fanSpeedLevelAttribute() - */ + Sets the current fan speed level to \a value, where the level can be between \c minimumValue(off) and \c maximumValue(strongest). + + \sa fanSpeedLevel() fanSpeedLevelChanged() fanSpeedLevelAttribute() +*/ void QIviClimateControl::setFanSpeedLevel(int value) { Q_D(QIviClimateControl); @@ -1508,10 +1510,10 @@ void QIviClimateControl::setFanSpeedLevel(int value) } /*! - * Sets the current target temperature to \a temperature expressed in centigrades. - * - * \sa targetTemperature() targetTemperatureChanged() targetTemperatureAttribute() - */ + Sets the current target temperature to \a temperature expressed in centigrades. + + \sa targetTemperature() targetTemperatureChanged() targetTemperatureAttribute() +*/ void QIviClimateControl::setTargetTemperature(int temperature) { Q_D(QIviClimateControl); @@ -1520,10 +1522,10 @@ void QIviClimateControl::setTargetTemperature(int temperature) } /*! - * Sets the current seat cooler level to \a value, where the level can be between \c minimumValue(off) and \c maximumValue(coolest). - * - * \sa seatCooler() seatCoolerChanged() seatCoolerAttribute() - */ + Sets the current seat cooler level to \a value, where the level can be between \c minimumValue(off) and \c maximumValue(coolest). + + \sa seatCooler() seatCoolerChanged() seatCoolerAttribute() +*/ void QIviClimateControl::setSeatCooler(int value) { Q_D(QIviClimateControl); @@ -1532,10 +1534,10 @@ void QIviClimateControl::setSeatCooler(int value) } /*! - * Sets the current seat heater level to \a value, where the level can be between \c minimumValue(off) and \c maximumValue(warmest). - * - * \sa seatHeater() seatHeaterChanged() seatHeaterAttribute() - */ + Sets the current seat heater level to \a value, where the level can be between \c minimumValue(off) and \c maximumValue(warmest). + + \sa seatHeater() seatHeaterChanged() seatHeaterAttribute() +*/ void QIviClimateControl::setSeatHeater(int value) { Q_D(QIviClimateControl); @@ -1544,10 +1546,10 @@ void QIviClimateControl::setSeatHeater(int value) } /*! - * Enables the zone synchronization, if \a enabled is true, otherwise it will be disabled. - * - * \sa isZoneSynchronizationEnabled() zoneSynchronizationEnabledChanged() zoneSynchronizationAttribute() - */ + Enables the zone synchronization, if \a enabled is true, otherwise it will be disabled. + + \sa isZoneSynchronizationEnabled() zoneSynchronizationEnabledChanged() zoneSynchronizationAttribute() +*/ void QIviClimateControl::setZoneSynchronizationEnabled(bool enabled) { Q_D(QIviClimateControl); @@ -1556,10 +1558,10 @@ void QIviClimateControl::setZoneSynchronizationEnabled(bool enabled) } /*! - * Enables defrosting of the windshield, if \a enabled is true, otherwise it will be disabled. - * - * \sa isDefrostEnabled() defrostEnabledChanged() defrostAttribute() - */ + Enables defrosting of the windshield, if \a enabled is true, otherwise it will be disabled. + + \sa isDefrostEnabled() defrostEnabledChanged() defrostAttribute() +*/ void QIviClimateControl::setDefrostEnabled(bool enabled) { Q_D(QIviClimateControl); @@ -1568,10 +1570,10 @@ void QIviClimateControl::setDefrostEnabled(bool enabled) } /*! - * Sets the recirculation mode to \a recirculationMode. - * - * \sa recirculationMode() recirculationModeChanged() recirculationModeAttribute() - */ + Sets the recirculation mode to \a recirculationMode. + + \sa recirculationMode() recirculationModeChanged() recirculationModeAttribute() +*/ void QIviClimateControl::setRecirculationMode(QIviClimateControl::RecirculationMode recirculationMode) { Q_D(QIviClimateControl); @@ -1580,10 +1582,10 @@ void QIviClimateControl::setRecirculationMode(QIviClimateControl::RecirculationM } /*! - * Sets the current sensitivity level for the AutomaticRecirculation mode to \a value, where the level can be between \c minimumValue(least sensitive) and \c maximumValue(most sensitive). - * - * \sa recirculationSensitivityLevel() recirculationSensitivityLevelChanged() recirculationSensitivityLevelAttribute() - */ + Sets the current sensitivity level for the AutomaticRecirculation mode to \a value, where the level can be between \c minimumValue(least sensitive) and \c maximumValue(most sensitive). + + \sa recirculationSensitivityLevel() recirculationSensitivityLevelChanged() recirculationSensitivityLevelAttribute() +*/ void QIviClimateControl::setRecirculationSensitivityLevel(int value) { Q_D(QIviClimateControl); @@ -1592,10 +1594,10 @@ void QIviClimateControl::setRecirculationSensitivityLevel(int value) } /*! - * Sets the climate mode to \a climateMode. - * - * \sa climateMode() climateModeChanged() climateModeAttribute() - */ + Sets the climate mode to \a climateMode. + + \sa climateMode() climateModeChanged() climateModeAttribute() +*/ void QIviClimateControl::setClimateMode(QIviClimateControl::ClimateMode climateMode) { Q_D(QIviClimateControl); @@ -1604,10 +1606,10 @@ void QIviClimateControl::setClimateMode(QIviClimateControl::ClimateMode climateM } /*! - * Sets the current fan intensity level for the AutomaticClimate mode to \a value, where the level can be between \c minimumValue(least intensity) and \c maximumValue(most intensity). - * - * \sa automaticClimateFanIntensityLevel() automaticClimateFanIntensityLevelChanged() automaticClimateFanIntensityLevelAttribute() - */ + Sets the current fan intensity level for the AutomaticClimate mode to \a value, where the level can be between \c minimumValue(least intensity) and \c maximumValue(most intensity). + + \sa automaticClimateFanIntensityLevel() automaticClimateFanIntensityLevelChanged() automaticClimateFanIntensityLevelAttribute() +*/ void QIviClimateControl::setAutomaticClimateFanIntensityLevel(int value) { Q_D(QIviClimateControl); @@ -1616,228 +1618,230 @@ void QIviClimateControl::setAutomaticClimateFanIntensityLevel(int value) } /*! - * \fn void QIviClimateControl::airflowDirectionsChanged(QIviClimateControl::AirflowDirections value) - * - * This signal is emitted whenever the air flow directions change. The new flow directions are passed as \a value. - * - * \sa airflowDirections() setAirflowDirections() airflowDirectionsAttribute() - */ -/*! - * \fn void QIviClimateControl::airflowDirectionsAttributeChanged(const QIviPropertyAttribute<QIviClimateControl::AirflowDirections> &attribute); - * - * This signal is emitted whenever the attribute for the airflowDirections property changes. The new attribute is passed as \a attribute. - * - * \sa airflowDirectionsAttribute() airflowDirections() - */ -/*! - * \fn void QIviClimateControl::airConditioningEnabledChanged(bool enabled); - * - * This signal is emitted whenever the air conditioning system is turned \e on or \e off. The new value is passed as \a enabled. - * - * \sa isAirConditioningEnabled() setAirConditioningEnabled() airConditioningAttribute() - */ -/*! - * \fn void QIviClimateControl::airConditioningAttributeChanged(const QIviPropertyAttribute<bool> &attribute); - * - * This signal is emitted whenever the attribute for the airConditioning property changes. The new attribute is passed as \a attribute. - * - * \sa airConditioningAttribute() isAirConditioningEnabled() - */ -/*! - * \fn void QIviClimateControl::heaterEnabledChanged(bool enabled); - * - * This signal is emitted whenever the heater is turned \e on or \e off. The new value is passed as \a enabled. - * - * \sa isHeaterEnabled() setHeaterEnabled() heaterAttribute() - */ -/*! - * \fn void QIviClimateControl::heaterAttributeChanged(const QIviPropertyAttribute<bool> &attribute); - * - * This signal is emitted whenever the attribute for the heater property changes. The new attribute is passed as \a attribute. - * - * \sa heaterAttribute() isHeaterEnabled() - */ -/*! - * \fn void QIviClimateControl::steeringWheelHeaterChanged(int value); - * - * This signal is emitted whenever the steering wheel heater level changed. The new level is passed as \a value. - * - * \sa steeringWheelHeater() setSteeringWheelHeater() steeringWheelHeaterAttribute() - */ -/*! - * \fn void QIviClimateControl::steeringWheelHeaterAttributeChanged(const QIviPropertyAttribute<int> &attribute); - * - * This signal is emitted whenever the attribute for the steeringWheelHeater property changes. The new attribute is passed as \a attribute. - * - * \sa steeringWheelHeaterAttribute() steeringWheelHeater() - */ -/*! - * \fn void QIviClimateControl::fanSpeedLevelChanged(int value); - * - * This signal is emitted whenever the fan speed level changed. The new level is passed as \a value. - * - * \sa fanSpeedLevel() setFanSpeedLevel() fanSpeedLevelAttribute() - */ -/*! - * \fn void QIviClimateControl::fanSpeedLevelAttributeChanged(const QIviPropertyAttribute<int> &attribute); - * - * This signal is emitted whenever the attribute for the fanSpeedLevel property changes. The new attribute is passed as \a attribute. - * - * \sa fanSpeedLevelAttribute() fanSpeedLevel() - */ -/*! - * \fn void QIviClimateControl::targetTemperatureChanged(int temperature); - * - * This signal is emitted whenever the target temperature changed. The new temperature is passed as \a temperature. - * - * \sa targetTemperature() setTargetTemperature() targetTemperatureAttribute() - */ -/*! - * \fn void QIviClimateControl::targetTemperatureAttributeChanged(const QIviPropertyAttribute<int> &attribute); - * - * This signal is emitted whenever the attribute for the targetTemperature property changes. The new attribute is passed as \a attribute. - * - * \sa targetTemperatureAttribute() targetTemperature() - */ -/*! - * \fn void QIviClimateControl::seatCoolerChanged(int value); - * - * This signal is emitted whenever the seat cooler level changed. The new level is passed as \a value. - * - * \sa seatCooler() setSeatCooler() seatCoolerAttribute() - */ -/*! - * \fn void QIviClimateControl::seatCoolerAttributeChanged(const QIviPropertyAttribute<int> &attribute); - * - * This signal is emitted whenever the attribute for the seatCooler property changes. The new attribute is passed as \a attribute. - * - * \sa seatCoolerAttribute() seatCooler() - */ -/*! - * \fn void QIviClimateControl::seatHeaterChanged(int value); - * - * This signal is emitted whenever the seat heater level changed. The new level is passed as \a value. - * - * \sa seatHeater() setSeatHeater() seatHeaterAttribute() - */ -/*! - * \fn void QIviClimateControl::seatHeaterAttributeChanged(const QIviPropertyAttribute<int> &attribute); - * - * This signal is emitted whenever the attribute for the heater property changes. The new attribute is passed as \a attribute. - * - * \sa heaterAttribute() isHeaterEnabled() - */ -/*! - * \fn void QIviClimateControl::outsideTemperatureChanged(int value); - * - * This signal is emitted whenever the outside temperature changes. The new temperature is passed as \a value. - * - * \sa outsideTemperature() outsideTemperatureAttribute() - */ -/*! - * \fn void QIviClimateControl::outsideTemperatureAttributeChanged(const QIviPropertyAttribute<int> &attribute); - * - * This signal is emitted whenever the attribute for the outsideTemperature property changes. The new attribute is passed as \a attribute. - * - * \sa outsideTemperatureAttribute() outsideTemperature() - */ -/*! - * \fn void QIviClimateControl::zoneSynchronizationEnabledChanged(bool enabled); - * - * This signal is emitted whenever the zone synchronization is turned \e on or \e off. The new value is passed as \a enabled. - * - * \sa isZoneSynchronizationEnabled() setZoneSynchronizationEnabled() zoneSynchronizationAttribute() - */ -/*! - * \fn void QIviClimateControl::zoneSynchronizationAttributeChanged(const QIviPropertyAttribute<bool> &attribute); - * - * This signal is emitted whenever the attribute for the zoneSynchronization property changes. The new attribute is passed as \a attribute. - * - * \sa zoneSynchronizationAttribute() isZoneSynchronizationEnabled() - */ -/*! - * \fn void QIviClimateControl::defrostEnabledChanged(bool enabled); - * - * This signal is emitted whenever the defrost is turned \e on or \e off. The new value is passed as \a enabled. - * - * \sa isDefrostEnabled() setDefrostEnabled() defrostAttribute() - */ -/*! - * \fn void QIviClimateControl::defrostAttributeChanged(const QIviPropertyAttribute<bool> &attribute); - * - * This signal is emitted whenever the attribute for the defrost property changes. The new attribute is passed as \a attribute. - * - * \sa defrostAttribute() isDefrostEnabled() - */ -/*! - * \fn void QIviClimateControl::recirculationEnabledChanged(bool enabled); - * - * This signal is emitted whenever the recirculation is turned \e on or \e off. The new value is passed as \a enabled. - * - * \sa isRecirculationEnabled() recirculationAttribute() - */ -/*! - * \fn void QIviClimateControl::recirculationAttributeChanged(const QIviPropertyAttribute<bool> &attribute); - * - * This signal is emitted whenever the attribute for the heater property changes. The new attribute is passed as \a attribute. - * - * \sa recirculationAttribute() isRecirculationEnabled() - */ -/*! - * \fn void QIviClimateControl::recirculationModeChanged(QIviClimateControl::RecirculationMode value) - * - * This signal is emitted whenever the recirculation mode changes. The new recirculation mode is passed as \a value. - * - * \sa recirculationMode() setRecirculationMode() recirculationModeAttribute() - */ -/*! - * \fn void QIviClimateControl::recirculationModeAttributeChanged(const QIviPropertyAttribute<QIviClimateControl::RecirculationMode> &attribute); - * - * This signal is emitted whenever the attribute for the recirculationMode property changes. The new attribute is passed as \a attribute. - * - * \sa recirculationModeAttribute() recirculationMode() - */ -/*! - * \fn void QIviClimateControl::recirculationSensitivityLevelChanged(int value); - * - * This signal is emitted whenever the recirculation sensitivity level level changes. The new level is passed as \a value. - * - * \sa recirculationSensitivityLevel() setRecirculationSensitivityLevel() recirculationSensitivityLevelAttribute() - */ -/*! - * \fn void QIviClimateControl::recirculationSensitivityLevelAttributeChanged(const QIviPropertyAttribute<int> &attribute); - * - * This signal is emitted whenever the attribute for the recirculationSensitivityLevel property changes. The new attribute is passed as \a attribute. - * - * \sa recirculationSensitivityLevelAttribute() recirculationSensitivityLevel() - */ -/*! - * \fn void QIviClimateControl::climateModeChanged(QIviClimateControl::ClimateMode value) - * - * This signal is emitted whenever the climate mode changes. The new climate mode is passed as \a value. - * - * \sa climateMode() setClimateMode() climateModeAttribute() - */ -/*! - * \fn void QIviClimateControl::climateModeAttributeChanged(const QIviPropertyAttribute<QIviClimateControl::ClimateMode> &attribute); - * - * This signal is emitted whenever the attribute for the climateMode property changes. The new attribute is passed as \a attribute. - * - * \sa climateModeAttribute() climateMode() - */ -/*! - * \fn void QIviClimateControl::automaticClimateFanIntensityLevelChanged(int value); - * - * This signal is emitted whenever the fan intensity level changes. The new level is passed as \a value. - * - * \sa automaticClimateFanIntensityLevel() setAutomaticClimateFanIntensityLevel() automaticClimateFanIntensityLevelAttribute() - */ -/*! - * \fn void QIviClimateControl::automaticClimateFanIntensityLevelAttributeChanged(const QIviPropertyAttribute<int> &attribute); - * - * This signal is emitted whenever the attribute for the automaticClimateFanIntensityLevel property changes. The new attribute is passed as \a attribute. - * - * \sa automaticClimateFanIntensityLevelAttribute() automaticClimateFanIntensityLevel() - */ - - #include "moc_qiviclimatecontrol.cpp" + \fn void QIviClimateControl::airflowDirectionsChanged(QIviClimateControl::AirflowDirections value) + + This signal is emitted whenever the air flow directions change. The new flow directions are passed as \a value. + + \sa airflowDirections() setAirflowDirections() airflowDirectionsAttribute() +*/ +/*! + \fn void QIviClimateControl::airflowDirectionsAttributeChanged(const QIviPropertyAttribute<QIviClimateControl::AirflowDirections> &attribute); + + This signal is emitted whenever the attribute for the airflowDirections property changes. The new attribute is passed as \a attribute. + + \sa airflowDirectionsAttribute() airflowDirections() +*/ +/*! + \fn void QIviClimateControl::airConditioningEnabledChanged(bool enabled); + + This signal is emitted whenever the air conditioning system is turned \e on or \e off. The new value is passed as \a enabled. + + \sa isAirConditioningEnabled() setAirConditioningEnabled() airConditioningAttribute() +*/ +/*! + \fn void QIviClimateControl::airConditioningAttributeChanged(const QIviPropertyAttribute<bool> &attribute); + + This signal is emitted whenever the attribute for the airConditioning property changes. The new attribute is passed as \a attribute. + + \sa airConditioningAttribute() isAirConditioningEnabled() +*/ +/*! + \fn void QIviClimateControl::heaterEnabledChanged(bool enabled); + + This signal is emitted whenever the heater is turned \e on or \e off. The new value is passed as \a enabled. + + \sa isHeaterEnabled() setHeaterEnabled() heaterAttribute() +*/ +/*! + \fn void QIviClimateControl::heaterAttributeChanged(const QIviPropertyAttribute<bool> &attribute); + + This signal is emitted whenever the attribute for the heater property changes. The new attribute is passed as \a attribute. + + \sa heaterAttribute() isHeaterEnabled() +*/ +/*! + \fn void QIviClimateControl::steeringWheelHeaterChanged(int value); + + This signal is emitted whenever the steering wheel heater level changed. The new level is passed as \a value. + + \sa steeringWheelHeater() setSteeringWheelHeater() steeringWheelHeaterAttribute() +*/ +/*! + \fn void QIviClimateControl::steeringWheelHeaterAttributeChanged(const QIviPropertyAttribute<int> &attribute); + + This signal is emitted whenever the attribute for the steeringWheelHeater property changes. The new attribute is passed as \a attribute. + + \sa steeringWheelHeaterAttribute() steeringWheelHeater() +*/ +/*! + \fn void QIviClimateControl::fanSpeedLevelChanged(int value); + + This signal is emitted whenever the fan speed level changed. The new level is passed as \a value. + + \sa fanSpeedLevel() setFanSpeedLevel() fanSpeedLevelAttribute() +*/ +/*! + \fn void QIviClimateControl::fanSpeedLevelAttributeChanged(const QIviPropertyAttribute<int> &attribute); + + This signal is emitted whenever the attribute for the fanSpeedLevel property changes. The new attribute is passed as \a attribute. + + \sa fanSpeedLevelAttribute() fanSpeedLevel() +*/ +/*! + \fn void QIviClimateControl::targetTemperatureChanged(int temperature); + + This signal is emitted whenever the target temperature changed. The new temperature is passed as \a temperature. + + \sa targetTemperature() setTargetTemperature() targetTemperatureAttribute() +*/ +/*! + \fn void QIviClimateControl::targetTemperatureAttributeChanged(const QIviPropertyAttribute<int> &attribute); + + This signal is emitted whenever the attribute for the targetTemperature property changes. The new attribute is passed as \a attribute. + + \sa targetTemperatureAttribute() targetTemperature() +*/ +/*! + \fn void QIviClimateControl::seatCoolerChanged(int value); + + This signal is emitted whenever the seat cooler level changed. The new level is passed as \a value. + + \sa seatCooler() setSeatCooler() seatCoolerAttribute() +*/ +/*! + \fn void QIviClimateControl::seatCoolerAttributeChanged(const QIviPropertyAttribute<int> &attribute); + + This signal is emitted whenever the attribute for the seatCooler property changes. The new attribute is passed as \a attribute. + + \sa seatCoolerAttribute() seatCooler() +*/ +/*! + \fn void QIviClimateControl::seatHeaterChanged(int value); + + This signal is emitted whenever the seat heater level changed. The new level is passed as \a value. + + \sa seatHeater() setSeatHeater() seatHeaterAttribute() +*/ +/*! + \fn void QIviClimateControl::seatHeaterAttributeChanged(const QIviPropertyAttribute<int> &attribute); + + This signal is emitted whenever the attribute for the heater property changes. The new attribute is passed as \a attribute. + + \sa heaterAttribute() isHeaterEnabled() +*/ +/*! + \fn void QIviClimateControl::outsideTemperatureChanged(int value); + + This signal is emitted whenever the outside temperature changes. The new temperature is passed as \a value. + + \sa outsideTemperature() outsideTemperatureAttribute() +*/ +/*! + \fn void QIviClimateControl::outsideTemperatureAttributeChanged(const QIviPropertyAttribute<int> &attribute); + + This signal is emitted whenever the attribute for the outsideTemperature property changes. The new attribute is passed as \a attribute. + + \sa outsideTemperatureAttribute() outsideTemperature() +*/ +/*! + \fn void QIviClimateControl::zoneSynchronizationEnabledChanged(bool enabled); + + This signal is emitted whenever the zone synchronization is turned \e on or \e off. The new value is passed as \a enabled. + + \sa isZoneSynchronizationEnabled() setZoneSynchronizationEnabled() zoneSynchronizationAttribute() +*/ +/*! + \fn void QIviClimateControl::zoneSynchronizationAttributeChanged(const QIviPropertyAttribute<bool> &attribute); + + This signal is emitted whenever the attribute for the zoneSynchronization property changes. The new attribute is passed as \a attribute. + + \sa zoneSynchronizationAttribute() isZoneSynchronizationEnabled() +*/ +/*! + \fn void QIviClimateControl::defrostEnabledChanged(bool enabled); + + This signal is emitted whenever the defrost is turned \e on or \e off. The new value is passed as \a enabled. + + \sa isDefrostEnabled() setDefrostEnabled() defrostAttribute() +*/ +/*! + \fn void QIviClimateControl::defrostAttributeChanged(const QIviPropertyAttribute<bool> &attribute); + + This signal is emitted whenever the attribute for the defrost property changes. The new attribute is passed as \a attribute. + + \sa defrostAttribute() isDefrostEnabled() +*/ +/*! + \fn void QIviClimateControl::recirculationEnabledChanged(bool enabled); + + This signal is emitted whenever the recirculation is turned \e on or \e off. The new value is passed as \a enabled. + + \sa isRecirculationEnabled() recirculationAttribute() +*/ +/*! + \fn void QIviClimateControl::recirculationAttributeChanged(const QIviPropertyAttribute<bool> &attribute); + + This signal is emitted whenever the attribute for the heater property changes. The new attribute is passed as \a attribute. + + \sa recirculationAttribute() isRecirculationEnabled() +*/ +/*! + \fn void QIviClimateControl::recirculationModeChanged(QIviClimateControl::RecirculationMode value) + + This signal is emitted whenever the recirculation mode changes. The new recirculation mode is passed as \a value. + + \sa recirculationMode() setRecirculationMode() recirculationModeAttribute() +*/ +/*! + \fn void QIviClimateControl::recirculationModeAttributeChanged(const QIviPropertyAttribute<QIviClimateControl::RecirculationMode> &attribute); + + This signal is emitted whenever the attribute for the recirculationMode property changes. The new attribute is passed as \a attribute. + + \sa recirculationModeAttribute() recirculationMode() +*/ +/*! + \fn void QIviClimateControl::recirculationSensitivityLevelChanged(int value); + + This signal is emitted whenever the recirculation sensitivity level level changes. The new level is passed as \a value. + + \sa recirculationSensitivityLevel() setRecirculationSensitivityLevel() recirculationSensitivityLevelAttribute() +*/ +/*! + \fn void QIviClimateControl::recirculationSensitivityLevelAttributeChanged(const QIviPropertyAttribute<int> &attribute); + + This signal is emitted whenever the attribute for the recirculationSensitivityLevel property changes. The new attribute is passed as \a attribute. + + \sa recirculationSensitivityLevelAttribute() recirculationSensitivityLevel() +*/ +/*! + \fn void QIviClimateControl::climateModeChanged(QIviClimateControl::ClimateMode value) + + This signal is emitted whenever the climate mode changes. The new climate mode is passed as \a value. + + \sa climateMode() setClimateMode() climateModeAttribute() +*/ +/*! + \fn void QIviClimateControl::climateModeAttributeChanged(const QIviPropertyAttribute<QIviClimateControl::ClimateMode> &attribute); + + This signal is emitted whenever the attribute for the climateMode property changes. The new attribute is passed as \a attribute. + + \sa climateModeAttribute() climateMode() +*/ +/*! + \fn void QIviClimateControl::automaticClimateFanIntensityLevelChanged(int value); + + This signal is emitted whenever the fan intensity level changes. The new level is passed as \a value. + + \sa automaticClimateFanIntensityLevel() setAutomaticClimateFanIntensityLevel() automaticClimateFanIntensityLevelAttribute() +*/ +/*! + \fn void QIviClimateControl::automaticClimateFanIntensityLevelAttributeChanged(const QIviPropertyAttribute<int> &attribute); + + This signal is emitted whenever the attribute for the automaticClimateFanIntensityLevel property changes. The new attribute is passed as \a attribute. + + \sa automaticClimateFanIntensityLevelAttribute() automaticClimateFanIntensityLevel() +*/ + +QT_END_NAMESPACE + +#include "moc_qiviclimatecontrol.cpp" diff --git a/src/ivivehiclefunctions/qiviclimatecontrol.h b/src/ivivehiclefunctions/qiviclimatecontrol.h index 2faf2ce..316cdee 100644 --- a/src/ivivehiclefunctions/qiviclimatecontrol.h +++ b/src/ivivehiclefunctions/qiviclimatecontrol.h @@ -94,7 +94,7 @@ public: }; Q_ENUM(ClimateMode) - QIviClimateControl(const QString &zone = QString(), QObject *parent = Q_NULLPTR); + QIviClimateControl(const QString &zone = QString(), QObject *parent = nullptr); ~QIviClimateControl(); bool isAirConditioningEnabled() const; @@ -197,11 +197,11 @@ Q_SIGNALS: void automaticClimateFanIntensityLevelAttributeChanged(const QIviPropertyAttribute<int> &attribute); protected: - QIviClimateControl(QIviClimateControlPrivate &dd, QObject *parent = Q_NULLPTR); - virtual QIviAbstractZonedFeature *createZoneFeature(const QString &zone) Q_DECL_OVERRIDE; + QIviClimateControl(QIviClimateControlPrivate &dd, QObject *parent = nullptr); + virtual QIviAbstractZonedFeature *createZoneFeature(const QString &zone) override; - virtual void connectToServiceObject(QIviServiceObject *serviceObject) Q_DECL_OVERRIDE; - virtual void clearServiceObject() Q_DECL_OVERRIDE; + virtual void connectToServiceObject(QIviServiceObject *serviceObject) override; + virtual void clearServiceObject() override; private: Q_DECLARE_PRIVATE(QIviClimateControl) diff --git a/src/ivivehiclefunctions/qiviclimatecontrol_p.h b/src/ivivehiclefunctions/qiviclimatecontrol_p.h index 38502a0..104867a 100644 --- a/src/ivivehiclefunctions/qiviclimatecontrol_p.h +++ b/src/ivivehiclefunctions/qiviclimatecontrol_p.h @@ -66,7 +66,7 @@ class QIviClimateControlPrivate : public QIviAbstractZonedFeaturePrivate public: QIviClimateControlPrivate(const QString &interface, const QString &zone, QIviClimateControl *parent); - virtual void initialize() Q_DECL_OVERRIDE; + virtual void initialize() override; void clearToDefaults(); void onAirflowDirectionsChanged(QIviClimateControl::AirflowDirections value, const QString &zone); diff --git a/src/ivivehiclefunctions/qiviclimatecontrolbackendinterface.cpp b/src/ivivehiclefunctions/qiviclimatecontrolbackendinterface.cpp index 947901a..b21d1ce 100644 --- a/src/ivivehiclefunctions/qiviclimatecontrolbackendinterface.cpp +++ b/src/ivivehiclefunctions/qiviclimatecontrolbackendinterface.cpp @@ -41,416 +41,421 @@ #include "qiviclimatecontrolbackendinterface.h" +QT_BEGIN_NAMESPACE + /*! - * \class QIviClimateControlBackendInterface - * \inmodule QtIviVehicleFunctions - * \ingroup backends - * \inherits QIviZonedFeatureInterface - * \brief The QIviClimateControlBackendInterface defines the interface for backends to the - * QIviClimateControl feature class. - * - * The QIviClimateControlBackendInterface is the interface used by \l QIviClimateControl - * - * The interface is discovered by a \l QIviClimateControl object, which connects to it and sets up - * the connections to it. - * - * \sa QIviClimateControl - */ - -/*! - * \fn QIviClimateControlBackendInterface::QIviClimateControlBackendInterface(QObject *parent=0) - * - * Constructs a backend interface. - * - * The \a parent is sent to the QObject constructor. - */ + \class QIviClimateControlBackendInterface + \inmodule QtIviVehicleFunctions + \ingroup backends + \inherits QIviZonedFeatureInterface + \keyword org.qt-project.qtivi.ClimateControl/1.0 + \brief The QIviClimateControlBackendInterface defines the interface for backends to the + QIviClimateControl feature class. + + The QIviClimateControlBackendInterface is the interface used by \l QIviClimateControl + + The interface is discovered by a \l QIviClimateControl object, which connects to it and sets up + the connections to it. + + \sa QIviClimateControl +*/ + +/*! + \fn QIviClimateControlBackendInterface::QIviClimateControlBackendInterface(QObject *parent = nullptr) + + Constructs a backend interface. + + The \a parent is sent to the QObject constructor. +*/ QIviClimateControlBackendInterface::QIviClimateControlBackendInterface(QObject *parent) : QIviZonedFeatureInterface(parent) { } /*! - * \fn virtual void QIviClimateControlBackendInterface::setTargetTemperature(int value, const QString &zone) = 0 - * - * Sets the target temperature of \a zone to \a value, where the \a value is expressed in - * centigrades and may be range limited by the backend. - * - * This method is expected to emit a \l targetTemperatureChanged() signal when the internal state changes - * due to this function call. The signal is even expected to be emitted if the given \a value is out of range and no - * actual change takes place. - * - * \sa targetTemperatureChanged() - */ - -/*! - * \fn virtual void QIviClimateControlBackendInterface::setSeatCooler(int value, const QString &zone) = 0 - * - * Sets the seat ventilation level of \a zone to \a value. The range can be defined using the attribute system. - * - * This method is expected to emit a \l seatCoolerChanged() signal when the internal state changes - * due to this function call. The signal is even expected to be emitted if the given \a value is out of range and no - * actual change takes place. - * - * \sa seatCoolerChanged() - */ - -/*! - * \fn virtual void QIviClimateControlBackendInterface::setSeatHeater(int value, const QString &zone) = 0; - * - * Sets the seat heater level of \a zone to \a value. The range can be defined using the attribute system. - * - * This method is expected to emit a \l seatHeaterChanged() signal when the internal state changes - * due to this function call. The signal is even expected to be emitted if the given \a value is out of range and no - * actual change takes place. - * - * \sa seatHeaterChanged() - */ - -/*! - * \fn virtual void QIviClimateControlBackendInterface::setAirflowDirections(QIviClimateControl::AirflowDirections, const QString &zone) = 0; - * - * Sets the \a zone air flow directions to \a airflowDirections. - * - * This method is expected to emit the \l airflowDirectionsChanged() signal when the internal state changes - * due to this function call. - * - * \sa airflowDirectionsChanged() - */ - -/*! - * \fn virtual void QIviClimateControlBackendInterface::setAirConditioningEnabled(bool enabled, const QString &zone) = 0 - * - * Enables or disables the \a zone air conditioning based on \a enabled. - * - * This method is expected to emit the \l airConditioningEnabledChanged() signal when the internal state changes - * due to this function call. - * - * \sa airConditioningEnabledChanged() - */ - -/*! - * \fn virtual void QIviClimateControlBackendInterface::setHeaterEnabled(bool enabled, const QString &zone) = 0 - * - * Enables or disables the \a zone heater based on \a enabled. - * - * This method is expected to emit the \l heaterEnabledChanged() signal when the internal state changes - * due to this function call. - * - * \sa heaterEnabledChanged() - */ - -/*! - * \fn virtual void QIviClimateControlBackendInterface::setSteeringWheelHeater(int value, const QString &zone) = 0 - * - * Sets the steering wheel heater level of \a zone to \a value. The range can be defined using the attribute system. - * - * This method is expected to emit a \l steeringWheelHeaterChanged() signal when the internal state changes - * due to this function call. The signal is even expected to be emitted if the given \a value is out of range and no - * actual change takes place. - * - * \sa steeringWheelHeaterChanged() - */ - -/*! - * \fn virtual void QIviClimateControlBackendInterface::setFanSpeedLevel(int value, const QString &zone) = 0 - * - * Sets the fan speed level of \a zone to \a value. The range can be defined using the attribute system. - * - * This method is expected to emit a \l fanSpeedLevelChanged() signal when the internal state changes - * due to this function call. The signal is even expected to be emitted if the given \a value is out of range and no - * actual change takes place. - * - * \sa fanSpeedLevelChanged() - */ - -/*! - * \fn virtual void QIviClimateControlBackendInterface::setZoneSynchronizationEnabled(bool enabled, const QString &zone) = 0 - * - * Enables or disables the \a zone synchronization based on \a enabled. - * - * This method is expected to emit the \l zoneSynchronizationEnabledChanged() signal when the internal state changes - * due to this function call. - * - * \sa zoneSynchronizationEnabledChanged() - */ - -/*! - * \fn virtual void QIviClimateControlBackendInterface::setDefrostEnabled(bool enabled, const QString &zone) = 0 - * - * Enables or disables the \a zone defrost mode based on \a enabled. - * - * This method is expected to emit the \l defrostEnabledChanged() signal when the internal state changes - * due to this function call. - * - * \sa defrostEnabledChanged() - */ - -/*! - * \fn virtual void QIviClimateControlBackendInterface::setRecirculationMode(QIviClimateControl::RecirculationMode, const QString &zone) = 0; - * - * Sets the \a zone recirculation mode to \a recirculationMode. - * - * This method is expected to emit the \l recirculationModeChanged() signal when the internal state changes - * due to this function call. - * - * \sa recirculationModeChanged() - */ - -/*! - * \fn virtual void QIviClimateControlBackendInterface::setRecirculationSensitivityLevel(int value, const QString &zone) = 0 - * - * Sets the recirculation sensitivity level of \a zone to \a value. The range can be defined using the attribute system. - * - * This method is expected to emit a \l recirculationSensitivityLevelChanged() signal when the internal state changes - * due to this function call. The signal is even expected to be emitted if the given \a value is out of range and no - * actual change takes place. - * - * \sa recirculationSensitivityLevelChanged() - */ - -/*! - * \fn virtual void QIviClimateControlBackendInterface::setClimateMode(QIviClimateControl::ClimateMode, const QString &zone) = 0; - * - * Sets the \a zone climate mode to \a climateMode. - * - * This method is expected to emit the \l climateModeChanged() signal when the internal state changes - * due to this function call. - * - * \sa climateModeChanged() - */ - -/*! - * \fn virtual void QIviClimateControlBackendInterface::setAutomaticClimateFanIntensityLevel(int value, const QString &zone) = 0 - * - * Sets the fan intensity level for the AutomaticClimate mode of \a zone to \a value. The range can be defined using the attribute system. - * - * This method is expected to emit a \l automaticClimateFanIntensityLevelChanged() signal when the internal state changes - * due to this function call. The signal is even expected to be emitted if the given \a value is out of range and no - * actual change takes place. - * - * \sa automaticClimateFanIntensityLevelChanged() - */ - -/*! - * \fn virtual void QIviClimateControlBackendInterface::targetTemperatureChanged(int value, const QString &zone = QString()) = 0 - * - * The signal is emitted when the target temperature for \a zone is changed to \a value, where - * value is expressed in centigrades. - * - * \sa setTargetTemperature() - */ - -/*! - * \fn void QIviClimateControlBackendInterface::targetTemperatureAttributeChanged(const QIviPropertyAttribute<int> &attribute, const QString &zone = QString()); - * - * The signal is emitted when the target temperature attribute for \a zone is changed to \a attribute. - */ - -/*! - * \fn virtual void QIviClimateControlBackendInterface::seatCoolerChanged(int value, const QString &zone = QString()) = 0 - * - * The signal is emitted when the seat cooler level is changed for \a zone to \a value. The range can be defined using the attribute system. - * - * \sa setSeatCooler() - */ - -/*! - * \fn void QIviClimateControlBackendInterface::seatCoolerAttributeChanged(const QIviPropertyAttribute<int> &attribute, const QString &zone = QString()); - * - * The signal is emitted when the seat cooler level attribute for \a zone is changed to \a attribute. - */ + \fn virtual void QIviClimateControlBackendInterface::setTargetTemperature(int value, const QString &zone) = 0 + + Sets the target temperature of \a zone to \a value, where the \a value is expressed in + centigrades and may be range limited by the backend. + + This method is expected to emit a \l targetTemperatureChanged() signal when the internal state changes + due to this function call. The signal is even expected to be emitted if the given \a value is out of range and no + actual change takes place. + + \sa targetTemperatureChanged() +*/ /*! - * \fn virtual void QIviClimateControlBackendInterface::seatHeaterChanged(int value, const QString &zone = QString()) = 0 - * - * The signal is emitted when the seat heater level is changed for \a zone to \a value. The range can be defined using the attribute system. - * - * \sa setSeatHeater() - */ + \fn virtual void QIviClimateControlBackendInterface::setSeatCooler(int value, const QString &zone) = 0 + + Sets the seat ventilation level of \a zone to \a value. The range can be defined using the attribute system. + + This method is expected to emit a \l seatCoolerChanged() signal when the internal state changes + due to this function call. The signal is even expected to be emitted if the given \a value is out of range and no + actual change takes place. + + \sa seatCoolerChanged() +*/ /*! - * \fn void QIviClimateControlBackendInterface::seatHeaterAttributeChanged(const QIviPropertyAttribute<int> &attribute, const QString &zone = QString()); - * - * The signal is emitted when the seat heater attribute for \a zone is changed to \a attribute. - */ + \fn virtual void QIviClimateControlBackendInterface::setSeatHeater(int value, const QString &zone) = 0; + + Sets the seat heater level of \a zone to \a value. The range can be defined using the attribute system. + + This method is expected to emit a \l seatHeaterChanged() signal when the internal state changes + due to this function call. The signal is even expected to be emitted if the given \a value is out of range and no + actual change takes place. + + \sa seatHeaterChanged() +*/ /*! - * \fn virtual void QIviClimateControlBackendInterface::airflowDirectionsChanged(QIviClimateControl::AirflowDirections airflowDirections, const QString &zone = QString()) = 0 - * - * The signal is emitted when the \a zone airflow directions changed to \a airflowDirections. - * - * \sa setAirflowDirections() - */ + \fn virtual void QIviClimateControlBackendInterface::setAirflowDirections(QIviClimateControl::AirflowDirections, const QString &zone) = 0; + + Sets the \a zone air flow directions to \a airflowDirections. + + This method is expected to emit the \l airflowDirectionsChanged() signal when the internal state changes + due to this function call. + + \sa airflowDirectionsChanged() +*/ /*! - * \fn void QIviClimateControlBackendInterface::airflowDirectionsAttributeChanged(const QIviPropertyAttribute<QIviClimateControl::AirflowDirections> &attribute, const QString &zone = QString()); - * - * The signal is emitted when the zone airflow direction attribute for \a zone is changed to \a attribute. - */ + \fn virtual void QIviClimateControlBackendInterface::setAirConditioningEnabled(bool enabled, const QString &zone) = 0 + + Enables or disables the \a zone air conditioning based on \a enabled. + + This method is expected to emit the \l airConditioningEnabledChanged() signal when the internal state changes + due to this function call. + + \sa airConditioningEnabledChanged() +*/ /*! - * \fn virtual void QIviClimateControlBackendInterface::airConditioningEnabledChanged(bool enabled, const QString &zone = QString()) = 0 - * - * The signal is emitted when the \a zone air conditioning state is changed to \a enabled. - * - * \sa setAirConditioningEnabled() - */ + \fn virtual void QIviClimateControlBackendInterface::setHeaterEnabled(bool enabled, const QString &zone) = 0 + + Enables or disables the \a zone heater based on \a enabled. + + This method is expected to emit the \l heaterEnabledChanged() signal when the internal state changes + due to this function call. + + \sa heaterEnabledChanged() +*/ /*! - * \fn void QIviClimateControlBackendInterface::airConditioningAttributeChanged(const QIviPropertyAttribute<bool> &attribute, const QString &zone = QString()); - * - * The signal is emitted when the air conditioning state attribute for \a zone is changed to \a attribute. - */ + \fn virtual void QIviClimateControlBackendInterface::setSteeringWheelHeater(int value, const QString &zone) = 0 + + Sets the steering wheel heater level of \a zone to \a value. The range can be defined using the attribute system. + + This method is expected to emit a \l steeringWheelHeaterChanged() signal when the internal state changes + due to this function call. The signal is even expected to be emitted if the given \a value is out of range and no + actual change takes place. + + \sa steeringWheelHeaterChanged() +*/ /*! - * \fn virtual void QIviClimateControlBackendInterface::heaterEnabledChanged(bool enabled, const QString &zone = QString()) = 0 - * - * The signal is emitted when the \a zone heater state is changed to \a enabled. - * - * \sa setHeaterEnabled() - */ + \fn virtual void QIviClimateControlBackendInterface::setFanSpeedLevel(int value, const QString &zone) = 0 + + Sets the fan speed level of \a zone to \a value. The range can be defined using the attribute system. + + This method is expected to emit a \l fanSpeedLevelChanged() signal when the internal state changes + due to this function call. The signal is even expected to be emitted if the given \a value is out of range and no + actual change takes place. + + \sa fanSpeedLevelChanged() +*/ /*! - * \fn void QIviClimateControlBackendInterface::heaterAttributeChanged(const QIviPropertyAttribute<bool> &attribute, const QString &zone = QString()); - * - * The signal is emitted when the heater state attribute for \a zone is changed to \a attribute. - */ + \fn virtual void QIviClimateControlBackendInterface::setZoneSynchronizationEnabled(bool enabled, const QString &zone) = 0 + + Enables or disables the \a zone synchronization based on \a enabled. + + This method is expected to emit the \l zoneSynchronizationEnabledChanged() signal when the internal state changes + due to this function call. + + \sa zoneSynchronizationEnabledChanged() +*/ /*! - * \fn virtual void QIviClimateControlBackendInterface::steeringWheelHeaterChanged(int level, const QString &zone = QString()) = 0 - * - * The signals is emitted when the steering wheel heater level of \a zone is changed to \a level. The range can be defined using the attribute system. - * - * \sa setSteeringWheelHeater() - */ + \fn virtual void QIviClimateControlBackendInterface::setDefrostEnabled(bool enabled, const QString &zone) = 0 + + Enables or disables the \a zone defrost mode based on \a enabled. + + This method is expected to emit the \l defrostEnabledChanged() signal when the internal state changes + due to this function call. + + \sa defrostEnabledChanged() +*/ /*! - * \fn void QIviClimateControlBackendInterface::steeringWheelHeaterAttributeChanged(const QIviPropertyAttribute<int> &attribute, const QString &zone = QString()); - * - * The signal is emitted when the steering wheel heater level attribute for \a zone is changed to \a attribute. - */ + \fn virtual void QIviClimateControlBackendInterface::setRecirculationMode(QIviClimateControl::RecirculationMode, const QString &zone) = 0; + + Sets the \a zone recirculation mode to \a recirculationMode. + + This method is expected to emit the \l recirculationModeChanged() signal when the internal state changes + due to this function call. + + \sa recirculationModeChanged() +*/ /*! - * \fn virtual void QIviClimateControlBackendInterface::fanSpeedLevelChanged(int level, const QString &zone = QString()) = 0 - * - * The signals is emitted when the fan speel level of \a zone is changed to \a level. The range can be defined using the attribute system. - * - * \sa setFanSpeedLevel() - */ + \fn virtual void QIviClimateControlBackendInterface::setRecirculationSensitivityLevel(int value, const QString &zone) = 0 + + Sets the recirculation sensitivity level of \a zone to \a value. The range can be defined using the attribute system. + + This method is expected to emit a \l recirculationSensitivityLevelChanged() signal when the internal state changes + due to this function call. The signal is even expected to be emitted if the given \a value is out of range and no + actual change takes place. + + \sa recirculationSensitivityLevelChanged() +*/ /*! - * \fn void QIviClimateControlBackendInterface::fanSpeedLevelAttributeChanged(const QIviPropertyAttribute<int> &attribute, const QString &zone = QString()); - * - * The signal is emitted when the recirculation sensitivity level for \a zone is changed to \a attribute. - */ + \fn virtual void QIviClimateControlBackendInterface::setClimateMode(QIviClimateControl::ClimateMode, const QString &zone) = 0; + + Sets the \a zone climate mode to \a climateMode. + + This method is expected to emit the \l climateModeChanged() signal when the internal state changes + due to this function call. + + \sa climateModeChanged() +*/ /*! - * \fn virtual void QIviClimateControlBackendInterface::outsideTemperatureChanged(int value, const QString &zone = QString()) = 0 - * - * The signal is emitted when the outside temperature for \a zone is changed to \a value, where - * value is expressed in centigrades. - */ + \fn virtual void QIviClimateControlBackendInterface::setAutomaticClimateFanIntensityLevel(int value, const QString &zone) = 0 + + Sets the fan intensity level for the AutomaticClimate mode of \a zone to \a value. The range can be defined using the attribute system. + + This method is expected to emit a \l automaticClimateFanIntensityLevelChanged() signal when the internal state changes + due to this function call. The signal is even expected to be emitted if the given \a value is out of range and no + actual change takes place. + + \sa automaticClimateFanIntensityLevelChanged() +*/ /*! - * \fn void QIviClimateControlBackendInterface::outsideTemperatureAttributeChanged(const QIviPropertyAttribute<int> &attribute, const QString &zone = QString()); - * - * The signal is emitted when the outside temperature attribute for \a zone is changed to \a attribute. - */ + \fn virtual void QIviClimateControlBackendInterface::targetTemperatureChanged(int value, const QString &zone = QString()) = 0 + + The signal is emitted when the target temperature for \a zone is changed to \a value, where + value is expressed in centigrades. + + \sa setTargetTemperature() +*/ /*! - * \fn virtual void QIviClimateControlBackendInterface::zoneSynchronizationEnabledChanged(bool enabled, const QString &zone = QString()) = 0 - * - * The signal is emitted when the \a zone synchronization state is changed to \a enabled. - * - * \sa setZoneSynchronizationEnabled() - */ + \fn void QIviClimateControlBackendInterface::targetTemperatureAttributeChanged(const QIviPropertyAttribute<int> &attribute, const QString &zone = QString()); + + The signal is emitted when the target temperature attribute for \a zone is changed to \a attribute. +*/ /*! - * \fn void QIviClimateControlBackendInterface::zoneSynchronizationAttributeChanged(const QIviPropertyAttribute<bool> &attribute, const QString &zone = QString()); - * - * The signal is emitted when the zone synchronization state attribute for \a zone is changed to \a attribute. - */ + \fn virtual void QIviClimateControlBackendInterface::seatCoolerChanged(int value, const QString &zone = QString()) = 0 + + The signal is emitted when the seat cooler level is changed for \a zone to \a value. The range can be defined using the attribute system. + \sa setSeatCooler() +*/ /*! - * \fn virtual void QIviClimateControlBackendInterface::defrostEnabledChanged(bool enabled, const QString &zone = QString()) = 0 - * - * The signal is emitted when the \a zone defrost state is changed to \a enabled. - * - * \sa setDefrostEnabled() - */ + \fn void QIviClimateControlBackendInterface::seatCoolerAttributeChanged(const QIviPropertyAttribute<int> &attribute, const QString &zone = QString()); + + The signal is emitted when the seat cooler level attribute for \a zone is changed to \a attribute. +*/ /*! - * \fn void QIviClimateControlBackendInterface::defrostAttributeChanged(const QIviPropertyAttribute<bool> &attribute, const QString &zone = QString()); - * - * The signal is emitted when the defrost state attribute for \a zone is changed to \a attribute. - */ + \fn virtual void QIviClimateControlBackendInterface::seatHeaterChanged(int value, const QString &zone = QString()) = 0 + + The signal is emitted when the seat heater level is changed for \a zone to \a value. The range can be defined using the attribute system. + \sa setSeatHeater() +*/ /*! - * \fn virtual void QIviClimateControlBackendInterface::recirculationModeChanged(QIviClimateControl::RecirculationMode recirculationMode, const QString &zone = QString()) = 0 - * - * The signal is emitted when the \a zone recirculation mode changed to \a recirculationMode. - * - * \sa setRecirculationMode() - */ + \fn void QIviClimateControlBackendInterface::seatHeaterAttributeChanged(const QIviPropertyAttribute<int> &attribute, const QString &zone = QString()); + + The signal is emitted when the seat heater attribute for \a zone is changed to \a attribute. +*/ /*! - * \fn void QIviClimateControlBackendInterface::recirculationModeAttributeChanged(const QIviPropertyAttribute<QIviClimateControl::RecirculationMode> &attribute, const QString &zone = QString()); - * - * The signal is emitted when the recirculation mode attribute for \a zone is changed to \a attribute. - */ + \fn virtual void QIviClimateControlBackendInterface::airflowDirectionsChanged(QIviClimateControl::AirflowDirections airflowDirections, const QString &zone = QString()) = 0 + + The signal is emitted when the \a zone airflow directions changed to \a airflowDirections. + + \sa setAirflowDirections() +*/ /*! - * \fn virtual void QIviClimateControlBackendInterface::recirculationEnabledChanged(bool enabled, const QString &zone = QString()) = 0 - * - * The signal is emitted when the \a zone recirculation state is changed to \a enabled. - */ + \fn void QIviClimateControlBackendInterface::airflowDirectionsAttributeChanged(const QIviPropertyAttribute<QIviClimateControl::AirflowDirections> &attribute, const QString &zone = QString()); + + The signal is emitted when the zone airflow direction attribute for \a zone is changed to \a attribute. +*/ /*! - * \fn void QIviClimateControlBackendInterface::recirculationAttributeChanged(const QIviPropertyAttribute<bool> &attribute, const QString &zone = QString()); - * - * The signal is emitted when the recirculation state attribute for \a zone is changed to \a attribute. - */ + \fn virtual void QIviClimateControlBackendInterface::airConditioningEnabledChanged(bool enabled, const QString &zone = QString()) = 0 + + The signal is emitted when the \a zone air conditioning state is changed to \a enabled. + + \sa setAirConditioningEnabled() +*/ /*! - * \fn virtual void QIviClimateControlBackendInterface::recirculationSensitivityLevelChanged(int level, const QString &zone = QString()) = 0 - * - * The signals is emitted when the recirculation sensitivity level for \a zone is changed to \a level. The range can be defined using the attribute system. - * - * \sa setRecirculationSensitivityLevel() - */ + \fn void QIviClimateControlBackendInterface::airConditioningAttributeChanged(const QIviPropertyAttribute<bool> &attribute, const QString &zone = QString()); + + The signal is emitted when the air conditioning state attribute for \a zone is changed to \a attribute. +*/ /*! - * \fn void QIviClimateControlBackendInterface::recirculationSensitivityLevelAttributeChanged(const QIviPropertyAttribute<int> &attribute, const QString &zone = QString()); - * - * The signal is emitted when the fan intensity level for the AutomaticClimate mode for \a zone is changed to \a attribute. - */ + \fn virtual void QIviClimateControlBackendInterface::heaterEnabledChanged(bool enabled, const QString &zone = QString()) = 0 + + The signal is emitted when the \a zone heater state is changed to \a enabled. + + \sa setHeaterEnabled() +*/ /*! - * \fn virtual void QIviClimateControlBackendInterface::climateModeChanged(QIviClimateControl::ClimateMode climateMode, const QString &zone = QString()) = 0 - * - * The signal is emitted when the \a zone climate mode changed to \a climateMode. - * - * \sa setAirflowDirections() - */ + \fn void QIviClimateControlBackendInterface::heaterAttributeChanged(const QIviPropertyAttribute<bool> &attribute, const QString &zone = QString()); + + The signal is emitted when the heater state attribute for \a zone is changed to \a attribute. +*/ /*! - * \fn void QIviClimateControlBackendInterface::climateModeAttributeChanged(const QIviPropertyAttribute<QIviClimateControl::ClimateMode> &attribute, const QString &zone = QString()); - * - * The signal is emitted when the climate mode attribute for \a zone is changed to \a attribute. - */ + \fn virtual void QIviClimateControlBackendInterface::steeringWheelHeaterChanged(int level, const QString &zone = QString()) = 0 + + The signals is emitted when the steering wheel heater level of \a zone is changed to \a level. The range can be defined using the attribute system. + + \sa setSteeringWheelHeater() +*/ /*! - * \fn virtual void QIviClimateControlBackendInterface::automaticClimateFanIntensityLevelChanged(int level, const QString &zone = QString()) = 0 - * - * The signals is emitted when the fan intensity level for the AutomaticClimate mode for \a zone is changed to \a level. The range can be defined using the attribute system. - * - * \sa setAutomaticClimateFanIntensityLevel() - */ + \fn void QIviClimateControlBackendInterface::steeringWheelHeaterAttributeChanged(const QIviPropertyAttribute<int> &attribute, const QString &zone = QString()); + + The signal is emitted when the steering wheel heater level attribute for \a zone is changed to \a attribute. +*/ /*! - * \fn void QIviClimateControlBackendInterface::automaticClimateFanIntensityLevelAttributeChanged(const QIviPropertyAttribute<int> &attribute, const QString &zone = QString()); - * - * The signal is emitted when the fan intensity level for the AutomaticClimate mode for \a zone is changed to \a attribute. - */ + \fn virtual void QIviClimateControlBackendInterface::fanSpeedLevelChanged(int level, const QString &zone = QString()) = 0 + + The signals is emitted when the fan speel level of \a zone is changed to \a level. The range can be defined using the attribute system. + + \sa setFanSpeedLevel() +*/ + +/*! + \fn void QIviClimateControlBackendInterface::fanSpeedLevelAttributeChanged(const QIviPropertyAttribute<int> &attribute, const QString &zone = QString()); + + The signal is emitted when the recirculation sensitivity level for \a zone is changed to \a attribute. +*/ + +/*! + \fn virtual void QIviClimateControlBackendInterface::outsideTemperatureChanged(int value, const QString &zone = QString()) = 0 + + The signal is emitted when the outside temperature for \a zone is changed to \a value, where + value is expressed in centigrades. +*/ + +/*! + \fn void QIviClimateControlBackendInterface::outsideTemperatureAttributeChanged(const QIviPropertyAttribute<int> &attribute, const QString &zone = QString()); + + The signal is emitted when the outside temperature attribute for \a zone is changed to \a attribute. +*/ + +/*! + \fn virtual void QIviClimateControlBackendInterface::zoneSynchronizationEnabledChanged(bool enabled, const QString &zone = QString()) = 0 + + The signal is emitted when the \a zone synchronization state is changed to \a enabled. + + \sa setZoneSynchronizationEnabled() +*/ + +/*! + \fn void QIviClimateControlBackendInterface::zoneSynchronizationAttributeChanged(const QIviPropertyAttribute<bool> &attribute, const QString &zone = QString()); + + The signal is emitted when the zone synchronization state attribute for \a zone is changed to \a attribute. +*/ + + +/*! + \fn virtual void QIviClimateControlBackendInterface::defrostEnabledChanged(bool enabled, const QString &zone = QString()) = 0 + + The signal is emitted when the \a zone defrost state is changed to \a enabled. + + \sa setDefrostEnabled() +*/ + +/*! + \fn void QIviClimateControlBackendInterface::defrostAttributeChanged(const QIviPropertyAttribute<bool> &attribute, const QString &zone = QString()); + + The signal is emitted when the defrost state attribute for \a zone is changed to \a attribute. +*/ + + +/*! + \fn virtual void QIviClimateControlBackendInterface::recirculationModeChanged(QIviClimateControl::RecirculationMode recirculationMode, const QString &zone = QString()) = 0 + + The signal is emitted when the \a zone recirculation mode changed to \a recirculationMode. + + \sa setRecirculationMode() +*/ + +/*! + \fn void QIviClimateControlBackendInterface::recirculationModeAttributeChanged(const QIviPropertyAttribute<QIviClimateControl::RecirculationMode> &attribute, const QString &zone = QString()); + + The signal is emitted when the recirculation mode attribute for \a zone is changed to \a attribute. +*/ + +/*! + \fn virtual void QIviClimateControlBackendInterface::recirculationEnabledChanged(bool enabled, const QString &zone = QString()) = 0 + + The signal is emitted when the \a zone recirculation state is changed to \a enabled. +*/ + +/*! + \fn void QIviClimateControlBackendInterface::recirculationAttributeChanged(const QIviPropertyAttribute<bool> &attribute, const QString &zone = QString()); + + The signal is emitted when the recirculation state attribute for \a zone is changed to \a attribute. +*/ + +/*! + \fn virtual void QIviClimateControlBackendInterface::recirculationSensitivityLevelChanged(int level, const QString &zone = QString()) = 0 + + The signals is emitted when the recirculation sensitivity level for \a zone is changed to \a level. The range can be defined using the attribute system. + + \sa setRecirculationSensitivityLevel() +*/ + +/*! + \fn void QIviClimateControlBackendInterface::recirculationSensitivityLevelAttributeChanged(const QIviPropertyAttribute<int> &attribute, const QString &zone = QString()); + + The signal is emitted when the fan intensity level for the AutomaticClimate mode for \a zone is changed to \a attribute. +*/ + +/*! + \fn virtual void QIviClimateControlBackendInterface::climateModeChanged(QIviClimateControl::ClimateMode climateMode, const QString &zone = QString()) = 0 + + The signal is emitted when the \a zone climate mode changed to \a climateMode. + + \sa setAirflowDirections() +*/ + +/*! + \fn void QIviClimateControlBackendInterface::climateModeAttributeChanged(const QIviPropertyAttribute<QIviClimateControl::ClimateMode> &attribute, const QString &zone = QString()); + + The signal is emitted when the climate mode attribute for \a zone is changed to \a attribute. +*/ + +/*! + \fn virtual void QIviClimateControlBackendInterface::automaticClimateFanIntensityLevelChanged(int level, const QString &zone = QString()) = 0 + + The signals is emitted when the fan intensity level for the AutomaticClimate mode for \a zone is changed to \a level. The range can be defined using the attribute system. + + \sa setAutomaticClimateFanIntensityLevel() +*/ + +/*! + \fn void QIviClimateControlBackendInterface::automaticClimateFanIntensityLevelAttributeChanged(const QIviPropertyAttribute<int> &attribute, const QString &zone = QString()); + + The signal is emitted when the fan intensity level for the AutomaticClimate mode for \a zone is changed to \a attribute. +*/ + +QT_END_NAMESPACE diff --git a/src/ivivehiclefunctions/qiviclimatecontrolbackendinterface.h b/src/ivivehiclefunctions/qiviclimatecontrolbackendinterface.h index 96f8860..e9abe67 100644 --- a/src/ivivehiclefunctions/qiviclimatecontrolbackendinterface.h +++ b/src/ivivehiclefunctions/qiviclimatecontrolbackendinterface.h @@ -55,7 +55,7 @@ class Q_QTIVIVEHICLEFUNCTIONS_EXPORT QIviClimateControlBackendInterface : public Q_OBJECT public: - QIviClimateControlBackendInterface(QObject *parent = Q_NULLPTR); + QIviClimateControlBackendInterface(QObject *parent = nullptr); virtual void setTargetTemperature(int value, const QString &zone) = 0; virtual void setSeatCooler(int value, const QString &zone) = 0; diff --git a/src/ivivehiclefunctions/qiviwindowcontrol.cpp b/src/ivivehiclefunctions/qiviwindowcontrol.cpp index 26909cb..6768dda 100644 --- a/src/ivivehiclefunctions/qiviwindowcontrol.cpp +++ b/src/ivivehiclefunctions/qiviwindowcontrol.cpp @@ -45,6 +45,8 @@ #include <QtIviCore/QIviPropertyFactory> #include <QtIviCore/QIviServiceObject> +QT_BEGIN_NAMESPACE + QIviWindowControlPrivate::QIviWindowControlPrivate(const QString &interface, const QString &zone, QIviWindowControl *parent) : QIviAbstractZonedFeaturePrivate(interface, zone, parent) , m_heaterMode(QIviWindowControl::HeaterOff) @@ -239,16 +241,16 @@ QIviWindowControlBackendInterface *QIviWindowControlPrivate::windowControlBacken } /*! - \class QIviWindowControl - \inmodule QtIviVehicleFunctions - \brief Provides an interface to the window control. + \class QIviWindowControl + \inmodule QtIviVehicleFunctions + \brief Provides an interface to the window control. - The QIviWindowControl provides an interface to control the physical windows of the vehicle. + The QIviWindowControl provides an interface to control the physical windows of the vehicle. - All properties are exposed through zone objects. The zones are retrieved using the \l zoneAt method. + All properties are exposed through zone objects. The zones are retrieved using the \l zoneAt method. - The QIviWindowControl expects a single backend to be available. It is recommended to use it - with \l {QIviAbstractFeature::}{discoveryMode} set to \l AutoDiscovery. + The QIviWindowControl expects a single backend to be available. It is recommended to use it + with \l {QIviAbstractFeature::}{discoveryMode} set to \l AutoDiscovery. */ /*! @@ -260,39 +262,39 @@ QIviWindowControlBackendInterface *QIviWindowControlPrivate::windowControlBacken */ /*! - \enum QIviWindowControl::HeaterMode - \value HeaterOn + \enum QIviWindowControl::HeaterMode + \value HeaterOn The window heater is turned on. - \value HeaterOff + \value HeaterOff The window heater is turned off. - \value AutoHeater + \value AutoHeater The window heater is turning off and on automatically. */ /*! - \enum QIviWindowControl::BlindMode - \value BlindOpen + \enum QIviWindowControl::BlindMode + \value BlindOpen The blind will be opened. - \value BlindClosed + \value BlindClosed The blind will be closed. - \value AutoBlind + \value AutoBlind The blind is opened or closed automatically. */ /*! - \enum QIviWindowControl::State - \value FullyOpen + \enum QIviWindowControl::State + \value FullyOpen The object is fully open. - \value Open + \value Open The object is open, but not fully open yet. - \value Closed + \value Closed The object is closed. */ /*! - Constructs a window control object to the given \a zone. + Constructs a window control object to the given \a zone. - The \a parent argument is passed on to the \l QIviAbstractZonedFeature base class. + The \a parent argument is passed on to the \l QIviAbstractZonedFeature base class. */ QIviWindowControl::QIviWindowControl(const QString &zone, QObject *parent) : QIviAbstractZonedFeature(*new QIviWindowControlPrivate(QLatin1String(QIviWindowControl_iid), zone, this), parent) @@ -307,7 +309,7 @@ QIviWindowControl::~QIviWindowControl() } /*! - \reimp + \reimp */ void QIviWindowControl::connectToServiceObject(QIviServiceObject *serviceObject) { @@ -339,11 +341,11 @@ void QIviWindowControl::connectToServiceObject(QIviServiceObject *serviceObject) QObjectPrivate::connect(backend, &QIviWindowControlBackendInterface::stateAttributeChanged, d, &QIviWindowControlPrivate::onStateAttributeChanged); - backend->initializeAttributes(); + QIviAbstractFeature::connectToServiceObject(serviceObject); } /*! - \reimp + \reimp */ void QIviWindowControl::clearServiceObject() { @@ -358,7 +360,7 @@ QIviWindowControl::QIviWindowControl(QIviWindowControlPrivate &dd, QObject *pare } /*! - \reimp + \reimp */ QIviAbstractZonedFeature *QIviWindowControl::createZoneFeature(const QString &zone) { @@ -366,30 +368,30 @@ QIviAbstractZonedFeature *QIviWindowControl::createZoneFeature(const QString &zo } /*! - \qmlqtivipropertyEnum {QtIvi.VehicleFunctions::WindowControl::heaterMode} + \qmlqtivipropertyEnum {QtIvi.VehicleFunctions::WindowControl::heaterMode} - \e value holds the heater mode. - Available values are: - \value HeaterOn + \e value holds the heater mode. + Available values are: + \value HeaterOn The window heater is turned on. - \value HeaterOff + \value HeaterOff The window heater is turned off. - \value AutoHeater + \value AutoHeater The window heater is turning off and on automatically. - */ +*/ /*! - \property QIviWindowControl::heaterMode + \property QIviWindowControl::heaterMode - Holds a QIviProperty of type \e QIviWindowControl::HeaterMode where the QIviProperty::value() function returns the current heaterMode. + Holds a QIviProperty of type \e QIviWindowControl::HeaterMode where the QIviProperty::value() function returns the current heaterMode. - \sa AttributeSystem - \sa heaterMode() setHeaterMode() heaterModeAttribute() - */ + \sa AttributeSystem + \sa heaterMode() setHeaterMode() heaterModeAttribute() +*/ /*! - * Returns the current heaterMode. - * - * \sa setHeaterMode() heaterModeChanged() heaterModeAttribute() - */ + Returns the current heaterMode. + + \sa setHeaterMode() heaterModeChanged() heaterModeAttribute() +*/ QIviWindowControl::HeaterMode QIviWindowControl::heaterMode() const { @@ -397,10 +399,10 @@ QIviWindowControl::HeaterMode QIviWindowControl::heaterMode() const return d->m_heaterMode; } /*! - * Returns the attribute defining the boundaries and availability of the heaterMode property. - * - * \sa setHeaterMode() heaterMode() heaterModeChanged() - */ + Returns the attribute defining the boundaries and availability of the heaterMode property. + + \sa setHeaterMode() heaterMode() heaterModeChanged() +*/ QIviPropertyAttribute<QIviWindowControl::HeaterMode> QIviWindowControl::heaterModeAttribute() const { Q_D(const QIviWindowControl); @@ -414,23 +416,23 @@ QIviProperty *QIviWindowControl::heaterModeProperty() const } /*! - \qmlqtivipropertyBool {QtIvi.VehicleFunctions::WindowControl::heater} + \qmlqtivipropertyBool {QtIvi.VehicleFunctions::WindowControl::heater} - \e value is true if the heater is currently running. - */ + \e value is true if the heater is currently running. +*/ /*! - \property QIviWindowControl::heater + \property QIviWindowControl::heater - Holds a QIviProperty of type \e bool where the QIviProperty::value() function indicates if the heater is running. + Holds a QIviProperty of type \e bool where the QIviProperty::value() function indicates if the heater is running. - \sa AttributeSystem - \sa isHeaterEnabled() heaterAttribute() - */ + \sa AttributeSystem + \sa isHeaterEnabled() heaterAttribute() +*/ /*! - * Returns true if heater is currently enabled(running). - * - * \sa heaterEnabledChanged() heaterAttribute() - */ + Returns true if heater is currently enabled(running). + + \sa heaterEnabledChanged() heaterAttribute() +*/ bool QIviWindowControl::isHeaterEnabled() const { @@ -438,10 +440,10 @@ bool QIviWindowControl::isHeaterEnabled() const return d->m_heater; } /*! - * Returns the attribute defining the boundaries and availability of the heater property. - * - * \sa isHeaterEnabled() heaterEnabledChanged() - */ + Returns the attribute defining the boundaries and availability of the heater property. + + \sa isHeaterEnabled() heaterEnabledChanged() +*/ QIviPropertyAttribute<bool> QIviWindowControl::heaterAttribute() const { Q_D(const QIviWindowControl); @@ -455,30 +457,30 @@ QIviProperty *QIviWindowControl::heaterProperty() const } /*! - \qmlqtivipropertyEnum {QtIvi.VehicleFunctions::WindowControl::blindMode} + \qmlqtivipropertyEnum {QtIvi.VehicleFunctions::WindowControl::blindMode} - \e value holds the blind mode. - Available values are: - \value BlindOpen + \e value holds the blind mode. + Available values are: + \value BlindOpen The blind will be opened. - \value BlindClosed + \value BlindClosed The blind will be closed. - \value AutoBlind + \value AutoBlind The blind is opened or closed automatically. - */ +*/ /*! - \property QIviWindowControl::blindMode + \property QIviWindowControl::blindMode - Holds a QIviProperty of type \e QIviWindowControl::BlindMode where the QIviProperty::value() function returns the current blind mode. + Holds a QIviProperty of type \e QIviWindowControl::BlindMode where the QIviProperty::value() function returns the current blind mode. - \sa AttributeSystem - \sa blindMode() setBlindMode() blindModeAttribute() - */ + \sa AttributeSystem + \sa blindMode() setBlindMode() blindModeAttribute() +*/ /*! - * Returns the current blind mode. - * - * \sa setBlindMode() blindModeChanged() blindModeAttribute() - */ + Returns the current blind mode. + + \sa setBlindMode() blindModeChanged() blindModeAttribute() +*/ QIviWindowControl::BlindMode QIviWindowControl::blindMode() const { @@ -486,10 +488,10 @@ QIviWindowControl::BlindMode QIviWindowControl::blindMode() const return d->m_blindMode; } /*! - * Returns the attribute defining the boundaries and availability of the blindMode property. - * - * \sa setBlindMode() blindMode() blindModeChanged() - */ + Returns the attribute defining the boundaries and availability of the blindMode property. + + \sa setBlindMode() blindMode() blindModeChanged() +*/ QIviPropertyAttribute<QIviWindowControl::BlindMode> QIviWindowControl::blindModeAttribute() const { Q_D(const QIviWindowControl); @@ -503,30 +505,30 @@ QIviProperty *QIviWindowControl::blindModeProperty() const } /*! - \qmlqtivipropertyEnum {QtIvi.VehicleFunctions::WindowControl::blindState} + \qmlqtivipropertyEnum {QtIvi.VehicleFunctions::WindowControl::blindState} - \e value holds the current blind state. - Available values are: - \value FullyOpen + \e value holds the current blind state. + Available values are: + \value FullyOpen The object is fully open. - \value Open + \value Open The object is open, but not fully open yet. - \value Closed + \value Closed The object is closed. - */ +*/ /*! - \property QIviWindowControl::blindState + \property QIviWindowControl::blindState - Holds a QIviProperty of type \e QIviWindowControl::State where the QIviProperty::value() function returns the current blind state. + Holds a QIviProperty of type \e QIviWindowControl::State where the QIviProperty::value() function returns the current blind state. - \sa AttributeSystem - \sa blindState() blindStateAttribute() - */ + \sa AttributeSystem + \sa blindState() blindStateAttribute() +*/ /*! - * Returns the current blind state. - * - * \sa blindStateChanged() blindStateAttribute() - */ + Returns the current blind state. + + \sa blindStateChanged() blindStateAttribute() +*/ QIviWindowControl::State QIviWindowControl::blindState() const { @@ -534,10 +536,10 @@ QIviWindowControl::State QIviWindowControl::blindState() const return d->m_blindState; } /*! - * Returns the attribute defining the boundaries and availability of the blindState property. - * - * \sa blindState() blindStateChanged() - */ + Returns the attribute defining the boundaries and availability of the blindState property. + + \sa blindState() blindStateChanged() +*/ QIviPropertyAttribute<QIviWindowControl::State> QIviWindowControl::blindStateAttribute() const { Q_D(const QIviWindowControl); @@ -551,32 +553,32 @@ QIviProperty *QIviWindowControl::blindStateProperty() const } /*! - \qmlqtivipropertyEnum {QtIvi.VehicleFunctions::WindowControl::state} + \qmlqtivipropertyEnum {QtIvi.VehicleFunctions::WindowControl::state} - \e value holds the current window state. - Available values are: - \value FullyOpen + \e value holds the current window state. + Available values are: + \value FullyOpen The object is fully open. - \value Open + \value Open The object is open, but not fully open yet. - \value Closed + \value Closed The object is closed. - \sa open() close() - */ + \sa open() close() +*/ /*! - \property QIviWindowControl::state + \property QIviWindowControl::state - Holds a QIviProperty of type \e QIviWindowControl::State where the QIviProperty::value() function returns the current window state. + Holds a QIviProperty of type \e QIviWindowControl::State where the QIviProperty::value() function returns the current window state. - \sa AttributeSystem - \sa state() stateAttribute() open() close() - */ + \sa AttributeSystem + \sa state() stateAttribute() open() close() +*/ /*! - * Returns the current window state. - * - * \sa stateChanged() stateAttribute() - */ + Returns the current window state. + + \sa stateChanged() stateAttribute() +*/ QIviWindowControl::State QIviWindowControl::state() const { @@ -584,10 +586,10 @@ QIviWindowControl::State QIviWindowControl::state() const return d->m_state; } /*! - * Returns the attribute defining the boundaries and availability of the state property. - * - * \sa state() stateChanged() - */ + Returns the attribute defining the boundaries and availability of the state property. + + \sa state() stateChanged() +*/ QIviPropertyAttribute<QIviWindowControl::State> QIviWindowControl::stateAttribute() const { Q_D(const QIviWindowControl); @@ -601,10 +603,10 @@ QIviProperty *QIviWindowControl::stateProperty() const } /*! - * Sets the current heater mode to \a value. - * - * \sa heaterMode() heaterModeChanged() heaterModeAttribute() - */ + Sets the current heater mode to \a value. + + \sa heaterMode() heaterModeChanged() heaterModeAttribute() +*/ void QIviWindowControl::setHeaterMode(QIviWindowControl::HeaterMode value) { Q_D(QIviWindowControl); @@ -613,10 +615,10 @@ void QIviWindowControl::setHeaterMode(QIviWindowControl::HeaterMode value) } /*! - * Sets the current blind mode to \a value. - * - * \sa blindMode() blindModeChanged() blindModeAttribute() - */ + Sets the current blind mode to \a value. + + \sa blindMode() blindModeChanged() blindModeAttribute() +*/ void QIviWindowControl::setBlindMode(QIviWindowControl::BlindMode value) { Q_D(QIviWindowControl); @@ -625,18 +627,18 @@ void QIviWindowControl::setBlindMode(QIviWindowControl::BlindMode value) } /*! - * \qmlmethod WindowControl::open() - * - * Opens the window, if not already in the QIviWindowControl::FullyOpen state. - * - * \sa WindowControl::state - */ + \qmlmethod WindowControl::open() + + Opens the window, if not already in the QIviWindowControl::FullyOpen state. + + \sa WindowControl::state +*/ /*! - * Opens the window, if not already in the QIviWindowControl::FullyOpen state. - * - * \sa state() close() - */ + Opens the window, if not already in the QIviWindowControl::FullyOpen state. + + \sa state() close() +*/ void QIviWindowControl::open() { Q_D(QIviWindowControl); @@ -645,18 +647,18 @@ void QIviWindowControl::open() } /*! - * \qmlmethod WindowControl::close() - * - * Closes the window, if not already in the QIviWindowControl::Closed state. - * - * \sa WindowControl::state - */ + \qmlmethod WindowControl::close() + + Closes the window, if not already in the QIviWindowControl::Closed state. + + \sa WindowControl::state +*/ /*! - * Closes the window, if not already in the QIviWindowControl::Closed state. - * - * \sa state() open() - */ + Closes the window, if not already in the QIviWindowControl::Closed state. + + \sa state() open() +*/ void QIviWindowControl::close() { Q_D(QIviWindowControl); @@ -665,85 +667,85 @@ void QIviWindowControl::close() } /*! - * \fn void QIviWindowControl::heaterModeChanged(QIviWindowControl::HeaterMode value); - * - * This signal is emitted whenever the heater mode changed. The new value is passed as \a value. - * - * \sa heaterMode() setHeaterMode() heaterModeAttribute() - */ + \fn void QIviWindowControl::heaterModeChanged(QIviWindowControl::HeaterMode value); + + This signal is emitted whenever the heater mode changed. The new value is passed as \a value. + + \sa heaterMode() setHeaterMode() heaterModeAttribute() +*/ /*! - * \fn void QIviWindowControl::heaterModeAttributeChanged(const QIviPropertyAttribute<QIviWindowControl::HeaterMode> &attribute); - * - * This signal is emitted whenever the attribute for the heaterMode property changes. The new attribute is passed as \a attribute. - * - * \sa heaterModeAttribute() heaterMode() - */ + \fn void QIviWindowControl::heaterModeAttributeChanged(const QIviPropertyAttribute<QIviWindowControl::HeaterMode> &attribute); + + This signal is emitted whenever the attribute for the heaterMode property changes. The new attribute is passed as \a attribute. + + \sa heaterModeAttribute() heaterMode() +*/ /*! - * \fn void QIviWindowControl::heaterEnabledChanged(bool enabled); - * - * This signal is emitted whenever the heater is turned \e on or \e off. The new value is passed as \a enabled. - * - * \sa isHeaterEnabled() heaterAttribute() - */ + \fn void QIviWindowControl::heaterEnabledChanged(bool enabled); + + This signal is emitted whenever the heater is turned \e on or \e off. The new value is passed as \a enabled. + + \sa isHeaterEnabled() heaterAttribute() +*/ /*! - * \fn void QIviWindowControl::heaterAttributeChanged(const QIviPropertyAttribute<bool> &attribute); - * - * This signal is emitted whenever the attribute for the heater property changes. The new attribute is passed as \a attribute. - * - * \sa heaterAttribute() isHeaterEnabled() - */ + \fn void QIviWindowControl::heaterAttributeChanged(const QIviPropertyAttribute<bool> &attribute); + + This signal is emitted whenever the attribute for the heater property changes. The new attribute is passed as \a attribute. + + \sa heaterAttribute() isHeaterEnabled() +*/ /*! - * \fn void QIviWindowControl::blindModeChanged(QIviWindowControl::BlindMode value); - * - * This signal is emitted whenever the blind mode changed. The new value is passed as \a value. - * - * \sa blindMode() setBlindMode() blindModeAttribute() - */ + \fn void QIviWindowControl::blindModeChanged(QIviWindowControl::BlindMode value); + + This signal is emitted whenever the blind mode changed. The new value is passed as \a value. + + \sa blindMode() setBlindMode() blindModeAttribute() +*/ /*! - * \fn void QIviWindowControl::blindModeAttributeChanged(const QIviPropertyAttribute<QIviWindowControl::BlindMode> &attribute); - * - * This signal is emitted whenever the attribute for the blindMode property changes. The new attribute is passed as \a attribute. - * - * \sa blindModeAttribute() blindMode() - */ + \fn void QIviWindowControl::blindModeAttributeChanged(const QIviPropertyAttribute<QIviWindowControl::BlindMode> &attribute); + + This signal is emitted whenever the attribute for the blindMode property changes. The new attribute is passed as \a attribute. + + \sa blindModeAttribute() blindMode() +*/ /*! - * \fn void QIviWindowControl::blindStateChanged(QIviWindowControl::State value); - * - * This signal is emitted whenever the blind state changed. The new value is passed as \a value. - * - * \sa blindState() blindStateAttribute() - */ + \fn void QIviWindowControl::blindStateChanged(QIviWindowControl::State value); + + This signal is emitted whenever the blind state changed. The new value is passed as \a value. + + \sa blindState() blindStateAttribute() +*/ /*! - * \fn void QIviWindowControl::blindStateAttributeChanged(const QIviPropertyAttribute<QIviWindowControl::State> &attribute); - * - * This signal is emitted whenever the attribute for the blindState property changes. The new attribute is passed as \a attribute. - * - * \sa blindStateAttribute() blindState() - */ + \fn void QIviWindowControl::blindStateAttributeChanged(const QIviPropertyAttribute<QIviWindowControl::State> &attribute); + + This signal is emitted whenever the attribute for the blindState property changes. The new attribute is passed as \a attribute. + + \sa blindStateAttribute() blindState() +*/ /*! - * \fn void QIviWindowControl::stateChanged(QIviWindowControl::State value); - * - * This signal is emitted whenever the state changed. The new value is passed as \a value. - * - * \sa state() stateAttribute() - */ + \fn void QIviWindowControl::stateChanged(QIviWindowControl::State value); + + This signal is emitted whenever the state changed. The new value is passed as \a value. + + \sa state() stateAttribute() +*/ /*! - * \fn void QIviWindowControl::stateAttributeChanged(const QIviPropertyAttribute<QIviWindowControl::State> &attribute); - * - * This signal is emitted whenever the attribute for the state property changes. The new attribute is passed as \a attribute. - * - * \sa stateAttribute() state() - */ + \fn void QIviWindowControl::stateAttributeChanged(const QIviPropertyAttribute<QIviWindowControl::State> &attribute); + This signal is emitted whenever the attribute for the state property changes. The new attribute is passed as \a attribute. + + \sa stateAttribute() state() +*/ +QT_END_NAMESPACE #include "moc_qiviwindowcontrol.cpp" diff --git a/src/ivivehiclefunctions/qiviwindowcontrol.h b/src/ivivehiclefunctions/qiviwindowcontrol.h index bbe6337..c440035 100644 --- a/src/ivivehiclefunctions/qiviwindowcontrol.h +++ b/src/ivivehiclefunctions/qiviwindowcontrol.h @@ -84,7 +84,7 @@ public: }; Q_ENUM(State) - QIviWindowControl(const QString &zone = QString(), QObject *parent = Q_NULLPTR); + QIviWindowControl(const QString &zone = QString(), QObject *parent = nullptr); ~QIviWindowControl(); QIviWindowControl::HeaterMode heaterMode() const; @@ -122,11 +122,11 @@ Q_SIGNALS: void stateAttributeChanged(const QIviPropertyAttribute<QIviWindowControl::State> &attribute); protected: - QIviWindowControl(QIviWindowControlPrivate &dd, QObject *parent = Q_NULLPTR); - virtual QIviAbstractZonedFeature *createZoneFeature(const QString &zone) Q_DECL_OVERRIDE; + QIviWindowControl(QIviWindowControlPrivate &dd, QObject *parent = nullptr); + virtual QIviAbstractZonedFeature *createZoneFeature(const QString &zone) override; - virtual void connectToServiceObject(QIviServiceObject *serviceObject) Q_DECL_OVERRIDE; - virtual void clearServiceObject() Q_DECL_OVERRIDE; + virtual void connectToServiceObject(QIviServiceObject *serviceObject) override; + virtual void clearServiceObject() override; private: Q_DECLARE_PRIVATE(QIviWindowControl) diff --git a/src/ivivehiclefunctions/qiviwindowcontrol_p.h b/src/ivivehiclefunctions/qiviwindowcontrol_p.h index 5ab15e5..67b9416 100644 --- a/src/ivivehiclefunctions/qiviwindowcontrol_p.h +++ b/src/ivivehiclefunctions/qiviwindowcontrol_p.h @@ -66,7 +66,7 @@ class QIviWindowControlPrivate : public QIviAbstractZonedFeaturePrivate public: QIviWindowControlPrivate(const QString &interface, const QString &zone, QIviWindowControl *parent); - virtual void initialize() Q_DECL_OVERRIDE; + virtual void initialize() override; void clearToDefaults(); void onHeaterModeChanged(QIviWindowControl::HeaterMode heaterMode, const QString &zone); diff --git a/src/ivivehiclefunctions/qiviwindowcontrolbackendinterface.cpp b/src/ivivehiclefunctions/qiviwindowcontrolbackendinterface.cpp index 98fce0a..d79cb5d 100644 --- a/src/ivivehiclefunctions/qiviwindowcontrolbackendinterface.cpp +++ b/src/ivivehiclefunctions/qiviwindowcontrolbackendinterface.cpp @@ -41,134 +41,139 @@ #include "qiviwindowcontrolbackendinterface.h" +QT_BEGIN_NAMESPACE + +/*! + \class QIviWindowControlBackendInterface + \inmodule QtIviVehicleFunctions + \ingroup backends + \inherits QIviZonedFeatureInterface + \keyword org.qt-project.qtivi.WindowControl/1.0 + \brief The QIviWindowControlBackendInterface defines the interface for backends to the + QIviWindowControl feature class. + + The QIviWindowControlBackendInterface is the interface used by \l QIviWindowControl + + The interface is discovered by a \l QIviWindowControl object, which connects to it and sets up + the connections to it. + + \sa QIviWindowControl +*/ + /*! - * \class QIviWindowControlBackendInterface - * \inmodule QtIviVehicleFunctions - * \ingroup backends - * \inherits QIviZonedFeatureInterface - * \brief The QIviWindowControlBackendInterface defines the interface for backends to the - * QIviWindowControl feature class. - * - * The QIviWindowControlBackendInterface is the interface used by \l QIviWindowControl - * - * The interface is discovered by a \l QIviWindowControl object, which connects to it and sets up - * the connections to it. - * - * \sa QIviWindowControl - */ - -/*! - * \fn QIviWindowControlBackendInterface::QIviWindowControlBackendInterface(QObject *parent=0) - * - * Constructs a backend interface. - * - * The \a parent is sent to the QObject constructor. - */ + \fn QIviWindowControlBackendInterface::QIviWindowControlBackendInterface(QObject *parent = nullptr) + + Constructs a backend interface. + + The \a parent is sent to the QObject constructor. +*/ QIviWindowControlBackendInterface::QIviWindowControlBackendInterface(QObject *parent) : QIviZonedFeatureInterface(parent) { } /*! - * \fn virtual void QIviWindowControlBackendInterface::setHeaterMode(QIviWindowControl::HeaterMode value, const QString &zone) = 0 - * - * Sets the heater mode of \a zone to \a value. The available modes can be defined using the attribute system. - * - * This method is expected to emit a \l heaterModeChanged() signal when the internal state changes - * due to this function call. The signal is even expected to be emitted if the given \a value is not supported and no - * actual change takes place. - * - * \sa heaterModeChanged() - */ + \fn virtual void QIviWindowControlBackendInterface::setHeaterMode(QIviWindowControl::HeaterMode value, const QString &zone) = 0 + + Sets the heater mode of \a zone to \a value. The available modes can be defined using the attribute system. + + This method is expected to emit a \l heaterModeChanged() signal when the internal state changes + due to this function call. The signal is even expected to be emitted if the given \a value is not supported and no + actual change takes place. + + \sa heaterModeChanged() +*/ /*! - * \fn virtual void QIviWindowControlBackendInterface::setBlindMode(QIviWindowControl::BlindMode value, const QString &zone) = 0 - * - * Sets the blind mode of \a zone to \a value. The available modes can be defined using the attribute system. - * - * This method is expected to emit a \l blindModeChanged() signal when the internal state changes - * due to this function call. The signal is even expected to be emitted if the given \a value is not supported and no - * actual change takes place. - * - * \sa blindModeChanged() - */ + \fn virtual void QIviWindowControlBackendInterface::setBlindMode(QIviWindowControl::BlindMode value, const QString &zone) = 0 + + Sets the blind mode of \a zone to \a value. The available modes can be defined using the attribute system. + + This method is expected to emit a \l blindModeChanged() signal when the internal state changes + due to this function call. The signal is even expected to be emitted if the given \a value is not supported and no + actual change takes place. + + \sa blindModeChanged() +*/ /*! - * \fn virtual void QIviWindowControlBackendInterface::open(const QString &zone) = 0 - * - * Opens the window identified by \a zone. Whether the window can be opened is controlled by the attribute system. - * - * \sa stateChanged() - */ + \fn virtual void QIviWindowControlBackendInterface::open(const QString &zone) = 0 + + Opens the window identified by \a zone. Whether the window can be opened is controlled by the attribute system. + + \sa stateChanged() +*/ /*! - * \fn virtual void QIviWindowControlBackendInterface::close(const QString &zone) = 0 - * - * Closes the window identified by \a zone. Whether the window can be closed is controlled by the attribute system. - * - * \sa stateChanged() - */ + \fn virtual void QIviWindowControlBackendInterface::close(const QString &zone) = 0 + + Closes the window identified by \a zone. Whether the window can be closed is controlled by the attribute system. + + \sa stateChanged() +*/ /*! - * \fn virtual void QIviWindowControlBackendInterface::heaterModeChanged(QIviWindowControl::HeaterMode value, const QString &zone = QString()) - * - * The signal is emitted when the heater mode is changed for \a zone to \a value. The available modes can be defined using the attribute system. - * - * \sa setHeaterMode() - */ + \fn virtual void QIviWindowControlBackendInterface::heaterModeChanged(QIviWindowControl::HeaterMode value, const QString &zone = QString()) + + The signal is emitted when the heater mode is changed for \a zone to \a value. The available modes can be defined using the attribute system. + + \sa setHeaterMode() +*/ /*! - * \fn void QIviWindowControlBackendInterface::heaterModeAttributeChanged(const QIviPropertyAttribute<QIviWindowControl::HeaterMode> &attribute, const QString &zone = QString()) - * - * The signal is emitted when the heater mode attribute for \a zone is changed to \a attribute. - */ + \fn void QIviWindowControlBackendInterface::heaterModeAttributeChanged(const QIviPropertyAttribute<QIviWindowControl::HeaterMode> &attribute, const QString &zone = QString()) + + The signal is emitted when the heater mode attribute for \a zone is changed to \a attribute. +*/ /*! - * \fn virtual void QIviWindowControlBackendInterface::heaterEnabledChanged(bool enabled, const QString &zone = QString()) - * - * The signal is emitted when the \a zone heater state is changed to \a enabled. - */ + \fn virtual void QIviWindowControlBackendInterface::heaterEnabledChanged(bool enabled, const QString &zone = QString()) + + The signal is emitted when the \a zone heater state is changed to \a enabled. +*/ /*! - * \fn void QIviWindowControlBackendInterface::heaterAttributeChanged(const QIviPropertyAttribute<bool> &attribute, const QString &zone = QString()) - * - * The signal is emitted when the heater attribute for \a zone is changed to \a attribute. - */ + \fn void QIviWindowControlBackendInterface::heaterAttributeChanged(const QIviPropertyAttribute<bool> &attribute, const QString &zone = QString()) + + The signal is emitted when the heater attribute for \a zone is changed to \a attribute. +*/ /*! - * \fn virtual void QIviWindowControlBackendInterface::blindModeChanged(QIviWindowControl::BlindMode value, const QString &zone = QString()) - * - * The signal is emitted when the blind mode is changed for \a zone to \a value. The available modes can be defined using the attribute system. - * - * \sa setBlindMode() - */ + \fn virtual void QIviWindowControlBackendInterface::blindModeChanged(QIviWindowControl::BlindMode value, const QString &zone = QString()) + + The signal is emitted when the blind mode is changed for \a zone to \a value. The available modes can be defined using the attribute system. + + \sa setBlindMode() +*/ /*! - * \fn void QIviWindowControlBackendInterface::blindModeAttributeChanged(const QIviPropertyAttribute<QIviWindowControl::BlindMode> &attribute, const QString &zone = QString()) - * - * The signal is emitted when the blind mode attribute for \a zone is changed to \a attribute. - */ + \fn void QIviWindowControlBackendInterface::blindModeAttributeChanged(const QIviPropertyAttribute<QIviWindowControl::BlindMode> &attribute, const QString &zone = QString()) + + The signal is emitted when the blind mode attribute for \a zone is changed to \a attribute. +*/ /*! - * \fn virtual void QIviWindowControlBackendInterface::blindStateChanged(QIviWindowControl::State value, const QString &zone = QString()) - * - * The signal is emitted when the blind state is changed for \a zone to \a value. The available states can be defined using the attribute system. - */ + \fn virtual void QIviWindowControlBackendInterface::blindStateChanged(QIviWindowControl::State value, const QString &zone = QString()) + + The signal is emitted when the blind state is changed for \a zone to \a value. The available states can be defined using the attribute system. +*/ /*! - * \fn void QIviWindowControlBackendInterface::blindStateAttributeChanged(const QIviPropertyAttribute<QIviWindowControl::State> &attribute, const QString &zone = QString()) - * - * The signal is emitted when the blind state attribute for \a zone is changed to \a attribute. - */ + \fn void QIviWindowControlBackendInterface::blindStateAttributeChanged(const QIviPropertyAttribute<QIviWindowControl::State> &attribute, const QString &zone = QString()) + + The signal is emitted when the blind state attribute for \a zone is changed to \a attribute. +*/ /*! - * \fn virtual void QIviWindowControlBackendInterface::stateChanged(QIviWindowControl::State value, const QString &zone = QString()) - * - * The signal is emitted when the state is changed for \a zone to \a value. The available states can be defined using the attribute system. - */ + \fn virtual void QIviWindowControlBackendInterface::stateChanged(QIviWindowControl::State value, const QString &zone = QString()) + + The signal is emitted when the state is changed for \a zone to \a value. The available states can be defined using the attribute system. +*/ /*! - * \fn void QIviWindowControlBackendInterface::stateAttributeChanged(const QIviPropertyAttribute<QIviWindowControl::State> &attribute, const QString &zone = QString()) - * - * The signal is emitted when the state attribute for \a zone is changed to \a attribute. - */ + \fn void QIviWindowControlBackendInterface::stateAttributeChanged(const QIviPropertyAttribute<QIviWindowControl::State> &attribute, const QString &zone = QString()) + + The signal is emitted when the state attribute for \a zone is changed to \a attribute. +*/ + +QT_END_NAMESPACE diff --git a/src/ivivehiclefunctions/qiviwindowcontrolbackendinterface.h b/src/ivivehiclefunctions/qiviwindowcontrolbackendinterface.h index f5b8c01..0f17244 100644 --- a/src/ivivehiclefunctions/qiviwindowcontrolbackendinterface.h +++ b/src/ivivehiclefunctions/qiviwindowcontrolbackendinterface.h @@ -55,7 +55,7 @@ class Q_QTIVIVEHICLEFUNCTIONS_EXPORT QIviWindowControlBackendInterface : public Q_OBJECT public: - QIviWindowControlBackendInterface(QObject *parent = Q_NULLPTR); + QIviWindowControlBackendInterface(QObject *parent = nullptr); virtual void setHeaterMode(QIviWindowControl::HeaterMode value, const QString &zone) = 0; virtual void setBlindMode(QIviWindowControl::BlindMode value, const QString &zone) = 0; diff --git a/src/plugins/ivimedia/doc/qtivimedia_plugins.qdocconf b/src/plugins/ivimedia/doc/qtivimedia_plugins.qdocconf new file mode 100644 index 0000000..076faaf --- /dev/null +++ b/src/plugins/ivimedia/doc/qtivimedia_plugins.qdocconf @@ -0,0 +1,3 @@ +headerdirs += . + +sourcedirs += . diff --git a/src/plugins/ivimedia/doc/src/backends.qdoc b/src/plugins/ivimedia/doc/src/backends.qdoc new file mode 100644 index 0000000..55696a7 --- /dev/null +++ b/src/plugins/ivimedia/doc/src/backends.qdoc @@ -0,0 +1,127 @@ +/**************************************************************************** +** +** Copyright (C) 2017 Pelagicore AG +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the QtIvi module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL-QTAS$ +** Commercial License Usage +** Licensees holding valid commercial Qt Automotive Suite licenses may use +** this file in accordance with the commercial license agreement provided +** with the Software or, alternatively, in accordance with the terms +** contained in a written agreement between you and The Qt Company. For +** licensing terms and conditions see https://www.qt.io/terms-conditions. +** For further information use the contact form at https://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! +\page qtivimedia-backends.html +\title QtIviMedia Backends +\ingroup qtivi_backend_groups + +All backends supporting interfaces from QtIviMedia + +\annotatedlist qtivimedia_backend +*/ + +/*! +\page qtivimedia-tuner-simulation-backend.html +\title QtIviMedia Tuner Simulation Backend +\ingroup qtivimedia_backend +\ingroup qtivi_backend + +\brief Provides a static tuner simulation. + +\section1 Supported interfaces +\list + \li \l{org.qt-project.qtivi.AmFmTuner/1.0} + \li \l{org.qt-project.qtivi.SearchAndBrowseModel/1.0} +\endlist + +The backend will return a fixed set of radio stations on the FM band and no stations on the AM band. + +For the SearchAndBrowseModel the following contenTypes are supported: +\list + \li \b station A list of all stations found. + \li \b presets A list for storing the users favorite stations. +\endlist + +\note Both lists don't support filtering and sorting. +*/ + +/*! +\page qtivimedia-player-simulation-backend.html +\title QtIviMedia MediaPlayer Simulation Backend +\ingroup qtivimedia_backend +\ingroup qtivi_backend + +\brief Provides a media player simulation using QtMultimedia. + +\section1 Requirements +\list + \li QtMultimedia + \li taglib +\endlist + +\section1 Supported interfaces +\list + \li \l{org.qt-project.qtivi.MediaPlayer/1.0} + \li \l{org.qt-project.qtivi.MediaIndexer/1.0} + \li \l{org.qt-project.qtivi.MediaDiscovery/1.0} + \li \l{org.qt-project.qtivi.SearchAndBrowseModel/1.0} +\endlist + +The backend uses QtMultimedia to offer real media playback on various platforms. +The indexer will automatically start to index all \c mp3 files in the media folder. + +For the SearchAndBrowseModel the following contenTypes are supported: +\list + \li \b artist A list of all artists. + \li \b album A list of all albums. + \li \b track A list of all tracks. +\endlist + +The model supports filtering and sorting, as well as navigating through the media library using +the following navigation paths: + +\list + \li Artist -> Album -> Track + \li Album -> Track +\endlist + +\note On systems where \c taglib wasn't found, indexing of files doesn't work and because of that +the media database can't be created. + +\section1 Configuration + +This backend uses environment variables for its configuration. By default it will use +a non persistent mode, where the indexed media database is not saved, but recreated on every start +of the app. + +\table +\header + \li Name + \li Description +\row + \li QTIVIMEDIA_SIMULATOR_DATABASE + \li A path to the media database which should be used. +\row + \li QTIVIMEDIA_SIMULATOR_LOCALMEDIAFOLDER + \li The local media directory (default: /home/<user>/media) +\row + \li QTIVIMEDIA_SIMULATOR_DEVICEFOLDER + \li The path which will be used by the DiscoveryModel for discovering media devices. + (default: /home/<user>/usb-simulation) +\endtable +*/ diff --git a/src/plugins/ivimedia/ivimedia.pro b/src/plugins/ivimedia/ivimedia.pro index 3afabaa..10c945a 100644 --- a/src/plugins/ivimedia/ivimedia.pro +++ b/src/plugins/ivimedia/ivimedia.pro @@ -1,3 +1,7 @@ TEMPLATE = subdirs SUBDIRS = media_simulator \ tuner_simulator + +OTHER_FILES += \ + $$PWD/doc/*.qdocconf \ + $$PWD/doc/src/*.qdoc diff --git a/src/plugins/ivimedia/media_simulator/mediadiscoverybackend.cpp b/src/plugins/ivimedia/media_simulator/mediadiscoverybackend.cpp index 4003fc8..08b52dd 100644 --- a/src/plugins/ivimedia/media_simulator/mediadiscoverybackend.cpp +++ b/src/plugins/ivimedia/media_simulator/mediadiscoverybackend.cpp @@ -65,11 +65,13 @@ void MediaDiscoveryBackend::initialize() #endif QDir deviceFolder(m_deviceFolder); - for (const QString &folder : deviceFolder.entryList(QDir::Dirs | QDir::NoDotAndDotDot)) { + const QStringList folders = deviceFolder.entryList(QDir::Dirs | QDir::NoDotAndDotDot); + for (const QString &folder : folders) { qDebug() << "Adding USB Device for: " << folder; m_deviceMap.insert(folder, new USBDevice(deviceFolder.absoluteFilePath(folder))); } emit availableDevices(m_deviceMap.values()); + emit initializationDone(); } void MediaDiscoveryBackend::onDirectoryChanged(const QString &path) @@ -78,7 +80,10 @@ void MediaDiscoveryBackend::onDirectoryChanged(const QString &path) QDir deviceFolder(m_deviceFolder); //Check for removed Devices - for (const QString &folder : m_deviceMap.keys()) { + QMapIterator<QString, QIviServiceObject*> i(m_deviceMap); + while (i.hasNext()) { + i.next(); + const QString &folder = i.key(); if (!deviceFolder.exists(folder)) { qDebug() << "Removing USB Device for: " << folder; QIviServiceObject *device = m_deviceMap.take(folder); @@ -88,7 +93,8 @@ void MediaDiscoveryBackend::onDirectoryChanged(const QString &path) } //Check for newly added Devices - for (const QString &folder : deviceFolder.entryList(QDir::Dirs | QDir::NoDotAndDotDot)) { + const QStringList folders = deviceFolder.entryList(QDir::Dirs | QDir::NoDotAndDotDot); + for (const QString &folder : folders) { if (m_deviceMap.contains(folder)) continue; diff --git a/src/plugins/ivimedia/media_simulator/mediadiscoverybackend.h b/src/plugins/ivimedia/media_simulator/mediadiscoverybackend.h index 9dbf2d6..1603bae 100644 --- a/src/plugins/ivimedia/media_simulator/mediadiscoverybackend.h +++ b/src/plugins/ivimedia/media_simulator/mediadiscoverybackend.h @@ -52,9 +52,9 @@ class MediaDiscoveryBackend : public QIviMediaDeviceDiscoveryModelBackendInterfa Q_OBJECT public: - MediaDiscoveryBackend(QObject *parent = 0); + MediaDiscoveryBackend(QObject *parent = nullptr); - void initialize() Q_DECL_OVERRIDE; + void initialize() override; private slots: void onDirectoryChanged(const QString &path); diff --git a/src/plugins/ivimedia/media_simulator/mediaindexerbackend.cpp b/src/plugins/ivimedia/media_simulator/mediaindexerbackend.cpp index 1dd890e..06c7d30 100644 --- a/src/plugins/ivimedia/media_simulator/mediaindexerbackend.cpp +++ b/src/plugins/ivimedia/media_simulator/mediaindexerbackend.cpp @@ -49,6 +49,9 @@ #include <QSqlQuery> #include <QtDebug> +#include <QMediaPlayer> +#include <QMediaMetaData> + #ifdef QT_TAGLIB #include <attachedpictureframe.h> #include <fileref.h> @@ -86,6 +89,7 @@ MediaIndexerBackend::MediaIndexerBackend(const QSqlDatabase &database, QObject * void MediaIndexerBackend::initialize() { emit stateChanged(m_state); + emit initializationDone(); } void MediaIndexerBackend::pause() @@ -139,6 +143,7 @@ bool MediaIndexerBackend::scanWorker(const QString &mediaDir, bool removeData) qInfo() << "Scanning path: " << mediaDir; + QMediaPlayer player; QSqlQuery query(m_db); bool ret = query.exec("CREATE TABLE IF NOT EXISTS track " @@ -178,21 +183,15 @@ bool MediaIndexerBackend::scanWorker(const QString &mediaDir, bool removeData) if (qApp->closingDown()) return false; + QString defaultCoverArtUrl = fileName + QLatin1Literal(".png"); + QString coverArtUrl; #ifdef QT_TAGLIB TagLib::FileRef f(fileName.toLocal8Bit()); - QString coverArtUrl; - - QSqlQuery query(m_db); - - query.prepare("INSERT OR IGNORE INTO track (trackName, albumName, artistName, genre, number, file, coverArtUrl) " - "VALUES (:trackName, :albumName, :artistName, :genre, :number, :file, :coverArtUrl)"); - - query.bindValue(":trackName", QLatin1String(f.tag()->title().toCString())); - query.bindValue(":albumName", QLatin1String(f.tag()->album().toCString())); - query.bindValue(":artistName", QLatin1String(f.tag()->artist().toCString())); - query.bindValue(":genre", QLatin1String(f.tag()->genre().toCString())); - query.bindValue(":number", f.tag()->track()); - query.bindValue(":file", fileName); + QString trackName = QLatin1String(f.tag()->title().toCString()); + QString albumName = QLatin1String(f.tag()->album().toCString()); + QString artistName = QLatin1String(f.tag()->artist().toCString()); + QString genre = QLatin1String(f.tag()->genre().toCString()); + int number = f.tag()->track(); // Extract cover art TagLib::MPEG::File file(fileName.toLocal8Bit()); @@ -205,16 +204,67 @@ bool MediaIndexerBackend::scanWorker(const QString &mediaDir, bool removeData) TagLib::ID3v2::AttachedPictureFrame *coverImage = static_cast<TagLib::ID3v2::AttachedPictureFrame *>(frameList.front()); - coverArtUrl = fileName + QLatin1Literal(".png"); - QImage coverQImg; + coverArtUrl = defaultCoverArtUrl; coverQImg.loadFromData((const uchar *)coverImage->picture().data(), coverImage->picture().size()); coverQImg.save(coverArtUrl, "PNG"); + } +#else + player.setMedia(QUrl::fromLocalFile(fileName)); + // Evil hack to wait until the media is loaded + while (player.mediaStatus() != QMediaPlayer::LoadedMedia) { + QThread::msleep(100); + qApp->processEvents(); + } - query.bindValue(":coverArtUrl", coverArtUrl); + if (!QFile::exists(defaultCoverArtUrl)) { + QImage coverArt = player.metaData(QMediaMetaData::CoverArtImage).value<QImage>(); + if (coverArt.isNull()) { + // Either there is no coverArt information available, or QtMultimedia cannot read it. + // We try to be smart and see whether we can find a cover file where the music is located. + QFileInfo info(fileName); + QString coverPath = info.absoluteDir().absoluteFilePath(QLatin1String("cover.png")); + if (QFile::exists(coverPath)) + coverArtUrl = coverPath; + } else { + coverArt.save(defaultCoverArtUrl, "PNG"); + coverArtUrl = defaultCoverArtUrl; + } + } else { + coverArtUrl = defaultCoverArtUrl; } + if (coverArtUrl.isEmpty()) + qWarning() << "No cover art was found"; + + QString trackName = player.metaData(QMediaMetaData::Title).toString(); + QString albumName = player.metaData(QMediaMetaData::AlbumTitle).toString(); + QString artistName = player.metaData(QMediaMetaData::AlbumArtist).toString(); + if (artistName.isEmpty()) + artistName = player.metaData(QMediaMetaData::Author).toString(); + if (artistName.isEmpty()) + artistName = player.metaData(QMediaMetaData::ContributingArtist).toString(); + QString genre; + QStringList genres = player.metaData(QMediaMetaData::Genre).toStringList(); + if (genres.count()) + genre = genres.first(); + int number = player.metaData(QMediaMetaData::TrackNumber).toInt(); +#endif // QT_TAGLIB + + QSqlQuery query(m_db); + + query.prepare("INSERT OR IGNORE INTO track (trackName, albumName, artistName, genre, number, file, coverArtUrl) " + "VALUES (:trackName, :albumName, :artistName, :genre, :number, :file, :coverArtUrl)"); + + query.bindValue(":trackName", trackName); + query.bindValue(":albumName", albumName); + query.bindValue(":artistName", artistName); + query.bindValue(":genre", genre); + query.bindValue(":number", number); + query.bindValue(":file", fileName); + query.bindValue(":coverArtUrl", coverArtUrl); + bool ret = query.exec(); if (!ret) { @@ -224,11 +274,8 @@ bool MediaIndexerBackend::scanWorker(const QString &mediaDir, bool removeData) } else { emit progressChanged(qreal(currentFileIndex)/qreal(totalFileCount)); } -#else - emit progressChanged(qreal(currentFileIndex)/qreal(totalFileCount)); -#endif - currentFileIndex++; + currentFileIndex++; } return true; @@ -245,10 +292,6 @@ void MediaIndexerBackend::onScanFinished() emit progressChanged(1); emit indexingDone(); -#ifndef QT_TAGLIB - qWarning() << "No tracks have been added as the simulation was compiled without taglib"; -#endif - //If the last run didn't succeed we will stay in the Error state if (m_watcher.future().result()) setState(QIviMediaIndexerControl::Idle); diff --git a/src/plugins/ivimedia/media_simulator/mediaindexerbackend.h b/src/plugins/ivimedia/media_simulator/mediaindexerbackend.h index 23a759a..0708098 100644 --- a/src/plugins/ivimedia/media_simulator/mediaindexerbackend.h +++ b/src/plugins/ivimedia/media_simulator/mediaindexerbackend.h @@ -53,11 +53,11 @@ class MediaIndexerBackend : public QIviMediaIndexerControlBackendInterface { Q_OBJECT public: - explicit MediaIndexerBackend(const QSqlDatabase &database, QObject *parent = 0); + explicit MediaIndexerBackend(const QSqlDatabase &database, QObject *parent = nullptr); - virtual void initialize() Q_DECL_OVERRIDE; - virtual void pause() Q_DECL_OVERRIDE; - virtual void resume() Q_DECL_OVERRIDE; + virtual void initialize() override; + virtual void pause() override; + virtual void resume() override; signals: void indexingDone(); diff --git a/src/plugins/ivimedia/media_simulator/mediaplayerbackend.cpp b/src/plugins/ivimedia/media_simulator/mediaplayerbackend.cpp index b42599f..4476679 100644 --- a/src/plugins/ivimedia/media_simulator/mediaplayerbackend.cpp +++ b/src/plugins/ivimedia/media_simulator/mediaplayerbackend.cpp @@ -82,6 +82,7 @@ void MediaPlayerBackend::initialize() { emit durationChanged(0); emit positionChanged(0); + emit initializationDone(); } void MediaPlayerBackend::play() diff --git a/src/plugins/ivimedia/media_simulator/mediaplayerbackend.h b/src/plugins/ivimedia/media_simulator/mediaplayerbackend.h index 3d354d9..054f9c4 100644 --- a/src/plugins/ivimedia/media_simulator/mediaplayerbackend.h +++ b/src/plugins/ivimedia/media_simulator/mediaplayerbackend.h @@ -64,25 +64,25 @@ public: }; Q_ENUM(OperationType) - MediaPlayerBackend(const QSqlDatabase &database, QObject *parent = Q_NULLPTR); + MediaPlayerBackend(const QSqlDatabase &database, QObject *parent = nullptr); - virtual void initialize() Q_DECL_OVERRIDE; - virtual void play() Q_DECL_OVERRIDE; - virtual void pause() Q_DECL_OVERRIDE; - virtual void stop() Q_DECL_OVERRIDE; - virtual void seek(qint64 offset) Q_DECL_OVERRIDE; - virtual void next() Q_DECL_OVERRIDE; - virtual void previous() Q_DECL_OVERRIDE; - virtual void setPlayMode(QIviMediaPlayer::PlayMode playMode) Q_DECL_OVERRIDE; - virtual void setPosition(qint64 position) Q_DECL_OVERRIDE; - virtual void setCurrentIndex(int index) Q_DECL_OVERRIDE; + virtual void initialize() override; + virtual void play() override; + virtual void pause() override; + virtual void stop() override; + virtual void seek(qint64 offset) override; + virtual void next() override; + virtual void previous() override; + virtual void setPlayMode(QIviMediaPlayer::PlayMode playMode) override; + virtual void setPosition(qint64 position) override; + virtual void setCurrentIndex(int index) override; - virtual bool canReportCount() Q_DECL_OVERRIDE; - virtual void fetchData(int start, int count) Q_DECL_OVERRIDE; + virtual bool canReportCount() override; + virtual void fetchData(int start, int count) override; - virtual void insert(int index, const QIviPlayableItem *item) Q_DECL_OVERRIDE; - virtual void remove(int index) Q_DECL_OVERRIDE; - virtual void move(int cur_index, int new_index) Q_DECL_OVERRIDE; + virtual void insert(int index, const QIviPlayableItem *item) override; + virtual void remove(int index) override; + virtual void move(int cur_index, int new_index) override; public Q_SLOTS: void doSqlOperation(MediaPlayerBackend::OperationType type, const QStringList &queries, int start, int count); diff --git a/src/plugins/ivimedia/media_simulator/mediaplugin.cpp b/src/plugins/ivimedia/media_simulator/mediaplugin.cpp index 7dfe602..908d0a0 100644 --- a/src/plugins/ivimedia/media_simulator/mediaplugin.cpp +++ b/src/plugins/ivimedia/media_simulator/mediaplugin.cpp @@ -89,7 +89,7 @@ QStringList MediaPlugin::interfaces() const return list; } -QObject *MediaPlugin::interfaceInstance(const QString &interface) const +QIviFeatureInterface *MediaPlugin::interfaceInstance(const QString &interface) const { if (interface == QIviMediaPlayer_iid) return m_player; diff --git a/src/plugins/ivimedia/media_simulator/mediaplugin.h b/src/plugins/ivimedia/media_simulator/mediaplugin.h index 62230c6..a681198 100644 --- a/src/plugins/ivimedia/media_simulator/mediaplugin.h +++ b/src/plugins/ivimedia/media_simulator/mediaplugin.h @@ -60,10 +60,10 @@ class MediaPlugin : public QObject, QIviServiceInterface Q_INTERFACES(QIviServiceInterface) public: - explicit MediaPlugin(QObject *parent = Q_NULLPTR); + explicit MediaPlugin(QObject *parent = nullptr); QStringList interfaces() const; - QObject *interfaceInstance(const QString &interface) const; + QIviFeatureInterface *interfaceInstance(const QString &interface) const; private: MediaPlayerBackend *m_player; diff --git a/src/plugins/ivimedia/media_simulator/searchandbrowsebackend.cpp b/src/plugins/ivimedia/media_simulator/searchandbrowsebackend.cpp index 62e7f1e..716a88a 100644 --- a/src/plugins/ivimedia/media_simulator/searchandbrowsebackend.cpp +++ b/src/plugins/ivimedia/media_simulator/searchandbrowsebackend.cpp @@ -60,6 +60,11 @@ SearchAndBrowseBackend::SearchAndBrowseBackend(const QSqlDatabase &database, QOb m_db.open(); } +void SearchAndBrowseBackend::initialize() +{ + emit initializationDone(); +} + void SearchAndBrowseBackend::fetchData(const QUuid &identifier, const QString &type, QIviAbstractQueryTerm *term, const QList<QIviOrderTerm> &orderTerms, int start, int count) { emit supportedCapabilitiesChanged(identifier, QIviSearchAndBrowseModel::Capabilities( @@ -109,9 +114,9 @@ void SearchAndBrowseBackend::fetchData(const QUuid &identifier, const QString &t QString whereClause = where_clauses.join(" AND "); QString countQuery = QString(QLatin1String("SELECT count() FROM (SELECT %1 FROM track %2 %3)")) - .arg(columns) - .arg(whereClause.isEmpty() ? QString() : QLatin1String("WHERE ") + whereClause) - .arg(groupBy.isEmpty() ? QString() : QLatin1String("GROUP BY ") + groupBy); + .arg(columns, + whereClause.isEmpty() ? QString() : QLatin1String("WHERE ") + whereClause, + groupBy.isEmpty() ? QString() : QLatin1String("GROUP BY ") + groupBy); QSqlQuery query(m_db); @@ -124,12 +129,12 @@ void SearchAndBrowseBackend::fetchData(const QUuid &identifier, const QString &t } QString queryString = QString(QLatin1String("SELECT %1 FROM track %2 %3 %4 LIMIT %5, %6")) - .arg(columns) - .arg(whereClause.isEmpty() ? QString() : QLatin1String("WHERE ") + whereClause) - .arg(order) - .arg(groupBy.isEmpty() ? QString() : QLatin1String("GROUP BY ") + groupBy) - .arg(start) - .arg(count); + .arg(columns, + whereClause.isEmpty() ? QString() : QLatin1String("WHERE ") + whereClause, + order, + groupBy.isEmpty() ? QString() : QLatin1String("GROUP BY ") + groupBy, + QString::number(start), + QString::number(count)); QtConcurrent::run(this, &SearchAndBrowseBackend::search, diff --git a/src/plugins/ivimedia/media_simulator/searchandbrowsebackend.h b/src/plugins/ivimedia/media_simulator/searchandbrowsebackend.h index 371d887..de32345 100644 --- a/src/plugins/ivimedia/media_simulator/searchandbrowsebackend.h +++ b/src/plugins/ivimedia/media_simulator/searchandbrowsebackend.h @@ -70,18 +70,19 @@ class SearchAndBrowseBackend : public QIviSearchAndBrowseModelInterface { Q_OBJECT public: - explicit SearchAndBrowseBackend(const QSqlDatabase &database, QObject *parent = Q_NULLPTR); + explicit SearchAndBrowseBackend(const QSqlDatabase &database, QObject *parent = nullptr); - virtual void fetchData(const QUuid &identifier, const QString &type, QIviAbstractQueryTerm *term, const QList<QIviOrderTerm> &orderTerms, int start, int count) Q_DECL_OVERRIDE; - virtual bool canGoBack(const QUuid &identifier, const QString &type) Q_DECL_OVERRIDE; - virtual QString goBack(const QUuid &identifier, const QString &type) Q_DECL_OVERRIDE; - virtual bool canGoForward(const QUuid &identifier, const QString &type, const QString &itemId) Q_DECL_OVERRIDE; - virtual QString goForward(const QUuid &identifier, const QString &type, const QString &itemId) Q_DECL_OVERRIDE; + virtual void initialize() override; + virtual void fetchData(const QUuid &identifier, const QString &type, QIviAbstractQueryTerm *term, const QList<QIviOrderTerm> &orderTerms, int start, int count) override; + virtual bool canGoBack(const QUuid &identifier, const QString &type) override; + virtual QString goBack(const QUuid &identifier, const QString &type) override; + virtual bool canGoForward(const QUuid &identifier, const QString &type, const QString &itemId) override; + virtual QString goForward(const QUuid &identifier, const QString &type, const QString &itemId) override; - virtual void insert(const QUuid &identifier, const QString &type, int index, const QIviSearchAndBrowseModelItem *item) Q_DECL_OVERRIDE; - virtual void remove(const QUuid &identifier, const QString &type, int index) Q_DECL_OVERRIDE; - virtual void move(const QUuid &identifier, const QString &type, int currentIndex, int newIndex) Q_DECL_OVERRIDE; - virtual int indexOf(const QUuid &identifier, const QString &type, const QIviSearchAndBrowseModelItem *item) Q_DECL_OVERRIDE; + virtual void insert(const QUuid &identifier, const QString &type, int index, const QIviSearchAndBrowseModelItem *item) override; + virtual void remove(const QUuid &identifier, const QString &type, int index) override; + virtual void move(const QUuid &identifier, const QString &type, int currentIndex, int newIndex) override; + virtual int indexOf(const QUuid &identifier, const QString &type, const QIviSearchAndBrowseModelItem *item) override; private slots: void search(const QUuid &identifier, const QString &queryString, const QString &type, int start, int count); diff --git a/src/plugins/ivimedia/media_simulator/usbbrowsebackend.cpp b/src/plugins/ivimedia/media_simulator/usbbrowsebackend.cpp index 58678f5..a752145 100644 --- a/src/plugins/ivimedia/media_simulator/usbbrowsebackend.cpp +++ b/src/plugins/ivimedia/media_simulator/usbbrowsebackend.cpp @@ -52,6 +52,11 @@ UsbBrowseBackend::UsbBrowseBackend(const QString &path, QObject *parent) registerContentType<SearchAndBrowseItem>("file"); } +void UsbBrowseBackend::initialize() +{ + emit initializationDone(); +} + void UsbBrowseBackend::fetchData(const QUuid &identifier, const QString &type, QIviAbstractQueryTerm *term, const QList<QIviOrderTerm> &orderTerms, int start, int count) { emit supportedCapabilitiesChanged(identifier, QIviSearchAndBrowseModel::Capabilities( diff --git a/src/plugins/ivimedia/media_simulator/usbbrowsebackend.h b/src/plugins/ivimedia/media_simulator/usbbrowsebackend.h index 5230c7e..af5e0b9 100644 --- a/src/plugins/ivimedia/media_simulator/usbbrowsebackend.h +++ b/src/plugins/ivimedia/media_simulator/usbbrowsebackend.h @@ -46,19 +46,22 @@ class UsbBrowseBackend : public QIviSearchAndBrowseModelInterface { + Q_OBJECT + public: - UsbBrowseBackend(const QString &path, QObject *parent = 0); + UsbBrowseBackend(const QString &path, QObject *parent = nullptr); - virtual void fetchData(const QUuid &identifier, const QString &type, QIviAbstractQueryTerm *term, const QList<QIviOrderTerm> &orderTerms, int start, int count) Q_DECL_OVERRIDE; - virtual bool canGoBack(const QUuid &identifier, const QString &type) Q_DECL_OVERRIDE; - virtual QString goBack(const QUuid &identifier, const QString &type) Q_DECL_OVERRIDE; - virtual bool canGoForward(const QUuid &identifier, const QString &type, const QString &itemId) Q_DECL_OVERRIDE; - virtual QString goForward(const QUuid &identifier, const QString &type, const QString &itemId) Q_DECL_OVERRIDE; + virtual void initialize() override; + virtual void fetchData(const QUuid &identifier, const QString &type, QIviAbstractQueryTerm *term, const QList<QIviOrderTerm> &orderTerms, int start, int count) override; + virtual bool canGoBack(const QUuid &identifier, const QString &type) override; + virtual QString goBack(const QUuid &identifier, const QString &type) override; + virtual bool canGoForward(const QUuid &identifier, const QString &type, const QString &itemId) override; + virtual QString goForward(const QUuid &identifier, const QString &type, const QString &itemId) override; - virtual void insert(const QUuid &identifier, const QString &type, int index, const QIviSearchAndBrowseModelItem *item) Q_DECL_OVERRIDE; - virtual void remove(const QUuid &identifier, const QString &type, int index) Q_DECL_OVERRIDE; - virtual void move(const QUuid &identifier, const QString &type, int currentIndex, int newIndex) Q_DECL_OVERRIDE; - virtual int indexOf(const QUuid &identifier, const QString &type, const QIviSearchAndBrowseModelItem *item) Q_DECL_OVERRIDE; + virtual void insert(const QUuid &identifier, const QString &type, int index, const QIviSearchAndBrowseModelItem *item) override; + virtual void remove(const QUuid &identifier, const QString &type, int index) override; + virtual void move(const QUuid &identifier, const QString &type, int currentIndex, int newIndex) override; + virtual int indexOf(const QUuid &identifier, const QString &type, const QIviSearchAndBrowseModelItem *item) override; private: QString m_rootFolder; diff --git a/src/plugins/ivimedia/media_simulator/usbdevice.cpp b/src/plugins/ivimedia/media_simulator/usbdevice.cpp index ab0fbf9..326eaf8 100644 --- a/src/plugins/ivimedia/media_simulator/usbdevice.cpp +++ b/src/plugins/ivimedia/media_simulator/usbdevice.cpp @@ -70,7 +70,7 @@ QStringList USBDevice::interfaces() const return list; } -QObject *USBDevice::interfaceInstance(const QString &interface) const +QIviFeatureInterface *USBDevice::interfaceInstance(const QString &interface) const { if (interface == QIviSearchAndBrowseModel_iid) return m_browseModel; diff --git a/src/plugins/ivimedia/media_simulator/usbdevice.h b/src/plugins/ivimedia/media_simulator/usbdevice.h index fee2a9e..8126c2a 100644 --- a/src/plugins/ivimedia/media_simulator/usbdevice.h +++ b/src/plugins/ivimedia/media_simulator/usbdevice.h @@ -50,13 +50,13 @@ class USBDevice : public QIviMediaUsbDevice { Q_OBJECT public: - explicit USBDevice(const QString &folder, QObject *parent = 0); + explicit USBDevice(const QString &folder, QObject *parent = nullptr); - virtual QString name() const Q_DECL_OVERRIDE; - virtual void eject() Q_DECL_OVERRIDE; + virtual QString name() const override; + virtual void eject() override; - virtual QStringList interfaces() const Q_DECL_OVERRIDE; - virtual QObject *interfaceInstance(const QString &interface) const Q_DECL_OVERRIDE; + virtual QStringList interfaces() const override; + virtual QIviFeatureInterface *interfaceInstance(const QString &interface) const override; private: UsbBrowseBackend *m_browseModel; diff --git a/src/plugins/ivimedia/tuner_simulator/amfmtunerbackend.cpp b/src/plugins/ivimedia/tuner_simulator/amfmtunerbackend.cpp index 6e5bd55..b77a440 100644 --- a/src/plugins/ivimedia/tuner_simulator/amfmtunerbackend.cpp +++ b/src/plugins/ivimedia/tuner_simulator/amfmtunerbackend.cpp @@ -88,6 +88,7 @@ void AmFmTunerBackend::initialize() emit stepSizeChanged(m_bandHash[m_band].m_stepSize); emit frequencyChanged(m_bandHash[m_band].m_frequency); emit stationChanged(m_bandHash[m_band].m_stations.at(0)); + emit initializationDone(); } void AmFmTunerBackend::setFrequency(int frequency) diff --git a/src/plugins/ivimedia/tuner_simulator/amfmtunerbackend.h b/src/plugins/ivimedia/tuner_simulator/amfmtunerbackend.h index 55b4318..157579b 100644 --- a/src/plugins/ivimedia/tuner_simulator/amfmtunerbackend.h +++ b/src/plugins/ivimedia/tuner_simulator/amfmtunerbackend.h @@ -50,23 +50,23 @@ class AmFmTunerBackend : public QIviAmFmTunerBackendInterface { Q_OBJECT public: - explicit AmFmTunerBackend(QObject *parent = 0); + explicit AmFmTunerBackend(QObject *parent = nullptr); - virtual void initialize() Q_DECL_OVERRIDE; - virtual void setFrequency(int frequency) Q_DECL_OVERRIDE; - virtual void setBand(QIviAmFmTuner::Band band) Q_DECL_OVERRIDE; - virtual void stepUp() Q_DECL_OVERRIDE; - virtual void stepDown() Q_DECL_OVERRIDE; - virtual void seekUp() Q_DECL_OVERRIDE; - virtual void seekDown() Q_DECL_OVERRIDE; - virtual void startScan() Q_DECL_OVERRIDE; - virtual void stopScan() Q_DECL_OVERRIDE; + virtual void initialize() override; + virtual void setFrequency(int frequency) override; + virtual void setBand(QIviAmFmTuner::Band band) override; + virtual void stepUp() override; + virtual void stepDown() override; + virtual void seekUp() override; + virtual void seekDown() override; + virtual void startScan() override; + virtual void stopScan() override; private: void setCurrentStation(const QIviAmFmTunerStation &station); int stationIndexFromFrequency(int frequency) const; QIviAmFmTunerStation stationAt(int frequency) const; - void timerEvent(QTimerEvent *event) Q_DECL_OVERRIDE; + void timerEvent(QTimerEvent *event) override; QIviAmFmTuner::Band m_band; struct BandData { diff --git a/src/plugins/ivimedia/tuner_simulator/searchandbrowsebackend.cpp b/src/plugins/ivimedia/tuner_simulator/searchandbrowsebackend.cpp index e7db4ad..6c59483 100644 --- a/src/plugins/ivimedia/tuner_simulator/searchandbrowsebackend.cpp +++ b/src/plugins/ivimedia/tuner_simulator/searchandbrowsebackend.cpp @@ -53,6 +53,11 @@ SearchAndBrowseBackend::SearchAndBrowseBackend(AmFmTunerBackend *tunerBackend, Q registerContentType<QIviAmFmTunerStation>("presets"); } +void SearchAndBrowseBackend::initialize() +{ + emit initializationDone(); +} + void SearchAndBrowseBackend::fetchData(const QUuid &identifier, const QString &type, QIviAbstractQueryTerm *term, const QList<QIviOrderTerm> &orderTerms, int start, int count) { emit supportedCapabilitiesChanged(identifier, QIviSearchAndBrowseModel::Capabilities( @@ -119,7 +124,7 @@ void SearchAndBrowseBackend::insert(const QUuid &identifier, const QString &type if (type != "presets" || item->type() != "amfmtunerstation") return; - QIviAmFmTunerStation station = *static_cast<const QIviAmFmTunerStation*>(item); + const QIviAmFmTunerStation &station = *static_cast<const QIviAmFmTunerStation*>(item); m_presets.insert(index, station); QVariantList stations = { QVariant::fromValue(station) }; emit dataChanged(identifier, stations, index, 0); diff --git a/src/plugins/ivimedia/tuner_simulator/searchandbrowsebackend.h b/src/plugins/ivimedia/tuner_simulator/searchandbrowsebackend.h index 0d065e8..d6bd9b6 100644 --- a/src/plugins/ivimedia/tuner_simulator/searchandbrowsebackend.h +++ b/src/plugins/ivimedia/tuner_simulator/searchandbrowsebackend.h @@ -52,18 +52,19 @@ class SearchAndBrowseBackend : public QIviSearchAndBrowseModelInterface { Q_OBJECT public: - explicit SearchAndBrowseBackend(AmFmTunerBackend *tunerBackend, QObject *parent = Q_NULLPTR); + explicit SearchAndBrowseBackend(AmFmTunerBackend *tunerBackend, QObject *parent = nullptr); - virtual void fetchData(const QUuid &identifier, const QString &type, QIviAbstractQueryTerm *term, const QList<QIviOrderTerm> &orderTerms, int start, int count) Q_DECL_OVERRIDE; - virtual bool canGoBack(const QUuid &identifier, const QString &type) Q_DECL_OVERRIDE; - virtual QString goBack(const QUuid &identifier, const QString &type) Q_DECL_OVERRIDE; - virtual bool canGoForward(const QUuid &identifier, const QString &type, const QString &itemId) Q_DECL_OVERRIDE; - virtual QString goForward(const QUuid &identifier, const QString &type, const QString &itemId) Q_DECL_OVERRIDE; + virtual void initialize() override; + virtual void fetchData(const QUuid &identifier, const QString &type, QIviAbstractQueryTerm *term, const QList<QIviOrderTerm> &orderTerms, int start, int count) override; + virtual bool canGoBack(const QUuid &identifier, const QString &type) override; + virtual QString goBack(const QUuid &identifier, const QString &type) override; + virtual bool canGoForward(const QUuid &identifier, const QString &type, const QString &itemId) override; + virtual QString goForward(const QUuid &identifier, const QString &type, const QString &itemId) override; - virtual void insert(const QUuid &identifier, const QString &type, int index, const QIviSearchAndBrowseModelItem *item) Q_DECL_OVERRIDE; - virtual void remove(const QUuid &identifier, const QString &type, int index) Q_DECL_OVERRIDE; - virtual void move(const QUuid &identifier, const QString &type, int currentIndex, int newIndex) Q_DECL_OVERRIDE; - virtual int indexOf(const QUuid &identifier, const QString &type, const QIviSearchAndBrowseModelItem *item) Q_DECL_OVERRIDE; + virtual void insert(const QUuid &identifier, const QString &type, int index, const QIviSearchAndBrowseModelItem *item) override; + virtual void remove(const QUuid &identifier, const QString &type, int index) override; + virtual void move(const QUuid &identifier, const QString &type, int currentIndex, int newIndex) override; + virtual int indexOf(const QUuid &identifier, const QString &type, const QIviSearchAndBrowseModelItem *item) override; private: AmFmTunerBackend *m_tunerBackend; diff --git a/src/plugins/ivimedia/tuner_simulator/tunerplugin.cpp b/src/plugins/ivimedia/tuner_simulator/tunerplugin.cpp index f6d18af..6f6e56c 100644 --- a/src/plugins/ivimedia/tuner_simulator/tunerplugin.cpp +++ b/src/plugins/ivimedia/tuner_simulator/tunerplugin.cpp @@ -63,7 +63,7 @@ QStringList TunerPlugin::interfaces() const return list; } -QObject *TunerPlugin::interfaceInstance(const QString &interface) const +QIviFeatureInterface *TunerPlugin::interfaceInstance(const QString &interface) const { if (interface == QIviAmFmTuner_iid) return m_amfmtuner; diff --git a/src/plugins/ivimedia/tuner_simulator/tunerplugin.h b/src/plugins/ivimedia/tuner_simulator/tunerplugin.h index b6317d8..5cc7f0d 100644 --- a/src/plugins/ivimedia/tuner_simulator/tunerplugin.h +++ b/src/plugins/ivimedia/tuner_simulator/tunerplugin.h @@ -54,10 +54,10 @@ class TunerPlugin : public QObject, QIviServiceInterface Q_INTERFACES(QIviServiceInterface) public: - explicit TunerPlugin(QObject *parent = Q_NULLPTR); + explicit TunerPlugin(QObject *parent = nullptr); QStringList interfaces() const; - QObject *interfaceInstance(const QString &interface) const; + QIviFeatureInterface *interfaceInstance(const QString &interface) const; private: AmFmTunerBackend *m_amfmtuner; diff --git a/src/plugins/ivivehiclefunctions/doc/qtivivehiclefunctions_plugins.qdocconf b/src/plugins/ivivehiclefunctions/doc/qtivivehiclefunctions_plugins.qdocconf new file mode 100644 index 0000000..076faaf --- /dev/null +++ b/src/plugins/ivivehiclefunctions/doc/qtivivehiclefunctions_plugins.qdocconf @@ -0,0 +1,3 @@ +headerdirs += . + +sourcedirs += . diff --git a/src/plugins/ivivehiclefunctions/doc/src/backends.qdoc b/src/plugins/ivivehiclefunctions/doc/src/backends.qdoc new file mode 100644 index 0000000..2f6e483 --- /dev/null +++ b/src/plugins/ivivehiclefunctions/doc/src/backends.qdoc @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2017 Pelagicore AG +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the documentation of the QtIvi module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:FDL-QTAS$ +** Commercial License Usage +** Licensees holding valid commercial Qt Automotive Suite licenses may use +** this file in accordance with the commercial license agreement provided +** with the Software or, alternatively, in accordance with the terms +** contained in a written agreement between you and The Qt Company. For +** licensing terms and conditions see https://www.qt.io/terms-conditions. +** For further information use the contact form at https://www.qt.io/contact-us. +** +** GNU Free Documentation License Usage +** Alternatively, this file may be used under the terms of the GNU Free +** Documentation License version 1.3 as published by the Free Software +** Foundation and appearing in the file included in the packaging of +** this file. Please review the following information to ensure +** the GNU Free Documentation License version 1.3 requirements +** will be met: https://www.gnu.org/licenses/fdl-1.3.html. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/*! +\page qtivivehiclefunctions-backends.html +\title QtIviVehicleFunctions Backends +\ingroup qtivi_backend_groups + +All backends supporting interfaces from QtIviVehicleFunctions + +\annotatedlist qtivivehiclefunctions_backend +*/ + +/*! +\page qtivivehiclefunctions-simulation-backend.html +\title QtIviVehicleFunctions Simulation Backend +\ingroup qtivivehiclefunctions_backend +\ingroup qtivi_backend + +\brief Provides a static vehicle functions simulation. + +\section1 Supported interfaces +\list + \li \l{org.qt-project.qtivi.ClimateControl/1.0} + \li \l{org.qt-project.qtivi.WindowControl/1.0} +\endlist + +\section1 Supported Zones +\list + \li ClimateControl + \list + \li FrontLeft + \li FrontRight + \li Rear + \endlist + \li WindowControl + \list + \li FrontLeft + \li FrontRight + \li RearLeft + \li RearRight + \li Rear + \li Roof + \endlist +\endlist +*/ diff --git a/src/plugins/ivivehiclefunctions/ivivehiclefunctions.pro b/src/plugins/ivivehiclefunctions/ivivehiclefunctions.pro index c790087..1fa827a 100644 --- a/src/plugins/ivivehiclefunctions/ivivehiclefunctions.pro +++ b/src/plugins/ivivehiclefunctions/ivivehiclefunctions.pro @@ -1,3 +1,6 @@ TEMPLATE = subdirs SUBDIRS = vehiclefunction_simulator +OTHER_FILES += \ + $$PWD/doc/*.qdocconf \ + $$PWD/doc/src/*.qdoc diff --git a/src/plugins/ivivehiclefunctions/vehiclefunction_simulator/climatecontrolbackend.cpp b/src/plugins/ivivehiclefunctions/vehiclefunction_simulator/climatecontrolbackend.cpp index 85d576c..747340a 100644 --- a/src/plugins/ivivehiclefunctions/vehiclefunction_simulator/climatecontrolbackend.cpp +++ b/src/plugins/ivivehiclefunctions/vehiclefunction_simulator/climatecontrolbackend.cpp @@ -96,7 +96,7 @@ QStringList ClimateControlBackend::availableZones() const return m_zoneMap.keys(); } -void ClimateControlBackend::initializeAttributes() +void ClimateControlBackend::initialize() { QVector<QIviClimateControl::AirflowDirections> airflow; airflow << (QIviClimateControl::Floor | QIviClimateControl::Dashboard) << QIviClimateControl::Floor << QIviClimateControl::Dashboard; @@ -140,6 +140,8 @@ void ClimateControlBackend::initializeAttributes() emit seatHeaterAttributeChanged(m_zoneMap[zone].seatHeaterAttribute, zone); emit seatHeaterChanged(m_zoneMap[zone].seatHeater, zone); } + + emit initializationDone(); } void ClimateControlBackend::setTargetTemperature(int val, const QString &zone) diff --git a/src/plugins/ivivehiclefunctions/vehiclefunction_simulator/climatecontrolbackend.h b/src/plugins/ivivehiclefunctions/vehiclefunction_simulator/climatecontrolbackend.h index 3fb7a68..f28a54b 100644 --- a/src/plugins/ivivehiclefunctions/vehiclefunction_simulator/climatecontrolbackend.h +++ b/src/plugins/ivivehiclefunctions/vehiclefunction_simulator/climatecontrolbackend.h @@ -47,14 +47,16 @@ class ClimateControlBackend : public QIviClimateControlBackendInterface { + Q_OBJECT + public: - ClimateControlBackend(QObject *parent = 0); + ClimateControlBackend(QObject *parent = nullptr); ~ClimateControlBackend(); public: QStringList availableZones() const; - void initializeAttributes(); + void initialize(); void setTargetTemperature(int val, const QString &zone); void setSeatCooler(int val, const QString &zone); diff --git a/src/plugins/ivivehiclefunctions/vehiclefunction_simulator/vehicleplugin.cpp b/src/plugins/ivivehiclefunctions/vehiclefunction_simulator/vehicleplugin.cpp index f89d1d7..dd86d4a 100644 --- a/src/plugins/ivivehiclefunctions/vehiclefunction_simulator/vehicleplugin.cpp +++ b/src/plugins/ivivehiclefunctions/vehiclefunction_simulator/vehicleplugin.cpp @@ -61,7 +61,7 @@ QStringList VehiclePlugin::interfaces() const return list; } -QObject *VehiclePlugin::interfaceInstance(const QString &interface) const +QIviFeatureInterface *VehiclePlugin::interfaceInstance(const QString &interface) const { if (interface == QIviClimateControl_iid) return m_climate; diff --git a/src/plugins/ivivehiclefunctions/vehiclefunction_simulator/vehicleplugin.h b/src/plugins/ivivehiclefunctions/vehiclefunction_simulator/vehicleplugin.h index 1d69cbb..c94e4d7 100644 --- a/src/plugins/ivivehiclefunctions/vehiclefunction_simulator/vehicleplugin.h +++ b/src/plugins/ivivehiclefunctions/vehiclefunction_simulator/vehicleplugin.h @@ -54,10 +54,10 @@ class VehiclePlugin : public QObject, QIviServiceInterface Q_INTERFACES(QIviServiceInterface) public: - VehiclePlugin(QObject *parent = 0); + VehiclePlugin(QObject *parent = nullptr); QStringList interfaces() const; - QObject *interfaceInstance(const QString& interface) const; + QIviFeatureInterface *interfaceInstance(const QString& interface) const; private: ClimateControlBackend *m_climate; diff --git a/src/plugins/ivivehiclefunctions/vehiclefunction_simulator/windowcontrolbackend.cpp b/src/plugins/ivivehiclefunctions/vehiclefunction_simulator/windowcontrolbackend.cpp index 021db82..4d30715 100644 --- a/src/plugins/ivivehiclefunctions/vehiclefunction_simulator/windowcontrolbackend.cpp +++ b/src/plugins/ivivehiclefunctions/vehiclefunction_simulator/windowcontrolbackend.cpp @@ -214,7 +214,7 @@ QStringList WindowControlBackend::availableZones() const return m_zoneMap.keys(); } -void WindowControlBackend::initializeAttributes() +void WindowControlBackend::initialize() { const auto zones = availableZones(); for (const QString &zone : zones) { @@ -229,6 +229,8 @@ void WindowControlBackend::initializeAttributes() emit stateChanged(m_zoneMap[zone].state, zone); emit stateAttributeChanged(m_zoneMap[zone].stateAttribute, zone); } + + emit initializationDone(); } void WindowControlBackend::setHeaterMode(QIviWindowControl::HeaterMode value, const QString &zone) diff --git a/src/plugins/ivivehiclefunctions/vehiclefunction_simulator/windowcontrolbackend.h b/src/plugins/ivivehiclefunctions/vehiclefunction_simulator/windowcontrolbackend.h index 92aeb07..2a5cf53 100644 --- a/src/plugins/ivivehiclefunctions/vehiclefunction_simulator/windowcontrolbackend.h +++ b/src/plugins/ivivehiclefunctions/vehiclefunction_simulator/windowcontrolbackend.h @@ -73,12 +73,14 @@ private: class WindowControlBackend : public QIviWindowControlBackendInterface { + Q_OBJECT + public: - WindowControlBackend(QObject *parent = 0); + WindowControlBackend(QObject *parent = nullptr); ~WindowControlBackend(); QStringList availableZones() const; - void initializeAttributes(); + void initialize(); void setHeaterMode(QIviWindowControl::HeaterMode value, const QString &zone); void setBlindMode(QIviWindowControl::BlindMode value, const QString &zone); |