summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominik Holland <dominik.holland@pelagicore.com>2017-11-03 09:48:04 +0100
committerDominik Holland <dominik.holland@pelagicore.com>2017-11-03 09:49:33 +0100
commitfb338368765f60c48d2b44abbad8b4c9fb6751eb (patch)
tree86d9c7b4ff4afab6b1aa90d31e9fb31c03a6acfb
parent9d372b44458baeab4ee5d131477dfc4bbd858f6b (diff)
parent489d2d4bd6c4602729f2dfe75f4a3b966b693c9c (diff)
downloadqtivi-fb338368765f60c48d2b44abbad8b4c9fb6751eb.tar.gz
Merge remote-tracking branch 'origin/5.10' into 5.9
Change-Id: I5f8466c36a701eefec72fbd3bc32a8fe129e994d
-rw-r--r--.gitattributes1
-rw-r--r--.gitignore2
-rw-r--r--.gitmodules4
-rw-r--r--.qmake.conf6
-rw-r--r--examples/core/core.pro4
-rw-r--r--examples/core/qface-ivi-climate/backend_simulator/backend_simulator.pro69
-rwxr-xr-xexamples/core/qface-ivi-climate/build.sh77
-rw-r--r--examples/core/qface-ivi-climate/demo/demo.pro82
-rw-r--r--examples/core/qface-ivi-climate/demo/main.cpp69
-rw-r--r--examples/core/qface-ivi-climate/demo/main.qml119
-rw-r--r--examples/core/qface-ivi-climate/demo/qml.qrc5
-rw-r--r--examples/core/qface-ivi-climate/example-ivi-climate.qface132
-rw-r--r--examples/core/qface-ivi-climate/example-ivi-climate.yaml62
-rw-r--r--examples/core/qface-ivi-climate/frontend/frontend.pro62
-rw-r--r--examples/core/qface-ivi-climate/qface-ivi-climate.pro59
-rw-r--r--examples/examples.pro1
-rw-r--r--examples/vehiclefunctions/climate_qml/main.qml94
-rw-r--r--examples/vehiclefunctions/climate_widget/mainwindow.cpp62
-rw-r--r--examples/vehiclefunctions/climate_widget/mainwindow.h10
-rw-r--r--examples/vehiclefunctions/window_qml/WindowItem.qml41
-rw-r--r--mkspecs/features/features.pro19
-rw-r--r--mkspecs/features/ivigenerator.prf155
-rw-r--r--mkspecs/features/ivigenerator_qt_module.prf29
-rw-r--r--mkspecs/mkspecs.pro5
-rw-r--r--qtivi.pro5
m---------src/3rdparty/qface0
-rw-r--r--src/3rdparty/qt_attribution.json17
-rw-r--r--src/doc/qtautomotivesuite/qtautomotivesuite-project.qdocconf13
-rw-r--r--src/doc/qtautomotivesuite/src/external-resources.qdoc77
-rw-r--r--src/doc/qtautomotivesuite/src/images/ok.pngbin0 -> 880 bytes
-rw-r--r--src/doc/qtautomotivesuite/src/images/qtas-architecture.pngbin0 -> 18156 bytes
-rw-r--r--src/doc/qtautomotivesuite/src/images/qtas-yocto.pngbin0 -> 21364 bytes
-rw-r--r--src/doc/qtautomotivesuite/src/qtautomotivesuite-byos.qdoc195
-rw-r--r--src/doc/qtautomotivesuite/src/qtautomotivesuite-drive-cx.qdoc68
-rw-r--r--src/doc/qtautomotivesuite/src/qtautomotivesuite-toc.qdoc46
-rw-r--r--src/doc/qtautomotivesuite/src/qtautomotivesuite.qdoc104
-rw-r--r--src/doc/qtautomotivesuite/src/shared/qtas-post-install-setup.qdocinc72
-rw-r--r--src/doc/qtivi/images/backendtypes.jpgbin0 -> 19752 bytes
-rw-r--r--src/doc/qtivi/images/feature_backend.jpgbin0 -> 18496 bytes
-rw-r--r--src/doc/qtivi/qtivi-project.qdocconf6
-rw-r--r--src/doc/qtivi/src/JINJA_LICENSE31
-rw-r--r--src/doc/qtivi/src/attribute-system.qdoc5
-rw-r--r--src/doc/qtivi/src/backend-system.qdoc137
-rw-r--r--src/doc/qtivi/src/concepts.qdoc41
-rw-r--r--src/doc/qtivi/src/configuration.qdoc112
-rw-r--r--src/doc/qtivi/src/examples-qface-ivi-climate.qdoc142
-rw-r--r--src/doc/qtivi/src/extending-qtivi.qdoc2
-rw-r--r--src/doc/qtivi/src/generator-usage.qdoc311
-rw-r--r--src/doc/qtivi/src/idl-syntax.qdoc315
-rw-r--r--src/doc/qtivi/src/ivigenerator.qdoc43
-rw-r--r--src/doc/qtivi/src/models.qdoc115
-rw-r--r--src/doc/qtivi/src/qmake-integration.qdoc70
-rw-r--r--src/doc/qtivi/src/qt_attribution.json17
-rw-r--r--src/doc/qtivi/src/qtivi-backends.qdoc46
-rw-r--r--src/doc/qtivi/src/qtivi.qdoc23
-rw-r--r--src/doc/qtivi/src/query-language.qdoc2
-rw-r--r--src/doc/qtivi/src/reference-api.qdoc68
-rw-r--r--src/doc/qtivi/src/template-syntax.qdoc474
-rw-r--r--src/geniviextras/doc/qtgeniviextras.qdocconf4
-rw-r--r--src/geniviextras/qdltregistration.cpp7
-rw-r--r--src/geniviextras/qdltregistration.h3
-rw-r--r--src/imports/imports.pro2
-rw-r--r--src/imports/vehiclefunctions/plugin.cpp4
-rw-r--r--src/ivicore/configure.json96
-rw-r--r--src/ivicore/configure.pri57
-rw-r--r--src/ivicore/doc/qtivicore.qdocconf2
-rw-r--r--src/ivicore/doc/src/qtivicore.qdoc11
-rw-r--r--src/ivicore/ivicore.pro8
-rw-r--r--src/ivicore/qiviabstractfeature.cpp669
-rw-r--r--src/ivicore/qiviabstractfeature.h12
-rw-r--r--src/ivicore/qiviabstractfeature_p.h20
-rw-r--r--src/ivicore/qiviabstractfeaturelistmodel.cpp176
-rw-r--r--src/ivicore/qiviabstractfeaturelistmodel.h13
-rw-r--r--src/ivicore/qiviabstractfeaturelistmodel_p.h14
-rw-r--r--src/ivicore/qiviabstractzonedfeature.cpp121
-rw-r--r--src/ivicore/qiviabstractzonedfeature.h12
-rw-r--r--src/ivicore/qividefaultpropertyoverrider.cpp552
-rw-r--r--src/ivicore/qividefaultpropertyoverrider_p.h161
-rw-r--r--src/ivicore/qivifeatureinterface.cpp108
-rw-r--r--src/ivicore/qivifeatureinterface.h (renamed from src/ivivehiclefunctions/qtivivehiclefunctionsglobal.h)36
-rw-r--r--src/ivicore/qiviproperty.cpp108
-rw-r--r--src/ivicore/qiviproperty.h2
-rw-r--r--src/ivicore/qivipropertyattribute.cpp178
-rw-r--r--src/ivicore/qivipropertyfactory.cpp134
-rw-r--r--src/ivicore/qivipropertyfactory.h10
-rw-r--r--src/ivicore/qiviproxyserviceobject_p.cpp5
-rw-r--r--src/ivicore/qiviproxyserviceobject_p.h8
-rw-r--r--src/ivicore/qivisearchandbrowsemodel.cpp84
-rw-r--r--src/ivicore/qivisearchandbrowsemodel.h24
-rw-r--r--src/ivicore/qivisearchandbrowsemodel_p.h2
-rw-r--r--src/ivicore/qivisearchandbrowsemodelinterface.cpp9
-rw-r--r--src/ivicore/qivisearchandbrowsemodelinterface.h7
-rw-r--r--src/ivicore/qivisearchandbrowsemodelitem.cpp4
-rw-r--r--src/ivicore/qiviserviceinterface.h3
-rw-r--r--src/ivicore/qiviservicemanager.cpp156
-rw-r--r--src/ivicore/qiviservicemanager.h2
-rw-r--r--src/ivicore/qiviserviceobject.cpp111
-rw-r--r--src/ivicore/qiviserviceobject.h5
-rw-r--r--src/ivicore/qivizonedfeatureinterface.cpp175
-rw-r--r--src/ivicore/qivizonedfeatureinterface.h11
-rw-r--r--src/ivicore/queryparser/qiviqueryparser.g18
-rw-r--r--src/ivicore/queryparser/qiviqueryparser_flex_p.h240
-rw-r--r--src/ivicore/queryparser/qiviqueryparser_p.h2
-rw-r--r--src/ivicore/queryparser/qiviqueryterm.h20
-rw-r--r--src/ivimedia/configure.json1
-rw-r--r--src/ivimedia/qiviamfmtuner.cpp51
-rw-r--r--src/ivimedia/qiviamfmtuner.h8
-rw-r--r--src/ivimedia/qiviamfmtunerbackendinterface.cpp14
-rw-r--r--src/ivimedia/qiviamfmtunerbackendinterface.h7
-rw-r--r--src/ivimedia/qivimediadevice.cpp4
-rw-r--r--src/ivimedia/qivimediadevice.h6
-rw-r--r--src/ivimedia/qivimediadevicediscoverymodel.cpp28
-rw-r--r--src/ivimedia/qivimediadevicediscoverymodel.h14
-rw-r--r--src/ivimedia/qivimediadevicediscoverymodel_p.h2
-rw-r--r--src/ivimedia/qivimediadevicediscoverymodelbackendinterface.cpp7
-rw-r--r--src/ivimedia/qivimediadevicediscoverymodelbackendinterface.h6
-rw-r--r--src/ivimedia/qivimediaindexercontrol.cpp19
-rw-r--r--src/ivimedia/qivimediaindexercontrol.h8
-rw-r--r--src/ivimedia/qivimediaindexercontrolbackendinterface.cpp7
-rw-r--r--src/ivimedia/qivimediaindexercontrolbackendinterface.h6
-rw-r--r--src/ivimedia/qivimediaplayer.cpp61
-rw-r--r--src/ivimedia/qivimediaplayer.h8
-rw-r--r--src/ivimedia/qivimediaplayer_p.h2
-rw-r--r--src/ivimedia/qivimediaplayerbackendinterface.cpp14
-rw-r--r--src/ivimedia/qivimediaplayerbackendinterface.h7
-rw-r--r--src/ivimedia/qiviplayableitem.cpp4
-rw-r--r--src/ivimedia/qiviplayableitem.h14
-rw-r--r--src/ivimedia/qiviplayqueue.cpp48
-rw-r--r--src/ivimedia/qiviplayqueue.h12
-rw-r--r--src/ivimedia/qivitunerstation.cpp4
-rw-r--r--src/ivimedia/qivitunerstation.h8
-rw-r--r--src/ivivehiclefunctions/doc/qtivivehiclefunctions.qdocconf6
-rw-r--r--src/ivivehiclefunctions/doc/src/qtivivehiclefunctions.qdoc124
-rw-r--r--src/ivivehiclefunctions/ivivehiclefunctions.pro21
-rw-r--r--src/ivivehiclefunctions/ivivehiclefunctions.qface265
-rw-r--r--src/ivivehiclefunctions/ivivehiclefunctions.yaml100
-rw-r--r--src/ivivehiclefunctions/qiviclimatecontrol.cpp1843
-rw-r--r--src/ivivehiclefunctions/qiviclimatecontrol.h249
-rw-r--r--src/ivivehiclefunctions/qiviclimatecontrol_p.h162
-rw-r--r--src/ivivehiclefunctions/qiviclimatecontrolbackendinterface.cpp456
-rw-r--r--src/ivivehiclefunctions/qiviclimatecontrolbackendinterface.h115
-rw-r--r--src/ivivehiclefunctions/qiviwindowcontrol.cpp749
-rw-r--r--src/ivivehiclefunctions/qiviwindowcontrol.h151
-rw-r--r--src/ivivehiclefunctions/qiviwindowcontrol_p.h108
-rw-r--r--src/ivivehiclefunctions/qiviwindowcontrolbackendinterface.cpp174
-rw-r--r--src/ivivehiclefunctions/qiviwindowcontrolbackendinterface.h82
-rw-r--r--src/plugins/ivimedia/doc/qtivimedia_plugins.qdocconf3
-rw-r--r--src/plugins/ivimedia/doc/src/backends.qdoc127
-rw-r--r--src/plugins/ivimedia/ivimedia.pro6
-rw-r--r--src/plugins/ivimedia/media_simulator/mediadiscoverybackend.cpp12
-rw-r--r--src/plugins/ivimedia/media_simulator/mediadiscoverybackend.h4
-rw-r--r--src/plugins/ivimedia/media_simulator/mediaindexerbackend.cpp93
-rw-r--r--src/plugins/ivimedia/media_simulator/mediaindexerbackend.h8
-rw-r--r--src/plugins/ivimedia/media_simulator/mediaplayerbackend.cpp1
-rw-r--r--src/plugins/ivimedia/media_simulator/mediaplayerbackend.h32
-rw-r--r--src/plugins/ivimedia/media_simulator/mediaplugin.cpp2
-rw-r--r--src/plugins/ivimedia/media_simulator/mediaplugin.h4
-rw-r--r--src/plugins/ivimedia/media_simulator/searchandbrowsebackend.cpp23
-rw-r--r--src/plugins/ivimedia/media_simulator/searchandbrowsebackend.h21
-rw-r--r--src/plugins/ivimedia/media_simulator/usbbrowsebackend.cpp5
-rw-r--r--src/plugins/ivimedia/media_simulator/usbbrowsebackend.h23
-rw-r--r--src/plugins/ivimedia/media_simulator/usbdevice.cpp2
-rw-r--r--src/plugins/ivimedia/media_simulator/usbdevice.h10
-rw-r--r--src/plugins/ivimedia/media_simulator_mpris/media_simulator_mpris.json5
-rw-r--r--src/plugins/ivimedia/media_simulator_mpris/media_simulator_mpris.pro22
-rw-r--r--src/plugins/ivimedia/media_simulator_mpris/mediaplayerbackend.cpp374
-rw-r--r--src/plugins/ivimedia/media_simulator_mpris/mediaplayerbackend.h99
-rw-r--r--src/plugins/ivimedia/media_simulator_mpris/mediaplugin.cpp (renamed from src/ivivehiclefunctions/qtivivehiclefunctionsglobal_p.h)48
-rw-r--r--src/plugins/ivimedia/media_simulator_mpris/mediaplugin.h (renamed from src/plugins/ivivehiclefunctions/vehiclefunction_simulator/vehicleplugin.h)21
-rw-r--r--src/plugins/ivimedia/media_simulator_mpris/org.mpris.MediaPlayer2.xml113
-rw-r--r--src/plugins/ivimedia/tuner_simulator/amfmtunerbackend.cpp1
-rw-r--r--src/plugins/ivimedia/tuner_simulator/amfmtunerbackend.h22
-rw-r--r--src/plugins/ivimedia/tuner_simulator/searchandbrowsebackend.cpp7
-rw-r--r--src/plugins/ivimedia/tuner_simulator/searchandbrowsebackend.h21
-rw-r--r--src/plugins/ivimedia/tuner_simulator/tunerplugin.cpp2
-rw-r--r--src/plugins/ivimedia/tuner_simulator/tunerplugin.h4
-rw-r--r--src/plugins/ivivehiclefunctions/doc/qtivivehiclefunctions_plugins.qdocconf3
-rw-r--r--src/plugins/ivivehiclefunctions/doc/src/backends.qdoc70
-rw-r--r--src/plugins/ivivehiclefunctions/ivivehiclefunctions.cpp (renamed from src/plugins/ivivehiclefunctions/vehiclefunction_simulator/vehicleplugin.cpp)41
-rw-r--r--src/plugins/ivivehiclefunctions/ivivehiclefunctions.pro28
-rw-r--r--src/plugins/ivivehiclefunctions/qiviconcretewindowcontrolbackend.cpp192
-rw-r--r--src/plugins/ivivehiclefunctions/qiviconcretewindowcontrolbackend.h (renamed from src/plugins/ivivehiclefunctions/vehiclefunction_simulator/windowcontrolbackend.h)61
-rw-r--r--src/plugins/ivivehiclefunctions/vehiclefunction_simulator/climatecontrolbackend.cpp318
-rw-r--r--src/plugins/ivivehiclefunctions/vehiclefunction_simulator/climatecontrolbackend.h101
-rw-r--r--src/plugins/ivivehiclefunctions/vehiclefunction_simulator/vehiclefunction_simulator.json3
-rw-r--r--src/plugins/ivivehiclefunctions/vehiclefunction_simulator/vehiclefunction_simulator.pro20
-rw-r--r--src/plugins/ivivehiclefunctions/vehiclefunction_simulator/windowcontrolbackend.cpp311
-rw-r--r--src/plugins/plugins.pro4
-rw-r--r--src/src.pro54
-rw-r--r--src/tools/ivigenerator/deploy-virtualenv-files.txt147
-rw-r--r--src/tools/ivigenerator/deploy-virtualenv.bat91
-rwxr-xr-xsrc/tools/ivigenerator/deploy-virtualenv.sh105
-rwxr-xr-xsrc/tools/ivigenerator/generate.py608
-rw-r--r--src/tools/ivigenerator/ivigenerator.pri5
-rw-r--r--src/tools/ivigenerator/ivigenerator.pro121
-rw-r--r--src/tools/ivigenerator/qface_internal_build.pri92
-rw-r--r--src/tools/ivigenerator/templates_backend_simulator.yaml17
-rw-r--r--src/tools/ivigenerator/templates_backend_simulator/backend.cpp.tpl257
-rw-r--r--src/tools/ivigenerator/templates_backend_simulator/backend.h.tpl122
-rw-r--r--src/tools/ivigenerator/templates_backend_simulator/backend_range.cpp.tpl67
-rw-r--r--src/tools/ivigenerator/templates_backend_simulator/generated_comment.cpp.tpl47
-rw-r--r--src/tools/ivigenerator/templates_backend_simulator/plugin.cpp.tpl94
-rw-r--r--src/tools/ivigenerator/templates_backend_simulator/plugin.h.tpl72
-rw-r--r--src/tools/ivigenerator/templates_backend_simulator/plugin.json49
-rw-r--r--src/tools/ivigenerator/templates_backend_simulator/plugin.pri.tpl61
-rw-r--r--src/tools/ivigenerator/templates_backend_simulator/plugin.pro63
-rw-r--r--src/tools/ivigenerator/templates_backend_simulator/utils.tpl9
-rw-r--r--src/tools/ivigenerator/templates_control_panel.yaml27
-rw-r--r--src/tools/ivigenerator/templates_control_panel/EnumControl.qml.tpl31
-rw-r--r--src/tools/ivigenerator/templates_control_panel/FlagControl.qml.tpl29
-rw-r--r--src/tools/ivigenerator/templates_control_panel/generated_comment.cpp.tpl47
-rw-r--r--src/tools/ivigenerator/templates_control_panel/global.h.tpl62
-rw-r--r--src/tools/ivigenerator/templates_control_panel/interface.cpp.tpl257
-rw-r--r--src/tools/ivigenerator/templates_control_panel/interface.h.tpl135
-rw-r--r--src/tools/ivigenerator/templates_control_panel/interface.qml.tpl189
-rw-r--r--src/tools/ivigenerator/templates_control_panel/main.cpp.tpl64
-rw-r--r--src/tools/ivigenerator/templates_control_panel/main.qml.tpl78
-rw-r--r--src/tools/ivigenerator/templates_control_panel/module.cpp.tpl146
-rw-r--r--src/tools/ivigenerator/templates_control_panel/module.h.tpl87
-rw-r--r--src/tools/ivigenerator/templates_control_panel/qml.qrc.tpl49
-rw-r--r--src/tools/ivigenerator/templates_control_panel/ui.pri.tpl23
-rw-r--r--src/tools/ivigenerator/templates_control_panel/utils.tpl7
-rw-r--r--src/tools/ivigenerator/templates_frontend.yaml36
-rw-r--r--src/tools/ivigenerator/templates_frontend/backendinterface.cpp.tpl162
-rw-r--r--src/tools/ivigenerator/templates_frontend/backendinterface.h.tpl114
-rw-r--r--src/tools/ivigenerator/templates_frontend/generated_comment.cpp.tpl46
-rw-r--r--src/tools/ivigenerator/templates_frontend/global.h.tpl62
-rw-r--r--src/tools/ivigenerator/templates_frontend/interface.cpp.tpl421
-rw-r--r--src/tools/ivigenerator/templates_frontend/interface.h.tpl132
-rw-r--r--src/tools/ivigenerator/templates_frontend/interface_p.h.tpl131
-rw-r--r--src/tools/ivigenerator/templates_frontend/module.cpp.tpl145
-rw-r--r--src/tools/ivigenerator/templates_frontend/module.h.tpl88
-rw-r--r--src/tools/ivigenerator/templates_frontend/module.pri.tpl69
-rw-r--r--src/tools/ivigenerator/templates_frontend/modulefactory.cpp.tpl81
-rw-r--r--src/tools/ivigenerator/templates_frontend/modulefactory.h.tpl70
-rw-r--r--src/tools/ivigenerator/templates_frontend/struct.cpp.tpl127
-rw-r--r--src/tools/ivigenerator/templates_frontend/struct.h.tpl92
-rw-r--r--src/tools/ivigenerator/templates_frontend/structmodel.cpp.tpl223
-rw-r--r--src/tools/ivigenerator/templates_frontend/structmodel.h.tpl95
-rw-r--r--src/tools/ivigenerator/templates_frontend/structmodel_p.h.tpl79
-rw-r--r--src/tools/ivigenerator/templates_frontend/utils.tpl9
-rw-r--r--src/tools/ivigenerator/templates_generation_validator.yaml19
-rw-r--r--src/tools/ivigenerator/templates_generation_validator/generated_comment.cpp.tpl47
-rw-r--r--src/tools/ivigenerator/templates_generation_validator/generationstatusitem.cpp.tpl59
-rw-r--r--src/tools/ivigenerator/templates_generation_validator/generationstatusitem.h.tpl56
-rw-r--r--src/tools/ivigenerator/templates_generation_validator/main.cpp.tpl73
-rw-r--r--src/tools/ivigenerator/templates_generation_validator/main.qml.tpl99
-rw-r--r--src/tools/ivigenerator/templates_generation_validator/qml.qrc.tpl44
-rw-r--r--src/tools/ivigenerator/templates_generation_validator/ui.pri.tpl15
-rw-r--r--src/tools/ivigenerator/templates_generation_validator/validationstatus.cpp.tpl193
-rw-r--r--src/tools/ivigenerator/templates_generation_validator/validationstatus.h.tpl50
-rw-r--r--src/tools/vehiclefunctions-controller/vehiclefunctions-controller.pro10
-rw-r--r--sync.profile2
-rw-r--r--tests/auto/auto.pro2
-rw-r--r--tests/auto/core/core.pro3
-rwxr-xr-xtests/auto/core/ivigenerator/autotest.sh157
-rw-r--r--tests/auto/core/ivigenerator/ivigenerator.pro7
-rw-r--r--tests/auto/core/ivigenerator/org.example.echo.noprivate.qface53
-rw-r--r--tests/auto/core/ivigenerator/org.example.echo.qface101
-rw-r--r--tests/auto/core/ivigenerator/org.example.echo.yaml42
-rw-r--r--tests/auto/core/ivigenerator/projects/org-example-echo-noprivate/backend_simulator/backend_simulator.pro16
-rw-r--r--tests/auto/core/ivigenerator/projects/org-example-echo-noprivate/control_panel/control_panel.pro10
-rw-r--r--tests/auto/core/ivigenerator/projects/org-example-echo-noprivate/frontend/frontend.pro12
-rw-r--r--tests/auto/core/ivigenerator/projects/org-example-echo-noprivate/org-example-echo-noprivate.pro14
-rw-r--r--tests/auto/core/ivigenerator/projects/org-example-echo-noprivate/validator/validator.pro15
-rw-r--r--tests/auto/core/ivigenerator/projects/org-example-echo/backend_simulator/backend_simulator.cpp15
-rw-r--r--tests/auto/core/ivigenerator/projects/org-example-echo/backend_simulator/backend_simulator.pro18
-rw-r--r--tests/auto/core/ivigenerator/projects/org-example-echo/frontend/frontend.pro12
-rw-r--r--tests/auto/core/ivigenerator/projects/org-example-echo/org-example-echo.pro8
-rw-r--r--tests/auto/core/ivigenerator/projects/org-example-echo/validator/validator.pro15
-rw-r--r--tests/auto/core/ivigenerator/projects/projects.pro4
-rw-r--r--tests/auto/core/qiviabstractfeature/qivifeaturetester.h18
-rw-r--r--tests/auto/core/qiviabstractfeature/tst_qiviabstractfeature.cpp38
-rw-r--r--tests/auto/core/qiviproperty/tst_qiviproperty.cpp2
-rw-r--r--tests/auto/core/qivisearchandbrowsemodel/tst_qivisearchandbrowsemodel.cpp31
-rw-r--r--tests/auto/core/servicemanagertest/simple_plugin/simpleplugin.h6
-rw-r--r--tests/auto/core/servicemanagertest/tst_servicemanagertest.cpp55
-rw-r--r--tests/auto/core/servicemanagertest/wrong_plugin/wrongplugin.h4
-rw-r--r--tests/auto/core/servicemanagertest/wrongmetadata_plugin/wrongmetadataplugin.h6
-rw-r--r--tests/auto/dlt/tst_dlt.cpp2
-rw-r--r--tests/auto/vehiclefunctions/climatecontroltest/tst_climatecontroltest.cpp68
-rw-r--r--tests/auto/vehiclefunctions/windowcontroltest/tst_windowcontroltest.cpp51
282 files changed, 14561 insertions, 6759 deletions
diff --git a/.gitattributes b/.gitattributes
index 1a045fa..2b545f2 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -2,3 +2,4 @@
.gitignore export-ignore
.gitattributes export-ignore
.commit-template export-ignore
+*.bat text eol=crlf
diff --git a/.gitignore b/.gitignore
index b36e8ea..eff2a2d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,6 +9,7 @@ ui_*
.DS_STORE
*.so*
*.o
+*.orig
*.pch
*.log
*.version*
@@ -22,7 +23,6 @@ tst_*
# Directories to ignore
include/*
lib/*
-mkspecs/*
# Executables generated by configure
config.tests/dlt/dlt
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..eda14b0
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,4 @@
+[submodule "src/3rdparty/qface"]
+ path = src/3rdparty/qface
+ url = ../qtivi-qface.git
+ branch = upstream/develop
diff --git a/.qmake.conf b/.qmake.conf
index 2cda66d..120586f 100644
--- a/.qmake.conf
+++ b/.qmake.conf
@@ -1,5 +1,9 @@
+QTIVI_ROOT = $$PWD
+QTIVI_BUILD_ROOT=$$shadowed($$PWD)
+
load(qt_build_config)
DEFINES += QT_NO_FOREACH
+QMAKEFEATURES=$$PWD/mkspecs/features
-MODULE_VERSION = 1.1.0
+MODULE_VERSION = 2.0.0
diff --git a/examples/core/core.pro b/examples/core/core.pro
new file mode 100644
index 0000000..14dc55e
--- /dev/null
+++ b/examples/core/core.pro
@@ -0,0 +1,4 @@
+TEMPLATE = subdirs
+
+QT_FOR_CONFIG += ivicore
+qtConfig(ivigenerator): SUBDIRS = qface-ivi-climate
diff --git a/examples/core/qface-ivi-climate/backend_simulator/backend_simulator.pro b/examples/core/qface-ivi-climate/backend_simulator/backend_simulator.pro
new file mode 100644
index 0000000..23c1bbf
--- /dev/null
+++ b/examples/core/qface-ivi-climate/backend_simulator/backend_simulator.pro
@@ -0,0 +1,69 @@
+# 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:BSD-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.
+#
+# BSD License Usage
+# Alternatively, you may use this file under the terms of the BSD license
+# as follows:
+#
+# "Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of The Qt Company Ltd nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+#
+# $QT_END_LICENSE$
+#
+# SPDX-License-Identifier: BSD-3-Clause
+
+TEMPLATE=lib
+TARGET = $$qtLibraryTarget(example_ivi_climate)
+CONFIG += ivigenerator plugin
+macos: CONFIG += debug_and_release build_all
+
+LIBS += -L$$OUT_PWD/../ -l$$qtLibraryTarget(QtIviClimateExample)
+DESTDIR = ../qtivi
+
+CONFIG += warn_off
+INCLUDEPATH += $$OUT_PWD/../frontend
+PLUGIN_TYPE = qtivi
+PLUGIN_EXTENDS = qtivi
+PLUGIN_CLASS_NAME = ClimatePlugin
+
+QT += core ivicore
+
+QFACE_FORMAT = backend_simulator
+QFACE_SOURCES = ../example-ivi-climate.qface
+
+target.path = $$[QT_INSTALL_EXAMPLES]/core/qface-ivi-climate/backend_simulator
+INSTALLS += target
diff --git a/examples/core/qface-ivi-climate/build.sh b/examples/core/qface-ivi-climate/build.sh
new file mode 100755
index 0000000..f61aabe
--- /dev/null
+++ b/examples/core/qface-ivi-climate/build.sh
@@ -0,0 +1,77 @@
+#!/bin/bash -e
+
+# 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:BSD-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.
+#
+# BSD License Usage
+# Alternatively, you may use this file under the terms of the BSD license
+# as follows:
+#
+# "Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of The Qt Company Ltd nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+#
+# $QT_END_LICENSE$
+#
+# SPDX-License-Identifier: BSD-3-Clause
+
+# A die helper function
+# $1: The exit message
+# $2: The exit code
+die() {
+ echo "${1}"
+ exit ${2}
+}
+
+WORKDIR=$(dirname $0)
+GENERATOR=${WORKDIR}/../../src/tools/ivigenerator/generate.py
+test -x ${GENERATOR} || die "${GENERATOR} does not exists or can't be executed" 1
+out_dir=${WORKDIR}
+idlfile=qface-ivi-climate
+/bin/rm -rf ${out_dir}/frontend/*.{h,cpp,pri}
+/bin/rm -rf ${out_dir}/backend_simulator/*.{h,cpp,pri}
+${GENERATOR} --format=frontend ${WORKDIR}/${idlfile}.qface ${out_dir}/frontend || die "Generator failed" 1
+${GENERATOR} --format=backend_simulator ${WORKDIR}/${idlfile}.qface ${out_dir}/backend_simulator || die "Generator for backend failed" 1
+test -d build && /bin/rm -rf build
+test -d build && die "Cannot remove existing build folder" 1
+mkdir -p build || die "Cannot create build folder" 1
+pushd build
+project_dir=..
+qmake ${project_dir}/${idlfile}.pro || die "Failed to run qmake" 1
+make || die "Failed to build" 1
+popd
+
+die "All OK" 0
diff --git a/examples/core/qface-ivi-climate/demo/demo.pro b/examples/core/qface-ivi-climate/demo/demo.pro
new file mode 100644
index 0000000..980bf42
--- /dev/null
+++ b/examples/core/qface-ivi-climate/demo/demo.pro
@@ -0,0 +1,82 @@
+# 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:BSD-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.
+#
+# BSD License Usage
+# Alternatively, you may use this file under the terms of the BSD license
+# as follows:
+#
+# "Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of The Qt Company Ltd nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+#
+# $QT_END_LICENSE$
+#
+# SPDX-License-Identifier: BSD-3-Clause
+
+TARGET = qface-ivi-climate
+TEMPLATE = app
+
+QT += qml quick
+CONFIG += c++11
+CONFIG -= app_bundle
+DESTDIR = ../
+
+LIBS += -L$$OUT_PWD/../ -l$$qtLibraryTarget(QtIviClimateExample)
+INCLUDEPATH += $$OUT_PWD/../frontend
+
+SOURCES += main.cpp
+
+RESOURCES += qml.qrc
+
+# Additional import path used to resolve QML modules in Qt Creator's code model
+QML_IMPORT_PATH =
+
+# Additional import path used to resolve QML modules just for Qt Quick Designer
+QML_DESIGNER_IMPORT_PATH =
+
+# The following define makes your compiler emit warnings if you use
+# any feature of Qt which as been marked deprecated (the exact warnings
+# depend on your compiler). Please consult the documentation of the
+# deprecated API in order to know how to port your code away from it.
+DEFINES += QT_DEPRECATED_WARNINGS
+
+# You can also make your code fail to compile if you use deprecated APIs.
+# In order to do so, uncomment the following line.
+# You can also select to disable deprecated APIs only up to a certain version of Qt.
+#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
+
+target.path = $$[QT_INSTALL_EXAMPLES]/core/qface-ivi-climate/demo
+INSTALLS += target
diff --git a/examples/core/qface-ivi-climate/demo/main.cpp b/examples/core/qface-ivi-climate/demo/main.cpp
new file mode 100644
index 0000000..245bb26
--- /dev/null
+++ b/examples/core/qface-ivi-climate/demo/main.cpp
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+#include <QGuiApplication>
+#include <QQmlApplicationEngine>
+
+#include <climatemodule.h>
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+
+ ClimateModule::registerTypes();
+ ClimateModule::registerQmlTypes(QLatin1String("IviClimate"), 1, 0);
+
+ QQmlApplicationEngine engine;
+ engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
+
+ return app.exec();
+}
diff --git a/examples/core/qface-ivi-climate/demo/main.qml b/examples/core/qface-ivi-climate/demo/main.qml
new file mode 100644
index 0000000..a8255db
--- /dev/null
+++ b/examples/core/qface-ivi-climate/demo/main.qml
@@ -0,0 +1,119 @@
+/****************************************************************************
+**
+** 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:BSD-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.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+** SPDX-License-Identifier: BSD-3-Clause
+**
+****************************************************************************/
+
+import QtQuick 2.7
+import QtQuick.Window 2.2
+import IviClimate 1.0
+
+Window {
+ visible: true
+ width: 640
+ height: 480
+ title: qsTr("QtIVI Climate")
+
+ UiClimateControl {
+ id: climateCtrl
+ }
+
+ Column {
+ anchors.fill: parent
+ anchors.margins: 5
+
+ Text {
+ text: "Air Conditioning: " + climateCtrl.airConditioning
+ }
+ Text {
+ text: "Heater: " + climateCtrl.heater
+ }
+ Text {
+ text: "Fan Speed Level: " + climateCtrl.fanSpeedLevel
+ }
+ Text {
+ text: "Steering Wheel Heater: " + climateCtrl.steeringWheelHeater
+ }
+ Text {
+ text: "Target Temperature: " + climateCtrl.targetTemperature
+ }
+ Text {
+ text: "Seat Cooler: " + climateCtrl.seatCooler
+ }
+ Text {
+ text: "Seat Heater: " + climateCtrl.seatHeater
+ }
+ Text {
+ text: "Outside Temperature: " + climateCtrl.outsideTemperature
+ }
+ Text {
+ text: "Zone Synchronization: " + climateCtrl.zoneSynchronization
+ }
+ Text {
+ text: "Defrost: " + climateCtrl.defrost
+ }
+ Text {
+ property var vals: ["Off", "On", "Auto"]
+ text: "Recirculation Mode: " + vals[climateCtrl.recirculationMode]
+ }
+ Text {
+ text: "Recirculation: " + climateCtrl.recirculation
+ }
+ Text {
+ text: "Recirculation Sensitivity Level: " + climateCtrl.recirculationSensitivityLevel
+ }
+ Text {
+ property var vals: ["Off", "On", "Auto"]
+ text: "Climate Mode: " + vals[climateCtrl.climateMode]
+ }
+ Text {
+ text: "Automatic Climate Fan Intensity Level: " + climateCtrl.automaticClimateFanIntensityLevel
+ }
+ }
+}
diff --git a/examples/core/qface-ivi-climate/demo/qml.qrc b/examples/core/qface-ivi-climate/demo/qml.qrc
new file mode 100644
index 0000000..5f6483a
--- /dev/null
+++ b/examples/core/qface-ivi-climate/demo/qml.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/">
+ <file>main.qml</file>
+ </qresource>
+</RCC>
diff --git a/examples/core/qface-ivi-climate/example-ivi-climate.qface b/examples/core/qface-ivi-climate/example-ivi-climate.qface
new file mode 100644
index 0000000..ec99060
--- /dev/null
+++ b/examples/core/qface-ivi-climate/example-ivi-climate.qface
@@ -0,0 +1,132 @@
+/**
+ * Test module
+ */
+module Example.IVI.Climate 1.0;
+
+/**
+ * The ClimateControl provides a QML interface to the climate control
+ * of the vehicle.
+ */
+@config: { zoned: true, id: "example.qtivi.ClimateControl/1.0", qml_type: "UiClimateControl" }
+interface ClimateControl {
+ /**
+ * @brief Value is true if the air conditioning is enabled.
+ */
+ bool airConditioning;
+ /**
+ * @brief value is true if the heater is enabled.
+ */
+ bool heater;
+ /**
+ * @brief value holds the fan speed level, where the level can be between
+ * minimumValue(off) to maximumValue (strongest).
+ */
+ @config_simulator: { range: [0, 50] }
+ int fanSpeedLevel;
+ /**
+ * @brief value holds the steering wheel heater level, where the level can
+ * be between minimumValue(off) to maximumValue (warmest).
+ */
+ @config_simulator: { minimum: 0 }
+ int steeringWheelHeater;
+ /**
+ * @brief value holds the target temperature of the zone expressed
+ * in centigrades, where the temperature can be between
+ * minimumValue(coolest) to maximumValue (warmest).
+ */
+ @config_simulator: { maximum: 30.0 }
+ real targetTemperature;
+ /**
+ * @brief value holds the seat cooler level, where the level can be
+ * between minimumValue(off) to maximumValue (coolest).
+ */
+ int seatCooler;
+ /**
+ * @brief value holds the seat heater level, where the level can be between
+ * minimumValue(off) to maximumValue (warmest).
+ */
+ int seatHeater;
+ /**
+ * @brief value holds the outside temperature of the zone expressed in
+ * centigrades, where the temperature can be between
+ * minimumValue(coolest) to maximumValue (warmest).
+ */
+ int outsideTemperature;
+ /**
+ * @brief outside temp lable
+ */
+ @config_simulator: { domain: ["cold", "mild", "warm" ] }
+ string outsideTemperatureLabel;
+ /**
+ * @brief value is true if the zone synchronization is enabled.
+ *
+ * Which zones and properties are synchronized is controlled
+ * by the backend implementing it.
+ */
+ bool zoneSynchronization;
+ /**
+ * @brief value is true if defrost is enabled. Usually that means that the fans
+ * are on the highest level to remove ice from the windshield.
+ */
+ bool defrost;
+ /**
+ * @brief value holds the recirculation mode
+ */
+ RecirculationMode recirculationMode;
+ /**
+ * @brief value is true if the recirculation is currently running.
+ */
+ bool recirculation;
+ /**
+ * @brief value holds the sensitivity level of the recirculation
+ * system when the recirculationMode is set to AutoRecirculation,
+ * where the level can be between minimumValue(least sensitive)
+ * to maximumValue(most sensitive).
+ */
+ int recirculationSensitivityLevel;
+ /**
+ * @brief value holds the climate mode
+ */
+ ClimateMode climateMode;
+ /**
+ * @brief value holds the intensity level of the fan when the climateMode
+ * is set to AutoClimate, where the level can be between
+ * minimumValue(least intensity) to maximumValue(most intensity).
+ */
+ int automaticClimateFanIntensityLevel;
+ /**
+ * @brief value holds the combination of flags indicating the areas
+ * where airflow is on.
+ */
+ AirflowDirection airflowDirections;
+}
+
+/**
+ * @brief Control where the airflow goes
+ */
+flag AirflowDirection {
+ /**
+ * @brief Airflow to the windshield
+ */
+ Windshield = 1,
+ /**
+ * @brief Airflow to the dashboard
+ */
+ Dashboard = 2,
+ /**
+ * @brief Airflow to the floor
+ */
+ Floor = 4
+}
+
+enum RecirculationMode {
+ RecirculationOff = 0x0,
+ RecirculationOn = 0x1,
+ AutoRecirculation = 0x2
+}
+
+enum ClimateMode {
+ ClimateOff = 0x0,
+ ClimateOn = 0x1,
+ AutoClimate = 0x2
+}
diff --git a/examples/core/qface-ivi-climate/example-ivi-climate.yaml b/examples/core/qface-ivi-climate/example-ivi-climate.yaml
new file mode 100644
index 0000000..f114ef0
--- /dev/null
+++ b/examples/core/qface-ivi-climate/example-ivi-climate.yaml
@@ -0,0 +1,62 @@
+Example.IVI.Climate.ClimateControl:
+ config_simulator:
+ zones: { left : FrontLeft, right : FrontRight, rear: Rear }
+
+Example.IVI.Climate.ClimateControl#airConditioning:
+ config_simulator:
+ default: true
+
+Example.IVI.Climate.ClimateControl#heater:
+ config_simulator:
+ default: true
+
+Example.IVI.Climate.ClimateControl#recirculation:
+ config_simulator:
+ default: false
+
+Example.IVI.Climate.ClimateControl#zoneSynchronization:
+ config_simulator:
+ default: false
+
+Example.IVI.Climate.ClimateControl#defrost:
+ config_simulator:
+ default: false
+
+Example.IVI.Climate.ClimateControl#steeringWheelHeater:
+ config_simulator:
+ default: 0
+
+Example.IVI.Climate.ClimateControl#fanSpeedLevel:
+ config_simulator:
+ default: 2
+
+Example.IVI.Climate.ClimateControl#recirculationMode:
+ config_simulator:
+ default: RecirculationMode.RecirculationOff
+
+Example.IVI.Climate.ClimateControl#recirculationSensitivityLevel:
+ config_simulator:
+ unsupported: true
+ default: 0
+
+Example.IVI.Climate.ClimateControl#climateMode:
+ config_simulator:
+ unsupported: true
+ default: ClimateMode.ClimateOn
+
+Example.IVI.Climate.ClimateControl#automaticClimateFanIntensityLevel:
+ config_simulator:
+ unsupported: true
+ default: 0
+
+Example.IVI.Climate.ClimateControl#targetTemperature:
+ config_simulator:
+ default: 0
+
+Example.IVI.Climate.ClimateControl#seatCooler:
+ config_simulator:
+ default: 0
+
+Example.IVI.Climate.ClimateControl#seatHeater:
+ config_simulator:
+ default: 0
diff --git a/examples/core/qface-ivi-climate/frontend/frontend.pro b/examples/core/qface-ivi-climate/frontend/frontend.pro
new file mode 100644
index 0000000..7e11573
--- /dev/null
+++ b/examples/core/qface-ivi-climate/frontend/frontend.pro
@@ -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:BSD-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.
+#
+# BSD License Usage
+# Alternatively, you may use this file under the terms of the BSD license
+# as follows:
+#
+# "Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of The Qt Company Ltd nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+#
+# $QT_END_LICENSE$
+#
+# SPDX-License-Identifier: BSD-3-Clause
+
+TARGET = $$qtLibraryTarget(QtIviClimateExample)
+TEMPLATE = lib
+CONFIG += ivigenerator
+DESTDIR = ..
+macos: CONFIG += debug_and_release build_all
+
+QT += ivicore ivicore-private qml quick
+
+DEFINES += QT_BUILD_CLIMATE_LIB
+
+QFACE_SOURCES = ../example-ivi-climate.qface
+
+target.path = $$[QT_INSTALL_EXAMPLES]/core/qface-ivi-climate/frontend
+INSTALLS += target
diff --git a/examples/core/qface-ivi-climate/qface-ivi-climate.pro b/examples/core/qface-ivi-climate/qface-ivi-climate.pro
new file mode 100644
index 0000000..07bc50c
--- /dev/null
+++ b/examples/core/qface-ivi-climate/qface-ivi-climate.pro
@@ -0,0 +1,59 @@
+# 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:BSD-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.
+#
+# BSD License Usage
+# Alternatively, you may use this file under the terms of the BSD license
+# as follows:
+#
+# "Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in
+# the documentation and/or other materials provided with the
+# distribution.
+# * Neither the name of The Qt Company Ltd nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+#
+# $QT_END_LICENSE$
+#
+# SPDX-License-Identifier: BSD-3-Clause
+
+TEMPLATE = subdirs
+
+SUBDIRS = frontend \
+ backend_simulator \
+ demo
+
+CONFIG += ordered
+
+OTHER_FILES += \
+ example-ivi-climate.qface \
+ example-ivi-climate.yaml
diff --git a/examples/examples.pro b/examples/examples.pro
index e689d54..d58eb45 100644
--- a/examples/examples.pro
+++ b/examples/examples.pro
@@ -1,5 +1,6 @@
TEMPLATE = subdirs
+SUBDIRS += core
qtHaveModule(ivivehiclefunctions): SUBDIRS += vehiclefunctions
qtHaveModule(ivimedia): SUBDIRS += media
qtHaveModule(geniviextras): SUBDIRS += geniviextras
diff --git a/examples/vehiclefunctions/climate_qml/main.qml b/examples/vehiclefunctions/climate_qml/main.qml
index 1d84f47..3dc8c6f 100644
--- a/examples/vehiclefunctions/climate_qml/main.qml
+++ b/examples/vehiclefunctions/climate_qml/main.qml
@@ -83,37 +83,34 @@ ApplicationWindow {
anchors.fill: parent
CheckBox {
text: "Windshield"
- checked: climateControl.airflowDirections.value & ClimateControl.Windshield
- enabled: climateControl.airflowDirections.availableValues.indexOf(ClimateControl.Windshield) !== -1
+ checked: climateControl.airflowDirections & ClimateControl.Windshield
onClicked: {
if (checked)
- climateControl.airflowDirections.value |= ClimateControl.Windshield
+ climateControl.airflowDirections |= ClimateControl.Windshield
else
- climateControl.airflowDirections.value &= ~ClimateControl.Windshield
+ climateControl.airflowDirections &= ~ClimateControl.Windshield
}
}
CheckBox {
text: "Dashboard"
- checked: climateControl.airflowDirections.value & ClimateControl.Dashboard
- enabled: climateControl.airflowDirections.availableValues.indexOf(ClimateControl.Dashboard) !== -1
+ checked: climateControl.airflowDirections & ClimateControl.Dashboard
onClicked: {
if (checked)
- climateControl.airflowDirections.value |= ClimateControl.Dashboard
+ climateControl.airflowDirections |= ClimateControl.Dashboard
else
- climateControl.airflowDirections.value &= ~ClimateControl.Dashboard
+ climateControl.airflowDirections &= ~ClimateControl.Dashboard
}
}
CheckBox {
text: "Floor"
- checked: climateControl.airflowDirections.value & ClimateControl.Floor
- enabled: climateControl.airflowDirections.availableValues.indexOf(ClimateControl.Floor) !== -1
+ checked: climateControl.airflowDirections & ClimateControl.Floor
onClicked: {
if (checked)
- climateControl.airflowDirections.value |= ClimateControl.Floor
+ climateControl.airflowDirections |= ClimateControl.Floor
else
- climateControl.airflowDirections.value &= ~ClimateControl.Floor
+ climateControl.airflowDirections &= ~ClimateControl.Floor
}
}
}
@@ -121,31 +118,28 @@ ApplicationWindow {
CheckBox {
text: "Air Condition"
- checked: climateControl.airConditioning.value
- enabled: climateControl.airConditioning.available
+ checked: climateControl.airConditioningEnabled
onClicked: {
- climateControl.airConditioning.value = checked
+ climateControl.airConditioningEnabled = checked
}
}
CheckBox {
text: "Heater"
- checked: climateControl.heater.value
- enabled: climateControl.heater.available
+ checked: climateControl.heaterEnabled
onClicked: {
- climateControl.heater.value = checked
+ climateControl.heaterEnabled = checked
}
}
CheckBox {
text: "Air Recirculation"
- checked: climateControl.recirculationMode.value === ClimateControl.RecirculationOn
- enabled: climateControl.airRecirculation.available
+ checked: climateControl.recirculationMode === ClimateControl.RecirculationOn
onClicked: {
if (checked)
- climateControl.recirculationMode.value = ClimateControl.RecirculationOn
+ climateControl.recirculationMode = ClimateControl.RecirculationOn
else
- climateControl.recirculationMode.value = ClimateControl.RecirculationOff
+ climateControl.recirculationMode = ClimateControl.RecirculationOff
}
}
@@ -157,12 +151,9 @@ ApplicationWindow {
}
SpinBox {
- value: climateControl.fanSpeedLevel.value
- minimumValue: climateControl.fanSpeedLevel.minimumValue
- maximumValue: climateControl.fanSpeedLevel.maximumValue
- enabled: climateControl.fanSpeedLevel.available
+ value: climateControl.fanSpeedLevel
onValueChanged: {
- climateControl.fanSpeedLevel.value = value
+ climateControl.fanSpeedLevel = value
}
}
}
@@ -175,12 +166,9 @@ ApplicationWindow {
}
SpinBox {
- value: climateControl.steeringWheelHeater.value
- minimumValue: climateControl.steeringWheelHeater.minimumValue
- maximumValue: climateControl.steeringWheelHeater.maximumValue
- enabled: climateControl.steeringWheelHeater.available
+ value: climateControl.steeringWheelHeater
onValueChanged: {
- climateControl.steeringWheelHeater.value = value
+ climateControl.steeringWheelHeater = value
}
}
}
@@ -199,12 +187,9 @@ ApplicationWindow {
}
SpinBox {
- value: climateControl.zoneAt.FrontLeft.targetTemperature.value
- minimumValue: climateControl.zoneAt.FrontLeft.targetTemperature.minimumValue
- maximumValue: climateControl.zoneAt.FrontLeft.targetTemperature.maximumValue
- enabled: climateControl.zoneAt.FrontLeft.targetTemperature.available
+ value: climateControl.zoneAt.FrontLeft.targetTemperature
onValueChanged: {
- climateControl.zoneAt.FrontLeft.targetTemperature.value = value
+ climateControl.zoneAt.FrontLeft.targetTemperature = value
}
}
}
@@ -217,12 +202,9 @@ ApplicationWindow {
}
SpinBox {
- value: climateControl.zoneAt.FrontLeft.seatHeater.value
- minimumValue: climateControl.zoneAt.FrontLeft.seatHeater.minimumValue
- maximumValue: climateControl.zoneAt.FrontLeft.seatHeater.maximumValue
- enabled: climateControl.zoneAt.FrontLeft.seatHeater.available
+ value: climateControl.zoneAt.FrontLeft.seatHeater
onValueChanged: {
- climateControl.zoneAt.FrontLeft.seatHeater.value = value
+ climateControl.zoneAt.FrontLeft.seatHeater = value
}
}
}
@@ -240,12 +222,9 @@ ApplicationWindow {
}
SpinBox {
- value: climateControl.zoneAt.FrontRight.targetTemperature.value
- minimumValue: climateControl.zoneAt.FrontRight.targetTemperature.minimumValue
- maximumValue: climateControl.zoneAt.FrontRight.targetTemperature.maximumValue
- enabled: climateControl.zoneAt.FrontRight.targetTemperature.available
+ value: climateControl.zoneAt.FrontRight.targetTemperature
onValueChanged: {
- climateControl.zoneAt.FrontRight.targetTemperature.value = value
+ climateControl.zoneAt.FrontRight.targetTemperature = value
}
}
}
@@ -258,12 +237,9 @@ ApplicationWindow {
}
SpinBox {
- value: climateControl.zoneAt.FrontRight.seatHeater.value
- minimumValue: climateControl.zoneAt.FrontRight.seatHeater.minimumValue
- maximumValue: climateControl.zoneAt.FrontRight.seatHeater.maximumValue
- enabled: climateControl.zoneAt.FrontRight.seatHeater.available
+ value: climateControl.zoneAt.FrontRight.seatHeater
onValueChanged: {
- climateControl.zoneAt.FrontRight.seatHeater.value = value
+ climateControl.zoneAt.FrontRight.seatHeater = value
}
}
}
@@ -281,12 +257,9 @@ ApplicationWindow {
}
SpinBox {
- value: climateControl.zoneAt.Rear.targetTemperature.value
- minimumValue: climateControl.zoneAt.Rear.targetTemperature.minimumValue
- maximumValue: climateControl.zoneAt.Rear.targetTemperature.maximumValue
- enabled: climateControl.zoneAt.Rear.targetTemperature.available
+ value: climateControl.zoneAt.Rear.targetTemperature
onValueChanged: {
- climateControl.zoneAt.Rear.targetTemperature.value = value
+ climateControl.zoneAt.Rear.targetTemperature = value
}
}
}
@@ -299,12 +272,9 @@ ApplicationWindow {
}
SpinBox {
- value: climateControl.zoneAt.Rear.seatHeater.value
- minimumValue: climateControl.zoneAt.Rear.seatHeater.minimumValue
- maximumValue: climateControl.zoneAt.Rear.seatHeater.maximumValue
- enabled: climateControl.zoneAt.Rear.seatHeater.available
+ value: climateControl.zoneAt.Rear.seatHeater
onValueChanged: {
- climateControl.zoneAt.Rear.seatHeater.value = value
+ climateControl.zoneAt.Rear.seatHeater = value
}
}
}
diff --git a/examples/vehiclefunctions/climate_widget/mainwindow.cpp b/examples/vehiclefunctions/climate_widget/mainwindow.cpp
index 50d1921..9e46a87 100644
--- a/examples/vehiclefunctions/climate_widget/mainwindow.cpp
+++ b/examples/vehiclefunctions/climate_widget/mainwindow.cpp
@@ -61,7 +61,7 @@ MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow),
m_buttonGroup(new QButtonGroup(this)),
- m_climateControl(0)
+ m_climateControl(nullptr)
{
ui->setupUi(this);
@@ -81,42 +81,30 @@ MainWindow::MainWindow(QWidget *parent) :
//![2]
//Air Flow Direction
setupFlowDirectionRadioButtons(m_climateControl->airflowDirections());
- setupFlowDirectionAttribute(m_climateControl->airflowDirectionsAttribute());
connect(m_buttonGroup, static_cast<void (QButtonGroup::*)(QAbstractButton *, bool)>(&QButtonGroup::buttonToggled),
this, &MainWindow::onFlowDirectionButtonToggled);
connect(m_climateControl, &QIviClimateControl::airflowDirectionsChanged,
this, &MainWindow::setupFlowDirectionRadioButtons);
- connect(m_climateControl, &QIviClimateControl::airflowDirectionsAttributeChanged,
- this, &MainWindow::setupFlowDirectionAttribute);
//Air Condition
ui->cb_airCondition->setChecked(m_climateControl->isAirConditioningEnabled());
- ui->cb_airCondition->setEnabled(m_climateControl->airConditioningAttribute().isAvailable());
connect(m_climateControl, &QIviClimateControl::airConditioningEnabledChanged,
ui->cb_airCondition, &QCheckBox::setChecked);
- connect(m_climateControl, &QIviClimateControl::airConditioningAttributeChanged,
- this, &MainWindow::onAirConditioningAttributeChanged);
connect(ui->cb_airCondition, &QCheckBox::clicked,
m_climateControl, &QIviClimateControl::setAirConditioningEnabled);
//Air Recirculation
- ui->cb_airRecirculation->setChecked(m_climateControl->recirculationMode() == QIviClimateControl::RecirculationOn);
- ui->cb_airRecirculation->setEnabled(m_climateControl->recirculationModeAttribute().isAvailable());
+ ui->cb_airRecirculation->setChecked(m_climateControl->recirculationMode() == QtIviVehicleFunctionsModule::RecirculationOn);
connect(m_climateControl, &QIviClimateControl::recirculationModeChanged,
this, &MainWindow::onAirRecirculationModeChanged);
- connect(m_climateControl, &QIviClimateControl::recirculationModeAttributeChanged,
- this, &MainWindow::onAirRecirculationAttributeChanged);
connect(ui->cb_airRecirculation, &QCheckBox::clicked,
this, &MainWindow::setAirRecirculationEnabled);
//Heater
ui->cb_heater->setChecked(m_climateControl->isHeaterEnabled());
- ui->cb_heater->setEnabled(m_climateControl->heaterAttribute().isAvailable());
connect(m_climateControl, &QIviClimateControl::heaterEnabledChanged,
ui->cb_heater, &QCheckBox::setChecked);
- connect(m_climateControl, &QIviClimateControl::heaterAttributeChanged,
- this, &MainWindow::onHeaterAttributeChanged);
connect(ui->cb_heater, &QCheckBox::clicked,
m_climateControl, &QIviClimateControl::setHeaterEnabled);
}
@@ -130,44 +118,22 @@ MainWindow::~MainWindow()
void MainWindow::setAirRecirculationEnabled(bool enabled)
{
if (enabled)
- m_climateControl->setRecirculationMode(QIviClimateControl::RecirculationOn);
+ m_climateControl->setRecirculationMode(QtIviVehicleFunctionsModule::RecirculationOn);
else
- m_climateControl->setRecirculationMode(QIviClimateControl::RecirculationOff);
+ m_climateControl->setRecirculationMode(QtIviVehicleFunctionsModule::RecirculationOff);
}
-void MainWindow::onAirRecirculationModeChanged(QIviClimateControl::RecirculationMode mode)
+void MainWindow::onAirRecirculationModeChanged(QtIviVehicleFunctionsModule::RecirculationMode mode)
{
- ui->cb_airRecirculation->setChecked(mode == QIviClimateControl::RecirculationOn);
-}
-
-void MainWindow::onAirRecirculationAttributeChanged(const QIviPropertyAttribute<QIviClimateControl::RecirculationMode> &attribute)
-{
- ui->cb_airRecirculation->setEnabled(attribute.isAvailable());
-}
-
-void MainWindow::onHeaterAttributeChanged(const QIviPropertyAttribute<bool> &attribute)
-{
- ui->cb_heater->setEnabled(attribute.isAvailable());
-}
-
-void MainWindow::onAirConditioningAttributeChanged(const QIviPropertyAttribute<bool> & attribute)
-{
- ui->cb_airCondition->setEnabled(attribute.isAvailable());
+ ui->cb_airRecirculation->setChecked(mode == QtIviVehicleFunctionsModule::RecirculationOn);
}
//![3]
-void MainWindow::setupFlowDirectionRadioButtons(QIviClimateControl::AirflowDirections direction)
-{
- ui->cb_windshield->setChecked(direction.testFlag(QIviClimateControl::Windshield));
- ui->cb_dashboard->setChecked(direction.testFlag(QIviClimateControl::Dashboard));
- ui->cb_floor->setChecked(direction.testFlag(QIviClimateControl::Floor));
-}
-
-void MainWindow::setupFlowDirectionAttribute(const QIviPropertyAttribute<QIviClimateControl::AirflowDirections> &attribute)
+void MainWindow::setupFlowDirectionRadioButtons(QtIviVehicleFunctionsModule::AirflowDirections direction)
{
- ui->cb_windshield->setEnabled(attribute.availableValues().contains(QIviClimateControl::Windshield));
- ui->cb_dashboard->setEnabled(attribute.availableValues().contains(QIviClimateControl::Dashboard));
- ui->cb_floor->setEnabled(attribute.availableValues().contains(QIviClimateControl::Floor));
+ ui->cb_windshield->setChecked(direction.testFlag(QtIviVehicleFunctionsModule::Windshield));
+ ui->cb_dashboard->setChecked(direction.testFlag(QtIviVehicleFunctionsModule::Dashboard));
+ ui->cb_floor->setChecked(direction.testFlag(QtIviVehicleFunctionsModule::Floor));
}
void MainWindow::onFlowDirectionButtonToggled(QAbstractButton *button, bool checked)
@@ -175,14 +141,14 @@ void MainWindow::onFlowDirectionButtonToggled(QAbstractButton *button, bool chec
Q_UNUSED(button)
Q_UNUSED(checked)
- QIviClimateControl::AirflowDirections direction;
+ QtIviVehicleFunctionsModule::AirflowDirections direction;
if (ui->cb_windshield->isChecked())
- direction |= QIviClimateControl::Windshield;
+ direction |= QtIviVehicleFunctionsModule::Windshield;
if (ui->cb_dashboard->isChecked())
- direction |= QIviClimateControl::Dashboard;
+ direction |= QtIviVehicleFunctionsModule::Dashboard;
if (ui->cb_floor->isChecked())
- direction |= QIviClimateControl::Floor;
+ direction |= QtIviVehicleFunctionsModule::Floor;
m_climateControl->setAirflowDirections(direction);
}
diff --git a/examples/vehiclefunctions/climate_widget/mainwindow.h b/examples/vehiclefunctions/climate_widget/mainwindow.h
index f296ffc..a7e0cd1 100644
--- a/examples/vehiclefunctions/climate_widget/mainwindow.h
+++ b/examples/vehiclefunctions/climate_widget/mainwindow.h
@@ -70,17 +70,13 @@ class MainWindow : public QMainWindow
Q_OBJECT
public:
- explicit MainWindow(QWidget *parent = 0);
+ explicit MainWindow(QWidget *parent = nullptr);
~MainWindow();
private slots:
void setAirRecirculationEnabled(bool enabled);
- void onAirRecirculationModeChanged(QIviClimateControl::RecirculationMode mode);
- void onAirRecirculationAttributeChanged(const QIviPropertyAttribute<QIviClimateControl::RecirculationMode> &attribute);
- void onHeaterAttributeChanged(const QIviPropertyAttribute<bool> &attribute);
- void onAirConditioningAttributeChanged(const QIviPropertyAttribute<bool> &attribute);
- void setupFlowDirectionRadioButtons(QIviClimateControl::AirflowDirections direction);
- void setupFlowDirectionAttribute(const QIviPropertyAttribute<QIviClimateControl::AirflowDirections> &attribute);
+ void onAirRecirculationModeChanged(QtIviVehicleFunctionsModule::RecirculationMode mode);
+ void setupFlowDirectionRadioButtons(QtIviVehicleFunctionsModule::AirflowDirections direction);
void onFlowDirectionButtonToggled(QAbstractButton *button, bool checked);
private:
diff --git a/examples/vehiclefunctions/window_qml/WindowItem.qml b/examples/vehiclefunctions/window_qml/WindowItem.qml
index 31bf053..3212e71 100644
--- a/examples/vehiclefunctions/window_qml/WindowItem.qml
+++ b/examples/vehiclefunctions/window_qml/WindowItem.qml
@@ -73,25 +73,22 @@ GroupBox {
ColumnLayout {
RowLayout {
- enabled: zone.state.available
Label {
text: "Window state: "
}
Label {
- text: stateToString(zone.state.value)
+ text: stateToString(zone.state)
}
}
Button {
text: "open"
- enabled: zone.state.available
onClicked: zone.open()
}
Button {
text: "close"
- enabled: zone.state.available
onClicked: zone.close()
}
@@ -101,14 +98,13 @@ GroupBox {
ColumnLayout {
RowLayout {
- enabled: zone.blindState.available
Label {
text: "State: "
}
Label {
- text: stateToString(zone.blindState.value)
+ text: stateToString(zone.blindState)
}
}
@@ -119,33 +115,30 @@ GroupBox {
RadioButton {
text: "Open"
exclusiveGroup: blindGroup
- enabled: zone.blindMode.availableValues.indexOf(WindowControl.BlindOpen) !== -1
- checked: zone.blindMode.value === WindowControl.BlindOpen
+ checked: zone.blindMode === WindowControl.BlindOpen
onCheckedChanged: {
if (checked)
- zone.blindMode.value = WindowControl.BlindOpen
+ zone.blindMode = WindowControl.BlindOpen
}
}
RadioButton {
text: "Closed"
exclusiveGroup: blindGroup
- enabled: zone.blindMode.availableValues.indexOf(WindowControl.BlindClosed) !== -1
- checked: zone.blindMode.value === WindowControl.BlindClosed
+ checked: zone.blindMode === WindowControl.BlindClosed
onCheckedChanged: {
if (checked)
- zone.blindMode.value = WindowControl.BlindClosed
+ zone.blindMode = WindowControl.BlindClosed
}
}
RadioButton {
text: "Automatic"
exclusiveGroup: blindGroup
- enabled: zone.blindMode.availableValues.indexOf(WindowControl.AutoBlind) !== -1
- checked: zone.blindMode.value === WindowControl.AutoBlind
+ checked: zone.blindMode === WindowControl.AutoBlind
onCheckedChanged: {
if (checked)
- zone.blindMode.value = WindowControl.AutoBlind
+ zone.blindMode = WindowControl.AutoBlind
}
}
}
@@ -157,14 +150,13 @@ GroupBox {
ColumnLayout {
RowLayout {
- enabled: zone.heater.available
Label {
text: "Running: "
}
Label {
- text: zone.heater.value
+ text: zone.heater
}
}
@@ -175,33 +167,30 @@ GroupBox {
RadioButton {
text: "On"
exclusiveGroup: heaterGroup
- enabled: zone.heaterMode.availableValues.indexOf(WindowControl.HeaterOn) !== -1
- checked: zone.heaterMode.value === WindowControl.HeaterOn
+ checked: zone.heaterMode === WindowControl.HeaterOn
onCheckedChanged: {
if (checked)
- zone.heaterMode.value = WindowControl.HeaterOn
+ zone.heaterMode = WindowControl.HeaterOn
}
}
RadioButton {
text: "Off"
exclusiveGroup: heaterGroup
- enabled: zone.heaterMode.availableValues.indexOf(WindowControl.HeaterOff) !== -1
- checked: zone.heaterMode.value === WindowControl.HeaterOff
+ checked: zone.heaterMode === WindowControl.HeaterOff
onCheckedChanged: {
if (checked)
- zone.heaterMode.value = WindowControl.HeaterOff
+ zone.heaterMode = WindowControl.HeaterOff
}
}
RadioButton {
text: "Automatic"
exclusiveGroup: heaterGroup
- enabled: zone.heaterMode.availableValues.indexOf(WindowControl.AutoHeater) !== -1
- checked: zone.heaterMode.value === WindowControl.AutoHeater
+ checked: zone.heaterMode === WindowControl.AutoHeater
onCheckedChanged: {
if (checked)
- zone.heaterMode.value = WindowControl.AutoHeater
+ zone.heaterMode = WindowControl.AutoHeater
}
}
}
diff --git a/mkspecs/features/features.pro b/mkspecs/features/features.pro
new file mode 100644
index 0000000..93814fe
--- /dev/null
+++ b/mkspecs/features/features.pro
@@ -0,0 +1,19 @@
+TEMPLATE = aux
+
+prf.files = ivigenerator.prf \
+ ivigenerator_qt_module.prf
+prf.path = $$[QT_HOST_DATA]/mkspecs/features
+INSTALLS += prf
+
+# Ensure files are copied to qtbase mkspecs for non-prefixed builds
+!force_independent:if(!debug_and_release|!build_all|CONFIG(release, debug|release)) {
+ defineReplace(stripSrcDir) {
+ return($$relative_path($$1, $$_PRO_FILE_PWD_))
+ }
+ prffiles2build.input = prf.files
+ prffiles2build.output = $$[QT_HOST_DATA]/mkspecs/features/${QMAKE_FUNC_FILE_IN_stripSrcDir}
+ prffiles2build.commands = $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT}
+ prffiles2build.name = COPY ${QMAKE_FILE_IN}
+ prffiles2build.CONFIG = no_link target_predeps
+ QMAKE_EXTRA_COMPILERS += prffiles2build
+}
diff --git a/mkspecs/features/ivigenerator.prf b/mkspecs/features/ivigenerator.prf
new file mode 100644
index 0000000..b65b34f
--- /dev/null
+++ b/mkspecs/features/ivigenerator.prf
@@ -0,0 +1,155 @@
+# Custom compiler for qface:
+#
+# If building a module, use load(ivigenerator_qt_module) instead
+#
+# Example input:
+# QFACE_SOURCES += my.foo.qface [required]
+# QFACE_MODULE_NAME = my_module_name
+# QFACE_FORMAT = frontend (or backend, simulator... -- defaults to "frontend")
+# QFACE_OUTPUT_DIR = my_output_dir (defaults to current build dir)
+#
+QT_FOR_CONFIG += ivicore-private
+
+isEmpty(QFACE_FORMAT): QFACE_FORMAT = frontend
+isEmpty(QFACE_OUTPUT_DIR): QFACE_OUTPUT_DIR = $$OUT_PWD
+isEmpty(QFACE_SOURCES): error("QFACE_SOURCES must be set!")
+
+!contains(QFACE_SOURCES, .+\\.qface$) {
+ error("Invalid qface file provided: The file needs to end with .qface")
+}
+
+# See the win32 section, why this is needed
+win32-msvc*:!contains(CONFIG, debug_and_release) {
+ error("The ivigenerator works only in the debug_and_release configuration on windows")
+}
+
+QFACE_PWD = $$dirname(QFACE_SOURCES)
+QFACE_ABS_PWD = $$absolute_path($$QFACE_PWD, $$_PRO_FILE_PWD_)
+QFACE_FILE = $$basename(QFACE_SOURCES)
+QFACE_BASE_NAME = $$replace(QFACE_FILE, .qface, )
+QFACE_YAML = $$QFACE_ABS_PWD/$${QFACE_BASE_NAME}.yaml
+OTHER_FILES += $$QFACE_FILE
+
+# The 'click' library used by the generator needs to have a utf8 locale setup.
+equals(QMAKE_HOST.os, Windows): ENV = chcp 65001 &&
+else: ENV = LC_ALL="en_US.UTF-8"
+
+# Detect whether we are using the feature inside the qtivi repository
+VIRTUALENV_PATH = $$[QT_HOST_BINS]/ivigenerator/qtivi_qface_virtualenv
+INTERNAL_VIRTUALENV_PATH = $$QTIVI_BUILD_ROOT/src/tools/ivigenerator/qtivi_qface_virtualenv
+IVI_GENERATOR_PATH = $$[QT_HOST_BINS]/ivigenerator
+QTEST_ENVIRONMENT = $$upper($$(QTEST_ENVIRONMENT))
+
+# Try to use the internal virtualenv when building qtivi
+# Because of the two stage build of COIN, it might not exist, but the installed version should still be there
+!isEmpty(QTIVI_BUILD_ROOT):!equals(QTEST_ENVIRONMENT, CI):!qtConfig(system-ivigenerator) {
+ VIRTUALENV_PATH = $$INTERNAL_VIRTUALENV_PATH
+ IVI_GENERATOR_PATH = $$QTIVI_ROOT/src/tools/ivigenerator
+ equals(QMAKE_HOST.os, Windows): ENV += set IVIGENERATOR_CONFIG="$$shell_path($$QTIVI_BUILD_ROOT/src/tools/ivigenerator/.config)" &&
+ else: ENV += IVIGENERATOR_CONFIG="$$shell_path($$QTIVI_BUILD_ROOT/src/tools/ivigenerator/.config)"
+}
+
+equals(QMAKE_HOST.os, Windows) {
+ VIRTUALENV_PYTHON = $$VIRTUALENV_PATH/Scripts/python.exe
+} else {
+ VIRTUALENV_PYTHON = $$VIRTUALENV_PATH/bin/python
+ ENV += LD_LIBRARY_PATH="$$shell_path($$VIRTUALENV_PATH/bin)"
+}
+IVI_GENERATOR = $$VIRTUALENV_PYTHON $$IVI_GENERATOR_PATH/generate.py
+
+# TODO make this work with multiple input files, or only support one QFACE_SOURCE
+# Although this could be extra_compiler it is a normal EXTRA_TARGET for a reason.
+# In the debug_and_release configuration, we want to have the generator executed
+# during the run of the meta Makefile to only generate the code once.
+PRI = $$QFACE_OUTPUT_DIR/$$lower($${QFACE_BASE_NAME}).pri
+IVI_GENERATOR_OPTIONS = --format=$$QFACE_FORMAT
+!isEmpty(QFACE_MODULE_NAME): IVI_GENERATOR_OPTIONS += --module=$$QFACE_MODULE
+
+qface_sources.target = $$relative_path($$PRI, $$OUT_PWD)
+macos: qface_sources.commands = sleep 1 && $$ENV $$shell_path($$IVI_GENERATOR) $$IVI_GENERATOR_OPTIONS $$shell_path($$QFACE_ABS_PWD/$${QFACE_FILE}) $$shell_path($$QFACE_OUTPUT_DIR)
+else: qface_sources.commands = $$ENV $$shell_path($$IVI_GENERATOR) $$IVI_GENERATOR_OPTIONS $$shell_path($$QFACE_ABS_PWD/$${QFACE_FILE}) $$shell_path($$QFACE_OUTPUT_DIR)
+qface_sources.depends = $$IVI_GENERATOR_PATH/generate.py
+
+# Add all templates of the generator format as dependency
+QFACE_TEMPLATE_PWD = $$IVI_GENERATOR_PATH/templates_$${QFACE_FORMAT}
+exists($$QFACE_TEMPLATE_PWD) {
+ qface_sources.depends += $$files($${QFACE_TEMPLATE_PWD}/*)
+}
+
+# Add the configuration yaml as dependency and to other files
+exists($$QFACE_YAML) {
+ qface_sources.depends += $$QFACE_YAML
+ OTHER_FILES += $$QFACE_YAML
+}
+
+!isEmpty(QFACE_HEADERS_OUTPUT_DIR) {
+ QFACE_HEADERS_OUTPUT_TARGET = $${QFACE_HEADERS_OUTPUT_DIR}/$$lower($${QFACE_MODULE_NAME})module.h
+ qface_headers.target = $$relative_path($$QFACE_HEADERS_OUTPUT_TARGET, $$OUT_PWD)
+ qface_headers.commands = $${QMAKE_COPY_FILE} $${QFACE_OUTPUT_DIR}/*.h $${QFACE_HEADERS_OUTPUT_DIR}
+ qface_headers.depends = $$relative_path($$PRI, $$OUT_PWD) $$IVI_GENERATOR_PATH/generate.py
+}
+
+# Reevaluate the Makefile after the generation has finished
+Makefile.target = Makefile
+# The relative_path is needed here as qmake will use a relative_path for the output files
+# when using a QMAKE_EXTRA_COMPILER
+Makefile.depends = $$relative_path($$PRI, $$OUT_PWD)
+
+# Make the qmake_all target work for usage inside QtCreator
+# Because of the Makefile target the generator is called before the actual Makefile
+# is evaluated. This is a problem if the virtualenv is not created yet.
+# In this case we create the target with a dependency to the forceRebuild file.
+# This file is created during the qmake run and updated once the virtualenv is ready
+# and will then cause a rerun of qmake
+!isEmpty(QTIVI_BUILD_ROOT):!exists($$VIRTUALENV_PATH): {
+ Makefile.depends = $$shadowed($$IVI_GENERATOR_PATH)/forceRebuild
+} else {
+ !isEmpty(QFACE_HEADERS_OUTPUT_TARGET) {
+ Makefile.depends += $$relative_path($$QFACE_HEADERS_OUTPUT_TARGET, $$OUT_PWD)
+ QMAKE_EXTRA_TARGETS += qface_headers
+ }
+}
+
+
+# After the generation, this should exists and qmake can create the correct build tree
+exists($$PRI) {
+ # save the state and reset for SOURCES, HEADERS and OTHER_FILES
+ # Afterwards add all autogenerated files to the 'make clean' target
+ SOURCES_ORIG = $$SOURCES
+ SOURCES =
+ HEADERS_ORIG = $$HEADERS
+ HEADERS =
+ OTHER_FILES_ORIG = $$OTHER_FILES
+ OTHER_FILES =
+ include($$PRI)
+ QMAKE_CLEAN += $$SOURCES
+ QMAKE_CLEAN += $$HEADERS
+ QMAKE_CLEAN += $$OTHER_FILES
+ QMAKE_CLEAN += $$PRI
+ SOURCES += $$SOURCES_ORIG
+ HEADERS += $$HEADERS_ORIG
+ OTHER_FILES += $$OTHER_FILES_ORIG
+}
+
+QMAKE_EXTRA_TARGETS += Makefile qface_sources
+
+# NMAKE doesn't support the Makefile target to call qmake and reevaluate itself
+# Because of that, the autogeneration is not started at all and if started
+# qmake is not run and the Makefile revaluated...
+# To workaround this, we depend on debug_and_release as a meta Makefile is generated
+# where we can envorce the run of the generator and qmake.
+# Afterwards the sub makefiles are read (Makefile.debug/release), which have been
+# regenerated before starting NMAKE on them.
+win32-msvc* {
+ qmake.depends = $$relative_path($$PRI, $$OUT_PWD)
+
+ debug.depends = qmake
+ debug-make_first.depends = qmake
+ debug-all.depends = qmake
+ release.depends = qmake
+ release-make_first.depends = qmake
+ release-all.depends = qmake
+ QMAKE_EXTRA_TARGETS += debug debug-make_first debug-all \
+ release release-make_first release-all \
+ qmake
+}
diff --git a/mkspecs/features/ivigenerator_qt_module.prf b/mkspecs/features/ivigenerator_qt_module.prf
new file mode 100644
index 0000000..bceff89
--- /dev/null
+++ b/mkspecs/features/ivigenerator_qt_module.prf
@@ -0,0 +1,29 @@
+# Custom compiler for qface base modules
+#
+# If not building a module, use CONFIG += ivigenerator instead
+#
+# Example input:
+# QFACE_SOURCES += my.foo.qface [required]
+# QFACE_MODULE_NAME = my_module_name
+# QFACE_FORMAT = frontend (or backend, simulator... -- defaults to "frontend")
+# QFACE_OUTPUT_DIR = my_output_dir (defaults to current build dir)
+#
+
+!contains(QFACE_SOURCES, .+\\.qface$) {
+ error("Invalid qface file provided: The file needs to end with .qface")
+}
+
+QFACE_PWD = $$dirname(QFACE_SOURCES)
+QFACE_ABS_PWD = $$absolute_path($$QFACE_PWD, $$_PRO_FILE_PWD_)
+
+load(qt_build_paths)
+!force_independent {
+ QFACE_HEADERS_REL_DIR = $$relative_path($$QFACE_ABS_PWD, $$QTIVI_ROOT)
+ QFACE_HEADERS_OUTPUT_DIR = $${MODULE_BASE_OUTDIR}/$${QFACE_HEADERS_REL_DIR}
+ !exists(QFACE_HEADERS_OUTPUT_DIR) {
+ mkpath($${QFACE_HEADERS_OUTPUT_DIR})
+ }
+}
+
+load(qt_module)
+load(ivigenerator)
diff --git a/mkspecs/mkspecs.pro b/mkspecs/mkspecs.pro
new file mode 100644
index 0000000..1c6be92
--- /dev/null
+++ b/mkspecs/mkspecs.pro
@@ -0,0 +1,5 @@
+TEMPLATE = subdirs
+
+include($$QTIVI_BUILD_ROOT/src/ivicore/qtivicore-config.pri)
+QT_FOR_CONFIG += ivicore ivicore-private
+qtConfig(ivigenerator): !qtConfig(system-ivigenerator): SUBDIRS += features
diff --git a/qtivi.pro b/qtivi.pro
index b946289..77e7f7f 100644
--- a/qtivi.pro
+++ b/qtivi.pro
@@ -1,3 +1,5 @@
+requires(!integrity) # temporary hack for the Qt CI
+
enable-examples {
QTIVI_BUILD_PARTS = $$QT_BUILD_PARTS
QTIVI_BUILD_PARTS *= examples
@@ -15,4 +17,7 @@ MIN_MINOR = 8 # b/c we need the new Qt configuration system
load(qt_parts)
+SUBDIRS += mkspecs
+mkspecs.depends = sub_src
+
OTHER_FILES += sync.profile
diff --git a/src/3rdparty/qface b/src/3rdparty/qface
new file mode 160000
+Subproject 295824c8df7f74af8f3d1f368ec15942e6622f2
diff --git a/src/3rdparty/qt_attribution.json b/src/3rdparty/qt_attribution.json
new file mode 100644
index 0000000..b3f2ba0
--- /dev/null
+++ b/src/3rdparty/qt_attribution.json
@@ -0,0 +1,17 @@
+{
+ "Id": "qface",
+ "Name": "QFace",
+ "QDocModule": "qtivi",
+ "QtUsage": "Used for qtivi autogeneration of interfaces.",
+ "Path": "qface",
+
+ "Description": "QFace is a generator framework based on a modern IDL.",
+ "Homepage": "https://pelagicore.github.io/qface",
+ "Version": "1.1",
+
+ "License": "MIT",
+ "LicenseId": "MIT",
+ "LicenseFile": "qface/LICENSE",
+ "Copyright": "Copyright (c) 2017 Pelagicore AG"
+}
+
diff --git a/src/doc/qtautomotivesuite/qtautomotivesuite-project.qdocconf b/src/doc/qtautomotivesuite/qtautomotivesuite-project.qdocconf
index 5c746e2..63d3bbe 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
@@ -47,4 +43,5 @@ depends += \
buildversion = "Qt Automotive Suite 1.1"
macro.QAS = "Qt Automotive Suite"
+macro.B2Q = "Boot to Qt"
navigation.homepage = "Qt Automotive Suite"
diff --git a/src/doc/qtautomotivesuite/src/external-resources.qdoc b/src/doc/qtautomotivesuite/src/external-resources.qdoc
index bcac20c..48fada7 100644
--- a/src/doc/qtautomotivesuite/src/external-resources.qdoc
+++ b/src/doc/qtautomotivesuite/src/external-resources.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** 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.
@@ -31,6 +31,11 @@
*/
/*!
+ \externalpage http://doc.qt.io/
+ \title Qt Reference Documentation
+*/
+
+/*!
\externalpage https://doc.qt.io/QtQuickCompiler
\title Qt Quick Compiler
*/
@@ -114,3 +119,73 @@
\externalpage https://doc.qt.io/QtGENIVIExtras/index.html
\title Qt GENIVI Extras
*/
+
+/*!
+ \externalpage http://doc.qt.io/QtForDeviceCreation/qtee-supported-platforms.html#supported-target-device-groups
+ \title Supported Target Devices
+*/
+
+/*!
+ \externalpage http://doc.qt.io/QtForDeviceCreation/qtee-supported-platforms.html#supported-development-hosts
+ \title Supported Development Hosts
+*/
+
+/*!
+ \externalpage http://doc.qt.io/QtForDeviceCreation/qtee-requirements-x11.html
+ \title Requirements for Linux/X11
+*/
+
+/*!
+ \externalpage http://doc.qt.io/QtForDeviceCreation/qtee-requirements-windows.html
+ \title Requirements for Windows
+*/
+
+/*!
+ \externalpage http://doc.qt.io/QtForDeviceCreation/qtee-building-and-running.html#building-and-running-an-example
+ \title Building and Running an Example
+*/
+
+/*!
+ \externalpage http://doc.qt.io/QtForDeviceCreation/qtee-custom-embedded-linux-image.html
+ \title Building Your Own Embedded Linux Image
+*/
+
+/*!
+ \externalpage http://doc.qt.io/QtForDeviceCreation/qtee-about-b2qt.html
+ \title About Boot to Qt
+*/
+
+/*!
+ \externalpage http://doc.qt.io/QtForDeviceCreation/qtee-custom-embedded-linux-image.html#configuring-qt-creator
+ \title Configuring Qt Creator
+*/
+
+/*!
+ \externalpage http://doc.qt.io/QtForDeviceCreation/qtee-custom-embedded-linux-image.html#using-toolchain-without-qt-creator
+ \title Using Toolchain without Qt Creator
+*/
+
+/*!
+ \externalpage http://www.yoctoproject.org/
+ \title Yocto Project
+*/
+
+/*!
+ \externalpage http://www.yoctoproject.org/documentation/current
+ \title Yocto Project Documentation for the Latest Release
+*/
+
+/*!
+ \externalpage http://www.nvidia.com/object/drive-cx-request.html
+ \title NVIDIA DRIVE™ CX
+*/
+
+/*!
+ \externalpage http://doc.qt.io/emulator/
+ \title Emulator
+*/
+
+/*!
+ \externalpage http://doc.qt.io/qtcreator/creator-overview-qtasam.html
+ \title Qt Creator Application Manager Plugin
+*/
diff --git a/src/doc/qtautomotivesuite/src/images/ok.png b/src/doc/qtautomotivesuite/src/images/ok.png
new file mode 100644
index 0000000..7c27201
--- /dev/null
+++ b/src/doc/qtautomotivesuite/src/images/ok.png
Binary files differ
diff --git a/src/doc/qtautomotivesuite/src/images/qtas-architecture.png b/src/doc/qtautomotivesuite/src/images/qtas-architecture.png
new file mode 100644
index 0000000..ab967fd
--- /dev/null
+++ b/src/doc/qtautomotivesuite/src/images/qtas-architecture.png
Binary files differ
diff --git a/src/doc/qtautomotivesuite/src/images/qtas-yocto.png b/src/doc/qtautomotivesuite/src/images/qtas-yocto.png
new file mode 100644
index 0000000..c3e5bf8
--- /dev/null
+++ b/src/doc/qtautomotivesuite/src/images/qtas-yocto.png
Binary files differ
diff --git a/src/doc/qtautomotivesuite/src/qtautomotivesuite-byos.qdoc b/src/doc/qtautomotivesuite/src/qtautomotivesuite-byos.qdoc
new file mode 100644
index 0000000..6e94ab9
--- /dev/null
+++ b/src/doc/qtautomotivesuite/src/qtautomotivesuite-byos.qdoc
@@ -0,0 +1,195 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+/*!
+ \page qtautomotive-byos.html
+ \title Building Your Own NVIDIA DRIVE CX Image
+ \previouspage qtas-preparing-hardware-drivecx.html
+ \nextpage {Qt Automotive Suite Overview}{Overview}
+
+ \QAS is built on top of the \l{About Boot to Qt}{Boot to Qt} software stack
+ for embedded Linux systems. Boot to Qt for embedded Linux is built using the
+ tools and resources from the \l{Yocto Project}, and is based on Yocto's reference
+ distribution. You can use the same tools to build custom Boot to Qt images,
+ and have control over which packages are included in the build and how the
+ software stack is configured.
+
+ To build your own NVIDIA DRIVE CX image, follow the steps in this topic.
+ For more information about building the Boot to Qt image, see
+ \l{Building Your Own Embedded Linux Image}.
+
+ \note Building your own NVIDIA DRIVE CX image is supported only in Linux.
+
+ \section1 Requirements
+
+ You should be familiar with the Yocto tools and the concept of
+ \e {recipes}. For more information, see
+ \l{Yocto Project Documentation for the Latest Release}.
+
+ Your \QAS installation must include Yocto meta layer components. To install
+ those, select \uicontrol {Qt Automotive Suite}
+ > \uicontrol {Qt for Automotive Software Stack} > \uicontrol {Components}
+ > \uicontrol {Yocto meta layer} in the Qt online installation wizard.
+
+ \image qtas-yocto.png
+
+ After a successful installation, you will find the Yocto meta layer under the path
+ <Qt installation directory>/<Qt version>/Automotive/sources/meta-boot2qt.
+
+ Install dependencies for the Yocto tools. In Ubuntu, the following
+ packages are required:
+
+ \badcode
+ sudo apt-get install gawk curl git-core diffstat unzip p7zip-full texinfo \
+ gcc-multilib build-essential chrpath libsdl1.2-dev xterm gperf bison \
+ g++-multilib
+ \endcode
+
+ Download NVIDIA DRIVE CX Platform Development Kit (PDK) from the NVIDIA site.
+ In order to get access to PDK, you need a valid NVIDIA license.
+ For more information, see \l{NVIDIA DRIVE™ CX}. The required PDK version is 4.1.4.0.
+
+ \section1 Setting Up Build Environment
+
+ Set up the NVIDIA DRIVE CX build environment:
+
+ \list 1
+ \li Extract the following packages from NVIDIA DRIVE CX PDK:
+
+ \badcode
+ vibrante-t186ref-foundation-4.1.4.0-8512955.pdk.7z
+ vibrante-t186ref-linux-4.1.4.0-8512955-pdk.7z
+ \endcode
+
+ \li For installing the documentation, run the following command in a terminal:
+
+ \badcode
+ vibrante-t186ref-foundation-4.1.4.0-8512955-RUN-THIS-FIRST-install-docs.run
+ \endcode
+ After running the command, the NVIDIA DRIVE CX documentation should
+ be started automatically.
+
+ \li In the NVIDIA DRIVE CX documentation, open the topic
+ \uicontrol {System Programming} > \uicontrol {Building the Yocto Project Based Components}
+ and extract all defined prerequisite packages.
+
+ \li Extract the following package:
+ \badcode
+ <PDK installation directory>/vibrante-t186ref-linux-4.1.4.0-8512955-pdk/vibrante-t186ref-linux_src/yocto/nvidia-layer.tgz
+ \endcode
+
+ \li Create a new directory for building the image. In our example,
+ we use the directory name \e{builddir}.
+
+ \li Run the following commands in a terminal:
+ \badcode
+ cd builddir
+ <Qt Automotive Suite installation directory>/<Qt version>/Automotive/sources/meta-boot2qt/b2qt-init-build-env init --device tegra-t18x
+ \endcode
+
+ After running the commands, you should have:
+
+ \list
+ \li A directory \e{sources} generated under \e{builddir}.
+ \li A shell script \e{setup-environment.sh} generated under \e{builddir}.
+ \endlist
+
+ \li Create the following symbolic links:
+ \endlist
+
+ \table
+ \header
+ \li A symbolic link name
+ \li A source folder path
+ \li A destination folder path
+ \row
+ \li nvidia-layer
+ \li <PDK installation directory>/vibrante-t186ref-linux-4.1.4.0-8512955-pdk/vibrante-t186ref-linux_src/yocto/layers
+ \li builddir/sources/meta-boot2qt/sources
+ \row
+ \li vibrante-t186
+ \li <PDK installation directory>/vibrante-t186ref-linux-4.1.4.0-8512955-pdk
+ \li builddir/sources/meta-boot2qt/sources
+ \endtable
+
+ \e{builddir} is the directory that you created for building the image.
+
+ \section1 Configuring Build Environment
+
+ Configure the build environment for NVIDIA DRIVE CX by running the
+ following commands in a terminal:
+
+ \badcode
+ cd builddir
+ export MACHINE=tegra-t18x
+ source ./setup-environment.sh
+ \endcode
+
+ \e{builddir} is the directory you created for building the image.
+
+ After running \e{setup-environment.sh}, your current directory in a terminal
+ is \e{builddir/build-tegra-t18x}. There you can build an image and/or
+ a toolchain for NVIDIA DRIVE CX. The toolchain can be used with Qt Creator
+ for building Qt applications.
+
+ \section1 Building Image
+
+ Build the NVIDIA DRIVE CX image by running the following commands in a terminal:
+
+ \badcode
+ cd builddir/build-tegra-t18x
+ bitbake b2qt-automotive-qt5-image
+ \endcode
+
+ You will find the built image file \e{b2qt-automotive-qt5-image-tegra-t18x.7z}
+ under the path builddir/tmp/deploy/images/tegra-t18x.
+
+ \section1 Building Toolchain
+
+ Build the NVIDIA DRIVE CX toolchain by running the following commands in a terminal:
+
+ \badcode
+ cd builddir/build-tegra-t18x
+ bitbake meta-toolchain-b2qt-automotive-qt5-sdk
+ \endcode
+
+ After building the toolchain, you will find the shell script
+ \e{b2qt-x86-64-meta-toolchain-b2qt-automotive-qt5-sdk-tegra-t18x.sh}
+ under the path builddir/tmp/deploy/sdk/. Install the toolchain by running
+ the shell script.
+
+ \section1 Using Toolchain
+
+ After installing the toolchain, you can use it with or without Qt Creator.
+
+ If you are using the toolchain with Qt Creator, you need to configure
+ Qt Creator for the toolchain. See \l{Configuring Qt Creator}.
+ If you are using the toolchain without Qt Creator,
+ see \l{Using Toolchain without Qt Creator}.
+
+*/
+
diff --git a/src/doc/qtautomotivesuite/src/qtautomotivesuite-drive-cx.qdoc b/src/doc/qtautomotivesuite/src/qtautomotivesuite-drive-cx.qdoc
new file mode 100644
index 0000000..80ed95c
--- /dev/null
+++ b/src/doc/qtautomotivesuite/src/qtautomotivesuite-drive-cx.qdoc
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+/*!
+ \page qtas-preparing-hardware-drivecx.html
+ \title NVIDIA DRIVE CX Guide
+ \previouspage qtas-install.html
+ \nextpage qtautomotive-byos.html
+
+ Take the following steps when preparing \l {http://www.nvidia.com/object/drive-cx.html}
+ {NVIDIA DRIVE CX} for \B2Q:
+
+ \note It is important that you repeat the steps in this section after you
+ update \QAS.
+
+ The image containing the \B2Q stack for the device, as well as the
+ flashing tool are included in \QAS.
+
+ \section1 Installing the \B2Q Image
+
+ Connect the DRIVE CX board to the development host via USB, and set it in
+ \e {recovery mode} by changing the position of J9 jumper on the board.
+
+ Then, run the flashing tool:
+
+ \badcode
+ cd <INSTALL_DIR>
+ sudo 5.9/Automotive/tegra-t18x/flash-nvidia/flash_device.sh
+ \endcode
+
+ After the installation is complete, replace the J9 jumper to its original
+ position, and restart the device. After reboot, check that the automotive
+ UI appears.
+
+ \section1 Setting up USB Access
+
+ \include qtas-post-install-setup.qdocinc setting up usb access
+
+ \section1 Configuring a Device Kit in Qt Creator
+
+ \include qtas-post-install-setup.qdocinc configuring device kit linux
+
+ You are now ready to start developing for your device. For more information,
+ see \l{Building and Running an Example}.
+*/
diff --git a/src/doc/qtautomotivesuite/src/qtautomotivesuite-toc.qdoc b/src/doc/qtautomotivesuite/src/qtautomotivesuite-toc.qdoc
new file mode 100644
index 0000000..3a689e7
--- /dev/null
+++ b/src/doc/qtautomotivesuite/src/qtautomotivesuite-toc.qdoc
@@ -0,0 +1,46 @@
+/****************************************************************************
+**
+** 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 {Qt Automotive Suite Overview}{Overview}
+ \li \l {Installing Qt Automotive Suite}{Install Instructions}
+ \list
+ \li \l{NVIDIA DRIVE CX Guide}
+ \endlist
+ \li \l {Building Your Own NVIDIA DRIVE CX Image}
+ \li \l {Related Information}
+ \endlist
+*/
diff --git a/src/doc/qtautomotivesuite/src/qtautomotivesuite.qdoc b/src/doc/qtautomotivesuite/src/qtautomotivesuite.qdoc
index 5a72f24..6d55b26 100644
--- a/src/doc/qtautomotivesuite/src/qtautomotivesuite.qdoc
+++ b/src/doc/qtautomotivesuite/src/qtautomotivesuite.qdoc
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** 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.
@@ -47,6 +47,10 @@
\list
\li \l {Qt Automotive Suite Overview}{Overview}
\li \l {Installing Qt Automotive Suite}{Install Instructions}
+ \list
+ \li \l{NVIDIA DRIVE CX Guide}
+ \endlist
+ \li \l {Building Your Own NVIDIA DRIVE CX Image}
\li \l {Related Information}
\endlist
@@ -69,18 +73,26 @@
\page qtas-overview.html
\title Qt Automotive Suite Overview
\previouspage {Qt Automotive Suite}
- \nextpage {Installing Qt Automotive Suite}{Installation}
-
- \section1 Components
+ \nextpage {Installing Qt Automotive Suite}
\QAS includes several components built on Qt and the \l {Qt Creator}
- integrated development environment.
+ integrated development environment. The following picture illustrates
+ the structure and environment of \QAS. The parts outlined in grey are
+ specific to \QAS:
+
+ \image qtas-architecture.png
- \section2 Qt
+ \section1 Qt and Qt for Device Creation
- Cross-platform \l {http://www.qt.io/}{Qt} development libraries (Qt 5.7)
- and core tools, developed through an open-source collaboration model.
- Qt is a full development framework designed to streamline the creation of
+ \QAS is built on top of the \l {Qt for Device Creation} offering.
+ In addition to Qt, Qt for Device Creation contains an embedded development
+ environment built around Qt Creator. Especially, Qt for Device Creation provides
+ Boot to Qt, a light-weight software stack for embedded systems. It supports
+ building your own Linux image for customizing the Boot to Qt stack.
+
+ Qt is a cross-platform \l {http://www.qt.io/}{Qt} development framework
+ that provides libraries and core tools, developed through an open-source
+ collaboration model. Qt is designed to streamline the creation of
applications and user interfaces for desktop, embedded, and mobile
platforms.
@@ -90,9 +102,9 @@
\l {Qt Quick} or HTML5/hybrid user interfaces with the \l {Qt WebEngine}
module.
- For overview about Qt libraries see the \l {Qt reference documentation}.
+ For an overview of Qt libraries, see the \l {Qt Reference Documentation}.
- Qt modules that are especially useful for embedded/IVI application
+ Qt modules that are especially useful for embedded and IVI application
development include:
\list
@@ -107,9 +119,11 @@
\l {http://www.chromium.org}{Chromium} project.
\endlist
- \section2 Development Environment
+ \section1 Development Environment
The development environment in \QAS is built around \l {Qt Creator}.
+ The following topics provide more information about Qt Creator as a
+ development environment:
\list
\li \l {Qt Creator: Developing Qt Quick Applications}
@@ -120,52 +134,59 @@
\QAS comes with additional functionality for diagnostics and debugging,
as well as deployment:
- \section3 GammaRay
+ \section2 GammaRay
GammaRay is a plugin for Qt Creator that provides software introspection
for Qt applications. It allows visualization of application behavior and
manipulating it at run-time, both locally and remotely on an embedded
target.
- \section3 QmlLive
+ \section2 QmlLive
\l{Qt QmlLive}{QmlLive} provides a live reloader environment for rapid development of
Qt Quick applications, dramatically reducing the time it takes to
deploy and test changes in the UI design.
- \section3 Deployment
+ \section2 Deployment
Device deployment can be done directly from the Qt Creator IDE to a
- device connected via USB or local area network, or to an emulator
+ device connected via USB or local area network, or to an \l{Emulator}{emulator}
running the same, full software stack as the devices.
As with any Qt application, the same project can be deployed to
- desktop or mobile targets as well.
+ desktop or target devices as well.
- \section2 Automotive APIs
+ \section1 Automotive APIs
The \l {Qt IVI} module provides C++ and QML interfaces for accessing
vehicle features, and also enables implementing new IVI features.
Already defined interfaces from the GENIVI alliance are exposed in the
\l {Qt GENIVI Extras} module.
- \section2 Qt Application Manager
+ \section1 Qt Application Manager
+
+ \l {Qt Application Manager} provides a basis for a multi-application
+ embedded system. It takes care of the application lifecycle management.
+ Qt Application Manager provides an API for implementing a UI and its application
+ logic separately.
- \l {Qt Application Manager} provides application lifecycle management.
+ Qt Creator contains a
+ \l{Qt Creator Application Manager Plugin}{Qt Application Manager} plugin
+ that facilitates the development of 3rd party applications within
+ a Qt Application Manager setup by automating the underlying processes.
- \section2 Reference Applications
+ \section1 Reference Applications
- \QAS includes \l{Neptune UI}{Neptune}, a reference HMI designed for IVI
- systems, including multiple IVI applications and an application store
- implementation. It enables the OEMs to test their applications on supported
- hardware and emulator targets.
+ \QAS includes \l{Neptune UI} that provides a UI implementation for
+ Qt in IVI (In-Vehichle Infotainment) systems. It demonstrates best practices
+ for developing an automotive UI with \QAS.
- \section3 Web Browser
+ \section1 Web Browser
- \l {Qt Web Browser} is a browser designed for embedded devices, based on
+ \l {Qt Web Browser} is a browser designed for embedded devices. It is based on
\l {Qt WebEngine}, with a slick, touch-friendly user interface.
- \section2 Over-The-Air Updates
+ \section1 Over-The-Air Updates
\QAS comes with \l {Over-The-Air Update}{Over-The-Air} (OTA) package, providing
tools that assist in enabling distribution of software updates in embedded
@@ -176,21 +197,32 @@
\page qtas-install.html
\title Installing Qt Automotive Suite
\previouspage {Qt Automotive Suite Overview}{Overview}
+ \nextpage qtas-preparing-hardware-drivecx.html
\QAS is a commercial product and requires a license to install and
explore its possibilities. Use the guide on the
\l{Download Qt} page to find the license that suits your need. The license you
buy is associated with a Qt Account, which is required to install the product.
+ \section1 Supported Target Devices and Development Hosts
+
+ \l {Supported Target Devices} lists the target devices supported by \QAS.
+
+ \l {Supported Development Hosts} lists the development hosts supported by \QAS.
+
\section1 Prerequisites
\QAS is based on the \l {Qt for Device Creation} offering so the
prerequisites are the same for both. For more information about how to install and
configure these prerequisites on your development host, see
- \e {Host-specific Requirements} section in the
- \l {Qt for Device Creation: Installation Guide}.
+ \l {Requirements for Linux/X11} and \l {Requirements for Windows}.
- \section1 Install \QAS
+ \section2 \QAS Prerequisites
+
+ The DriveCX support in \B2Q requires Vibrante 4.1 Linux Drive CX2
+ PDK version 4.1.4.0.
+
+ \section1 Installing \QAS
\list 1
\li Download the \l{Qt Online Installer Download}{Qt online installer}.
@@ -215,6 +247,16 @@
\borderedimage qtinstaller-qas.png
\endlist
+ \section1 Installing \B2Q on Target Devices
+
+ Before you can test \QAS applications on the target device, you must
+ flash the target device with an image containing the \B2Q stack. Follow the
+ steps in the target device guide:
+
+ \list
+ \li \l{NVIDIA DRIVE CX Guide}
+ \endlist
+
Once the installation is complete, start Qt Creator and try running one of the
examples against an automotive target or the Qt Automotive emulator.
*/
diff --git a/src/doc/qtautomotivesuite/src/shared/qtas-post-install-setup.qdocinc b/src/doc/qtautomotivesuite/src/shared/qtas-post-install-setup.qdocinc
new file mode 100644
index 0000000..eed018f
--- /dev/null
+++ b/src/doc/qtautomotivesuite/src/shared/qtas-post-install-setup.qdocinc
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+/*!
+//! [setting up usb access]
+ On Ubuntu Linux, the development user account must have access to plugged in
+ devices. To allow the development user access to the device via USB, create
+ a new \e{udev} rule.
+ \list 1
+
+ \li From Qt 5.9 onwards, run the following command in a shell:
+
+ \badcode
+ echo 'SUBSYSTEM=="usb", ATTRS{idVendor}=="dbdb", TAG+="udev-acl", TAG+="uaccess"' | sudo tee -a /etc/udev/rules.d/70-boot2qt.rules
+ \endcode
+
+ For Qt 5.8 or older, run the following command in a shell:
+
+ \badcode
+ echo 'SUBSYSTEM=="usb", ATTRS{idVendor}=="18d1", TAG+="udev-acl", TAG+="uaccess"' | sudo tee -a /etc/udev/rules.d/70-boot2qt.rules
+ \endcode
+
+ \li Connect the running device to the development host with a USB
+ cable. If the device is already connected, disconnect and reconnect the USB
+ cable after running the command above.
+ \endlist
+
+ The system log files \c{/var/log/udev} and \c{/var/log/syslog} may
+ provide relevant information in case of connection problems.
+
+//! [setting up usb access]
+
+//! [configuring device kit linux]
+ After you have prepared the hardware, you must perform one final step
+ to set up the development tools in Qt Creator for your device. That is,
+ you must configure the correct device to be used for each build and run
+ \e{kit}. Connect your device to the development host via USB and launch
+ Qt Creator. In Qt Creator:
+
+ \list 1
+ \li Select \uicontrol{Tools} > \uicontrol {Options} > \uicontrol {Build & Run}
+ > \uicontrol {Kits}.
+ \li Select one of the predefined kits starting with \e{Boot to Qt...}
+ that matches the type of your device.
+ \li Select the correct device in the \uicontrol{Device} field.
+ \li Select \uicontrol{OK}.
+ \endlist
+//! [configuring device kit linux]
+*/
diff --git a/src/doc/qtivi/images/backendtypes.jpg b/src/doc/qtivi/images/backendtypes.jpg
new file mode 100644
index 0000000..b06681d
--- /dev/null
+++ b/src/doc/qtivi/images/backendtypes.jpg
Binary files differ
diff --git a/src/doc/qtivi/images/feature_backend.jpg b/src/doc/qtivi/images/feature_backend.jpg
new file mode 100644
index 0000000..98e3fca
--- /dev/null
+++ b/src/doc/qtivi/images/feature_backend.jpg
Binary files differ
diff --git a/src/doc/qtivi/qtivi-project.qdocconf b/src/doc/qtivi/qtivi-project.qdocconf
index 6626607..19a3ccf 100644
--- a/src/doc/qtivi/qtivi-project.qdocconf
+++ b/src/doc/qtivi/qtivi-project.qdocconf
@@ -5,12 +5,18 @@ url = http://doc.qt.io/QtIVI
sourcedirs += .
headerdirs += .
+imagedirs += images
+exampledirs += ../../examples/core
# 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/JINJA_LICENSE b/src/doc/qtivi/src/JINJA_LICENSE
new file mode 100644
index 0000000..31bf900
--- /dev/null
+++ b/src/doc/qtivi/src/JINJA_LICENSE
@@ -0,0 +1,31 @@
+Copyright (c) 2009 by the Jinja Team, see AUTHORS for more details.
+
+Some rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+
+ * The names of the contributors may not be used to endorse or
+ promote products derived from this software without specific
+ prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
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..70f3dc7
--- /dev/null
+++ b/src/doc/qtivi/src/concepts.qdoc
@@ -0,0 +1,41 @@
+/****************************************************************************
+**
+** 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 {The Qt IVI Autogenerator}
+ \li \l {Models}
+ \li \l {The Qt IVI Query Language}
+\endlist
+*/
diff --git a/src/doc/qtivi/src/configuration.qdoc b/src/doc/qtivi/src/configuration.qdoc
new file mode 100644
index 0000000..16053ff
--- /dev/null
+++ b/src/doc/qtivi/src/configuration.qdoc
@@ -0,0 +1,112 @@
+/****************************************************************************
+**
+** 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 configuration.html
+\title Configuration
+
+The QtIvi module provides the following configuration options
+
+\section1 Configure Options and Features
+
+The following table shows the available features of the module. Just like with other modules, the
+available features are auto-detected and displayed after the configuration step in the "Configure
+summary".
+
+\table
+\header
+ \li Feature
+ \li Dependency
+ \li Description
+\row
+ \li IVI Generator
+ \keyword feature-ivigenerator
+ \li python3
+ python3-virtualenv
+ \li The IVI Generator provides tooling to generate source code out of IDL files. The IVI
+ Generator comes with a set of templates for specific generation use-cases.
+\row
+ \li QtSimulator Support
+ \keyword feature-qtsimulator
+ \li QtSimulator module
+ \li The QtSimulator Support is needed for the communication between the simulation backends and
+ their control panel (controller). It enhances the built-in templates by also generating
+ the needed code for the simulation backends to communicate over QtSimulator. In addition,
+ it also provides a new template to generate a controller application to communicate with
+ the simulation backend.
+\endtable
+
+Additional command-line options to tailor the build-system to your needs:
+
+\table
+\header
+ \li Command-line option
+ \li Description
+\row
+ \li --host-tools-only
+ \li Only compiles the tools needed on the host in order to cross-compile for another target.
+ E.g. the \e {IVI Generator}
+\row
+ \li --ivigenerator <no|qt|system>
+ \li \value no
+ Disables the \e {IVI Generator} feature completely.
+ \value qt
+ Enables the \e {IVI Generator} feature: will build and package the needed files.
+ \value system
+ Enables the \e {IVI Generator} feature, but is using the \e {IVI Generator} files
+ already available on the system. (e.g. from the native-qtivi package when
+ cross-compiling inside Yocto).
+\endtable
+
+These command-line options can be passed to qmake using the \c QMAKE_EXTRA_ARGS environment variable
+
+\code
+ QMAKE_EXTRA_ARGS="--host-tools-only" qmake <qtivi-src>/qtivi.pro
+\endcode
+
+\section1 Runtime Configuration
+
+The following environment variables are supported for runtime configurations:
+
+\table
+\header
+ \li Environment variable
+ \li Description
+\row
+ \li SIMULATOR_HOSTNAME
+ \li Specifies where the QtSimulator server is running - e.g. the autogenerated control panel
+ binaries.
+ \note This is only available when the \l {feature-qtsimulator} {QtSimulator Support} is
+ enabled.
+\endtable
+
+\section2 Logging
+
+The \e qt.ivi.servicemanagement Logging Category can be used to get more information on which
+backends were considered, when searching for the correct backend for a feature and also why it was
+chosen.
+*/
+
diff --git a/src/doc/qtivi/src/examples-qface-ivi-climate.qdoc b/src/doc/qtivi/src/examples-qface-ivi-climate.qdoc
new file mode 100644
index 0000000..52d87f1
--- /dev/null
+++ b/src/doc/qtivi/src/examples-qface-ivi-climate.qdoc
@@ -0,0 +1,142 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+/*!
+\example qface-ivi-climate
+\brief This Example shows how to use the Qt IVI Generator.
+\ingroup qtivicore-examples
+\title Qt IVI Generator Example
+
+This shows an example of using the Qt IVI Generator to build a new component.
+Based on a single qface IDL file it will generate:
+\list
+\li a shared library with the front end code
+\li a backend simulator plugin
+\li a demo application showing the current model values
+\endlist
+
+\section1 Introduction
+
+The QFace file used in the example represents a simplified climate control
+interface. It contains a single interface and a couple of enumerated types.
+The complete reference for the IDL syntax is available
+\l {QFace IDL syntax}{here}. In particular:
+\table
+\row
+ \li \code {@config: {interfaceBuilder: "echoInterfaceBuilder"}} \endcode
+ \li indicates the plugin should use a custom function to generate the backend instances.
+\row
+ \li \code {@config: {zoned: true}} \endcode
+ \li indicates the interface supports different zones
+\row
+ \li \code {@config: {zoned: true}} \endcode
+ \li indicates the interface supports different zones
+\row
+ \li \code {@config: {id: "..."}} \endcode
+ \li indicates the id used for matching backend plugins
+\row
+ \li \code {@config_simulator: { range:[0, 50] }} \endcode
+ \li range of valid values for number type properties
+\row
+ \li \code
+ {@config_simulator: { minimum: 0 }}
+ {@config_simulator: { maximum: 50 }} \endcode
+ \li minimum and maximum of valid values for number type properties.
+ \note \c {range} annotation is a short cut to specifying both minimum and
+ maximum values.
+\row
+ \li \code {@config_simulator: { domain: ["cold", "mild", "warm" ] }} \endcode
+ \li list of valid values for properties
+\endtable
+
+In addition to the qface file, a YAML file (with the same basename) is used to
+add extra configuration. These could also be added directly in the qface file
+but keeping them separate can improve readability.
+Highlights:
+\table
+\row
+ \li
+ \code
+ Example.IVI.Climate.ClimateControl:
+ config_simulator:
+ zones: { left : FrontLeft, right : FrontRight, rear: Rear }
+ \endcode
+ \li the names of the supported zones
+\row
+ \li
+ \code
+ Example.IVI.Climate.ClimateControl#recirculationMode:
+ config_simulator:
+ default: RecirculationMode.RecirculationOff
+ \endcode
+ \li the default value assigned to the property in the simulator backend plugin.
+\endtable
+
+
+\section1 Frontend library
+
+The QFace file is used to generate the API for the frontend, as a shared library.
+The interface class is derived from \c {QIviAbstractZonedFeature} and includes all
+the specified properties.
+
+The project files includes the basic setup for generating a shared library. The
+actual code is generated using these QMake variable:
+\code
+CONFIG += ivigenerator
+QFACE_SOURCES = ../example-ivi-climate.qface
+\endcode
+
+In addition to the feature interface class, the generator will also create
+an abstract base class which can used in the plugin.
+
+
+\section1 Backend Simulator Plugin
+
+Using the same qface file, this project will generate the backend plugin with
+the appropriate values for the properties.
+
+\code
+CONFIG += ivigenerator
+QFACE_FORMAT = backend_simulator
+QFACE_SOURCES = ../example-ivi-climate.qface
+\endcode
+
+If present for a given property, range and domain values will used to test the
+validity of incoming values in the setters.
+
+
+\section1 Demo Application
+
+The demo application presents a simple QML interface with all the properties of
+the generated interface.
+
+Qt IVI generator does not provide a QML plugin, so the application needs
+to link to the generated frontend and call the \c {ClimateModule::registerTypes}
+and \c {ClimateModule::registerQmlTypes} methods that are generated in the
+module singleton.
+
+*/
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..2159919
--- /dev/null
+++ b/src/doc/qtivi/src/generator-usage.qdoc
@@ -0,0 +1,311 @@
+/****************************************************************************
+**
+** 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 \l {QMake Integration}.
+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
+$$[QT_HOST_BINS]/ivigenerator/generate.py --format=backend_simulator interface.qface out_dir
+\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|<folder>]
+ \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.
+ \row
+ \li folder path
+ \li Uses templates inside the folder. A YAML file with the same name as the folder (and .yaml
+ extension) should provide a list of template files in the folder (see YAML format specification below).
+\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 substituted 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 automatically 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(interfaceBuilder: "FunctionName")
+ \li Main IDL file
+ \li Module
+ \li Declares a function which will be called in the plugin to generate the instances for every interface.
+ The function takes a pointer to the plugin instance and returns a \c {QVector<QIviFeatureInterface *>}.
+ Interfaces should be generated in the same order as defined by \c {Plugin::interfaces()}.
+
+ This can be used to instanciate classes derived from the generated plugin interfaces classes.
+ \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.
+ \row
+ \li @config(getter_name)
+ \li Main IDL file
+ \li Property
+ \li Overrides the default getter method name. Useful for boolean properties (for example, getter
+ for property 'enabled', should be 'isEnabled' rather than the default).
+ \row
+ \li @config(setter_name)
+ \li Main IDL file
+ \li Property
+ \li Overrides the default setter method name.
+\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 accompanying 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: AirflowDirection.Floor | AirflowDirection.Dashboard
+ \endcode
+ \li Accompanying YAML file
+ \li Property
+ \li Defines the initial values for the property returned by the simulator backend.
+
+ For zoned properties a mapping from a zone to a default value can be used. The default key of the map is "=".
+ \code
+ config_simulator:
+ default: { left: 21.0, right: 22.5, =: 0.0 }
+ \endcode
+ \row
+ \li \code
+ config_simulator:
+ minimum: 10
+ \endcode
+ \li Accompanying YAML file
+ \li Property
+ \li Defines the minimum value for integer and real properties, generated code in the simulator backend will check for validity.
+ \row
+ \li \code
+ config_simulator:
+ maximum: 10
+ \endcode
+ \li Accompanying YAML file
+ \li Property
+ \li Defines the maximum value for integer and real properties, generated code in the simulator backend will check for validity.
+ \row
+ \li \code
+ config_simulator:
+ range: [10, 20]
+ \endcode
+ \li Accompanying YAML file
+ \li Property
+ \li Defines the range value for integer and real properties, generated code in the simulator backend will check for validity.
+ \row
+ \li \code
+ config_simulator:
+ domain: {10, 20, 30}
+ \endcode
+ \li Accompanying YAML file
+ \li Property
+ \li Defines the possible values for the property, generated code in the simulator backend will check for validity.
+\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/ivigenerator.qdoc b/src/doc/qtivi/src/ivigenerator.qdoc
new file mode 100644
index 0000000..a024555
--- /dev/null
+++ b/src/doc/qtivi/src/ivigenerator.qdoc
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** 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 ivigenerator.html
+\title The Qt IVI Autogenerator
+\keyword QFace
+
+Qt IVI 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}
+ \li \l {qface-ivi-climate}{Generator Example}
+\endlist
+*/
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/qmake-integration.qdoc b/src/doc/qtivi/src/qmake-integration.qdoc
new file mode 100644
index 0000000..37a4a30
--- /dev/null
+++ b/src/doc/qtivi/src/qmake-integration.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 qmake-integration.html
+\title QMake Integration
+\previouspage Autogenerator usage
+
+Qt IVI Generator has been integrated with QMake to generate all or part of projects.
+
+In it's simplest form, QMake can generate all the source code and the project only
+need to configure what type of project is built.
+
+For complex setups, generated code can be combined with application specific code
+which can extend and use it.
+
+Example:
+\code
+CONFIG += ivigenerator
+
+QFACE_FORMAT = frontend
+QFACE_SOURCES = example.qface
+QFACE_MODULE_NAME = myModule
+QFACE_OUTPUT_DIR = myOutputDir
+\endcode
+
+Available QMake Variables:
+\table
+ \row
+ \li QFACE_FORMAT
+ \li frontend (default), simulator_backend
+ \row
+ \li QFACE_SOURCES
+ \li list of .qface input files
+ \row
+ \li QFACE_MODULE_NAME
+ \li The (optional) name of the module that is using the generated code
+ \row
+ \li QFACE_OUTPUT_DIR
+ \li Output folder where the generated code will be created. The default
+ is to use the current build folder
+\endtable
+
+
+See \l {Autogenerator usage} for more details on the generator command line arguments.
+
+*/
diff --git a/src/doc/qtivi/src/qt_attribution.json b/src/doc/qtivi/src/qt_attribution.json
new file mode 100644
index 0000000..ae70c34
--- /dev/null
+++ b/src/doc/qtivi/src/qt_attribution.json
@@ -0,0 +1,17 @@
+{
+ "Id": "jinja-documentation",
+ "Name": "Jinja Documentation",
+ "QDocModule": "qtivi",
+ "QtUsage": "Used in the Documentation of the Jinja template language",
+ "Path": "template-syntax.qdoc",
+
+ "Description": "Full featured template engine for python.",
+ "Homepage": "http://jinja.pocoo.org/",
+ "Version": "2.9.6",
+
+ "License": "BSD 3-clause License",
+ "LicenseId": "BSD-3-Clause",
+ "LicenseFile": "JINJA_LICENSE",
+ "Copyright": "(c) 2009 by the Jinja Team, see AUTHORS for more details."
+}
+
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..0fb1987 100644
--- a/src/doc/qtivi/src/qtivi.qdoc
+++ b/src/doc/qtivi/src/qtivi.qdoc
@@ -55,11 +55,13 @@
features. It can be used to develop automotive applications and to provide
automotive features to Qt-based applications in a structured manner.
+ \section1 Important Topics
+
\list
+ \li \l{Configuration}
+ \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
@@ -101,4 +103,19 @@
\li \l {Qt IVI QML Types}
\li \l {Qt IVI Examples}
\endlist
+
+ \section1 Licenses and Attributions
+
+ Qt IVI is available under commercial Qt Automotive Suite licenses.
+ In addition, it is available under the \l{GNU Lesser General Public License, version 3}, or
+ See \l{Qt Licensing} for further details.
+
+ Executables on Windows potentially link against \l{The qtmain Library}. This library is available
+ under commercial licenses, and in addition under the \l{BSD 3-clause "New" or "Revised" License}.
+
+ Furthermore Qt IVI potentially contains third party modules under following
+ permissive licenses:
+
+ \generatelist{groupsbymodule attributions-qtivi}
+
*/
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..2550189
--- /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 5fb20c8..f492556 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/imports/imports.pro b/src/imports/imports.pro
index c42b57b..d70d6d5 100644
--- a/src/imports/imports.pro
+++ b/src/imports/imports.pro
@@ -1,5 +1,5 @@
TEMPLATE = subdirs
SUBDIRS = core \
- vehiclefunctions \
media
+qtHaveModule(ivivehiclefunctions): SUBDIRS += vehiclefunctions
diff --git a/src/imports/vehiclefunctions/plugin.cpp b/src/imports/vehiclefunctions/plugin.cpp
index 8ae73c0..83276e8 100644
--- a/src/imports/vehiclefunctions/plugin.cpp
+++ b/src/imports/vehiclefunctions/plugin.cpp
@@ -57,8 +57,8 @@ public:
Q_ASSERT(QLatin1String(uri) == QLatin1String("QtIvi.VehicleFunctions"));
Q_UNUSED(uri);
- qmlRegisterType<QIviClimateControl>(uri, 1, 0, "ClimateControl");
- qmlRegisterType<QIviWindowControl>(uri, 1, 0, "WindowControl");
+ QIviClimateControl::registerQmlTypes(uri, 1, 0);
+ QIviWindowControl::registerQmlTypes(uri, 1, 0);
}
};
diff --git a/src/ivicore/configure.json b/src/ivicore/configure.json
index 3a494e2..ece6c51 100644
--- a/src/ivicore/configure.json
+++ b/src/ivicore/configure.json
@@ -2,9 +2,99 @@
"module": "ivicore",
"testDir": "../../config.tests",
- "features": {},
+ "commandline": {
+ "options": {
+ "ivigenerator": { "type": "enum", "values": [ "no", "qt", "system" ] },
+ "host-tools-only": "boolean"
+ }
+ },
- "report": [],
+ "tests": {
+ "python3": {
+ "label": "Python3",
+ "type": "python3",
+ "files": [ "python3" ]
+ },
+ "virtualenv": {
+ "label": "virtualenv",
+ "type": "python3_package",
+ "package": "virtualenv"
+ }
- "summary": []
+ },
+
+ "features": {
+ "python3": {
+ "label": "python3",
+ "condition": "tests.python3",
+ "output": [
+ "privateFeature",
+ { "type": "varAssign", "name": "QMAKE_PYTHON3_LOCATION", "value": "tests.python3.value" },
+ { "type": "varAssign", "name": "QMAKE_PYTHON3_VERSION", "value": "tests.python3.version" }
+ ]
+ },
+ "python3-virtualenv": {
+ "label": "virtualenv",
+ "condition": "features.python3 && tests.virtualenv",
+ "output": [ "privateFeature" ]
+ },
+ "system-ivigenerator": {
+ "label": "System IVI Generator",
+ "enable": "input.ivigenerator == 'system'",
+ "disable": "input.ivigenerator != 'system'",
+ "output": [ "privateFeature" ]
+ },
+ "ivigenerator": {
+ "label": "IVI Generator",
+ "enable": "input.ivigenerator == 'qt' || input.ivigenerator == 'system'",
+ "disable": "input.ivigenerator == 'no'",
+ "condition": "features.python3.&& features.python3-virtualenv || features.system-ivigenerator",
+ "output": [ "publicFeature" ]
+ },
+ "host-tools-only": {
+ "label": "Only build the host tools",
+ "condition": "input.host-tools-only == 'yes'",
+ "output": [ "privateFeature" ]
+ },
+ "simulator": {
+ "label": "QtSimulator Support",
+ "condition": "module.simulator",
+ "output": [ "publicFeature" ]
+ }
+ },
+
+ "report": [
+ {
+ "type": "warning",
+ "condition": "!features.ivigenerator",
+ "message": "Cannot build the IVI Generator because its dependencies are not satisfied.
+The IVI Generator provides tooling to generate source code out of IDL files.
+Make sure that python3 and its 'virtualenv' packages are installed."
+ },
+ {
+ "type": "warning",
+ "condition": "!features.simulator",
+ "message": "Cannot enable the QtSimulator Support because the QtSimulator module is not installed.
+The QtSimulator Support is needed for the communication between the simulation backends and its control panel(controller)."
+ }
+ ],
+
+ "summary": [
+ {
+ "section": "Qt IVI Core",
+ "entries": [
+ {
+ "section": "Python3",
+ "entries": [
+ {
+ "type": "python3"
+ },
+ "python3-virtualenv"
+ ]
+ },
+ "ivigenerator",
+ "simulator"
+ ]
+ }
+ ]
}
diff --git a/src/ivicore/configure.pri b/src/ivicore/configure.pri
new file mode 100644
index 0000000..fad2e22
--- /dev/null
+++ b/src/ivicore/configure.pri
@@ -0,0 +1,57 @@
+
+defineTest(qtConfTest_python3) {
+
+ PYTHON3_PATH = $$(PYTHON3_PATH)
+ # include binaries installed from homebrew
+ osx: PYTHON3_PATH += /usr/local/bin
+ PYTHON3_NAMES = "python3" "python"
+ for (python3_exe_name, PYTHON3_NAMES) {
+ equals(QMAKE_HOST.os, Windows): python3_exe_name = $${python3_exe_name}.exe
+
+ python3_exe = $$shell_path($$qtConfFindInPath($$python3_exe_name, $$PYTHON3_PATH))
+ isEmpty(python3_exe): \
+ next();
+
+ qtRunLoggedCommand("$$python3_exe -c \"import platform; print(platform.python_version_tuple()[0])\"", py_major_version)|next()
+ equals(py_major_version, 3) {
+ qtRunLoggedCommand("$$python3_exe -c \"import platform; print(platform.python_version())\"", python_version)|next()
+ break()
+ }
+ }
+
+ !isEmpty(python3_exe):exists($$python3_exe):!isEmpty(python_version) {
+ qtLog("Using: $$python3_exe")
+ qtLog("Version: $$py_major_version")
+
+ $${1}.value = $$python3_exe
+ export($${1}.value)
+ $${1}.version = $$python_version
+ export($${1}.version)
+ $${1}.cache += value
+ $${1}.cache += version
+ export($${1}.cache)
+ return(true)
+ }
+ return(false)
+}
+
+defineTest(qtConfTest_python3_package) {
+ python3_exe = $$eval($${currentConfig}.tests.python3.value)
+ package = $$eval($${1}.package)
+
+ qtRunLoggedCommand("$$python3_exe -c \"import $${package}\"", package_exists)|return(false)
+
+ return(true)
+}
+
+defineTest(qtConfReport_python3) {
+ !$$eval($${currentConfig}.features.python3.available) {
+ qtConfReportPadded($${1}Executable, "no")
+ return()
+ }
+
+ path = $$eval($${currentConfig}.tests.python3.value)
+ version = $$eval($${currentConfig}.tests.python3.version)
+ qtConfReportPadded("$${1}Executable", $$path)
+ qtConfReportPadded("$${1}Version", $$version)
+}
diff --git a/src/ivicore/doc/qtivicore.qdocconf b/src/ivicore/doc/qtivicore.qdocconf
index 844f89a..3aa0eea 100644
--- a/src/ivicore/doc/qtivicore.qdocconf
+++ b/src/ivicore/doc/qtivicore.qdocconf
@@ -4,6 +4,8 @@ headerdirs += .. \
sourcedirs += .. \
../../imports/core
+exampledirs += ../../../examples/core \
+
macro.qmlqtiviproperty = "\\qmlpropertygroup \2 \n\\qmlproperty bool \2.available\n \\qmlproperty \1 \2.maximumValue\n \\qmlproperty \1 \2.minimumValue\n \\qmlproperty list<\1> \2.availableValues\n \\qmlproperty \1 \2.value\n \\include src/qmlqtiviproperty.qdocinc"
macro.qmlqtivipropertyBool = "\\qmlpropertygroup \1 \n\\qmlproperty bool \1.available\n \\qmlproperty bool \1.value\n \\include src/qmlqtiviproperty.qdocinc"
macro.qmlqtivipropertyEnum = "\\qmlpropertygroup \1 \n\\qmlproperty bool \1.available\n \\qmlproperty list<enumeration> \1.availableValues\n \\qmlproperty enumeration \1.value\n \\include src/qmlqtiviproperty.qdocinc"
diff --git a/src/ivicore/doc/src/qtivicore.qdoc b/src/ivicore/doc/src/qtivicore.qdoc
index ebf7c50..13d6490 100644
--- a/src/ivicore/doc/src/qtivicore.qdoc
+++ b/src/ivicore/doc/src/qtivicore.qdoc
@@ -68,3 +68,14 @@
\section1 QML Types
*/
+
+/*!
+ \group qtivicore-examples
+ \ingroup all-examples
+ \ingroup qtivi-examples
+ \title Qt IVI Core Examples
+
+ \brief Examples for using the Qt IVI Core features
+
+ These are the Qt IVI Core features examples.
+*/
diff --git a/src/ivicore/ivicore.pro b/src/ivicore/ivicore.pro
index e2beea1..35eabe9 100644
--- a/src/ivicore/ivicore.pro
+++ b/src/ivicore/ivicore.pro
@@ -35,7 +35,9 @@ HEADERS += \
qivisearchandbrowsemodel_p.h \
qivisearchandbrowsemodelinterface.h \
qivisearchandbrowsemodelinterface_p.h \
- qivisearchandbrowsemodelitem.h
+ qivisearchandbrowsemodelitem.h \
+ qivifeatureinterface.h \
+ qividefaultpropertyoverrider_p.h
SOURCES += \
qiviservicemanager.cpp \
@@ -51,7 +53,9 @@ SOURCES += \
qiviabstractfeaturelistmodel.cpp \
qivisearchandbrowsemodel.cpp \
qivisearchandbrowsemodelinterface.cpp \
- qivisearchandbrowsemodelitem.cpp
+ qivisearchandbrowsemodelitem.cpp \
+ qivifeatureinterface.cpp \
+ qividefaultpropertyoverrider.cpp
include(queryparser/queryparser.pri)
diff --git a/src/ivicore/qiviabstractfeature.cpp b/src/ivicore/qiviabstractfeature.cpp
index 2750c48..ba1c2ad 100644
--- a/src/ivicore/qiviabstractfeature.cpp
+++ b/src/ivicore/qiviabstractfeature.cpp
@@ -50,15 +50,20 @@
#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)
+ , m_supportsPropertyOverriding(false)
+ , m_propertyOverride(nullptr)
{
}
@@ -66,6 +71,18 @@ void QIviAbstractFeaturePrivate::initialize()
{
}
+bool QIviAbstractFeaturePrivate::notify(const QByteArray &propertyName, const QVariant &value)
+{
+ Q_UNUSED(propertyName);
+ Q_UNUSED(value);
+ return false;
+}
+
+QIviAbstractFeaturePrivate *QIviAbstractFeaturePrivate::get(QIviAbstractFeature *q)
+{
+ return static_cast<QIviAbstractFeaturePrivate *>(q->d_ptr.data());
+}
+
void QIviAbstractFeaturePrivate::setDiscoveryResult(QIviAbstractFeature::DiscoveryResult discoveryResult)
{
if (m_discoveryResult == discoveryResult)
@@ -76,91 +93,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 +203,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 +234,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 +277,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 +306,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 +343,9 @@ void QIviAbstractFeature::setDiscoveryMode(QIviAbstractFeature::DiscoveryMode di
}
/*!
- * \internal
- * \overload
- */
+ \internal
+ \overload
+*/
void QIviAbstractFeature::classBegin()
{
Q_D(QIviAbstractFeature);
@@ -343,8 +353,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 +363,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 +388,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 +415,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 +432,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 +444,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 +460,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 +475,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 +588,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 +679,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 +711,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.
- This slot can be used when implementing a new Feature to report generic errors.
+ 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.
*/
void QIviAbstractFeature::onErrorChanged(QIviAbstractFeature::Error error, const QString &message)
{
@@ -654,7 +747,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..f10f284 100644
--- a/src/ivicore/qiviabstractfeature_p.h
+++ b/src/ivicore/qiviabstractfeature_p.h
@@ -60,14 +60,30 @@
QT_BEGIN_NAMESPACE
+class Q_QTIVICORE_EXPORT QIviPropertyOverrider {
+public:
+ QIviPropertyOverrider() { }
+ virtual ~QIviPropertyOverrider() { }
+
+ virtual QVariant property(int propertyIndex) const = 0;
+ virtual void setProperty(int propertyIndex, const QVariant &value) = 0;
+ virtual bool isOverridden(int propertyIndex) const = 0;
+private:
+ Q_DISABLE_COPY(QIviPropertyOverrider)
+};
+
class Q_QTIVICORE_EXPORT QIviAbstractFeaturePrivate : public QObjectPrivate
{
public:
QIviAbstractFeaturePrivate(const QString &interface, QIviAbstractFeature *parent);
+ static QIviAbstractFeaturePrivate *get(QIviAbstractFeature *q);
+
virtual void initialize();
+ virtual bool notify(const QByteArray &propertyName, const QVariant &value);
void setDiscoveryResult(QIviAbstractFeature::DiscoveryResult discoveryResult);
+ void onInitializationDone();
QIviAbstractFeature * const q_ptr;
Q_DECLARE_PUBLIC(QIviAbstractFeature)
@@ -79,6 +95,10 @@ public:
QString m_errorMessage;
QIviAbstractFeature::Error m_error;
bool m_qmlCreation;
+ bool m_isInitialized;
+
+ bool m_supportsPropertyOverriding;
+ QIviPropertyOverrider *m_propertyOverride;
};
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..8f5b7df 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);
@@ -237,6 +239,7 @@ void QIviAbstractZonedFeature::initializeZones()
else
f = createZoneFeature(zone);
if (f) {
+ dynamic_cast<QIviAbstractZonedFeaturePrivate *>(f->d_ptr.data())->m_serviceObject = d->m_serviceObject;
d->m_zoneFeatures.append(f);
d->m_zoneFeatureList.append(QVariant::fromValue(f));
d->m_zoneFeatureMap.insert(f->zone(), QVariant::fromValue(f));
@@ -248,15 +251,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 +270,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 +282,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 +296,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 +316,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/qividefaultpropertyoverrider.cpp b/src/ivicore/qividefaultpropertyoverrider.cpp
new file mode 100644
index 0000000..a51a67a
--- /dev/null
+++ b/src/ivicore/qividefaultpropertyoverrider.cpp
@@ -0,0 +1,552 @@
+/****************************************************************************
+**
+** 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 "qiviabstractfeature.h"
+#include "qiviabstractzonedfeature.h"
+#include "qiviserviceobject.h"
+#include "qiviabstractfeature_p.h"
+#include "qividefaultpropertyoverrider_p.h"
+
+#include <QDebug>
+#include <QJsonDocument>
+#include <QJsonArray>
+
+QT_BEGIN_NAMESPACE
+
+QIviDefaultPropertyOverrider::PropertyOverride::PropertyOverride()
+ : m_overridable(false)
+ , m_overriding(false)
+{
+}
+
+QIviDefaultPropertyOverrider::PropertyOverride::PropertyOverride(QIviDefaultPropertyOverrider::PropertyOverride &&other)
+{
+ *this = std::move(other);
+}
+
+QIviDefaultPropertyOverrider::PropertyOverride::PropertyOverride(const QMetaProperty &metaProperty, const QVariant &value, bool overridable)
+ : m_metaProperty(metaProperty)
+ , m_overridable(overridable)
+ , m_overriding(false)
+ , m_originalValue(value)
+{
+}
+
+QIviDefaultPropertyOverrider::PropertyOverride &QIviDefaultPropertyOverrider::PropertyOverride::operator=(QIviDefaultPropertyOverrider::PropertyOverride &&other)
+{
+ m_metaProperty = other.m_metaProperty;
+ m_originalValue = other.m_originalValue;
+ m_overridenValue = other.m_overridenValue;
+ m_overriding = other.m_overriding;
+ m_overridable = other.m_overridable;
+ return *this;
+}
+
+int QIviDefaultPropertyOverrider::PropertyOverride::propertyIndex() const
+{
+ return m_metaProperty.isValid() ? m_metaProperty.propertyIndex() : -1;
+}
+
+bool QIviDefaultPropertyOverrider::PropertyOverride::isValid() const
+{
+ return m_metaProperty.isValid();
+}
+
+bool QIviDefaultPropertyOverrider::PropertyOverride::isAvailable() const
+{
+ return m_metaProperty.isValid();
+}
+
+bool QIviDefaultPropertyOverrider::PropertyOverride::hasNotifySignal() const
+{
+ return m_metaProperty.hasNotifySignal();
+}
+
+bool QIviDefaultPropertyOverrider::PropertyOverride::isWritable() const
+{
+ return (m_metaProperty.isWritable() && !QMetaType(m_metaProperty.userType()).flags().testFlag(QMetaType::PointerToQObject));
+}
+
+bool QIviDefaultPropertyOverrider::PropertyOverride::isOverridable() const
+{
+ if (!m_overridable)
+ return false;
+ int propertyOffset = QIviAbstractFeature::staticMetaObject.propertyCount();
+ return m_metaProperty.propertyIndex() >= propertyOffset;
+}
+
+bool QIviDefaultPropertyOverrider::PropertyOverride::isOverridden() const
+{
+ return m_overriding;
+}
+
+QString QIviDefaultPropertyOverrider::PropertyOverride::name() const
+{
+ return QString::fromUtf8(m_metaProperty.name());
+}
+
+QString QIviDefaultPropertyOverrider::PropertyOverride::typeName() const
+{
+ const int userType(m_metaProperty.userType());
+ return QString::fromLatin1(QMetaType::typeName(userType));
+}
+
+QString QIviDefaultPropertyOverrider::PropertyOverride::displayText() const
+{
+ const QVariant &value = m_overriding ? m_overridenValue : m_originalValue;
+ return value.toString();
+}
+
+QVariant QIviDefaultPropertyOverrider::PropertyOverride::editValue() const
+{
+ const QVariant &value = m_overriding ? m_overridenValue : m_originalValue;
+ return value;
+}
+
+QVariant QIviDefaultPropertyOverrider::PropertyOverride::cppValue() const
+{
+ return m_overriding ? m_overridenValue : m_originalValue;
+}
+
+void QIviDefaultPropertyOverrider::PropertyOverride::setOverriden(bool override)
+{
+ if (override != m_overriding) {
+ m_overriding = override;
+ if (m_overriding)
+ m_overridenValue = m_originalValue;
+ }
+}
+
+bool QIviDefaultPropertyOverrider::PropertyOverride::setOverridenValue(const QVariant &value, QIviAbstractFeature *carrier)
+{
+ Q_ASSERT(isAvailable());
+
+ const bool wasOverride = isOverridden();
+ bool isOverride = wasOverride || !isWritable();
+
+ if (isOverride && !wasOverride && isOverridable())
+ setOverriden(isOverride);
+ if (isOverride)
+ m_overridenValue = value;
+
+ if (m_metaProperty.isWritable())
+ return m_metaProperty.write(carrier, value);
+ else
+ return notifyOverridenValue(value, carrier);
+}
+
+bool QIviDefaultPropertyOverrider::PropertyOverride::notifyOverridenValue(const QVariant &value, QIviAbstractFeature *carrier)
+{
+ QIviAbstractFeaturePrivate *d = QIviAbstractFeaturePrivate::get(carrier);
+ if (d && d->notify(m_metaProperty.name(), value))
+ return false;
+
+ QMetaMethod notifySignal = m_metaProperty.notifySignal();
+ if (!notifySignal.isValid() || notifySignal.parameterCount() != 1)
+ return false;
+
+ switch (value.type()) {
+ case QVariant::Int: return notifySignal.invoke(carrier, Q_ARG(int, value.value<int>()));
+ case QVariant::String: return notifySignal.invoke(carrier, Q_ARG(QString, value.value<QString>()));
+ case QVariant::Double: return notifySignal.invoke(carrier, Q_ARG(double, value.value<double>()));
+ case QVariant::Bool: return notifySignal.invoke(carrier, Q_ARG(double, value.value<bool>()));
+ default:
+ return false;
+ }
+}
+
+void QIviDefaultPropertyOverrider::PropertyOverride::setOriginalValue(const QVariant &editValue)
+{
+ m_originalValue = editValue;
+}
+
+bool QIviDefaultPropertyOverrider::PropertyOverride::operator==(const QByteArray &property) const
+{
+ return this->m_metaProperty.name() == property;
+}
+
+
+QIviDefaultPropertyOverrider::QIviDefaultPropertyOverrider(QIviAbstractFeature *carrier, QObject *parent)
+ : QObject(parent)
+ , m_serviceObject(nullptr)
+{
+ if (carrier) {
+ m_serviceObject = carrier->serviceObject();
+ init(carrier);
+ m_carriers.push_back(carrier);
+ }
+}
+
+QIviDefaultPropertyOverrider::~QIviDefaultPropertyOverrider()
+{
+ for (auto &c : qAsConst(m_carriers))
+ setCarrierOverride(false, c);
+}
+
+void QIviDefaultPropertyOverrider::init(QIviAbstractFeature *carrier)
+{
+ if (!carrier || !m_properties.empty())
+ return;
+
+ const QMetaObject *mo = carrier->metaObject();
+ const int propertyOffset = QIviAbstractFeature::staticMetaObject.propertyCount();
+ const int propertyCount = mo->propertyCount() - propertyOffset;
+
+ QIviAbstractFeaturePrivate *carrierPrivate = QIviAbstractFeaturePrivate::get(carrier);
+ const bool canOveride = carrierPrivate && carrierPrivate->m_supportsPropertyOverriding;
+
+ const QByteArray normalizedSignal(QMetaObject::normalizedSignature("propertyChanged()"));
+ const int propertyChangedSignalIndex(QIviDefaultPropertyOverrider::staticMetaObject.indexOfSignal(normalizedSignal));
+
+ for (int i = 0; i < propertyCount; ++i) {
+ const QMetaProperty metaProperty(mo->property(i + propertyOffset));
+ qDebug() << i << metaProperty.name() << metaProperty.isValid();
+ m_properties.push_back(PropertyOverride(metaProperty, metaProperty.read(carrier), canOveride));
+ if (metaProperty.hasNotifySignal()) {
+ QMetaObject::connect(carrier, metaProperty.notifySignalIndex(), this, propertyChangedSignalIndex);
+ }
+ }
+}
+
+void QIviDefaultPropertyOverrider::addCarrier(QIviAbstractFeature *carrier)
+{
+ if (!carrier)
+ return;
+
+ init(carrier);
+ m_carriers.push_back(carrier);
+ setCarrierOverride(true, carrier);
+}
+
+void QIviDefaultPropertyOverrider::removeCarrier(QIviAbstractFeature *carrier)
+{
+ setCarrierOverride(false, carrier);
+ m_carriers.erase(std::remove_if(m_carriers.begin(), m_carriers.end(), [carrier](QIviAbstractFeature *c) {
+ return carrier == c;
+ }), m_carriers.end());
+}
+
+void QIviDefaultPropertyOverrider::setCarrierOverride(bool override, QIviAbstractFeature *carrier)
+{
+ if (!carrier)
+ return;
+ QIviAbstractFeaturePrivate *const pPriv = QIviAbstractFeaturePrivate::get(carrier);
+ if (!pPriv)
+ return;
+ if (override && pPriv->m_propertyOverride == nullptr) {
+ pPriv->m_propertyOverride = this;
+ } else if (!override && pPriv->m_propertyOverride == this) {
+ pPriv->m_propertyOverride = nullptr;
+ }
+}
+
+int QIviDefaultPropertyOverrider::numCarriers() const
+{
+ return (int) m_carriers.size();
+}
+
+QVariant QIviDefaultPropertyOverrider::property(int propertyIndex) const
+{
+ if (m_carriers.empty())
+ return {};
+
+ const PropertyOverride &property = propertyForIndex(propertyIndex);
+ return property.cppValue();
+}
+
+void QIviDefaultPropertyOverrider::setProperty(int propertyIndex, const QVariant &value)
+{
+ if (m_carriers.empty())
+ return;
+
+ PropertyOverride &property = propertyForIndex(propertyIndex);
+ property.setOriginalValue(value);
+}
+
+bool QIviDefaultPropertyOverrider::isOverridden(int propertyIndex) const
+{
+ if (m_carriers.empty())
+ return false;
+
+ const PropertyOverride &property = propertyForIndex(propertyIndex);
+ return property.isOverridden();
+}
+
+bool QIviDefaultPropertyOverrider::isWritableAt(int index) const
+{
+ if (m_carriers.empty())
+ return false;
+
+ const PropertyOverride &property = m_properties.at(index);
+ return property.isWritable();
+}
+
+bool QIviDefaultPropertyOverrider::isOverridableAt(int index) const
+{
+ if (m_carriers.empty())
+ return false;
+
+ const PropertyOverride &property = m_properties.at(index);
+ return property.isOverridable();
+}
+
+bool QIviDefaultPropertyOverrider::isAvailableAt(int index) const
+{
+ if (m_carriers.empty())
+ return false;
+
+ const PropertyOverride &property = m_properties.at(index);
+ return property.isAvailable();
+}
+
+bool QIviDefaultPropertyOverrider::isOverriddenAt(int index) const
+{
+ if (m_carriers.empty())
+ return false;
+
+ const PropertyOverride &property = m_properties.at(index);
+ return property.isOverridden();
+}
+
+bool QIviDefaultPropertyOverrider::hasNotifySignalAt(int index) const
+{
+ if (m_carriers.empty())
+ return false;
+
+ const PropertyOverride &property = m_properties.at(index);
+ return property.hasNotifySignal();
+}
+
+QString QIviDefaultPropertyOverrider::nameAt(int index) const
+{
+ if (m_carriers.empty())
+ return {};
+
+ const PropertyOverride &property = m_properties.at(index);
+ return property.name();
+}
+
+QString QIviDefaultPropertyOverrider::typeNameAt(int index) const
+{
+ if (m_carriers.empty())
+ return {};
+
+ const PropertyOverride &property = m_properties.at(index);
+ return property.typeName();
+}
+
+QString QIviDefaultPropertyOverrider::displayTextAt(int index) const
+{
+ if (m_carriers.empty())
+ return {};
+
+ const PropertyOverride &property = m_properties.at(index);
+ return property.displayText();
+}
+
+QVariant QIviDefaultPropertyOverrider::iviConstraintsAt(int index) const
+{
+ if (m_carriers.empty())
+ return {};
+
+ auto carrier = m_carriers.front();
+ const PropertyOverride &property = m_properties.at(index);
+
+ QByteArray constraintsJSON;
+ for (int i=0; i<carrier->metaObject()->classInfoCount(); i++) {
+ QMetaClassInfo ci = carrier->metaObject()->classInfo(i);
+ if (QLatin1String(ci.name()) == QLatin1String("IviPropertyDomains")) {
+ constraintsJSON = QByteArray(ci.value());
+ break;
+ }
+ }
+ if (constraintsJSON.isEmpty())
+ return {};
+
+ QJsonDocument loadDoc = QJsonDocument::fromJson(constraintsJSON);
+ if (loadDoc.isNull() || loadDoc.isEmpty() || !loadDoc.isObject())
+ return {};
+
+ if (!loadDoc.object().contains(property.name()))
+ return {};
+
+ QJsonValue constraints = loadDoc.object().value(property.name());
+ QLatin1String range("range");
+ if (constraints.toObject().contains(range)) {
+ QJsonArray vals = constraints.toObject().value(range).toArray();
+ return QVariantList() << range << vals.at(0).toDouble() << vals.at(1).toDouble();
+ }
+ QLatin1String minimum("minimum");
+ if (constraints.toObject().contains(minimum)) {
+ double val = constraints.toObject().value(minimum).toDouble();
+ return QVariantList() << minimum << val;
+ }
+ QLatin1String maximum("maximum");
+ if (constraints.toObject().contains(maximum)) {
+ double val = constraints.toObject().value(maximum).toDouble();
+ return QVariantList() << maximum << val;
+ }
+ QLatin1String domain("domain");
+ if (constraints.toObject().contains(domain)) {
+ const QVariantList vals = constraints.toObject().value(domain).toArray().toVariantList();
+ QVariantList res;
+ res << domain << vals;
+ return res;
+ }
+ return {};
+}
+
+QVariant QIviDefaultPropertyOverrider::editValueAt(int index) const
+{
+ if (m_carriers.empty())
+ return {};
+
+ const PropertyOverride &property = m_properties.at(index);
+ return property.editValue();
+}
+
+QString QIviDefaultPropertyOverrider::label() const
+{
+ if (m_carriers.empty())
+ return {};
+ QString name = m_serviceObject ? m_serviceObject->objectName() : QString();
+ if (name.isEmpty())
+ name = typeName();
+ if (const QIviAbstractZonedFeature *zoned = qobject_cast<const QIviAbstractZonedFeature *>(m_carriers.front()))
+ // not translated; the zone API is fixed to English, too
+ name += QString::fromLatin1(" [Zone: %1]").arg(zoned->zone());
+ return name;
+}
+
+QString QIviDefaultPropertyOverrider::description() const
+{
+ if (!m_serviceObject)
+ return {};
+ return QString(QLatin1String("Backend Type: %1\nInstances in zone: %2"))
+ .arg(QString::fromLatin1(m_serviceObject->metaObject()->className()))
+ .arg(m_carriers.size());
+}
+
+QString QIviDefaultPropertyOverrider::typeName() const
+{
+ if (m_carriers.empty())
+ return {};
+ return QString::fromLatin1(m_carriers.front()->metaObject()->className());
+}
+
+bool QIviDefaultPropertyOverrider::setOverride(int index, bool isOverride)
+{
+ PropertyOverride &property = m_properties.at(index);
+ if (property.isOverridable() && isOverride != property.isOverridden()) {
+ if (!isOverride) {
+ QByteArray flag = QString(QLatin1String("%1DirtyOverride")).arg(property.name()).toLatin1();
+ for (const auto &carrier : m_carriers) {
+ carrier->setProperty(flag.data(), true);
+ property.setOverridenValue(property.m_originalValue, carrier);
+ }
+ }
+ property.setOverriden(isOverride);
+ return true;
+ }
+ return false;
+}
+
+bool QIviDefaultPropertyOverrider::setOverridenValue(int index, const QVariant &value)
+{
+ PropertyOverride &property = m_properties.at(index);
+ bool res = false;
+ for (const auto &carrier : m_carriers) {
+ if (property.setOverridenValue(value, carrier))
+ res = true;
+ }
+ return res;
+}
+
+int QIviDefaultPropertyOverrider::propertyCount() const
+{
+ return (int) m_properties.size();
+}
+
+const QIviDefaultPropertyOverrider::PropertyOverride &QIviDefaultPropertyOverrider::propertyForIndex(int index) const
+{
+ static QIviDefaultPropertyOverrider::PropertyOverride dummy;
+ for (const auto &p: m_properties) {
+ if (p.propertyIndex() == index)
+ return p;
+ }
+ return dummy;
+}
+
+QIviDefaultPropertyOverrider::PropertyOverride &QIviDefaultPropertyOverrider::propertyForIndex(int index)
+{
+ static QIviDefaultPropertyOverrider::PropertyOverride dummy;
+ for (auto &p: m_properties) {
+ if (p.propertyIndex() == index)
+ return p;
+ }
+ return dummy;
+}
+
+int QIviDefaultPropertyOverrider::indexOfProperty(const QByteArray &property) const
+{
+ for (uint i = 0; i < m_properties.size(); i++) {
+ if (m_properties.at(i) == property) {
+ return i;
+ }
+ }
+ return -1;
+}
+
+bool QIviDefaultPropertyOverrider::handles(const QObject *carrier) const
+{
+ return std::find_if(m_carriers.begin(), m_carriers.end(), [carrier](const QIviAbstractFeature *p) {
+ return p == carrier;
+ }) != m_carriers.end();
+}
+
+QString QIviDefaultPropertyOverrider::serviceId() const
+{
+ return m_serviceObject ? m_serviceObject->id() : QString();
+}
+
+QT_END_NAMESPACE
+
+#include "moc_qividefaultpropertyoverrider_p.cpp"
diff --git a/src/ivicore/qividefaultpropertyoverrider_p.h b/src/ivicore/qividefaultpropertyoverrider_p.h
new file mode 100644
index 0000000..fcbc85c
--- /dev/null
+++ b/src/ivicore/qividefaultpropertyoverrider_p.h
@@ -0,0 +1,161 @@
+/****************************************************************************
+**
+** 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
+**
+****************************************************************************/
+
+#ifndef QIVIDEFAULTPROPERTYOVERRIDER_P_H
+#define QIVIDEFAULTPROPERTYOVERRIDER_P_H
+
+//
+// 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 <private/qtiviglobal_p.h>
+#include <vector>
+#include <QMetaProperty>
+
+#include "qiviabstractfeature_p.h"
+
+QT_BEGIN_NAMESPACE
+
+class Q_QTIVICORE_EXPORT QIviDefaultPropertyOverrider: public QObject, public QIviPropertyOverrider
+{
+ Q_OBJECT
+
+public:
+ explicit QIviDefaultPropertyOverrider(QIviAbstractFeature *carrier, QObject *parent = nullptr);
+ ~QIviDefaultPropertyOverrider();
+
+ void addCarrier(QIviAbstractFeature *carrier);
+ void removeCarrier(QIviAbstractFeature *carrier);
+ void setCarrierOverride(bool override, QIviAbstractFeature *carrier);
+ int numCarriers() const;
+
+ bool handles(const QObject *carrier) const;
+ QString serviceId() const;
+
+ QVariant property(int propertyIndex) const override;
+ void setProperty(int propertyIndex, const QVariant &value) override;
+ bool isOverridden(int propertyIndex) const override;
+
+ bool isWritableAt(int index) const;
+ bool isOverridableAt(int index) const;
+ bool isAvailableAt(int index) const;
+ bool isOverriddenAt(int index) const;
+ bool hasNotifySignalAt(int index) const;
+
+ virtual QString nameAt(int index) const;
+ virtual QString typeNameAt(int index) const;
+ virtual QString displayTextAt(int index) const;
+ virtual QVariant iviConstraintsAt(int index) const;
+ virtual QVariant editValueAt(int index) const;
+
+ virtual QString label() const;
+ virtual QString description() const;
+ virtual QString typeName() const;
+
+ bool setOverride(int index, bool isOverride);
+ virtual bool setOverridenValue(int index, const QVariant &value);
+ int propertyCount() const;
+
+ int indexOfProperty(const QByteArray &property) const;
+
+signals:
+ void propertyChanged();
+
+protected:
+
+ class Q_QTIVICORE_EXPORT PropertyOverride
+ {
+ friend class QIviDefaultPropertyOverrider;
+
+ public:
+ PropertyOverride();
+ explicit PropertyOverride(const QMetaProperty &metaProperty, const QVariant &value, bool overridable);
+ PropertyOverride(PropertyOverride &&other);
+
+ int propertyIndex() const;
+ bool isValid() const;
+ bool isAvailable() const;
+ bool hasNotifySignal() const;
+ bool isWritable() const;
+ bool isOverridable() const;
+ bool isOverridden() const;
+ QString name() const;
+ QString typeName() const;
+ QString displayText() const;
+ QVariant editValue() const;
+ QVariant cppValue() const;
+ QVariant iviConstraints(QIviAbstractFeature *carrier) const;
+
+ void setOverriden(bool override);
+ bool setOverridenValue(const QVariant &value, QIviAbstractFeature *carrier);
+ bool notifyOverridenValue(const QVariant &value, QIviAbstractFeature *carrier);
+ void setOriginalValue(const QVariant &editValue);
+
+ PropertyOverride &operator=(PropertyOverride &&other);
+ bool operator==(const QByteArray &property) const;
+
+ private:
+ QMetaProperty m_metaProperty;
+ bool m_overridable;
+ bool m_overriding;
+ QVariant m_originalValue;
+ QVariant m_overridenValue;
+ };
+
+ const PropertyOverride &propertyForIndex(int index) const;
+ PropertyOverride &propertyForIndex(int index);
+ void init(QIviAbstractFeature *carrier);
+
+ QIviServiceObject *m_serviceObject;
+ std::vector<QIviAbstractFeature *> m_carriers;
+ std::vector<PropertyOverride> m_properties;
+};
+
+QT_END_NAMESPACE
+
+#endif // QIVIDEFAULTPROPERTYOVERRIDER_P_H
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/ivivehiclefunctions/qtivivehiclefunctionsglobal.h b/src/ivicore/qivifeatureinterface.h
index 454d1b0..52c3639 100644
--- a/src/ivivehiclefunctions/qtivivehiclefunctionsglobal.h
+++ b/src/ivicore/qivifeatureinterface.h
@@ -39,24 +39,32 @@
**
****************************************************************************/
-#ifndef QIVIVEHICLEFUNCTIONSGLOBAL_H
-#define QIVIVEHICLEFUNCTIONSGLOBAL_H
+#ifndef QIVIFEATUREINTERFACE_H
+#define QIVIFEATUREINTERFACE_H
-#include <QtCore/qglobal.h>
+#include <QtIviCore/QIviAbstractFeature>
+#include <QtIviCore/qtiviglobal.h>
QT_BEGIN_NAMESPACE
-#ifndef QT_STATIC
-# if defined(QT_BUILD_IVIVEHICLEFUNCTIONS_LIB)
-# define Q_QTIVIVEHICLEFUNCTIONS_EXPORT Q_DECL_EXPORT
-# else
-# define Q_QTIVIVEHICLEFUNCTIONS_EXPORT Q_DECL_IMPORT
-# endif
-#else
-# define Q_QTIVIVEHICLEFUNCTIONS_EXPORT
-#endif
+class Q_QTIVICORE_EXPORT QIviFeatureInterface : public QObject
+{
+ Q_OBJECT
-QT_END_NAMESPACE
+public:
+ explicit QIviFeatureInterface(QObject *parent = nullptr);
+ ~QIviFeatureInterface();
+
+ virtual void initialize() = 0;
+
+protected:
+ QIviFeatureInterface(QObjectPrivate &dd, QObject *parent = nullptr);
-#endif // QIVIVEHICLEFUNCTIONSGLOBAL_H
+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 f76939e..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() };
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..bc99600 100644
--- a/src/ivicore/qiviserviceobject.cpp
+++ b/src/ivicore/qiviserviceobject.cpp
@@ -43,86 +43,89 @@
#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)
+ , m_id(QUuid::createUuid().toString())
{
-
}
/*!
- * 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();
- return id.toString();
+ return m_id;
}
/*!
- * \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..342b340 100644
--- a/src/ivicore/qiviserviceobject.h
+++ b/src/ivicore/qiviserviceobject.h
@@ -56,12 +56,13 @@ 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;
private:
+ QString m_id;
};
QT_END_NAMESPACE
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/configure.json b/src/ivimedia/configure.json
index ae7e60d..01e3a74 100644
--- a/src/ivimedia/configure.json
+++ b/src/ivimedia/configure.json
@@ -8,6 +8,7 @@
"test": "taglib",
"sources": [
{ "type": "pkgConfig", "args": "taglib" },
+ { "includedir": "/usr/local/opt/taglib/include/taglib", "libs": "-L /usr/local/opt/taglib/lib -ltag" },
"-ltag"
]
}
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..fba42fe 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,13 +130,14 @@ 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)
{
+ qRegisterMetaType<QIviMediaIndexerControl::State>();
}
/*!
@@ -142,13 +145,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 +171,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 +252,8 @@ void QIviMediaIndexerControl::connectToServiceObject(QIviServiceObject *serviceO
QObjectPrivate::connect(backend, &QIviMediaIndexerControlBackendInterface::stateChanged,
d, &QIviMediaIndexerControlPrivate::onStateChanged);
+ QIviAbstractFeature::connectToServiceObject(serviceObject);
+
backend->initialize();
}
@@ -261,4 +266,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/qtivivehiclefunctions.qdocconf b/src/ivivehiclefunctions/doc/qtivivehiclefunctions.qdocconf
index bcba08a..477a4f1 100644
--- a/src/ivivehiclefunctions/doc/qtivivehiclefunctions.qdocconf
+++ b/src/ivivehiclefunctions/doc/qtivivehiclefunctions.qdocconf
@@ -1,8 +1,10 @@
headerdirs += .. \
- ../../imports/vehiclefunctions
+ ../../imports/vehiclefunctions \
+ $$BUILDDIR/../../ivivehiclefunctions \
sourcedirs += .. \
- ../../imports/vehiclefunctions
+ ../../imports/vehiclefunctions \
+ $$BUILDDIR/../../ivivehiclefunctions \
exampledirs += ../../../examples/vehiclefunctions \
snippets
diff --git a/src/ivivehiclefunctions/doc/src/qtivivehiclefunctions.qdoc b/src/ivivehiclefunctions/doc/src/qtivivehiclefunctions.qdoc
index bf25cc2..57948fb 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("FrontLeft")->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")
+ if (z->zone() == "FrontLeft")
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.FrontLeft.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/ivivehiclefunctions.pro b/src/ivivehiclefunctions/ivivehiclefunctions.pro
index 0dcb784..fb45238 100644
--- a/src/ivivehiclefunctions/ivivehiclefunctions.pro
+++ b/src/ivivehiclefunctions/ivivehiclefunctions.pro
@@ -1,6 +1,6 @@
TARGET = QtIviVehicleFunctions
QT = core core-private ivicore ivicore-private
-CONFIG += c++11
+CONFIG += c++11 ivigenerator
OTHER_FILES = \
$$PWD/doc/*.qdocconf \
@@ -10,20 +10,7 @@ OTHER_FILES = \
CMAKE_MODULE_TESTS = '-'
-HEADERS += \
- qtivivehiclefunctionsglobal.h \
- qtivivehiclefunctionsglobal_p.h \
- qiviclimatecontrol.h \
- qiviclimatecontrolbackendinterface.h \
- qiviclimatecontrol_p.h \
- qiviwindowcontrol.h \
- qiviwindowcontrol_p.h \
- qiviwindowcontrolbackendinterface.h
+QFACE_MODULE_NAME = QtIviVehicleFunctions
+QFACE_SOURCES += ivivehiclefunctions.qface
-SOURCES += \
- qiviclimatecontrol.cpp \
- qiviclimatecontrolbackendinterface.cpp \
- qiviwindowcontrol.cpp \
- qiviwindowcontrolbackendinterface.cpp
-
-load(qt_module)
+load(ivigenerator_qt_module)
diff --git a/src/ivivehiclefunctions/ivivehiclefunctions.qface b/src/ivivehiclefunctions/ivivehiclefunctions.qface
new file mode 100644
index 0000000..8515d4f
--- /dev/null
+++ b/src/ivivehiclefunctions/ivivehiclefunctions.qface
@@ -0,0 +1,265 @@
+@config: { qml_name: "QtIvi.VehicleFunctions", interfaceBuilder: "vehicleFunctionsInterfaceBuilder" }
+module QtIviVehicleFunctions 1.0;
+
+/**
+ * @brief Provides an interface to the climate control.
+ *
+ * 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 QIviClimateControl expects a single backend to be available. It is recommended to use it
+ * with \l {QIviAbstractFeature::}{discoveryMode} set to \l AutoDiscovery.
+ */
+@config: { zoned: true, id: "org.qt-project.qtivi.ClimateControl/1.0", qml_type: "ClimateControl" }
+interface QIviClimateControl {
+ /**
+ * Holds whether the air conditioning is enabled.
+ */
+ @config: { getter_name: "isAirConditioningEnabled" }
+ bool airConditioningEnabled;
+ /**
+ * Indicates whether the heater is enabled.
+ */
+ @config: { getter_name: "isHeaterEnabled" }
+ bool heaterEnabled;
+ /**
+ * Holds the fan speed level, where the level can be between
+ * minimumValue(off) to maximumValue (strongest).
+ */
+ @config_simulator: { range: [0, 50] }
+ int fanSpeedLevel;
+ /**
+ * Holds the steering wheel heater level, where the level can
+ * be between minimumValue(off) to maximumValue (warmest).
+ */
+ @config_simulator: { minimum: 0 }
+ int steeringWheelHeater;
+ /**
+ * Holds the target temperature of the zone expressed
+ * in centigrades, where the temperature can be between
+ * minimumValue(coolest) to maximumValue (warmest).
+ */
+ @config_simulator: { maximum: 30.0 }
+ real targetTemperature;
+ /**
+ * Holds the seat cooler level, where the level can be
+ * between minimumValue(off) to maximumValue (coolest).
+ */
+ int seatCooler;
+ /**
+ * Holds the seat heater level, where the level can be between
+ * minimumValue(off) to maximumValue (warmest).
+ */
+ int seatHeater;
+ /**
+ * Holds the outside temperature of the zone expressed in
+ * centigrades, where the temperature can be between
+ * minimumValue(coolest) to maximumValue (warmest).
+ */
+ int outsideTemperature;
+ /**
+ * The outside temperature expressed as a string, e.g. "mild"
+ */
+ @config_simulator: { domain: ["cold", "mild", "warm" ] }
+ string outsideTemperatureLabel;
+ /**
+ * Indicates whether the zone synchronization is enabled.
+ *
+ * Which zones and properties are synchronized is controlled
+ * by the backend implementing it.
+ */
+ @config: { getter_name: "isZoneSynchronizationEnabled" }
+ bool zoneSynchronizationEnabled;
+ /**
+ * Indicates whether the defrost mode is enabled. Usually that means that the fans
+ * are on the highest level to remove ice from the windshield.
+ */
+ @config: { getter_name: "isDefrostEnabled" }
+ bool defrostEnabled;
+ /**
+ * Holds the current recirculation mode
+ */
+ RecirculationMode recirculationMode;
+ /**
+ * Indicates whether the recirculation is currently running.
+ */
+ @config: { getter_name: "isRecirculationEnabled" }
+ bool recirculationEnabled;
+ /**
+ * Holds the sensitivity level of the recirculation
+ * system when the recirculationMode is set to AutoRecirculation,
+ * where the level can be between minimumValue(least sensitive)
+ * to maximumValue(most sensitive).
+ */
+ int recirculationSensitivityLevel;
+ /**
+ * value holds the climate mode
+ */
+ ClimateMode climateMode;
+ /**
+ * Holds the intensity level of the fan when the climateMode
+ * is set to AutoClimate, where the level can be between
+ * minimumValue(least intensity) to maximumValue(most intensity).
+ */
+ int automaticClimateFanIntensityLevel;
+ /**
+ * Holds the combination of flags indicating the areas
+ * where airflow is on.
+ */
+ AirflowDirection airflowDirections;
+}
+
+/**
+ * Controls where the airflow goes
+ */
+flag AirflowDirection {
+ /**
+ * Direct airflow along the windshield.
+ */
+ Windshield = 1,
+ /**
+ * Direct airflow through the dashboard.
+ */
+ Dashboard = 2,
+ /**
+ * Direct airflow to the floor.
+ */
+ Floor = 4
+}
+
+/**
+ * Indicates the current mode of the recirculation system
+ */
+enum RecirculationMode {
+ /**
+ * The recirculation is turned off.
+ */
+ RecirculationOff = 0x0,
+ /**
+ * The recirculation is turned on.
+ */
+ RecirculationOn = 0x1,
+ /**
+ * The recirculation is turning off and on automatically depending on the air quality.
+ */
+ AutoRecirculation = 0x2
+}
+
+/**
+ * Indicates the current mode of the climate system
+ */
+enum ClimateMode {
+ /**
+ * The climate system is turned off.
+ */
+ ClimateOff = 0x0,
+ /**
+ * The climate system is turned on.
+ */
+ ClimateOn = 0x1,
+ /**
+ * 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.
+ */
+ AutoClimate = 0x2
+}
+
+/**
+ * @brief Provides an interface to the window control.
+ *
+ * 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.
+ *
+ * The QIviWindowControl expects a single backend to be available. It is recommended to use it
+ * with \l {QIviAbstractFeature::}{discoveryMode} set to \l AutoDiscovery.
+ */
+@config: { zoned: true, id: "org.qt-project.qtivi.WindowControl/1.0", qml_type: "WindowControl" }
+interface QIviWindowControl {
+
+ /**
+ * Holds the current mode of the window heater.
+ */
+ HeaterMode heaterMode;
+ /**
+ * Indicates whether the window heater is currently running.
+ */
+ readonly bool heater;
+ /**
+ * Holds the current state of the window.
+ */
+ readonly WindowState state;
+ /**
+ * Holds the current mode of the window blind.
+ */
+ BlindMode blindMode;
+ /**
+ * Holds the current state of the window blind.
+ */
+ readonly WindowState blindState;
+
+ /**
+ * Opens the window, if not already in the QIviWindowControl::FullyOpen state.
+ */
+ void open();
+ /**
+ * Closes the window, if not already in the QIviWindowControl::Closed state.
+ */
+ void close();
+}
+
+/**
+ * Indicates the current mode of the window heater
+ */
+enum HeaterMode {
+ /**
+ * The window heater is turned on.
+ */
+ HeaterOn,
+ /**
+ * The window heater is turned off.
+ */
+ HeaterOff,
+ /**
+ * The window heater is turning off and on automatically.
+ */
+ AutoHeater
+}
+
+/**
+ * Indicates the current mode of the window blind
+ */
+enum BlindMode {
+ /**
+ * The blind will be opened.
+ */
+ BlindOpen,
+ /**
+ * The blind will be closed.
+ */
+ BlindClosed,
+ /**
+ * The blind is opened or closed automatically.
+ */
+ AutoBlind
+}
+
+/**
+ * The state of the window
+ */
+enum WindowState {
+ /**
+ * The object is fully open.
+ */
+ FullyOpen,
+ /**
+ * The object is open, but not fully open yet.
+ */
+ Open,
+ /**
+ * The object is closed.
+ */
+ Closed
+}
diff --git a/src/ivivehiclefunctions/ivivehiclefunctions.yaml b/src/ivivehiclefunctions/ivivehiclefunctions.yaml
new file mode 100644
index 0000000..c9dfdd7
--- /dev/null
+++ b/src/ivivehiclefunctions/ivivehiclefunctions.yaml
@@ -0,0 +1,100 @@
+QtIviVehicleFunctions.QIviClimateControl:
+ config_simulator:
+ zoned: true
+ zones: { left : FrontLeft, right : FrontRight, rear: Rear }
+
+QtIviVehicleFunctions.QIviClimateControl#airConditioningEnabled:
+ config_simulator:
+ default: true
+
+QtIviVehicleFunctions.QIviClimateControl#heaterEnabled:
+ config_simulator:
+ default: true
+
+QtIviVehicleFunctions.QIviClimateControl#recirculationEnabled:
+ config_simulator:
+ default: false
+
+QtIviVehicleFunctions.QIviClimateControl#zoneSynchronizationEnabled:
+ config_simulator:
+ default: false
+
+QtIviVehicleFunctions.QIviClimateControl#defrostEnabled:
+ config_simulator:
+ default: false
+
+QtIviVehicleFunctions.QIviClimateControl#steeringWheelHeater:
+ config_simulator:
+ default: 0
+
+QtIviVehicleFunctions.QIviClimateControl#fanSpeedLevel:
+ config_simulator:
+ default: 2
+
+QtIviVehicleFunctions.QIviClimateControl#recirculationMode:
+ config_simulator:
+ default: RecirculationMode.RecirculationOff
+
+QtIviVehicleFunctions.QIviClimateControl#recirculationSensitivityLevel:
+ config_simulator:
+ unsupported: true
+ default: 0
+
+QtIviVehicleFunctions.QIviClimateControl#climateMode:
+ config_simulator:
+ unsupported: true
+ default: ClimateMode.ClimateOn
+
+QtIviVehicleFunctions.QIviClimateControl#automaticClimateFanIntensityLevel:
+ config_simulator:
+ unsupported: true
+ default: 0
+
+QtIviVehicleFunctions.QIviClimateControl#targetTemperature:
+ config_simulator:
+ default: { left: 21.0, right: 22.5, =: 0.0 }
+ zoned: true
+
+QtIviVehicleFunctions.QIviClimateControl#seatCooler:
+ config_simulator:
+ default: 0
+ zoned: true
+
+QtIviVehicleFunctions.QIviClimateControl#seatHeater:
+ config_simulator:
+ default: 0
+ zoned: true
+
+QtIviVehicleFunctions.QIviClimateControl#outsideTemperature:
+ config_simulator:
+ default: 15
+
+QtIviVehicleFunctions.QIviWindowControl:
+ config_simulator:
+ zoned: true
+ zones: { left : FrontLeft, right : FrontRight, rearLeft: RearLeft, rearRight: RearRight, rear: Rear, roof: Roof }
+
+QtIviVehicleFunctions.QIviWindowControl#heaterMode:
+ config_simulator:
+ default: HeaterMode.HeaterOff
+ zoned: true
+
+QtIviVehicleFunctions.QIviWindowControl#heater:
+ config_simulator:
+ default: false
+ zoned: true
+
+QtIviVehicleFunctions.QIviWindowControl#state:
+ config_simulator:
+ default: WindowState.Closed
+ zoned: true
+
+QtIviVehicleFunctions.QIviWindowControl#blindMode:
+ config_simulator:
+ default: BlindMode.AutoBlind
+ zoned: true
+
+QtIviVehicleFunctions.QIviWindowControl#blindState:
+ config_simulator:
+ default: WindowState.Closed
+ zoned: true
diff --git a/src/ivivehiclefunctions/qiviclimatecontrol.cpp b/src/ivivehiclefunctions/qiviclimatecontrol.cpp
deleted file mode 100644
index 6c4cf7f..0000000
--- a/src/ivivehiclefunctions/qiviclimatecontrol.cpp
+++ /dev/null
@@ -1,1843 +0,0 @@
-/****************************************************************************
-**
-** 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 "qiviclimatecontrol.h"
-#include "qiviclimatecontrol_p.h"
-#include "qiviclimatecontrolbackendinterface.h"
-#include <QtIviCore/QIviServiceObject>
-#include <QtIviCore/QIviPropertyFactory>
-
-QIviClimateControlPrivate::QIviClimateControlPrivate(const QString &interface, const QString &zone, QIviClimateControl *parent)
- : QIviAbstractZonedFeaturePrivate(interface, zone, parent)
- , m_airflowDirections(0)
- , m_airConditioning(false)
- , m_heater(false)
- , m_targetTemperature(0)
- , m_seatCooler(0)
- , m_seatHeater(0)
- , m_steeringWheelHeater(0)
- , m_fanSpeedLevel(0)
- , m_outsideTemperature(0)
- , m_zoneSynchronization(false)
- , m_defrost(false)
- , m_recirculationMode(QIviClimateControl::RecirculationOff)
- , m_recirculation(false)
- , m_recirculationSensitivityLevel(-1)
- , m_climateMode(QIviClimateControl::ClimateOff)
- , m_automaticClimateFanIntensityLevel(0)
- , q_ptr(parent)
-{
-}
-
-void QIviClimateControlPrivate::initialize()
-{
- QIviAbstractZonedFeaturePrivate::initialize();
- Q_Q(QIviClimateControl);
- m_airFlowDirectionProperty = QIviPropertyFactory<QIviClimateControl::AirflowDirections>::create(q,
- &QIviClimateControl::airflowDirectionsAttribute,
- &QIviClimateControl::airflowDirectionsAttributeChanged,
- &QIviClimateControl::airflowDirections,
- &QIviClimateControl::airflowDirectionsChanged,
- &QIviClimateControl::setAirflowDirections);
- m_airConditioningProperty = QIviPropertyFactory<bool>::create(q,
- &QIviClimateControl::airConditioningAttribute,
- &QIviClimateControl::airConditioningAttributeChanged,
- &QIviClimateControl::isAirConditioningEnabled,
- &QIviClimateControl::airConditioningEnabledChanged,
- &QIviClimateControl::setAirConditioningEnabled);
- m_heaterProperty = QIviPropertyFactory<bool>::create(q,
- &QIviClimateControl::heaterAttribute,
- &QIviClimateControl::heaterAttributeChanged,
- &QIviClimateControl::isHeaterEnabled,
- &QIviClimateControl::heaterEnabledChanged,
- &QIviClimateControl::setHeaterEnabled);
- m_targetTemperatureProperty = QIviPropertyFactory<int>::create(q,
- &QIviClimateControl::targetTemperatureAttribute,
- &QIviClimateControl::targetTemperatureAttributeChanged,
- &QIviClimateControl::targetTemperature,
- &QIviClimateControl::targetTemperatureChanged,
- &QIviClimateControl::setTargetTemperature);
- m_seatCoolerProperty = QIviPropertyFactory<int>::create(q,
- &QIviClimateControl::seatCoolerAttribute,
- &QIviClimateControl::seatCoolerAttributeChanged,
- &QIviClimateControl::seatCooler,
- &QIviClimateControl::seatCoolerChanged,
- &QIviClimateControl::setSeatCooler);
- m_seatHeaterProperty = QIviPropertyFactory<int>::create(q,
- &QIviClimateControl::seatHeaterAttribute,
- &QIviClimateControl::seatHeaterAttributeChanged,
- &QIviClimateControl::seatHeater,
- &QIviClimateControl::seatHeaterChanged,
- &QIviClimateControl::setSeatHeater);
- m_steeringWheelHeaterProperty = QIviPropertyFactory<int>::create(q,
- &QIviClimateControl::steeringWheelHeaterAttribute,
- &QIviClimateControl::steeringWheelHeaterAttributeChanged,
- &QIviClimateControl::steeringWheelHeater,
- &QIviClimateControl::steeringWheelHeaterChanged,
- &QIviClimateControl::setSteeringWheelHeater);
- m_fanSpeedLevelProperty = QIviPropertyFactory<int>::create(q,
- &QIviClimateControl::fanSpeedLevelAttribute,
- &QIviClimateControl::fanSpeedLevelAttributeChanged,
- &QIviClimateControl::fanSpeedLevel,
- &QIviClimateControl::fanSpeedLevelChanged,
- &QIviClimateControl::setFanSpeedLevel);
- m_outsideTemperatureProperty = QIviPropertyFactory<int>::create(q,
- &QIviClimateControl::outsideTemperatureAttribute,
- &QIviClimateControl::outsideTemperatureAttributeChanged,
- &QIviClimateControl::outsideTemperature,
- &QIviClimateControl::outsideTemperatureChanged);
-
- m_zoneSynchronizationProperty = QIviPropertyFactory<bool>::create(q,
- &QIviClimateControl::zoneSynchronizationAttribute,
- &QIviClimateControl::zoneSynchronizationAttributeChanged,
- &QIviClimateControl::isZoneSynchronizationEnabled,
- &QIviClimateControl::zoneSynchronizationEnabledChanged,
- &QIviClimateControl::setZoneSynchronizationEnabled);
-
- m_defrostProperty = QIviPropertyFactory<bool>::create(q,
- &QIviClimateControl::defrostAttribute,
- &QIviClimateControl::defrostAttributeChanged,
- &QIviClimateControl::isDefrostEnabled,
- &QIviClimateControl::defrostEnabledChanged,
- &QIviClimateControl::setDefrostEnabled);
-
- m_recirculationModeProperty = QIviPropertyFactory<QIviClimateControl::RecirculationMode>::create(q,
- &QIviClimateControl::recirculationModeAttribute,
- &QIviClimateControl::recirculationModeAttributeChanged,
- &QIviClimateControl::recirculationMode,
- &QIviClimateControl::recirculationModeChanged,
- &QIviClimateControl::setRecirculationMode);
-
- m_recirculationProperty = QIviPropertyFactory<bool>::create(q,
- &QIviClimateControl::recirculationAttribute,
- &QIviClimateControl::recirculationAttributeChanged,
- &QIviClimateControl::isRecirculationEnabled,
- &QIviClimateControl::recirculationEnabledChanged);
-
- m_recirculationSensitivityLevelProperty = QIviPropertyFactory<int>::create(q,
- &QIviClimateControl::recirculationSensitivityLevelAttribute,
- &QIviClimateControl::recirculationSensitivityLevelAttributeChanged,
- &QIviClimateControl::recirculationSensitivityLevel,
- &QIviClimateControl::recirculationSensitivityLevelChanged,
- &QIviClimateControl::setRecirculationSensitivityLevel);
-
- m_climateModeProperty = QIviPropertyFactory<QIviClimateControl::ClimateMode>::create(q,
- &QIviClimateControl::climateModeAttribute,
- &QIviClimateControl::climateModeAttributeChanged,
- &QIviClimateControl::climateMode,
- &QIviClimateControl::climateModeChanged,
- &QIviClimateControl::setClimateMode);
-
- m_automaticClimateFanIntensityLevelProperty = QIviPropertyFactory<int>::create(q,
- &QIviClimateControl::automaticClimateFanIntensityLevelAttribute,
- &QIviClimateControl::automaticClimateFanIntensityLevelAttributeChanged,
- &QIviClimateControl::automaticClimateFanIntensityLevel,
- &QIviClimateControl::automaticClimateFanIntensityLevelChanged,
- &QIviClimateControl::setAutomaticClimateFanIntensityLevel);
-}
-
-void QIviClimateControlPrivate::clearToDefaults()
-{
- m_airConditioning = false;
- m_heater = false;
- m_targetTemperature = 0;
- m_seatCooler = 0;
- m_seatHeater = 0;
- m_steeringWheelHeater = 0;
- m_fanSpeedLevel = 0;
- m_outsideTemperature = 0;
- m_zoneSynchronization = false;
- m_defrost = false;
- m_recirculationMode = QIviClimateControl::RecirculationOff;
- m_recirculation = false;
- m_recirculationSensitivityLevel = -1;
- m_climateMode = QIviClimateControl::ClimateOff;
- m_automaticClimateFanIntensityLevel = 0;
-}
-
-void QIviClimateControlPrivate::onAirflowDirectionsChanged(QIviClimateControl::AirflowDirections value, const QString &zone)
-{
- Q_Q(QIviClimateControl);
- QIviClimateControl *f = qobject_cast<QIviClimateControl*>(q->zoneAt(zone));
- if (!f)
- f = q;
- if (f->zone() != zone)
- return;
- f->d_func()->m_airflowDirections = value;
- emit f->airflowDirectionsChanged(value);
-}
-
-void QIviClimateControlPrivate::onAirflowDirectionsAttributeChanged(const QIviPropertyAttribute<QIviClimateControl::AirflowDirections> &airflowDirectionsAttribute, const QString &zone)
-{
- Q_Q(QIviClimateControl);
- QIviClimateControl *f = qobject_cast<QIviClimateControl*>(q->zoneAt(zone));
- if (!f)
- f = q;
- if (f->zone() != zone)
- return;
- f->d_func()->m_airflowDirectionsAttribute = airflowDirectionsAttribute;
- emit f->airflowDirectionsAttributeChanged(airflowDirectionsAttribute);
-}
-
-void QIviClimateControlPrivate::onAirConditioningEnabledChanged(bool enabled, const QString &zone)
-{
- Q_Q(QIviClimateControl);
- QIviClimateControl *f = qobject_cast<QIviClimateControl*>(q->zoneAt(zone));
- if (!f)
- f = q;
- if (f->zone() != zone)
- return;
- f->d_func()->m_airConditioning = enabled;
- emit f->airConditioningEnabledChanged(enabled);
-}
-
-void QIviClimateControlPrivate::onAirConditioningAttributeChanged(const QIviPropertyAttribute<bool> &airConditioningEnabledAttribute, const QString &zone)
-{
- Q_Q(QIviClimateControl);
- QIviClimateControl *f = qobject_cast<QIviClimateControl*>(q->zoneAt(zone));
- if (!f)
- f = q;
- if (f->zone() != zone)
- return;
- f->d_func()->m_airConditioningAttribute = airConditioningEnabledAttribute;
- emit f->airConditioningAttributeChanged(airConditioningEnabledAttribute);
-}
-
-void QIviClimateControlPrivate::onHeaterEnabledChanged(bool enabled, const QString &zone)
-{
- Q_Q(QIviClimateControl);
- QIviClimateControl *f = qobject_cast<QIviClimateControl*>(q->zoneAt(zone));
- if (!f)
- f = q;
- if (f->zone() != zone)
- return;
- f->d_func()->m_heater = enabled;
- emit f->heaterEnabledChanged(enabled);
-}
-
-void QIviClimateControlPrivate::onHeaterAttributeChanged(const QIviPropertyAttribute<bool> &heaterEnabledAttribute, const QString &zone)
-{
- Q_Q(QIviClimateControl);
- QIviClimateControl *f = qobject_cast<QIviClimateControl*>(q->zoneAt(zone));
- if (!f)
- f = q;
- if (f->zone() != zone)
- return;
- f->d_func()->m_heaterAttribute = heaterEnabledAttribute;
- emit f->heaterAttributeChanged(heaterEnabledAttribute);
-}
-
-void QIviClimateControlPrivate::onSteeringWheelHeaterChanged(int value, const QString &zone)
-{
- Q_Q(QIviClimateControl);
- QIviClimateControl *f = qobject_cast<QIviClimateControl*>(q->zoneAt(zone));
- if (!f)
- f = q;
- if (f->zone() != zone)
- return;
- f->d_func()->m_steeringWheelHeater = value;
- emit f->steeringWheelHeaterChanged(value);
-}
-
-void QIviClimateControlPrivate::onSteeringWheelHeaterAttributeChanged(const QIviPropertyAttribute<int> &steeringWheelHeaterAttribute, const QString &zone)
-{
- Q_Q(QIviClimateControl);
- QIviClimateControl *f = qobject_cast<QIviClimateControl*>(q->zoneAt(zone));
- if (!f)
- f = q;
- if (f->zone() != zone)
- return;
- f->d_func()->m_steeringWheelHeaterAttribute = steeringWheelHeaterAttribute;
- emit f->steeringWheelHeaterAttributeChanged(steeringWheelHeaterAttribute);
-}
-
-void QIviClimateControlPrivate::onFanSpeedLevelChanged(int value, const QString &zone)
-{
- Q_Q(QIviClimateControl);
- QIviClimateControl *f = qobject_cast<QIviClimateControl*>(q->zoneAt(zone));
- if (!f)
- f = q;
- if (f->zone() != zone)
- return;
- f->d_func()->m_fanSpeedLevel = value;
- emit f->fanSpeedLevelChanged(value);
-}
-
-void QIviClimateControlPrivate::onFanSpeedLevelAttributeChanged(const QIviPropertyAttribute<int> &fanSpeedAttribute, const QString &zone)
-{
- Q_Q(QIviClimateControl);
- QIviClimateControl *f = qobject_cast<QIviClimateControl*>(q->zoneAt(zone));
- if (!f)
- f = q;
- if (f->zone() != zone)
- return;
- f->d_func()->m_fanSpeedLevelAttribute = fanSpeedAttribute;
- emit f->fanSpeedLevelAttributeChanged(fanSpeedAttribute);
-}
-
-void QIviClimateControlPrivate::onTargetTemperatureChanged(int temperature, const QString &zone)
-{
- Q_Q(QIviClimateControl);
- QIviClimateControl *f = qobject_cast<QIviClimateControl*>(q->zoneAt(zone));
- if (!f)
- f = q;
- if (f->zone() != zone)
- return;
- f->d_func()->m_targetTemperature = temperature;
- emit f->targetTemperatureChanged(temperature);
-}
-
-void QIviClimateControlPrivate::onTargetTemperatureAttributeChanged(const QIviPropertyAttribute<int> &temperatureAttribute, const QString &zone)
-{
- Q_Q(QIviClimateControl);
- QIviClimateControl *f = qobject_cast<QIviClimateControl*>(q->zoneAt(zone));
- if (!f)
- f = q;
- if (f->zone() != zone)
- return;
- f->d_func()->m_targetTemperatureAttribute = temperatureAttribute;
- emit f->targetTemperatureAttributeChanged(temperatureAttribute);
-}
-
-void QIviClimateControlPrivate::onSeatCoolerChanged(int value, const QString &zone)
-{
- Q_Q(QIviClimateControl);
- QIviClimateControl *f = qobject_cast<QIviClimateControl*>(q->zoneAt(zone));
- if (!f)
- f = q;
- if (f->zone() != zone)
- return;
- f->d_func()->m_seatCooler = value;
- emit f->seatCoolerChanged(value);
-}
-
-void QIviClimateControlPrivate::onSeatCoolerAttributeChanged(const QIviPropertyAttribute<int> &seatCoolerAttribute, const QString &zone)
-{
- Q_Q(QIviClimateControl);
- QIviClimateControl *f = qobject_cast<QIviClimateControl*>(q->zoneAt(zone));
- if (!f)
- f = q;
- if (f->zone() != zone)
- return;
- f->d_func()->m_seatCoolerAttribute = seatCoolerAttribute;
- emit f->seatCoolerAttributeChanged(seatCoolerAttribute);
-}
-
-void QIviClimateControlPrivate::onSeatHeaterChanged(int value, const QString &zone)
-{
- Q_Q(QIviClimateControl);
- QIviClimateControl *f = qobject_cast<QIviClimateControl*>(q->zoneAt(zone));
- if (!f)
- f = q;
- if (f->zone() != zone)
- return;
- f->d_func()->m_seatHeater = value;
- emit f->seatHeaterChanged(value);
-}
-
-void QIviClimateControlPrivate::onSeatHeaterAttributeChanged(const QIviPropertyAttribute<int> &seatHeaterAttribute, const QString &zone)
-{
- Q_Q(QIviClimateControl);
- QIviClimateControl *f = qobject_cast<QIviClimateControl*>(q->zoneAt(zone));
- if (!f)
- f = q;
- if (f->zone() != zone)
- return;
- f->d_func()->m_seatHeaterAttribute = seatHeaterAttribute;
- emit f->seatHeaterAttributeChanged(seatHeaterAttribute);
-}
-
-void QIviClimateControlPrivate::onOutsideTemperatureChanged(int outsideTemperature, const QString &zone)
-{
- Q_Q(QIviClimateControl);
- QIviClimateControl *f = qobject_cast<QIviClimateControl*>(q->zoneAt(zone));
- if (!f)
- f = q;
- if (f->zone() != zone)
- return;
- f->d_func()->m_outsideTemperature = outsideTemperature;
- emit f->outsideTemperatureChanged(outsideTemperature);
-}
-
-void QIviClimateControlPrivate::onOutsideTemperatureAttributeChanged(const QIviPropertyAttribute<int> &attribute, const QString &zone)
-{
- Q_Q(QIviClimateControl);
- QIviClimateControl *f = qobject_cast<QIviClimateControl*>(q->zoneAt(zone));
- if (!f)
- f = q;
- if (f->zone() != zone)
- return;
- f->d_func()->m_outsideTemperatureAttribute = attribute;
- emit f->outsideTemperatureAttributeChanged(attribute);
-}
-
-void QIviClimateControlPrivate::onZoneSynchronizationChanged(bool zoneSynchronization, const QString &zone)
-{
- Q_Q(QIviClimateControl);
- QIviClimateControl *f = qobject_cast<QIviClimateControl*>(q->zoneAt(zone));
- if (!f)
- f = q;
- if (f->zone() != zone)
- return;
- f->d_func()->m_zoneSynchronization = zoneSynchronization;
- emit f->zoneSynchronizationEnabledChanged(zoneSynchronization);
-}
-
-void QIviClimateControlPrivate::onZoneSynchronizationAttributeChanged(const QIviPropertyAttribute<bool> &attribute, const QString &zone)
-{
- Q_Q(QIviClimateControl);
- QIviClimateControl *f = qobject_cast<QIviClimateControl*>(q->zoneAt(zone));
- if (!f)
- f = q;
- if (f->zone() != zone)
- return;
- f->d_func()->m_zoneSynchronizationAttribute = attribute;
- emit f->zoneSynchronizationAttributeChanged(attribute);
-}
-
-void QIviClimateControlPrivate::onDefrostChanged(bool defrost, const QString &zone)
-{
- Q_Q(QIviClimateControl);
- QIviClimateControl *f = qobject_cast<QIviClimateControl*>(q->zoneAt(zone));
- if (!f)
- f = q;
- if (f->zone() != zone)
- return;
- f->d_func()->m_defrost = defrost;
- emit f->defrostEnabledChanged(defrost);
-}
-
-void QIviClimateControlPrivate::onDefrostAttributeChanged(const QIviPropertyAttribute<bool> &attribute, const QString &zone)
-{
- Q_Q(QIviClimateControl);
- QIviClimateControl *f = qobject_cast<QIviClimateControl*>(q->zoneAt(zone));
- if (!f)
- f = q;
- if (f->zone() != zone)
- return;
- f->d_func()->m_defrostAttribute = attribute;
- emit f->defrostAttributeChanged(attribute);
-}
-
-void QIviClimateControlPrivate::onRecirculationModeChanged(QIviClimateControl::RecirculationMode recirculationMode, const QString &zone)
-{
- Q_Q(QIviClimateControl);
- QIviClimateControl *f = qobject_cast<QIviClimateControl*>(q->zoneAt(zone));
- if (!f)
- f = q;
- if (f->zone() != zone)
- return;
- f->d_func()->m_recirculationMode = recirculationMode;
- emit f->recirculationModeChanged(recirculationMode);
-}
-
-void QIviClimateControlPrivate::onRecirculationModeAttributeChanged(const QIviPropertyAttribute<QIviClimateControl::RecirculationMode> &attribute, const QString &zone)
-{
- Q_Q(QIviClimateControl);
- QIviClimateControl *f = qobject_cast<QIviClimateControl*>(q->zoneAt(zone));
- if (!f)
- f = q;
- if (f->zone() != zone)
- return;
- f->d_func()->m_recirculationModeAttribute = attribute;
- emit f->recirculationModeAttributeChanged(attribute);
-}
-
-void QIviClimateControlPrivate::onRecirculationChanged(bool recirculation, const QString &zone)
-{
- Q_Q(QIviClimateControl);
- QIviClimateControl *f = qobject_cast<QIviClimateControl*>(q->zoneAt(zone));
- if (!f)
- f = q;
- if (f->zone() != zone)
- return;
- f->d_func()->m_recirculation = recirculation;
- emit f->recirculationEnabledChanged(recirculation);
-}
-
-void QIviClimateControlPrivate::onRecirculationAttributeChanged(const QIviPropertyAttribute<bool> &attribute, const QString &zone)
-{
- Q_Q(QIviClimateControl);
- QIviClimateControl *f = qobject_cast<QIviClimateControl*>(q->zoneAt(zone));
- if (!f)
- f = q;
- if (f->zone() != zone)
- return;
- f->d_func()->m_recirculationAttribute = attribute;
- emit f->recirculationAttributeChanged(attribute);
-}
-
-void QIviClimateControlPrivate::onRecirculationSensitivityLevelChanged(int recirculationSensitivityLevel, const QString &zone)
-{
- Q_Q(QIviClimateControl);
- QIviClimateControl *f = qobject_cast<QIviClimateControl*>(q->zoneAt(zone));
- if (!f)
- f = q;
- if (f->zone() != zone)
- return;
- f->d_func()->m_recirculationSensitivityLevel = recirculationSensitivityLevel;
- emit f->recirculationSensitivityLevelChanged(recirculationSensitivityLevel);
-}
-
-void QIviClimateControlPrivate::onRecirculationSensitivityLevelAttributeChanged(const QIviPropertyAttribute<int> &attribute, const QString &zone)
-{
- Q_Q(QIviClimateControl);
- QIviClimateControl *f = qobject_cast<QIviClimateControl*>(q->zoneAt(zone));
- if (!f)
- f = q;
- if (f->zone() != zone)
- return;
- f->d_func()->m_recirculationSensitivityLevelAttribute = attribute;
- emit f->recirculationSensitivityLevelAttributeChanged(attribute);
-}
-
-void QIviClimateControlPrivate::onClimateModeChanged(QIviClimateControl::ClimateMode climateMode, const QString &zone)
-{
- Q_Q(QIviClimateControl);
- QIviClimateControl *f = qobject_cast<QIviClimateControl*>(q->zoneAt(zone));
- if (!f)
- f = q;
- if (f->zone() != zone)
- return;
- f->d_func()->m_climateMode = climateMode;
- emit f->climateModeChanged(climateMode);
-}
-
-void QIviClimateControlPrivate::onClimateModeAttributeChanged(const QIviPropertyAttribute<QIviClimateControl::ClimateMode> &attribute, const QString &zone)
-{
- Q_Q(QIviClimateControl);
- QIviClimateControl *f = qobject_cast<QIviClimateControl*>(q->zoneAt(zone));
- if (!f)
- f = q;
- if (f->zone() != zone)
- return;
- f->d_func()->m_climateModeAttribute = attribute;
- emit f->climateModeAttributeChanged(attribute);
-}
-
-void QIviClimateControlPrivate::onAutomaticClimateFanIntensityLevelChanged(int automaticClimateFanIntensityLevel, const QString &zone)
-{
- Q_Q(QIviClimateControl);
- QIviClimateControl *f = qobject_cast<QIviClimateControl*>(q->zoneAt(zone));
- if (!f)
- f = q;
- if (f->zone() != zone)
- return;
- f->d_func()->m_automaticClimateFanIntensityLevel = automaticClimateFanIntensityLevel;
- emit f->automaticClimateFanIntensityLevelChanged(automaticClimateFanIntensityLevel);
-}
-
-void QIviClimateControlPrivate::onAutomaticClimateFanIntensityLevelAttributeChanged(const QIviPropertyAttribute<int> &attribute, const QString &zone)
-{
- Q_Q(QIviClimateControl);
- QIviClimateControl *f = qobject_cast<QIviClimateControl*>(q->zoneAt(zone));
- if (!f)
- f = q;
- if (f->zone() != zone)
- return;
- f->d_func()->m_automaticClimateFanIntensityLevelAttribute = attribute;
- emit f->automaticClimateFanIntensityLevelAttributeChanged(attribute);
-}
-
-QIviClimateControlBackendInterface *QIviClimateControlPrivate::climateControlBackend()
-{
- Q_Q(QIviClimateControl);
- return qobject_cast<QIviClimateControlBackendInterface*>(q->backend());
-}
-
-/*!
- \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 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.
-*/
-
-/*!
- \qmltype ClimateControl
- \instantiates QIviClimateControl
- \inqmlmodule QtIvi.VehicleFunctions
- \inherits AbstractZonedFeature
- \brief The ClimateControl provides a QML interface to the climate control of the vehicle.
-*/
-
-/*!
- \enum QIviClimateControl::AirflowDirection
- \value Windshield
- Direct airflow along the windshield.
- \value Dashboard
- Direct airflow through the dashboard.
- \value Floor
- Direct airflow to the floor.
-*/
-
-/*!
- \enum QIviClimateControl::RecirculationMode
- \value RecirculationOff
- The recirculation is turned off.
- \value RecirculationOn
- The recirculation is turned on.
- \value AutoRecirculation
- The recirculation is turning off and on automatically depending on the air quality.
-*/
-
-/*!
- \enum QIviClimateControl::ClimateMode
- \value ClimateOff
- The climate system is turned off.
- \value ClimateOn
- The climate system is turned on.
- \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.
-
- 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.
-*/
-QIviClimateControl::QIviClimateControl(const QString &zone, QObject *parent)
- : QIviAbstractZonedFeature(*new QIviClimateControlPrivate(QLatin1String(QIviClimateControl_iid), zone, this), parent)
-{
- qRegisterMetaType<QIviPropertyAttribute<QIviClimateControl::AirflowDirections>>();
- qRegisterMetaType<QIviPropertyAttribute<QIviClimateControl::RecirculationMode>>();
- qRegisterMetaType<QIviPropertyAttribute<QIviClimateControl::ClimateMode>>();
-}
-
-QIviClimateControl::~QIviClimateControl()
-{
-}
-
-/*!
- \reimp
-*/
-void QIviClimateControl::connectToServiceObject(QIviServiceObject *serviceObject)
-{
- Q_D(QIviClimateControl);
- QIviAbstractZonedFeature::connectToServiceObject(serviceObject);
-
- QIviClimateControlBackendInterface *backend = d->climateControlBackend();
- if (!backend)
- return;
-
- QObjectPrivate::connect(backend, &QIviClimateControlBackendInterface::targetTemperatureChanged,
- d, &QIviClimateControlPrivate::onTargetTemperatureChanged);
- QObjectPrivate::connect(backend, &QIviClimateControlBackendInterface::targetTemperatureAttributeChanged,
- d, &QIviClimateControlPrivate::onTargetTemperatureAttributeChanged);
- QObjectPrivate::connect(backend, &QIviClimateControlBackendInterface::seatCoolerChanged,
- d, &QIviClimateControlPrivate::onSeatCoolerChanged);
- QObjectPrivate::connect(backend, &QIviClimateControlBackendInterface::seatCoolerAttributeChanged,
- d, &QIviClimateControlPrivate::onSeatCoolerAttributeChanged);
- QObjectPrivate::connect(backend, &QIviClimateControlBackendInterface::seatHeaterChanged,
- d, &QIviClimateControlPrivate::onSeatHeaterChanged);
- QObjectPrivate::connect(backend, &QIviClimateControlBackendInterface::seatHeaterAttributeChanged,
- d, &QIviClimateControlPrivate::onSeatHeaterAttributeChanged);
- QObjectPrivate::connect(backend, &QIviClimateControlBackendInterface::steeringWheelHeaterChanged,
- d, &QIviClimateControlPrivate::onSteeringWheelHeaterChanged);
- QObjectPrivate::connect(backend, &QIviClimateControlBackendInterface::steeringWheelHeaterAttributeChanged,
- d, &QIviClimateControlPrivate::onSteeringWheelHeaterAttributeChanged);
- QObjectPrivate::connect(backend, &QIviClimateControlBackendInterface::fanSpeedLevelChanged,
- d, &QIviClimateControlPrivate::onFanSpeedLevelChanged);
- QObjectPrivate::connect(backend, &QIviClimateControlBackendInterface::fanSpeedLevelAttributeChanged,
- d, &QIviClimateControlPrivate::onFanSpeedLevelAttributeChanged);
- QObjectPrivate::connect(backend, &QIviClimateControlBackendInterface::airflowDirectionsChanged,
- d, &QIviClimateControlPrivate::onAirflowDirectionsChanged);
- QObjectPrivate::connect(backend, &QIviClimateControlBackendInterface::airflowDirectionsAttributeChanged,
- d, &QIviClimateControlPrivate::onAirflowDirectionsAttributeChanged);
- QObjectPrivate::connect(backend, &QIviClimateControlBackendInterface::airConditioningEnabledChanged,
- d, &QIviClimateControlPrivate::onAirConditioningEnabledChanged);
- QObjectPrivate::connect(backend, &QIviClimateControlBackendInterface::airConditioningAttributeChanged,
- d, &QIviClimateControlPrivate::onAirConditioningAttributeChanged);
- QObjectPrivate::connect(backend, &QIviClimateControlBackendInterface::heaterEnabledChanged,
- d, &QIviClimateControlPrivate::onHeaterEnabledChanged);
- QObjectPrivate::connect(backend, &QIviClimateControlBackendInterface::heaterAttributeChanged,
- d, &QIviClimateControlPrivate::onHeaterAttributeChanged);
- QObjectPrivate::connect(backend, &QIviClimateControlBackendInterface::outsideTemperatureChanged,
- d, &QIviClimateControlPrivate::onOutsideTemperatureChanged);
- QObjectPrivate::connect(backend, &QIviClimateControlBackendInterface::outsideTemperatureAttributeChanged,
- d, &QIviClimateControlPrivate::onOutsideTemperatureAttributeChanged);
- QObjectPrivate::connect(backend, &QIviClimateControlBackendInterface::zoneSynchronizationEnabledChanged,
- d, &QIviClimateControlPrivate::onZoneSynchronizationChanged);
- QObjectPrivate::connect(backend, &QIviClimateControlBackendInterface::zoneSynchronizationAttributeChanged,
- d, &QIviClimateControlPrivate::onZoneSynchronizationAttributeChanged);
- QObjectPrivate::connect(backend, &QIviClimateControlBackendInterface::defrostEnabledChanged,
- d, &QIviClimateControlPrivate::onDefrostChanged);
- QObjectPrivate::connect(backend, &QIviClimateControlBackendInterface::defrostAttributeChanged,
- d, &QIviClimateControlPrivate::onDefrostAttributeChanged);
- QObjectPrivate::connect(backend, &QIviClimateControlBackendInterface::recirculationModeChanged,
- d, &QIviClimateControlPrivate::onRecirculationModeChanged);
- QObjectPrivate::connect(backend, &QIviClimateControlBackendInterface::recirculationModeAttributeChanged,
- d, &QIviClimateControlPrivate::onRecirculationModeAttributeChanged);
- QObjectPrivate::connect(backend, &QIviClimateControlBackendInterface::recirculationEnabledChanged,
- d, &QIviClimateControlPrivate::onRecirculationChanged);
- QObjectPrivate::connect(backend, &QIviClimateControlBackendInterface::recirculationAttributeChanged,
- d, &QIviClimateControlPrivate::onRecirculationAttributeChanged);
- QObjectPrivate::connect(backend, &QIviClimateControlBackendInterface::recirculationSensitivityLevelChanged,
- d, &QIviClimateControlPrivate::onRecirculationSensitivityLevelChanged);
- QObjectPrivate::connect(backend, &QIviClimateControlBackendInterface::recirculationSensitivityLevelAttributeChanged,
- d, &QIviClimateControlPrivate::onRecirculationSensitivityLevelAttributeChanged);
- QObjectPrivate::connect(backend, &QIviClimateControlBackendInterface::climateModeChanged,
- d, &QIviClimateControlPrivate::onClimateModeChanged);
- QObjectPrivate::connect(backend, &QIviClimateControlBackendInterface::climateModeAttributeChanged,
- d, &QIviClimateControlPrivate::onClimateModeAttributeChanged);
- QObjectPrivate::connect(backend, &QIviClimateControlBackendInterface::automaticClimateFanIntensityLevelChanged,
- d, &QIviClimateControlPrivate::onAutomaticClimateFanIntensityLevelChanged);
- QObjectPrivate::connect(backend, &QIviClimateControlBackendInterface::automaticClimateFanIntensityLevelAttributeChanged,
- d, &QIviClimateControlPrivate::onAutomaticClimateFanIntensityLevelAttributeChanged);
-
- backend->initializeAttributes();
-}
-
-/*!
- \reimp
-*/
-void QIviClimateControl::clearServiceObject()
-{
- Q_D(QIviClimateControl);
- d->clearToDefaults();
- QIviAbstractZonedFeature::clearServiceObject();
-}
-
-QIviClimateControl::QIviClimateControl(QIviClimateControlPrivate &dd, QObject *parent)
- : QIviAbstractZonedFeature(dd, parent)
-{
-}
-
-/*!
- \reimp
-*/
-QIviAbstractZonedFeature *QIviClimateControl::createZoneFeature(const QString &zone)
-{
- return new QIviClimateControl(zone, this);
-}
-/*!
- \qmlqtivipropertyBool {QtIvi.VehicleFunctions::ClimateControl::airConditioning}
-
- \e value is true if the air conditioning is enabled.
-*/
-/*!
- \property QIviClimateControl::airConditioning
-
- Holds a QIviProperty of type \e bool where the QIviProperty::value() function indicates if air conditioning is enabled.
-
- \sa AttributeSystem
- \sa isAirConditioningEnabled() setAirConditioningEnabled() airConditioningAttribute()
- */
-/*!
- * Returns true if air conditioning is enabled.
- *
- * \sa setAirConditioningEnabled() airConditioningEnabledChanged() airConditioningAttribute()
- */
-bool QIviClimateControl::isAirConditioningEnabled() const
-{
- Q_D(const QIviClimateControl);
- return d->m_airConditioning;
-}
-
-/*!
- * 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);
- return d->m_airConditioningAttribute;
-}
-
-QIviProperty *QIviClimateControl::airConditioningProperty() const
-{
- Q_D(const QIviClimateControl);
- return d->m_airConditioningProperty;
-}
-
-/*!
- \qmlqtivipropertyEnum {QtIvi.VehicleFunctions::ClimateControl::airflowDirections}
-
- \e value holds the airflow directions.
- Available values are:
- \value Windshield
- Direct airflow along the windshield.
- \value Dashboard
- Direct airflow through the dashboard.
- \value Floor
- Direct airflow to the floor.
- */
-/*!
- \property QIviClimateControl::airflowDirections
-
- 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()
- */
-/*!
- * Returns the current air flow direction.
- *
- * \sa setAirflowDirections() airflowDirectionsChanged() airflowDirectionsAttribute()
- */
-QIviClimateControl::AirflowDirections QIviClimateControl::airflowDirections() const
-{
- Q_D(const QIviClimateControl);
- return d->m_airflowDirections;
-}
-
-/*!
- * 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);
- return d->m_airflowDirectionsAttribute;
-}
-
-QIviProperty *QIviClimateControl::airflowDirectionsProperty() const
-{
- Q_D(const QIviClimateControl);
- return d->m_airFlowDirectionProperty;
-}
-
-/*!
- \qmlqtivipropertyBool {QtIvi.VehicleFunctions::ClimateControl::heater}
-
- \e value is true if the heater is enabled.
-*/
-/*!
- \property QIviClimateControl::heater
-
- Holds a QIviProperty of type \e bool where the QIviProperty::value() function indicates if the heater is enabled.
-
- \sa AttributeSystem
- \sa isHeaterEnabled() setHeaterEnabled() heaterAttribute()
- */
-
-/*!
- * Returns true if the heater is enabled.
- *
- * \sa setHeaterEnabled() heaterEnabledChanged() heaterAttribute()
- */
-bool QIviClimateControl::isHeaterEnabled() const
-{
- Q_D(const QIviClimateControl);
- return d->m_heater;
-}
-
-/*!
- * 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);
- return d->m_heaterAttribute;
-}
-
-QIviProperty *QIviClimateControl::heaterProperty() const
-{
- Q_D(const QIviClimateControl);
- return d->m_heaterProperty;
-}
-
-/*!
- \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
-
- 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()
- */
-/*!
- * 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);
- return d->m_steeringWheelHeater;
-}
-
-/*!
- * 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);
- return d->m_steeringWheelHeaterAttribute;
-}
-
-QIviProperty *QIviClimateControl::steeringWheelHeaterProperty() const
-{
- Q_D(const QIviClimateControl);
- return d->m_steeringWheelHeaterProperty;
-}
-
-/*!
- \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
-
- Holds a QIviProperty of type \e int where the QIviProperty::value() function returns the current fan speed level.
-
- \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()
- */
-int QIviClimateControl::fanSpeedLevel() const
-{
- Q_D(const QIviClimateControl);
- return d->m_fanSpeedLevel;
-}
-
-/*!
- * 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);
- return d->m_fanSpeedLevelAttribute;
-}
-
-QIviProperty *QIviClimateControl::fanSpeedLevelProperty() const
-{
- Q_D(const QIviClimateControl);
- return d->m_fanSpeedLevelProperty;
-}
-
-/*!
- \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).
- */
-/*!
- \property QIviClimateControl::targetTemperature
-
- Holds a QIviProperty of type \e int where the QIviProperty::value() function returns the current target temperature.
-
- \sa AttributeSystem
- \sa targetTemperature() setTargetTemperature() targetTemperatureAttribute()
- */
-/*!
- * Returns the current target temperature expressed in centigrates.
- *
- * \sa setTargetTemperature() targetTemperatureChanged() targetTemperatureAttribute()
- */
-int QIviClimateControl::targetTemperature() const
-{
- Q_D(const QIviClimateControl);
- return d->m_targetTemperature;
-}
-
-/*!
- * 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);
- return d->m_targetTemperatureAttribute;
-}
-
-QIviProperty *QIviClimateControl::targetTemperatureProperty() const
-{
- Q_D(const QIviClimateControl);
- return d->m_targetTemperatureProperty;
-}
-
-/*!
- \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
-
- Holds a QIviProperty of type \e int where the QIviProperty::value() function returns the current seat cooler level.
-
- \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()
- */
-int QIviClimateControl::seatCooler() const
-{
- Q_D(const QIviClimateControl);
- return d->m_seatCooler;
-}
-
-/*!
- * 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);
- return d->m_seatCoolerAttribute;
-}
-
-QIviProperty *QIviClimateControl::seatCoolerProperty() const
-{
- Q_D(const QIviClimateControl);
- return d->m_seatCoolerProperty;
-}
-
-/*!
- \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
-
- Holds a QIviProperty of type \e int where the QIviProperty::value() function returns the current seat heater level.
-
- \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()
- */
-int QIviClimateControl::seatHeater() const
-{
- Q_D(const QIviClimateControl);
- return d->m_seatHeater;
-}
-
-/*!
- * 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);
- return d->m_seatHeaterAttribute;
-}
-
-QIviProperty *QIviClimateControl::seatHeaterProperty() const
-{
- Q_D(const QIviClimateControl);
- return d->m_seatHeaterProperty;
-}
-
-/*!
- \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).
- */
-/*!
- \property QIviClimateControl::outsideTemperature
-
- Holds a QIviProperty of type \e int where the QIviProperty::value() function returns the current outside temperature.
-
- \sa AttributeSystem
- \sa outsideTemperature() outsideTemperatureAttribute()
- */
-/*!
- * Returns the current outside temperature expressed in centigrates.
- *
- * \sa outsideTemperatureChanged() outsideTemperatureAttribute()
- */
-int QIviClimateControl::outsideTemperature() const
-{
- Q_D(const QIviClimateControl);
- return d->m_outsideTemperature;
-}
-
-/*!
- * 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);
- return d->m_outsideTemperatureAttribute;
-}
-
-QIviProperty *QIviClimateControl::outsideTemperatureProperty() const
-{
- Q_D(const QIviClimateControl);
- return d->m_outsideTemperatureProperty;
-}
-
-/*!
- \qmlqtivipropertyBool {QtIvi.VehicleFunctions::ClimateControl::zoneSynchronization}
-
- \e value is true if the zone synchronization is enabled.
-
- Which zones and properties are synchronized is controlled by the backend implementing it.
-*/
-/*!
- \property QIviClimateControl::zoneSynchronization
-
- 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.
-
- \sa AttributeSystem
- \sa isZoneSynchronizationEnabled() setZoneSynchronizationEnabled() zoneSynchronizationAttribute()
- */
-/*!
- * Returns true if zone synchronization is enabled.
- *
- * \sa setZoneSynchronizationEnabled() zoneSynchronizationEnabledChanged() zoneSynchronizationAttribute()
- */
-bool QIviClimateControl::isZoneSynchronizationEnabled() const
-{
- Q_D(const QIviClimateControl);
- return d->m_zoneSynchronization;
-}
-
-/*!
- * 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);
- return d->m_zoneSynchronizationAttribute;
-}
-
-QIviProperty *QIviClimateControl::zoneSynchronizationProperty() const
-{
- Q_D(const QIviClimateControl);
- return d->m_zoneSynchronizationProperty;
-}
-
-/*!
- \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.
-*/
-/*!
- \property QIviClimateControl::defrost
-
- Holds a QIviProperty of type \e bool where the QIviProperty::value() function indicates if defrost is enabled.
-
- \sa AttributeSystem
- \sa isDefrostEnabled() setDefrostEnabled() defrostAttribute()
- */
-/*!
- * Returns true if defrost is enabled.
- *
- * \sa setDefrostEnabled() defrostEnabledChanged() defrostAttribute()
- */
-bool QIviClimateControl::isDefrostEnabled() const
-{
- Q_D(const QIviClimateControl);
- return d->m_defrost;
-}
-
-/*!
- * 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);
- return d->m_defrostAttribute;
-}
-
-QIviProperty *QIviClimateControl::defrostProperty() const
-{
- Q_D(const QIviClimateControl);
- return d->m_defrostProperty;
-}
-
-/*!
- \qmlqtivipropertyEnum {QtIvi.VehicleFunctions::ClimateControl::recirculationMode}
-
- \e value holds the recirculation mode.
- Available values are:
- \value RecirculationOff
- The recirculation is turned off.
- \value RecirculationOn
- The recirculation is turned on.
- \value AutoRecirculation
- The recirculation is turning off and on automatically depending on the air quality.
- */
-/*!
- \property QIviClimateControl::recirculationMode
-
- Holds a QIviProperty of type \e QIviClimateControl::RecirculationMode where the QIviProperty::value() function returns the current recirculation mode.
-
- \sa AttributeSystem
- \sa recirculationMode() setRecirculationMode() recirculationModeAttribute()
- */
-/*!
- * Returns the current recirculation mode.
- *
- * \sa setRecirculationMode() recirculationModeChanged() recirculationModeAttribute()
- */
-QIviClimateControl::RecirculationMode QIviClimateControl::recirculationMode() const
-{
- Q_D(const QIviClimateControl);
- return d->m_recirculationMode;
-}
-
-/*!
- * 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);
- return d->m_recirculationModeAttribute;
-}
-
-QIviProperty *QIviClimateControl::recirculationModeProperty() const
-{
- Q_D(const QIviClimateControl);
- return d->m_recirculationModeProperty;
-}
-
-/*!
- \qmlqtivipropertyBool {QtIvi.VehicleFunctions::ClimateControl::recirculation}
-
- \e value is true if the recirculation is currently running.
-*/
-/*!
- \property QIviClimateControl::recirculation
-
- Holds a QIviProperty of type \e bool where the QIviProperty::value() function indicates if recirculation is running.
-
- \sa AttributeSystem
- \sa isRecirculationEnabled() recirculationAttribute()
- */
-/*!
- * Returns true if defrost is enabled.
- *
- * \sa recirculationEnabledChanged() recirculationAttribute()
- */
-bool QIviClimateControl::isRecirculationEnabled() const
-{
- Q_D(const QIviClimateControl);
- return d->m_recirculation;
-}
-
-/*!
- * Returns the attribute defining the boundaries and availability of the recirculation property.
- *
- * \sa isRecirculationEnabled() recirculationEnabledChanged()
- */
-QIviPropertyAttribute<bool> QIviClimateControl::recirculationAttribute() const
-{
- Q_D(const QIviClimateControl);
- return d->m_recirculationAttribute;
-}
-
-QIviProperty *QIviClimateControl::recirculationProperty() const
-{
- Q_D(const QIviClimateControl);
- return d->m_recirculationProperty;
-}
-
-/*!
- \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
-
- 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()
- */
-/*!
- * 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);
- return d->m_recirculationSensitivityLevel;
-}
-
-/*!
- * 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);
- return d->m_recirculationSensitivityLevelAttribute;
-}
-
-QIviProperty *QIviClimateControl::recirculationSensitivityLevelProperty() const
-{
- Q_D(const QIviClimateControl);
- return d->m_recirculationSensitivityLevelProperty;
-}
-
-/*!
- \qmlqtivipropertyEnum {QtIvi.VehicleFunctions::ClimateControl::climateMode}
-
- \e value holds the climate mode.
- Available values are:
- \value ClimateOff
- The climate system is turned off.
- \value ClimateOn
- The climate system is turned on.
- \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
-
- Holds a QIviProperty of type \e QIviClimateControl::ClimateMode where the QIviProperty::value() function returns the current climate mode.
-
- \sa AttributeSystem
- \sa climateMode() setClimateMode() climateModeAttribute()
- */
-/*!
- * Returns the current climate mode.
- *
- * \sa setClimateMode() climateModeChanged() climateModeAttribute()
- */
-QIviClimateControl::ClimateMode QIviClimateControl::climateMode() const
-{
- Q_D(const QIviClimateControl);
- return d->m_climateMode;
-}
-
-/*!
- * 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);
- return d->m_climateModeAttribute;
-}
-
-QIviProperty *QIviClimateControl::climateModeProperty() const
-{
- Q_D(const QIviClimateControl);
- return d->m_climateModeProperty;
-}
-
-/*!
- \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
-
- 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()
- */
-/*!
- * 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);
- return d->m_automaticClimateFanIntensityLevel;
-}
-
-/*!
- * 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);
- return d->m_automaticClimateFanIntensityLevelAttribute;
-}
-
-QIviProperty *QIviClimateControl::automaticClimateFanIntensityLevelProperty() const
-{
- Q_D(const QIviClimateControl);
- return d->m_automaticClimateFanIntensityLevelProperty;
-}
-
-/*!
- * 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);
- if (QIviClimateControlBackendInterface *backend = d->climateControlBackend())
- backend->setAirConditioningEnabled(enabled, zone());
-}
-
-/*!
- * Sets the air flow direction to \a direction.
- *
- * \sa airflowDirections() airflowDirectionsChanged() airflowDirectionsAttribute()
- */
-void QIviClimateControl::setAirflowDirections(QIviClimateControl::AirflowDirections direction)
-{
- Q_D(QIviClimateControl);
- if (QIviClimateControlBackendInterface *backend = d->climateControlBackend())
- backend->setAirflowDirections(direction, zone());
-}
-
-/*!
- * 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);
- if (QIviClimateControlBackendInterface *backend = d->climateControlBackend())
- backend->setHeaterEnabled(enabled, zone());
-}
-
-/*!
- * 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);
- if (QIviClimateControlBackendInterface *backend = d->climateControlBackend())
- backend->setSteeringWheelHeater(value, zone());
-}
-
-/*!
- * 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);
- if (QIviClimateControlBackendInterface *backend = d->climateControlBackend())
- backend->setFanSpeedLevel(value, zone());
-}
-
-/*!
- * Sets the current target temperature to \a temperature expressed in centigrades.
- *
- * \sa targetTemperature() targetTemperatureChanged() targetTemperatureAttribute()
- */
-void QIviClimateControl::setTargetTemperature(int temperature)
-{
- Q_D(QIviClimateControl);
- if (QIviClimateControlBackendInterface *backend = d->climateControlBackend())
- backend->setTargetTemperature(temperature, zone());
-}
-
-/*!
- * 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);
- if (QIviClimateControlBackendInterface *backend = d->climateControlBackend())
- backend->setSeatCooler(value, zone());
-}
-
-/*!
- * 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);
- if (QIviClimateControlBackendInterface *backend = d->climateControlBackend())
- backend->setSeatHeater(value, zone());
-}
-
-/*!
- * 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);
- if (QIviClimateControlBackendInterface *backend = d->climateControlBackend())
- backend->setZoneSynchronizationEnabled(enabled, zone());
-}
-
-/*!
- * 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);
- if (QIviClimateControlBackendInterface *backend = d->climateControlBackend())
- backend->setDefrostEnabled(enabled, zone());
-}
-
-/*!
- * Sets the recirculation mode to \a recirculationMode.
- *
- * \sa recirculationMode() recirculationModeChanged() recirculationModeAttribute()
- */
-void QIviClimateControl::setRecirculationMode(QIviClimateControl::RecirculationMode recirculationMode)
-{
- Q_D(QIviClimateControl);
- if (QIviClimateControlBackendInterface *backend = d->climateControlBackend())
- backend->setRecirculationMode(recirculationMode, zone());
-}
-
-/*!
- * 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);
- if (QIviClimateControlBackendInterface *backend = d->climateControlBackend())
- backend->setRecirculationSensitivityLevel(value, zone());
-}
-
-/*!
- * Sets the climate mode to \a climateMode.
- *
- * \sa climateMode() climateModeChanged() climateModeAttribute()
- */
-void QIviClimateControl::setClimateMode(QIviClimateControl::ClimateMode climateMode)
-{
- Q_D(QIviClimateControl);
- if (QIviClimateControlBackendInterface *backend = d->climateControlBackend())
- backend->setClimateMode(climateMode, zone());
-}
-
-/*!
- * 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);
- if (QIviClimateControlBackendInterface *backend = d->climateControlBackend())
- backend->setAutomaticClimateFanIntensityLevel(value, zone());
-}
-
-/*!
- * \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"
diff --git a/src/ivivehiclefunctions/qiviclimatecontrol.h b/src/ivivehiclefunctions/qiviclimatecontrol.h
deleted file mode 100644
index 2faf2ce..0000000
--- a/src/ivivehiclefunctions/qiviclimatecontrol.h
+++ /dev/null
@@ -1,249 +0,0 @@
-/****************************************************************************
-**
-** 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 CLIMATECONTROL_H
-#define CLIMATECONTROL_H
-
-#include <QtIviCore/QIviAbstractZonedFeature>
-#include <QtIviCore/QIviProperty>
-#include <QtIviVehicleFunctions/qtivivehiclefunctionsglobal.h>
-
-QT_BEGIN_NAMESPACE
-
-class QIviClimateControlBackendInterface;
-class QIviClimateControlPrivate;
-
-class Q_QTIVIVEHICLEFUNCTIONS_EXPORT QIviClimateControl : public QIviAbstractZonedFeature
-{
- Q_OBJECT
- Q_PROPERTY(QIviProperty *airConditioning READ airConditioningProperty CONSTANT)
- Q_PROPERTY(QIviProperty *airflowDirections READ airflowDirectionsProperty CONSTANT)
- Q_PROPERTY(QIviProperty *heater READ heaterProperty CONSTANT)
- Q_PROPERTY(QIviProperty *fanSpeedLevel READ fanSpeedLevelProperty CONSTANT)
- Q_PROPERTY(QIviProperty *steeringWheelHeater READ steeringWheelHeaterProperty CONSTANT)
- Q_PROPERTY(QIviProperty *targetTemperature READ targetTemperatureProperty CONSTANT)
- Q_PROPERTY(QIviProperty *seatCooler READ seatCoolerProperty CONSTANT)
- Q_PROPERTY(QIviProperty *seatHeater READ seatHeaterProperty CONSTANT)
- Q_PROPERTY(QIviProperty *outsideTemperature READ outsideTemperatureProperty CONSTANT)
- Q_PROPERTY(QIviProperty *zoneSynchronization READ zoneSynchronizationProperty CONSTANT)
- Q_PROPERTY(QIviProperty *defrost READ defrostProperty CONSTANT)
- Q_PROPERTY(QIviProperty *recirculationMode READ recirculationModeProperty CONSTANT)
- Q_PROPERTY(QIviProperty *recirculation READ recirculationProperty CONSTANT)
- Q_PROPERTY(QIviProperty *recirculationSensitivityLevel READ recirculationSensitivityLevelProperty CONSTANT)
- Q_PROPERTY(QIviProperty *climateMode READ climateModeProperty CONSTANT)
- Q_PROPERTY(QIviProperty *automaticClimateFanIntensityLevel READ automaticClimateFanIntensityLevelProperty CONSTANT)
-
-public:
- enum AirflowDirection {
- Windshield = 0x1,
- Dashboard = 0x2,
- Floor = 0x4
- };
- Q_DECLARE_FLAGS(AirflowDirections, AirflowDirection)
- Q_FLAG(AirflowDirections)
-
- enum RecirculationMode {
- RecirculationOff,
- RecirculationOn,
- AutoRecirculation
- };
- Q_ENUM(RecirculationMode)
-
- enum ClimateMode {
- ClimateOff,
- ClimateOn,
- AutoClimate
- };
- Q_ENUM(ClimateMode)
-
- QIviClimateControl(const QString &zone = QString(), QObject *parent = Q_NULLPTR);
- ~QIviClimateControl();
-
- bool isAirConditioningEnabled() const;
- QIviPropertyAttribute<bool> airConditioningAttribute() const;
- QIviProperty *airConditioningProperty() const;
- QIviClimateControl::AirflowDirections airflowDirections() const;
- QIviPropertyAttribute<QIviClimateControl::AirflowDirections> airflowDirectionsAttribute() const;
- QIviProperty *airflowDirectionsProperty() const;
- bool isHeaterEnabled() const;
- QIviPropertyAttribute<bool> heaterAttribute() const;
- QIviProperty *heaterProperty() const;
- int steeringWheelHeater() const;
- QIviPropertyAttribute<int> steeringWheelHeaterAttribute() const;
- QIviProperty *steeringWheelHeaterProperty() const;
- int fanSpeedLevel() const;
- QIviPropertyAttribute<int> fanSpeedLevelAttribute() const;
- QIviProperty *fanSpeedLevelProperty() const;
- int targetTemperature() const;
- QIviPropertyAttribute<int> targetTemperatureAttribute() const;
- QIviProperty *targetTemperatureProperty() const;
- int seatCooler() const;
- QIviPropertyAttribute<int> seatCoolerAttribute() const;
- QIviProperty *seatCoolerProperty() const;
- int seatHeater() const;
- QIviPropertyAttribute<int> seatHeaterAttribute() const;
- QIviProperty *seatHeaterProperty() const;
- int outsideTemperature() const;
- QIviPropertyAttribute<int> outsideTemperatureAttribute() const;
- QIviProperty *outsideTemperatureProperty() const;
- bool isZoneSynchronizationEnabled() const;
- QIviPropertyAttribute<bool> zoneSynchronizationAttribute() const;
- QIviProperty *zoneSynchronizationProperty() const;
- bool isDefrostEnabled() const;
- QIviPropertyAttribute<bool> defrostAttribute() const;
- QIviProperty *defrostProperty() const;
- QIviClimateControl::RecirculationMode recirculationMode() const;
- QIviPropertyAttribute<QIviClimateControl::RecirculationMode> recirculationModeAttribute() const;
- QIviProperty *recirculationModeProperty() const;
- bool isRecirculationEnabled() const;
- QIviPropertyAttribute<bool> recirculationAttribute() const;
- QIviProperty *recirculationProperty() const;
- int recirculationSensitivityLevel() const;
- QIviPropertyAttribute<int> recirculationSensitivityLevelAttribute() const;
- QIviProperty *recirculationSensitivityLevelProperty() const;
- QIviClimateControl::ClimateMode climateMode() const;
- QIviPropertyAttribute<QIviClimateControl::ClimateMode> climateModeAttribute() const;
- QIviProperty *climateModeProperty() const;
- int automaticClimateFanIntensityLevel() const;
- QIviPropertyAttribute<int> automaticClimateFanIntensityLevelAttribute() const;
- QIviProperty *automaticClimateFanIntensityLevelProperty() const;
-
-public Q_SLOTS:
- void setAirConditioningEnabled(bool enabled);
- void setAirflowDirections(QIviClimateControl::AirflowDirections value);
- void setHeaterEnabled(bool enabled);
- void setSteeringWheelHeater(int value);
- void setFanSpeedLevel(int value);
- void setTargetTemperature(int targetTemperature);
- void setSeatCooler(int seatCooler);
- void setSeatHeater(int seatHeater);
- void setZoneSynchronizationEnabled(bool enabled);
- void setDefrostEnabled(bool enabled);
- void setRecirculationMode(QIviClimateControl::RecirculationMode recirculationMode);
- void setRecirculationSensitivityLevel(int value);
- void setClimateMode(QIviClimateControl::ClimateMode climateMode);
- void setAutomaticClimateFanIntensityLevel(int value);
-
-Q_SIGNALS:
- void airflowDirectionsChanged(QIviClimateControl::AirflowDirections value);
- void airflowDirectionsAttributeChanged(const QIviPropertyAttribute<QIviClimateControl::AirflowDirections> &attribute);
- void airConditioningEnabledChanged(bool enabled);
- void airConditioningAttributeChanged(const QIviPropertyAttribute<bool> &attribute);
- void heaterEnabledChanged(bool enabled);
- void heaterAttributeChanged(const QIviPropertyAttribute<bool> &attribute);
- void steeringWheelHeaterChanged(int value);
- void steeringWheelHeaterAttributeChanged(const QIviPropertyAttribute<int> &attribute);
- void fanSpeedLevelChanged(int value);
- void fanSpeedLevelAttributeChanged(const QIviPropertyAttribute<int> &attribute);
- void targetTemperatureChanged(int temperature);
- void targetTemperatureAttributeChanged(const QIviPropertyAttribute<int> &attribute);
- void seatCoolerChanged(int value);
- void seatCoolerAttributeChanged(const QIviPropertyAttribute<int> &attribute);
- void seatHeaterChanged(int value);
- void seatHeaterAttributeChanged(const QIviPropertyAttribute<int> &attribute);
- void outsideTemperatureChanged(int value);
- void outsideTemperatureAttributeChanged(const QIviPropertyAttribute<int> &attribute);
- void zoneSynchronizationEnabledChanged(bool enabled);
- void zoneSynchronizationAttributeChanged(const QIviPropertyAttribute<bool> &attribute);
- void defrostEnabledChanged(bool enabled);
- void defrostAttributeChanged(const QIviPropertyAttribute<bool> &attribute);
- void recirculationModeChanged(QIviClimateControl::RecirculationMode value);
- void recirculationModeAttributeChanged(const QIviPropertyAttribute<QIviClimateControl::RecirculationMode> &attribute);
- void recirculationEnabledChanged(bool enabled);
- void recirculationAttributeChanged(const QIviPropertyAttribute<bool> &attribute);
- void recirculationSensitivityLevelChanged(int value);
- void recirculationSensitivityLevelAttributeChanged(const QIviPropertyAttribute<int> &attribute);
- void climateModeChanged(QIviClimateControl::ClimateMode value);
- void climateModeAttributeChanged(const QIviPropertyAttribute<QIviClimateControl::ClimateMode> &attribute);
- void automaticClimateFanIntensityLevelChanged(int value);
- void automaticClimateFanIntensityLevelAttributeChanged(const QIviPropertyAttribute<int> &attribute);
-
-protected:
- QIviClimateControl(QIviClimateControlPrivate &dd, QObject *parent = Q_NULLPTR);
- virtual QIviAbstractZonedFeature *createZoneFeature(const QString &zone) Q_DECL_OVERRIDE;
-
- virtual void connectToServiceObject(QIviServiceObject *serviceObject) Q_DECL_OVERRIDE;
- virtual void clearServiceObject() Q_DECL_OVERRIDE;
-
-private:
- Q_DECLARE_PRIVATE(QIviClimateControl)
- Q_PRIVATE_SLOT(d_func(), void onAirflowDirectionsChanged(QIviClimateControl::AirflowDirections value, const QString &zone))
- Q_PRIVATE_SLOT(d_func(), void onAirflowDirectionsAttributeChanged(const QIviPropertyAttribute<QIviClimateControl::AirflowDirections> &airflowDirectionsAttribute, const QString &zone))
- Q_PRIVATE_SLOT(d_func(), void onAirConditioningEnabledChanged(bool enabled, const QString &zone))
- Q_PRIVATE_SLOT(d_func(), void onAirConditioningAttributeChanged(const QIviPropertyAttribute<bool> &airConditioningEnabledAttribute, const QString &zone))
- Q_PRIVATE_SLOT(d_func(), void onHeaterEnabledChanged(bool enabled, const QString &zone))
- Q_PRIVATE_SLOT(d_func(), void onHeaterAttributeChanged(const QIviPropertyAttribute<bool> &heaterEnabledAttribute, const QString &zone))
- Q_PRIVATE_SLOT(d_func(), void onSteeringWheelHeaterChanged(int value, const QString &zone))
- Q_PRIVATE_SLOT(d_func(), void onSteeringWheelHeaterAttributeChanged(const QIviPropertyAttribute<int> &steeringWheelHeaterAttribute, const QString &zone))
- Q_PRIVATE_SLOT(d_func(), void onFanSpeedLevelChanged(int value, const QString &zone))
- Q_PRIVATE_SLOT(d_func(), void onFanSpeedLevelAttributeChanged(const QIviPropertyAttribute<int> &fanSpeedAttribute, const QString &zone))
- Q_PRIVATE_SLOT(d_func(), void onTargetTemperatureChanged(int temperature, const QString &zone))
- Q_PRIVATE_SLOT(d_func(), void onTargetTemperatureAttributeChanged(const QIviPropertyAttribute<int> &temperatureAttribute, const QString &zone))
- Q_PRIVATE_SLOT(d_func(), void onSeatCoolerChanged(int value, const QString &zone))
- Q_PRIVATE_SLOT(d_func(), void onSeatCoolerAttributeChanged(const QIviPropertyAttribute<int> &seatCoolerAttribute, const QString &zone))
- Q_PRIVATE_SLOT(d_func(), void onSeatHeaterChanged(int value, const QString &zone))
- Q_PRIVATE_SLOT(d_func(), void onSeatHeaterAttributeChanged(const QIviPropertyAttribute<int> &seatHeaterAttribute, const QString &zone))
- Q_PRIVATE_SLOT(d_func(), void onOutsideTemperatureChanged(int outsideTemperature, const QString &zone))
- Q_PRIVATE_SLOT(d_func(), void onOutsideTemperatureAttributeChanged(const QIviPropertyAttribute<int> &attribute, const QString &zone))
- Q_PRIVATE_SLOT(d_func(), void onZoneSynchronizationChanged(bool isZoneSynchronizationEnabled, const QString &zone))
- Q_PRIVATE_SLOT(d_func(), void onZoneSynchronizationAttributeChanged(const QIviPropertyAttribute<bool> &attribute, const QString &zone))
- Q_PRIVATE_SLOT(d_func(), void onDefrostChanged(bool isDefrostEnabled, const QString &zone))
- Q_PRIVATE_SLOT(d_func(), void onDefrostAttributeChanged(const QIviPropertyAttribute<bool> &attribute, const QString &zone))
- Q_PRIVATE_SLOT(d_func(), void onRecirculationModeChanged(QIviClimateControl::RecirculationMode recirculationMode, const QString &zone))
- Q_PRIVATE_SLOT(d_func(), void onRecirculationModeAttributeChanged(const QIviPropertyAttribute<QIviClimateControl::RecirculationMode> &attribute, const QString &zone))
- Q_PRIVATE_SLOT(d_func(), void onRecirculationChanged(bool isRecirculationEnabled, const QString &zone))
- Q_PRIVATE_SLOT(d_func(), void onRecirculationAttributeChanged(const QIviPropertyAttribute<bool> &attribute, const QString &zone))
- Q_PRIVATE_SLOT(d_func(), void onRecirculationSensitivityLevelChanged(int recirculationSensitivityLevel, const QString &zone))
- Q_PRIVATE_SLOT(d_func(), void onRecirculationSensitivityLevelAttributeChanged(const QIviPropertyAttribute<int> &attribute, const QString &zone))
- Q_PRIVATE_SLOT(d_func(), void onClimateModeChanged(QIviClimateControl::ClimateMode climateMode, const QString &zone))
- Q_PRIVATE_SLOT(d_func(), void onClimateModeAttributeChanged(const QIviPropertyAttribute<QIviClimateControl::ClimateMode> &attribute, const QString &zone))
- Q_PRIVATE_SLOT(d_func(), void onAutomaticClimateFanIntensityLevelChanged(int automaticClimateFanIntensityLevel, const QString &zone))
- Q_PRIVATE_SLOT(d_func(), void onAutomaticClimateFanIntensityLevelAttributeChanged(const QIviPropertyAttribute<int> &attribute, const QString &zone))
-};
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(QIviPropertyAttribute<QIviClimateControl::AirflowDirections>)
-Q_DECLARE_METATYPE(QIviPropertyAttribute<QIviClimateControl::RecirculationMode>)
-Q_DECLARE_METATYPE(QIviPropertyAttribute<QIviClimateControl::ClimateMode>)
-Q_DECLARE_OPERATORS_FOR_FLAGS(QIviClimateControl::AirflowDirections)
-
-#endif // CLIMATECONTROL_H
diff --git a/src/ivivehiclefunctions/qiviclimatecontrol_p.h b/src/ivivehiclefunctions/qiviclimatecontrol_p.h
deleted file mode 100644
index 38502a0..0000000
--- a/src/ivivehiclefunctions/qiviclimatecontrol_p.h
+++ /dev/null
@@ -1,162 +0,0 @@
-/****************************************************************************
-**
-** 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 QIVICLIMATECONTROL_P_H
-#define QIVICLIMATECONTROL_P_H
-
-//
-// 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 <private/qtivivehiclefunctionsglobal_p.h>
-#include <QtIviCore/QIviProperty>
-#include "private/qiviabstractzonedfeature_p.h"
-
-#include "qiviclimatecontrol.h"
-
-QT_BEGIN_NAMESPACE
-
-class QIviClimateControlPrivate : public QIviAbstractZonedFeaturePrivate
-{
-public:
- QIviClimateControlPrivate(const QString &interface, const QString &zone, QIviClimateControl *parent);
-
- virtual void initialize() Q_DECL_OVERRIDE;
- void clearToDefaults();
-
- void onAirflowDirectionsChanged(QIviClimateControl::AirflowDirections value, const QString &zone);
- void onAirflowDirectionsAttributeChanged(const QIviPropertyAttribute<QIviClimateControl::AirflowDirections> &airflowDirectionsAttribute, const QString &zone);
- void onAirConditioningEnabledChanged(bool enabled, const QString &zone);
- void onAirConditioningAttributeChanged(const QIviPropertyAttribute<bool> &airConditioningEnabledAttribute, const QString &zone);
- void onHeaterEnabledChanged(bool enabled, const QString &zone);
- void onHeaterAttributeChanged(const QIviPropertyAttribute<bool> &heaterEnabledAttribute, const QString &zone);
- void onSteeringWheelHeaterChanged(int value, const QString &zone);
- void onSteeringWheelHeaterAttributeChanged(const QIviPropertyAttribute<int> &steeringWheelHeaterAttribute, const QString &zone);
- void onFanSpeedLevelChanged(int value, const QString &zone);
- void onFanSpeedLevelAttributeChanged(const QIviPropertyAttribute<int> &fanSpeedAttribute, const QString &zone);
- void onTargetTemperatureChanged(int temperature, const QString &zone);
- void onTargetTemperatureAttributeChanged(const QIviPropertyAttribute<int> &temperatureAttribute, const QString &zone);
- void onSeatCoolerChanged(int value, const QString &zone);
- void onSeatCoolerAttributeChanged(const QIviPropertyAttribute<int> &seatCoolerAttribute, const QString &zone);
- void onSeatHeaterChanged(int value, const QString &zone);
- void onSeatHeaterAttributeChanged(const QIviPropertyAttribute<int> &seatHeaterAttribute, const QString &zone);
- void onOutsideTemperatureChanged(int outsideTemperature, const QString &zone);
- void onOutsideTemperatureAttributeChanged(const QIviPropertyAttribute<int> &attribute, const QString &zone);
- void onZoneSynchronizationChanged(bool zoneSynchronization, const QString &zone);
- void onZoneSynchronizationAttributeChanged(const QIviPropertyAttribute<bool> &attribute, const QString &zone);
- void onDefrostChanged(bool defrost, const QString &zone);
- void onDefrostAttributeChanged(const QIviPropertyAttribute<bool> &attribute, const QString &zone);
- void onRecirculationModeChanged(QIviClimateControl::RecirculationMode recirculationMode, const QString &zone);
- void onRecirculationModeAttributeChanged(const QIviPropertyAttribute<QIviClimateControl::RecirculationMode> &attribute, const QString &zone);
- void onRecirculationChanged(bool recirculation, const QString &zone);
- void onRecirculationAttributeChanged(const QIviPropertyAttribute<bool> &attribute, const QString &zone);
- void onRecirculationSensitivityLevelChanged(int recirculationSensitivityLevel, const QString &zone);
- void onRecirculationSensitivityLevelAttributeChanged(const QIviPropertyAttribute<int> &attribute, const QString &zone);
- void onClimateModeChanged(QIviClimateControl::ClimateMode climateMode, const QString &zone);
- void onClimateModeAttributeChanged(const QIviPropertyAttribute<QIviClimateControl::ClimateMode> &attribute, const QString &zone);
- void onAutomaticClimateFanIntensityLevelChanged(int automaticClimateFanIntensityLevel, const QString &zone);
- void onAutomaticClimateFanIntensityLevelAttributeChanged(const QIviPropertyAttribute<int> &attribute, const QString &zone);
-
- QIviClimateControlBackendInterface *climateControlBackend();
-
- QIviClimateControl::AirflowDirections m_airflowDirections;
- QIviPropertyAttribute<QIviClimateControl::AirflowDirections> m_airflowDirectionsAttribute;
- QIviProperty *m_airFlowDirectionProperty;
- bool m_airConditioning;
- QIviPropertyAttribute<bool> m_airConditioningAttribute;
- QIviProperty *m_airConditioningProperty;
- bool m_heater;
- QIviPropertyAttribute<bool> m_heaterAttribute;
- QIviProperty *m_heaterProperty;
- int m_targetTemperature;
- QIviPropertyAttribute<int> m_targetTemperatureAttribute;
- QIviProperty *m_targetTemperatureProperty;
- int m_seatCooler;
- QIviPropertyAttribute<int> m_seatCoolerAttribute;
- QIviProperty *m_seatCoolerProperty;
- int m_seatHeater;
- QIviPropertyAttribute<int> m_seatHeaterAttribute;
- QIviProperty *m_seatHeaterProperty;
- int m_steeringWheelHeater;
- QIviPropertyAttribute<int> m_steeringWheelHeaterAttribute;
- QIviProperty *m_steeringWheelHeaterProperty;
- int m_fanSpeedLevel;
- QIviPropertyAttribute<int> m_fanSpeedLevelAttribute;
- QIviProperty *m_fanSpeedLevelProperty;
- int m_outsideTemperature;
- QIviPropertyAttribute<int> m_outsideTemperatureAttribute;
- QIviProperty *m_outsideTemperatureProperty;
- bool m_zoneSynchronization;
- QIviPropertyAttribute<bool> m_zoneSynchronizationAttribute;
- QIviProperty *m_zoneSynchronizationProperty;
- bool m_defrost;
- QIviPropertyAttribute<bool> m_defrostAttribute;
- QIviProperty *m_defrostProperty;
- QIviClimateControl::RecirculationMode m_recirculationMode;
- QIviPropertyAttribute<QIviClimateControl::RecirculationMode> m_recirculationModeAttribute;
- QIviProperty *m_recirculationModeProperty;
- bool m_recirculation;
- QIviPropertyAttribute<bool> m_recirculationAttribute;
- QIviProperty *m_recirculationProperty;
- int m_recirculationSensitivityLevel;
- QIviPropertyAttribute<int> m_recirculationSensitivityLevelAttribute;
- QIviProperty *m_recirculationSensitivityLevelProperty;
- QIviClimateControl::ClimateMode m_climateMode;
- QIviPropertyAttribute<QIviClimateControl::ClimateMode> m_climateModeAttribute;
- QIviProperty *m_climateModeProperty;
- int m_automaticClimateFanIntensityLevel;
- QIviPropertyAttribute<int> m_automaticClimateFanIntensityLevelAttribute;
- QIviProperty *m_automaticClimateFanIntensityLevelProperty;
-
- QIviClimateControl * const q_ptr;
- Q_DECLARE_PUBLIC(QIviClimateControl)
-};
-
-QT_END_NAMESPACE
-
-#endif // QIVICLIMATECONTROL_P_H
diff --git a/src/ivivehiclefunctions/qiviclimatecontrolbackendinterface.cpp b/src/ivivehiclefunctions/qiviclimatecontrolbackendinterface.cpp
deleted file mode 100644
index 947901a..0000000
--- a/src/ivivehiclefunctions/qiviclimatecontrolbackendinterface.cpp
+++ /dev/null
@@ -1,456 +0,0 @@
-/****************************************************************************
-**
-** 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 "qiviclimatecontrolbackendinterface.h"
-
-/*!
- * \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.
- */
-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::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 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::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 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::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 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::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 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::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 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::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.
- */
diff --git a/src/ivivehiclefunctions/qiviclimatecontrolbackendinterface.h b/src/ivivehiclefunctions/qiviclimatecontrolbackendinterface.h
deleted file mode 100644
index 96f8860..0000000
--- a/src/ivivehiclefunctions/qiviclimatecontrolbackendinterface.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/****************************************************************************
-**
-** 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 QIVICLIMATECONTROLBACKENDINTERFACE_H
-#define QIVICLIMATECONTROLBACKENDINTERFACE_H
-
-#include <QtCore/QObject>
-
-#include <QtIviCore/qivizonedfeatureinterface.h>
-#include <QtIviCore/qivipropertyattribute.h>
-#include <QtIviVehicleFunctions/qiviclimatecontrol.h>
-
-QT_BEGIN_NAMESPACE
-
-class Q_QTIVIVEHICLEFUNCTIONS_EXPORT QIviClimateControlBackendInterface : public QIviZonedFeatureInterface
-{
- Q_OBJECT
-
-public:
- QIviClimateControlBackendInterface(QObject *parent = Q_NULLPTR);
-
- virtual void setTargetTemperature(int value, const QString &zone) = 0;
- virtual void setSeatCooler(int value, const QString &zone) = 0;
- virtual void setSeatHeater(int value, const QString &zone) = 0;
- virtual void setSteeringWheelHeater(int value, const QString &zone) = 0;
- virtual void setFanSpeedLevel(int value, const QString &zone) = 0;
- virtual void setAirflowDirections(QIviClimateControl::AirflowDirections airflowDirections, const QString &zone) = 0;
- virtual void setAirConditioningEnabled(bool enabled, const QString &zone) = 0;
- virtual void setHeaterEnabled(bool enabled, const QString &zone) = 0;
- virtual void setZoneSynchronizationEnabled(bool zoneSynchronization, const QString &zone) = 0;
- virtual void setDefrostEnabled(bool defrost, const QString &zone) = 0;
- virtual void setRecirculationMode(QIviClimateControl::RecirculationMode recirculationMode, const QString &zone) = 0;
- virtual void setRecirculationSensitivityLevel(int recirculationSensitivityLevel, const QString &zone) = 0;
- virtual void setClimateMode(QIviClimateControl::ClimateMode climateMode, const QString &zone) = 0;
- virtual void setAutomaticClimateFanIntensityLevel(int automaticClimateFanIntensityLevel, const QString &zone) = 0;
-
-Q_SIGNALS:
- void targetTemperatureChanged(int value, const QString &zone = QString());
- void targetTemperatureAttributeChanged(const QIviPropertyAttribute<int> &attribute, const QString &zone = QString());
- void seatCoolerChanged(int value, const QString &zone = QString());
- void seatCoolerAttributeChanged(const QIviPropertyAttribute<int> &attribute, const QString &zone = QString());
- void seatHeaterChanged(int value, const QString &zone = QString());
- void seatHeaterAttributeChanged(const QIviPropertyAttribute<int> &attribute, const QString &zone = QString());
- void steeringWheelHeaterChanged(int value, const QString &zone = QString());
- void steeringWheelHeaterAttributeChanged(const QIviPropertyAttribute<int> &attribute, const QString &zone = QString());
- void fanSpeedLevelChanged(int value, const QString &zone = QString());
- void fanSpeedLevelAttributeChanged(const QIviPropertyAttribute<int> &attribute, const QString &zone = QString());
- void airflowDirectionsChanged(QIviClimateControl::AirflowDirections value, const QString &zone = QString());
- void airflowDirectionsAttributeChanged(const QIviPropertyAttribute<QIviClimateControl::AirflowDirections> &attribute, const QString &zone = QString());
- void airConditioningEnabledChanged(bool value, const QString &zone = QString());
- void airConditioningAttributeChanged(const QIviPropertyAttribute<bool> &attribute, const QString &zone = QString());
- void heaterEnabledChanged(bool value, const QString &zone = QString());
- void heaterAttributeChanged(const QIviPropertyAttribute<bool> &attribute, const QString &zone = QString());
- void outsideTemperatureChanged(int outsideTemperature, const QString &zone = QString());
- void outsideTemperatureAttributeChanged(const QIviPropertyAttribute<int> &outsideTemperature, const QString &zone = QString());
- void zoneSynchronizationEnabledChanged(bool zoneSynchronization, const QString &zone = QString());
- void zoneSynchronizationAttributeChanged(const QIviPropertyAttribute<bool> &zoneSynchronization, const QString &zone = QString());
- void defrostEnabledChanged(bool defrost, const QString &zone = QString());
- void defrostAttributeChanged(const QIviPropertyAttribute<bool> &defrost, const QString &zone = QString());
- void recirculationModeChanged(QIviClimateControl::RecirculationMode recirculationMode, const QString &zone = QString());
- void recirculationModeAttributeChanged(const QIviPropertyAttribute<QIviClimateControl::RecirculationMode> &recirculationMode, const QString &zone = QString());
- void recirculationEnabledChanged(bool recirculation, const QString &zone = QString());
- void recirculationAttributeChanged(const QIviPropertyAttribute<bool> &recirculation, const QString &zone = QString());
- void recirculationSensitivityLevelChanged(int recirculationSensitivityLevel, const QString &zone = QString());
- void recirculationSensitivityLevelAttributeChanged(const QIviPropertyAttribute<int> &recirculationSensitivityLevel, const QString &zone = QString());
- void climateModeChanged(QIviClimateControl::ClimateMode climateMode, const QString &zone = QString());
- void climateModeAttributeChanged(const QIviPropertyAttribute<QIviClimateControl::ClimateMode> &climateMode, const QString &zone = QString());
- void automaticClimateFanIntensityLevelChanged(int automaticClimateFanIntensityLevel, const QString &zone = QString());
- void automaticClimateFanIntensityLevelAttributeChanged(const QIviPropertyAttribute<int> &automaticClimateFanIntensityLevel, const QString &zone = QString());
-};
-
-#define QIviClimateControl_iid "org.qt-project.qtivi.ClimateControl/1.0"
-
-QT_END_NAMESPACE
-
-#endif // QIVICLIMATECONTROLBACKENDINTERFACE_H
-
diff --git a/src/ivivehiclefunctions/qiviwindowcontrol.cpp b/src/ivivehiclefunctions/qiviwindowcontrol.cpp
deleted file mode 100644
index 26909cb..0000000
--- a/src/ivivehiclefunctions/qiviwindowcontrol.cpp
+++ /dev/null
@@ -1,749 +0,0 @@
-/****************************************************************************
-**
-** 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 "qiviwindowcontrol.h"
-#include "qiviwindowcontrol_p.h"
-#include "qiviwindowcontrolbackendinterface.h"
-#include <QtIviCore/QIviPropertyFactory>
-#include <QtIviCore/QIviServiceObject>
-
-QIviWindowControlPrivate::QIviWindowControlPrivate(const QString &interface, const QString &zone, QIviWindowControl *parent)
- : QIviAbstractZonedFeaturePrivate(interface, zone, parent)
- , m_heaterMode(QIviWindowControl::HeaterOff)
- , m_heater(false)
- , m_blindMode(QIviWindowControl::BlindClosed)
- , m_blindState(QIviWindowControl::Closed)
- , m_state(QIviWindowControl::Closed)
- , q_ptr(parent)
-{}
-
-void QIviWindowControlPrivate::initialize()
-{
- QIviAbstractZonedFeaturePrivate::initialize();
- Q_Q(QIviWindowControl);
-
- m_heaterModeProperty = QIviPropertyFactory<QIviWindowControl::HeaterMode>::create(q,
- &QIviWindowControl::heaterModeAttribute,
- &QIviWindowControl::heaterModeAttributeChanged,
- &QIviWindowControl::heaterMode,
- &QIviWindowControl::heaterModeChanged,
- &QIviWindowControl::setHeaterMode);
-
- m_heaterProperty = QIviPropertyFactory<bool>::create(q,
- &QIviWindowControl::heaterAttribute,
- &QIviWindowControl::heaterAttributeChanged,
- &QIviWindowControl::isHeaterEnabled,
- &QIviWindowControl::heaterEnabledChanged);
-
- m_blindModeProperty = QIviPropertyFactory<QIviWindowControl::BlindMode>::create(q,
- &QIviWindowControl::blindModeAttribute,
- &QIviWindowControl::blindModeAttributeChanged,
- &QIviWindowControl::blindMode,
- &QIviWindowControl::blindModeChanged,
- &QIviWindowControl::setBlindMode);
-
- m_blindStateProperty = QIviPropertyFactory<QIviWindowControl::State>::create(q,
- &QIviWindowControl::blindStateAttribute,
- &QIviWindowControl::blindStateAttributeChanged,
- &QIviWindowControl::blindState,
- &QIviWindowControl::blindStateChanged);
-
- m_stateProperty = QIviPropertyFactory<QIviWindowControl::State>::create(q,
- &QIviWindowControl::stateAttribute,
- &QIviWindowControl::stateAttributeChanged,
- &QIviWindowControl::state,
- &QIviWindowControl::stateChanged);
-
-}
-
-void QIviWindowControlPrivate::clearToDefaults()
-{
- m_heaterMode = QIviWindowControl::HeaterOff;
- m_heater = false;
- m_blindMode = QIviWindowControl::BlindClosed;
- m_blindState = QIviWindowControl::Closed;
- m_state = QIviWindowControl::Closed;
-}
-
-void QIviWindowControlPrivate::onHeaterModeChanged(QIviWindowControl::HeaterMode value, const QString &zone)
-{
- Q_Q(QIviWindowControl);
- QIviWindowControl *f = qobject_cast<QIviWindowControl*>(q->zoneAt(zone));
- if (!f)
- f = q;
- if (f->zone() != zone)
- return;
-
- f->d_func()->m_heaterMode = value;
- emit f->heaterModeChanged(value);
-}
-
-void QIviWindowControlPrivate::onHeaterModeAttributeChanged(const QIviPropertyAttribute<QIviWindowControl::HeaterMode> &attribute, const QString &zone)
-{
- Q_Q(QIviWindowControl);
- QIviWindowControl *f = qobject_cast<QIviWindowControl*>(q->zoneAt(zone));
- if (!f)
- f = q;
- if (f->zone() != zone)
- return;
- f->d_func()->m_heaterModeAttribute = attribute;
- emit f->heaterModeAttributeChanged(attribute);
-}
-
-
-void QIviWindowControlPrivate::onHeaterEnabledChanged(bool enabled, const QString &zone)
-{
- Q_Q(QIviWindowControl);
- QIviWindowControl *f = qobject_cast<QIviWindowControl*>(q->zoneAt(zone));
- if (!f)
- f = q;
- if (f->zone() != zone)
- return;
-
- f->d_func()->m_heater = enabled;
- emit f->heaterEnabledChanged(enabled);
-}
-
-void QIviWindowControlPrivate::onHeaterAttributeChanged(const QIviPropertyAttribute<bool> &attribute, const QString &zone)
-{
- Q_Q(QIviWindowControl);
- QIviWindowControl *f = qobject_cast<QIviWindowControl*>(q->zoneAt(zone));
- if (!f)
- f = q;
- if (f->zone() != zone)
- return;
- f->d_func()->m_heaterAttribute = attribute;
- emit f->heaterAttributeChanged(attribute);
-}
-
-
-void QIviWindowControlPrivate::onBlindModeChanged(QIviWindowControl::BlindMode value, const QString &zone)
-{
- Q_Q(QIviWindowControl);
- QIviWindowControl *f = qobject_cast<QIviWindowControl*>(q->zoneAt(zone));
- if (!f)
- f = q;
- if (f->zone() != zone)
- return;
-
- f->d_func()->m_blindMode = value;
- emit f->blindModeChanged(value);
-}
-
-void QIviWindowControlPrivate::onBlindModeAttributeChanged(const QIviPropertyAttribute<QIviWindowControl::BlindMode> &attribute, const QString &zone)
-{
- Q_Q(QIviWindowControl);
- QIviWindowControl *f = qobject_cast<QIviWindowControl*>(q->zoneAt(zone));
- if (!f)
- f = q;
- if (f->zone() != zone)
- return;
- f->d_func()->m_blindModeAttribute = attribute;
- emit f->blindModeAttributeChanged(attribute);
-}
-
-
-void QIviWindowControlPrivate::onBlindStateChanged(QIviWindowControl::State value, const QString &zone)
-{
- Q_Q(QIviWindowControl);
- QIviWindowControl *f = qobject_cast<QIviWindowControl*>(q->zoneAt(zone));
- if (!f)
- f = q;
- if (f->zone() != zone)
- return;
-
- f->d_func()->m_blindState = value;
- emit f->blindStateChanged(value);
-}
-
-void QIviWindowControlPrivate::onBlindStateAttributeChanged(const QIviPropertyAttribute<QIviWindowControl::State> &attribute, const QString &zone)
-{
- Q_Q(QIviWindowControl);
- QIviWindowControl *f = qobject_cast<QIviWindowControl*>(q->zoneAt(zone));
- if (!f)
- f = q;
- if (f->zone() != zone)
- return;
- f->d_func()->m_blindStateAttribute = attribute;
- emit f->blindStateAttributeChanged(attribute);
-}
-
-
-void QIviWindowControlPrivate::onStateChanged(QIviWindowControl::State value, const QString &zone)
-{
- Q_Q(QIviWindowControl);
- QIviWindowControl *f = qobject_cast<QIviWindowControl*>(q->zoneAt(zone));
- if (!f)
- f = q;
- if (f->zone() != zone)
- return;
-
- f->d_func()->m_state = value;
- emit f->stateChanged(value);
-}
-
-void QIviWindowControlPrivate::onStateAttributeChanged(const QIviPropertyAttribute<QIviWindowControl::State> &attribute, const QString &zone)
-{
- Q_Q(QIviWindowControl);
- QIviWindowControl *f = qobject_cast<QIviWindowControl*>(q->zoneAt(zone));
- if (!f)
- f = q;
- if (f->zone() != zone)
- return;
- f->d_func()->m_stateAttribute = attribute;
- emit f->stateAttributeChanged(attribute);
-}
-
-QIviWindowControlBackendInterface *QIviWindowControlPrivate::windowControlBackend()
-{
- Q_Q(QIviWindowControl);
- return qobject_cast<QIviWindowControlBackendInterface*>(q->backend());
-}
-
-/*!
- \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.
-
- 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.
-*/
-
-/*!
- \qmltype WindowControl
- \instantiates QIviWindowControl
- \inqmlmodule QtIvi.VehicleFunctions
- \inherits AbstractZonedFeature
- \brief The WindowControl provides a QML interface to control the physical windows of the vehicle.
-*/
-
-/*!
- \enum QIviWindowControl::HeaterMode
- \value HeaterOn
- The window heater is turned on.
- \value HeaterOff
- The window heater is turned off.
- \value AutoHeater
- The window heater is turning off and on automatically.
-*/
-
-/*!
- \enum QIviWindowControl::BlindMode
- \value BlindOpen
- The blind will be opened.
- \value BlindClosed
- The blind will be closed.
- \value AutoBlind
- The blind is opened or closed automatically.
-*/
-
-/*!
- \enum QIviWindowControl::State
- \value FullyOpen
- The object is fully open.
- \value Open
- The object is open, but not fully open yet.
- \value Closed
- The object is closed.
-*/
-
-/*!
- Constructs a window control object to the given \a zone.
-
- 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)
-{
- qRegisterMetaType<QIviPropertyAttribute<QIviWindowControl::HeaterMode>>();
- qRegisterMetaType<QIviPropertyAttribute<QIviWindowControl::BlindMode>>();
- qRegisterMetaType<QIviPropertyAttribute<QIviWindowControl::State>>();
-}
-
-QIviWindowControl::~QIviWindowControl()
-{
-}
-
-/*!
- \reimp
-*/
-void QIviWindowControl::connectToServiceObject(QIviServiceObject *serviceObject)
-{
- Q_D(QIviWindowControl);
- QIviAbstractZonedFeature::connectToServiceObject(serviceObject);
-
- QIviWindowControlBackendInterface *backend = d->windowControlBackend();
- if (!backend)
- return;
-
- QObjectPrivate::connect(backend, &QIviWindowControlBackendInterface::heaterModeChanged,
- d, &QIviWindowControlPrivate::onHeaterModeChanged);
- QObjectPrivate::connect(backend, &QIviWindowControlBackendInterface::heaterModeAttributeChanged,
- d, &QIviWindowControlPrivate::onHeaterModeAttributeChanged);
- QObjectPrivate::connect(backend, &QIviWindowControlBackendInterface::heaterEnabledChanged,
- d, &QIviWindowControlPrivate::onHeaterEnabledChanged);
- QObjectPrivate::connect(backend, &QIviWindowControlBackendInterface::heaterAttributeChanged,
- d, &QIviWindowControlPrivate::onHeaterAttributeChanged);
- QObjectPrivate::connect(backend, &QIviWindowControlBackendInterface::blindModeChanged,
- d, &QIviWindowControlPrivate::onBlindModeChanged);
- QObjectPrivate::connect(backend, &QIviWindowControlBackendInterface::blindModeAttributeChanged,
- d, &QIviWindowControlPrivate::onBlindModeAttributeChanged);
- QObjectPrivate::connect(backend, &QIviWindowControlBackendInterface::blindStateChanged,
- d, &QIviWindowControlPrivate::onBlindStateChanged);
- QObjectPrivate::connect(backend, &QIviWindowControlBackendInterface::blindStateAttributeChanged,
- d, &QIviWindowControlPrivate::onBlindStateAttributeChanged);
- QObjectPrivate::connect(backend, &QIviWindowControlBackendInterface::stateChanged,
- d, &QIviWindowControlPrivate::onStateChanged);
- QObjectPrivate::connect(backend, &QIviWindowControlBackendInterface::stateAttributeChanged,
- d, &QIviWindowControlPrivate::onStateAttributeChanged);
-
- backend->initializeAttributes();
-}
-
-/*!
- \reimp
-*/
-void QIviWindowControl::clearServiceObject()
-{
- Q_D(QIviWindowControl);
- d->clearToDefaults();
- QIviAbstractZonedFeature::clearServiceObject();
-}
-
-QIviWindowControl::QIviWindowControl(QIviWindowControlPrivate &dd, QObject *parent)
- : QIviAbstractZonedFeature(dd, parent)
-{
-}
-
-/*!
- \reimp
-*/
-QIviAbstractZonedFeature *QIviWindowControl::createZoneFeature(const QString &zone)
-{
- return new QIviWindowControl(zone, this);
-}
-
-/*!
- \qmlqtivipropertyEnum {QtIvi.VehicleFunctions::WindowControl::heaterMode}
-
- \e value holds the heater mode.
- Available values are:
- \value HeaterOn
- The window heater is turned on.
- \value HeaterOff
- The window heater is turned off.
- \value AutoHeater
- The window heater is turning off and on automatically.
- */
-/*!
- \property QIviWindowControl::heaterMode
-
- Holds a QIviProperty of type \e QIviWindowControl::HeaterMode where the QIviProperty::value() function returns the current heaterMode.
-
- \sa AttributeSystem
- \sa heaterMode() setHeaterMode() heaterModeAttribute()
- */
-/*!
- * Returns the current heaterMode.
- *
- * \sa setHeaterMode() heaterModeChanged() heaterModeAttribute()
- */
-QIviWindowControl::HeaterMode QIviWindowControl::heaterMode() const
-
-{
- Q_D(const QIviWindowControl);
- return d->m_heaterMode;
-}
-/*!
- * 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);
- return d->m_heaterModeAttribute;
-}
-
-QIviProperty *QIviWindowControl::heaterModeProperty() const
-{
- Q_D(const QIviWindowControl);
- return d->m_heaterModeProperty;
-}
-
-/*!
- \qmlqtivipropertyBool {QtIvi.VehicleFunctions::WindowControl::heater}
-
- \e value is true if the heater is currently running.
- */
-/*!
- \property QIviWindowControl::heater
-
- Holds a QIviProperty of type \e bool where the QIviProperty::value() function indicates if the heater is running.
-
- \sa AttributeSystem
- \sa isHeaterEnabled() heaterAttribute()
- */
-/*!
- * Returns true if heater is currently enabled(running).
- *
- * \sa heaterEnabledChanged() heaterAttribute()
- */
-bool QIviWindowControl::isHeaterEnabled() const
-
-{
- Q_D(const QIviWindowControl);
- return d->m_heater;
-}
-/*!
- * Returns the attribute defining the boundaries and availability of the heater property.
- *
- * \sa isHeaterEnabled() heaterEnabledChanged()
- */
-QIviPropertyAttribute<bool> QIviWindowControl::heaterAttribute() const
-{
- Q_D(const QIviWindowControl);
- return d->m_heaterAttribute;
-}
-
-QIviProperty *QIviWindowControl::heaterProperty() const
-{
- Q_D(const QIviWindowControl);
- return d->m_heaterProperty;
-}
-
-/*!
- \qmlqtivipropertyEnum {QtIvi.VehicleFunctions::WindowControl::blindMode}
-
- \e value holds the blind mode.
- Available values are:
- \value BlindOpen
- The blind will be opened.
- \value BlindClosed
- The blind will be closed.
- \value AutoBlind
- The blind is opened or closed automatically.
- */
-/*!
- \property QIviWindowControl::blindMode
-
- Holds a QIviProperty of type \e QIviWindowControl::BlindMode where the QIviProperty::value() function returns the current blind mode.
-
- \sa AttributeSystem
- \sa blindMode() setBlindMode() blindModeAttribute()
- */
-/*!
- * Returns the current blind mode.
- *
- * \sa setBlindMode() blindModeChanged() blindModeAttribute()
- */
-QIviWindowControl::BlindMode QIviWindowControl::blindMode() const
-
-{
- Q_D(const QIviWindowControl);
- return d->m_blindMode;
-}
-/*!
- * 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);
- return d->m_blindModeAttribute;
-}
-
-QIviProperty *QIviWindowControl::blindModeProperty() const
-{
- Q_D(const QIviWindowControl);
- return d->m_blindModeProperty;
-}
-
-/*!
- \qmlqtivipropertyEnum {QtIvi.VehicleFunctions::WindowControl::blindState}
-
- \e value holds the current blind state.
- Available values are:
- \value FullyOpen
- The object is fully open.
- \value Open
- The object is open, but not fully open yet.
- \value Closed
- The object is closed.
- */
-/*!
- \property QIviWindowControl::blindState
-
- Holds a QIviProperty of type \e QIviWindowControl::State where the QIviProperty::value() function returns the current blind state.
-
- \sa AttributeSystem
- \sa blindState() blindStateAttribute()
- */
-/*!
- * Returns the current blind state.
- *
- * \sa blindStateChanged() blindStateAttribute()
- */
-QIviWindowControl::State QIviWindowControl::blindState() const
-
-{
- Q_D(const QIviWindowControl);
- return d->m_blindState;
-}
-/*!
- * 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);
- return d->m_blindStateAttribute;
-}
-
-QIviProperty *QIviWindowControl::blindStateProperty() const
-{
- Q_D(const QIviWindowControl);
- return d->m_blindStateProperty;
-}
-
-/*!
- \qmlqtivipropertyEnum {QtIvi.VehicleFunctions::WindowControl::state}
-
- \e value holds the current window state.
- Available values are:
- \value FullyOpen
- The object is fully open.
- \value Open
- The object is open, but not fully open yet.
- \value Closed
- The object is closed.
-
- \sa open() close()
- */
-/*!
- \property QIviWindowControl::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()
- */
-/*!
- * Returns the current window state.
- *
- * \sa stateChanged() stateAttribute()
- */
-QIviWindowControl::State QIviWindowControl::state() const
-
-{
- Q_D(const QIviWindowControl);
- return d->m_state;
-}
-/*!
- * 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);
- return d->m_stateAttribute;
-}
-
-QIviProperty *QIviWindowControl::stateProperty() const
-{
- Q_D(const QIviWindowControl);
- return d->m_stateProperty;
-}
-
-/*!
- * Sets the current heater mode to \a value.
- *
- * \sa heaterMode() heaterModeChanged() heaterModeAttribute()
- */
-void QIviWindowControl::setHeaterMode(QIviWindowControl::HeaterMode value)
-{
- Q_D(QIviWindowControl);
- if (QIviWindowControlBackendInterface *backend = d->windowControlBackend())
- backend->setHeaterMode(value, zone());
-}
-
-/*!
- * Sets the current blind mode to \a value.
- *
- * \sa blindMode() blindModeChanged() blindModeAttribute()
- */
-void QIviWindowControl::setBlindMode(QIviWindowControl::BlindMode value)
-{
- Q_D(QIviWindowControl);
- if (QIviWindowControlBackendInterface *backend = d->windowControlBackend())
- backend->setBlindMode(value, zone());
-}
-
-/*!
- * \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()
- */
-void QIviWindowControl::open()
-{
- Q_D(QIviWindowControl);
- if (QIviWindowControlBackendInterface *backend = d->windowControlBackend())
- backend->open(zone());
-}
-
-/*!
- * \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()
- */
-void QIviWindowControl::close()
-{
- Q_D(QIviWindowControl);
- if (QIviWindowControlBackendInterface *backend = d->windowControlBackend())
- backend->close(zone());
-}
-
-/*!
- * \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::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::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::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::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()
- */
-
-
-
-#include "moc_qiviwindowcontrol.cpp"
diff --git a/src/ivivehiclefunctions/qiviwindowcontrol.h b/src/ivivehiclefunctions/qiviwindowcontrol.h
deleted file mode 100644
index bbe6337..0000000
--- a/src/ivivehiclefunctions/qiviwindowcontrol.h
+++ /dev/null
@@ -1,151 +0,0 @@
-/****************************************************************************
-**
-** 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 QIVIWINDOWCONTROL_H
-#define QIVIWINDOWCONTROL_H
-
-#include <QtIviCore/QIviAbstractZonedFeature>
-#include <QtIviCore/QIviProperty>
-#include <QtIviVehicleFunctions/qtivivehiclefunctionsglobal.h>
-
-QT_BEGIN_NAMESPACE
-
-class QIviWindowControlBackendInterface;
-class QIviWindowControlPrivate;
-
-class Q_QTIVIVEHICLEFUNCTIONS_EXPORT QIviWindowControl : public QIviAbstractZonedFeature
-{
- Q_OBJECT
-
- Q_PROPERTY(QIviProperty *heaterMode READ heaterModeProperty CONSTANT)
- Q_PROPERTY(QIviProperty *heater READ heaterProperty CONSTANT)
- Q_PROPERTY(QIviProperty *blindMode READ blindModeProperty CONSTANT)
- Q_PROPERTY(QIviProperty *blindState READ blindStateProperty CONSTANT)
- Q_PROPERTY(QIviProperty *state READ stateProperty CONSTANT)
-
-public:
-
- enum HeaterMode {
- HeaterOn,
- HeaterOff,
- AutoHeater
- };
- Q_ENUM(HeaterMode)
-
- enum BlindMode {
- BlindOpen,
- BlindClosed,
- AutoBlind
- };
- Q_ENUM(BlindMode)
-
- enum State {
- FullyOpen,
- Open,
- Closed
- };
- Q_ENUM(State)
-
- QIviWindowControl(const QString &zone = QString(), QObject *parent = Q_NULLPTR);
- ~QIviWindowControl();
-
- QIviWindowControl::HeaterMode heaterMode() const;
- QIviPropertyAttribute<QIviWindowControl::HeaterMode> heaterModeAttribute() const;
- QIviProperty *heaterModeProperty() const;
- bool isHeaterEnabled() const;
- QIviPropertyAttribute<bool> heaterAttribute() const;
- QIviProperty *heaterProperty() const;
- QIviWindowControl::BlindMode blindMode() const;
- QIviPropertyAttribute<QIviWindowControl::BlindMode> blindModeAttribute() const;
- QIviProperty *blindModeProperty() const;
- QIviWindowControl::State blindState() const;
- QIviPropertyAttribute<QIviWindowControl::State> blindStateAttribute() const;
- QIviProperty *blindStateProperty() const;
- QIviWindowControl::State state() const;
- QIviPropertyAttribute<QIviWindowControl::State> stateAttribute() const;
- QIviProperty *stateProperty() const;
-
-public Q_SLOTS:
- void setHeaterMode(QIviWindowControl::HeaterMode value);
- void setBlindMode(QIviWindowControl::BlindMode value);
- void open();
- void close();
-
-Q_SIGNALS:
- void heaterModeChanged(QIviWindowControl::HeaterMode value);
- void heaterModeAttributeChanged(const QIviPropertyAttribute<QIviWindowControl::HeaterMode> &attribute);
- void heaterEnabledChanged(bool enabled);
- void heaterAttributeChanged(const QIviPropertyAttribute<bool> &attribute);
- void blindModeChanged(QIviWindowControl::BlindMode value);
- void blindModeAttributeChanged(const QIviPropertyAttribute<QIviWindowControl::BlindMode> &attribute);
- void blindStateChanged(QIviWindowControl::State value);
- void blindStateAttributeChanged(const QIviPropertyAttribute<QIviWindowControl::State> &attribute);
- void stateChanged(QIviWindowControl::State value);
- void stateAttributeChanged(const QIviPropertyAttribute<QIviWindowControl::State> &attribute);
-
-protected:
- QIviWindowControl(QIviWindowControlPrivate &dd, QObject *parent = Q_NULLPTR);
- virtual QIviAbstractZonedFeature *createZoneFeature(const QString &zone) Q_DECL_OVERRIDE;
-
- virtual void connectToServiceObject(QIviServiceObject *serviceObject) Q_DECL_OVERRIDE;
- virtual void clearServiceObject() Q_DECL_OVERRIDE;
-
-private:
- Q_DECLARE_PRIVATE(QIviWindowControl)
- Q_PRIVATE_SLOT(d_func(), void onHeaterModeChanged(QIviWindowControl::HeaterMode heaterMode, const QString &zone))
- Q_PRIVATE_SLOT(d_func(), void onHeaterModeAttributeChanged(const QIviPropertyAttribute<QIviWindowControl::HeaterMode> &attribute, const QString &zone))
- Q_PRIVATE_SLOT(d_func(), void onHeaterEnabledChanged(bool heater, const QString &zone))
- Q_PRIVATE_SLOT(d_func(), void onHeaterAttributeChanged(const QIviPropertyAttribute<bool> &attribute, const QString &zone))
- Q_PRIVATE_SLOT(d_func(), void onBlindModeChanged(QIviWindowControl::BlindMode blindMode, const QString &zone))
- Q_PRIVATE_SLOT(d_func(), void onBlindModeAttributeChanged(const QIviPropertyAttribute<QIviWindowControl::BlindMode> &attribute, const QString &zone))
- Q_PRIVATE_SLOT(d_func(), void onBlindStateChanged(QIviWindowControl::State blindState, const QString &zone))
- Q_PRIVATE_SLOT(d_func(), void onBlindStateAttributeChanged(const QIviPropertyAttribute<QIviWindowControl::State> &attribute, const QString &zone))
- Q_PRIVATE_SLOT(d_func(), void onStateChanged(QIviWindowControl::State state, const QString &zone))
- Q_PRIVATE_SLOT(d_func(), void onStateAttributeChanged(const QIviPropertyAttribute<QIviWindowControl::State> &attribute, const QString &zone))
-};
-
-QT_END_NAMESPACE
-
-Q_DECLARE_METATYPE(QIviPropertyAttribute<QIviWindowControl::HeaterMode>)
-Q_DECLARE_METATYPE(QIviPropertyAttribute<QIviWindowControl::BlindMode>)
-Q_DECLARE_METATYPE(QIviPropertyAttribute<QIviWindowControl::State>)
-
-#endif // QIVIWINDOWCONTROL_H
diff --git a/src/ivivehiclefunctions/qiviwindowcontrol_p.h b/src/ivivehiclefunctions/qiviwindowcontrol_p.h
deleted file mode 100644
index 5ab15e5..0000000
--- a/src/ivivehiclefunctions/qiviwindowcontrol_p.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/****************************************************************************
-**
-** 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 QIVIWINDOWCONTROL_P_H
-#define QIVIWINDOWCONTROL_P_H
-
-//
-// 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 <private/qtivivehiclefunctionsglobal_p.h>
-#include <QtIviCore/QIviProperty>
-#include "private/qiviabstractzonedfeature_p.h"
-
-#include "qiviwindowcontrol.h"
-
-QT_BEGIN_NAMESPACE
-
-class QIviWindowControlPrivate : public QIviAbstractZonedFeaturePrivate
-{
-public:
- QIviWindowControlPrivate(const QString &interface, const QString &zone, QIviWindowControl *parent);
-
- virtual void initialize() Q_DECL_OVERRIDE;
- void clearToDefaults();
-
- void onHeaterModeChanged(QIviWindowControl::HeaterMode heaterMode, const QString &zone);
- void onHeaterModeAttributeChanged(const QIviPropertyAttribute<QIviWindowControl::HeaterMode> &attribute, const QString &zone);
- void onHeaterEnabledChanged(bool heater, const QString &zone);
- void onHeaterAttributeChanged(const QIviPropertyAttribute<bool> &attribute, const QString &zone);
- void onBlindModeChanged(QIviWindowControl::BlindMode blindMode, const QString &zone);
- void onBlindModeAttributeChanged(const QIviPropertyAttribute<QIviWindowControl::BlindMode> &attribute, const QString &zone);
- void onBlindStateChanged(QIviWindowControl::State blindState, const QString &zone);
- void onBlindStateAttributeChanged(const QIviPropertyAttribute<QIviWindowControl::State> &attribute, const QString &zone);
- void onStateChanged(QIviWindowControl::State state, const QString &zone);
- void onStateAttributeChanged(const QIviPropertyAttribute<QIviWindowControl::State> &attribute, const QString &zone);
-
-
- QIviWindowControlBackendInterface *windowControlBackend();
-
- QIviWindowControl::HeaterMode m_heaterMode;
- QIviPropertyAttribute<QIviWindowControl::HeaterMode> m_heaterModeAttribute;
- QIviProperty *m_heaterModeProperty;
- bool m_heater;
- QIviPropertyAttribute<bool> m_heaterAttribute;
- QIviProperty *m_heaterProperty;
- QIviWindowControl::BlindMode m_blindMode;
- QIviPropertyAttribute<QIviWindowControl::BlindMode> m_blindModeAttribute;
- QIviProperty *m_blindModeProperty;
- QIviWindowControl::State m_blindState;
- QIviPropertyAttribute<QIviWindowControl::State> m_blindStateAttribute;
- QIviProperty *m_blindStateProperty;
- QIviWindowControl::State m_state;
- QIviPropertyAttribute<QIviWindowControl::State> m_stateAttribute;
- QIviProperty *m_stateProperty;
-
- QIviWindowControl * const q_ptr;
- Q_DECLARE_PUBLIC(QIviWindowControl)
-};
-
-QT_END_NAMESPACE
-
-#endif // QIVIWINDOWCONTROL_P_H
diff --git a/src/ivivehiclefunctions/qiviwindowcontrolbackendinterface.cpp b/src/ivivehiclefunctions/qiviwindowcontrolbackendinterface.cpp
deleted file mode 100644
index 98fce0a..0000000
--- a/src/ivivehiclefunctions/qiviwindowcontrolbackendinterface.cpp
+++ /dev/null
@@ -1,174 +0,0 @@
-/****************************************************************************
-**
-** 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 "qiviwindowcontrolbackendinterface.h"
-
-/*!
- * \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.
- */
-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::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::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 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 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 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 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 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.
- */
diff --git a/src/ivivehiclefunctions/qiviwindowcontrolbackendinterface.h b/src/ivivehiclefunctions/qiviwindowcontrolbackendinterface.h
deleted file mode 100644
index f5b8c01..0000000
--- a/src/ivivehiclefunctions/qiviwindowcontrolbackendinterface.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/****************************************************************************
-**
-** 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 QIVIWINDOWCONTROLBACKENDINTERFACE_H
-#define QIVIWINDOWCONTROLBACKENDINTERFACE_H
-
-#include <QtCore/QObject>
-
-#include <QtIviCore/qivizonedfeatureinterface.h>
-#include <QtIviCore/qivipropertyattribute.h>
-#include <QtIviVehicleFunctions/qiviwindowcontrol.h>
-
-QT_BEGIN_NAMESPACE
-
-class Q_QTIVIVEHICLEFUNCTIONS_EXPORT QIviWindowControlBackendInterface : public QIviZonedFeatureInterface
-{
- Q_OBJECT
-
-public:
- QIviWindowControlBackendInterface(QObject *parent = Q_NULLPTR);
-
- virtual void setHeaterMode(QIviWindowControl::HeaterMode value, const QString &zone) = 0;
- virtual void setBlindMode(QIviWindowControl::BlindMode value, const QString &zone) = 0;
- virtual void open(const QString &zone) = 0;
- virtual void close(const QString &zone) = 0;
-
-Q_SIGNALS:
- void heaterModeChanged(QIviWindowControl::HeaterMode value, const QString &zone = QString());
- void heaterModeAttributeChanged(const QIviPropertyAttribute<QIviWindowControl::HeaterMode> &heaterMode, const QString &zone = QString());
- void heaterEnabledChanged(bool enabled, const QString &zone = QString());
- void heaterAttributeChanged(const QIviPropertyAttribute<bool> &heater, const QString &zone = QString());
- void blindModeChanged(QIviWindowControl::BlindMode value, const QString &zone = QString());
- void blindModeAttributeChanged(const QIviPropertyAttribute<QIviWindowControl::BlindMode> &blindMode, const QString &zone = QString());
- void blindStateChanged(QIviWindowControl::State value, const QString &zone = QString());
- void blindStateAttributeChanged(const QIviPropertyAttribute<QIviWindowControl::State> &blindState, const QString &zone = QString());
- void stateChanged(QIviWindowControl::State value, const QString &zone = QString());
- void stateAttributeChanged(const QIviPropertyAttribute<QIviWindowControl::State> &state, const QString &zone = QString());
-};
-
-#define QIviWindowControl_iid "org.qt-project.qtivi.WindowControl/1.0"
-
-QT_END_NAMESPACE
-
-#endif // QIVIWINDOWCONTROLBACKENDINTERFACE_H
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..8450403 100644
--- a/src/plugins/ivimedia/ivimedia.pro
+++ b/src/plugins/ivimedia/ivimedia.pro
@@ -1,3 +1,9 @@
TEMPLATE = subdirs
SUBDIRS = media_simulator \
tuner_simulator
+
+qtHaveModule(dbus): SUBDIRS += media_simulator_mpris
+
+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..faba4c7 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,9 @@ bool MediaIndexerBackend::scanWorker(const QString &mediaDir, bool removeData)
qInfo() << "Scanning path: " << mediaDir;
+#ifndef QT_TAGLIB
+ QMediaPlayer player;
+#endif
QSqlQuery query(m_db);
bool ret = query.exec("CREATE TABLE IF NOT EXISTS track "
@@ -178,21 +185,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 +206,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 +276,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 +294,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/media_simulator_mpris/media_simulator_mpris.json b/src/plugins/ivimedia/media_simulator_mpris/media_simulator_mpris.json
new file mode 100644
index 0000000..f7966a3
--- /dev/null
+++ b/src/plugins/ivimedia/media_simulator_mpris/media_simulator_mpris.json
@@ -0,0 +1,5 @@
+{
+ "interfaces" : [
+ "org.qt-project.qtivi.MediaPlayer/1.0"
+ ]
+}
diff --git a/src/plugins/ivimedia/media_simulator_mpris/media_simulator_mpris.pro b/src/plugins/ivimedia/media_simulator_mpris/media_simulator_mpris.pro
new file mode 100644
index 0000000..e3d8aee
--- /dev/null
+++ b/src/plugins/ivimedia/media_simulator_mpris/media_simulator_mpris.pro
@@ -0,0 +1,22 @@
+TARGET = media_simulator_mpris
+QT_FOR_CONFIG += ivimedia-private
+
+PLUGIN_TYPE = qtivi
+PLUGIN_EXTENDS = qtivi
+PLUGIN_CLASS_NAME = QIviServiceInterface
+
+QT += core ivicore ivimedia dbus
+
+load(qt_plugin)
+
+DISTFILES += media_simulator.json
+
+DBUS_INTERFACES += org.mpris.MediaPlayer2.xml
+
+HEADERS += \
+ mediaplugin.h \
+ mediaplayerbackend.h
+
+SOURCES += \
+ mediaplugin.cpp \
+ mediaplayerbackend.cpp
diff --git a/src/plugins/ivimedia/media_simulator_mpris/mediaplayerbackend.cpp b/src/plugins/ivimedia/media_simulator_mpris/mediaplayerbackend.cpp
new file mode 100644
index 0000000..188a296
--- /dev/null
+++ b/src/plugins/ivimedia/media_simulator_mpris/mediaplayerbackend.cpp
@@ -0,0 +1,374 @@
+/****************************************************************************
+**
+** 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 "mediaplayerbackend.h"
+
+#include <QtDebug>
+
+#include "mediaplayer2_interface.h"
+
+MediaPlayerBackend::MediaPlayerBackend(const QString &dbusServiceName, const QDBusConnection &dbusConnection, QObject *parent)
+ : QIviMediaPlayerBackendInterface(parent)
+{
+ qDBusRegisterMetaType<QList<QVariantMap> >();
+
+ m_dbusPlayer = new OrgMprisMediaPlayer2PlayerInterface(dbusServiceName,
+ "/org/mpris/MediaPlayer2",
+ dbusConnection,
+ this);
+
+ m_dbusPlayerProperties = new OrgFreedesktopDBusPropertiesInterface(dbusServiceName,
+ "/org/mpris/MediaPlayer2",
+ dbusConnection,
+ this);
+
+ m_dbusTrackList = new OrgMprisMediaPlayer2TrackListInterface(dbusServiceName,
+ "/org/mpris/MediaPlayer2",
+ dbusConnection,
+ this);
+ if (!m_dbusPlayer->isValid())
+ qWarning() << "Failed to load Player interface on" << dbusServiceName;
+
+ if (!m_dbusPlayerProperties->isValid())
+ qWarning() << "Failed to load Player properties interface on" << dbusServiceName;
+
+ if (!m_dbusTrackList->isValid())
+ qWarning() << "Failed to load Tracklist properties interface on" << dbusServiceName;
+
+ /* Player interface */
+ connect(m_dbusPlayerProperties, &OrgFreedesktopDBusPropertiesInterface::PropertiesChanged,
+ this, &MediaPlayerBackend::onPropertiesChanged);
+
+ /* Properties interface */
+ connect(m_dbusPlayer, &OrgMprisMediaPlayer2PlayerInterface::Seeked,
+ this, &MediaPlayerBackend::onSeeked);
+
+ /* Check for current position using timer */
+ QTimer *timer = new QTimer(this);
+ connect(timer, &QTimer::timeout, this, [=]() {
+ onSeeked(m_dbusPlayer->position());
+ });
+ timer->start(1000);
+
+}
+
+QIviAudioTrackItem MediaPlayerBackend::audioTrackFromMPRIS2Object(const QVariantMap &variantMap)
+{
+ QIviAudioTrackItem audioItem;
+
+ for (QVariantMap::const_iterator i = variantMap.cbegin(); i != variantMap.cend(); ++i) {
+ if (i.key() == QLatin1String("mpris:trackid")) {
+ const QString id = variantMap["mpris:trackid"].value<QDBusObjectPath>().path();
+ audioItem.setId(id);
+ } else if (i.key() == QLatin1String("xesam:url")) {
+ const QString url = variantMap["xesam:url"].toString();
+ audioItem.setUrl(url);
+ } else if (i.key() == QLatin1String("mpris:artUrl")) {
+ const QString url = variantMap["mpris:artUrl"].toString();
+ audioItem.setCoverArtUrl(url);
+ } else if (i.key() == QLatin1String("mpris:length")) {
+ const qlonglong length = variantMap["mpris:length"].toLongLong();
+ audioItem.setDuration(length);
+ } else if (i.key() == QLatin1String("xesam:artist")) {
+ const QStringList artists = variantMap["xesam:artist"].toStringList();
+ if (artists.length() > 0)
+ audioItem.setArtist(artists[0]);
+ } else if (i.key() == QLatin1String("xesam:title")) {
+ const QString title = variantMap["xesam:title"].toString();
+ audioItem.setTitle(title);
+ } else if (i.key() == QLatin1String("xesam:album")) {
+ const QString title = variantMap["xesam:album"].toString();
+ audioItem.setAlbum(title);
+ }
+ }
+
+ return audioItem;
+}
+
+void MediaPlayerBackend::updateTrackIndex(const QVariantMap &newTrack)
+{
+ if (newTrack.contains(QStringLiteral("mpris:trackid"))) {
+ QDBusObjectPath newTrackId = newTrack[QStringLiteral("mpris:trackid")].value<QDBusObjectPath>();
+ updateTrackIndex(newTrackId);
+ }
+}
+void MediaPlayerBackend::updateTrackIndex(const QDBusObjectPath &newTrackId)
+{
+ int newIndex = m_tracks.indexOf(newTrackId);
+ emit currentIndexChanged(newIndex);
+ m_currentTrack = newTrackId;
+}
+
+void MediaPlayerBackend::handlePlaybackStatus(const QString &playbackStatus){
+ if (playbackStatus == QLatin1String("Playing"))
+ emit playStateChanged(QIviMediaPlayer::PlayState::Playing);
+ else if (playbackStatus == QLatin1String("Paused"))
+ emit playStateChanged(QIviMediaPlayer::PlayState::Paused);
+ else if (playbackStatus == QLatin1String("Stopped"))
+ emit playStateChanged(QIviMediaPlayer::PlayState::Stopped);
+ else
+ qWarning() << "Unhandled PlaybackStatus: " << playbackStatus;
+}
+
+void MediaPlayerBackend::handlePosition(qlonglong position)
+{
+ /* QtIVI needs position to be in seconds, while MPRIS2 uses milliseconds */
+ emit positionChanged(position/1000);
+}
+
+void MediaPlayerBackend::onPropertiesChanged(const QString &interface, const QVariantMap &changed_properties, const QStringList &invalidated_properties)
+{
+ if (interface == QLatin1String("org.mpris.MediaPlayer2.Player")) {
+ for (QVariantMap::const_iterator i = changed_properties.constBegin(); i != changed_properties.constEnd(); ++i) {
+ if (i.key() == QLatin1String("PlaybackStatus")) {
+ handlePlaybackStatus(i.value().toString());
+ } else if (i.key() == QLatin1String("Metadata")) { /* Triggered when the current track changes */
+ QVariantMap variantMap;
+ i.value().value<QDBusArgument>() >> variantMap;
+
+ /* Update current duration */
+ if (variantMap.contains(QStringLiteral("mpris:length")))
+ emit durationChanged(variantMap[QStringLiteral("mpris:length")].toLongLong() / 1000);
+
+ /* Adjust current playing index according to track ID */
+ updateTrackIndex(variantMap);
+ } else if (i.key() == QLatin1String("Rate")) {
+ ; /* Not handled */
+ } else if (i.key() == QLatin1String("CanPlay")) {
+ ; /* Not handled */
+ } else if (i.key() == QLatin1String("CanPause")) {
+ ; /* Not handled */
+ } else if (i.key() == QLatin1String("CanSeek")) {
+ ; /* Not handled */
+ } else {
+ qWarning() << "Unhandled property: " << i.key() << ": " << i.value() << endl;
+ }
+ }
+ } else if (interface == QLatin1String("org.mpris.MediaPlayer2.TrackList")) {
+ for (QStringList::const_iterator i = invalidated_properties.constBegin(); i != invalidated_properties.constEnd(); ++i) {
+ if (*i == QLatin1String("Tracks"))
+ fetchOrUpdate(0 /* Update from first element */,
+ -1 /* Update until end of list (all elements)*/,
+ false /* Do an update, not a fetch */);
+ }
+ } else
+ qWarning("Property changed on unknown interface");
+}
+
+void MediaPlayerBackend::onSeeked(qlonglong position)
+{
+ handlePosition(position);
+}
+
+void MediaPlayerBackend::initialize()
+{
+ /* Run in separate thread so we can start fast even if track list is very long */
+ QtConcurrent::run(&m_threadPool, [=]() {
+ /* Fetch current track list from service, and emit its length so updates can be requested */
+ m_tracks = m_dbusTrackList->tracks();
+ QVariantMap metadata = m_dbusPlayer->metadata();
+ emit countChanged(m_tracks.length());
+ updateTrackIndex(metadata);
+
+ /* Simulate property change to get the latest metadata on start-up */
+ onPropertiesChanged(QStringLiteral("org.mpris.MediaPlayer2.Player"), metadata, QStringList());
+
+ /* Position is not in metadata, so handle separately */
+ handlePosition(m_dbusPlayer->position());
+
+ /* Playback status is not in metadata, so handle separately */
+ handlePlaybackStatus(m_dbusPlayer->playbackStatus());
+
+ emit initializationDone();
+ });
+}
+
+void MediaPlayerBackend::play()
+{
+ m_dbusPlayer->Play();
+}
+
+void MediaPlayerBackend::pause()
+{
+ m_dbusPlayer->Pause();
+}
+
+void MediaPlayerBackend::stop()
+{
+ m_dbusPlayer->Stop();
+}
+
+void MediaPlayerBackend::seek(qint64 offset)
+{
+ m_dbusPlayer->Seek(offset);
+}
+
+void MediaPlayerBackend::next()
+{
+ m_dbusPlayer->Next();
+}
+
+void MediaPlayerBackend::previous()
+{
+ m_dbusPlayer->Previous();
+}
+
+void MediaPlayerBackend::setPlayMode(QIviMediaPlayer::PlayMode playMode)
+{
+ bool shuffle = false;
+ QString loopStatus = "None";
+
+ switch (playMode) {
+ case QIviMediaPlayer::Normal:
+ shuffle = false;
+ loopStatus = "None";
+ break;
+ case QIviMediaPlayer::RepeatTrack:
+ shuffle = false;
+ loopStatus = "Track";
+ break;
+ case QIviMediaPlayer::RepeatAll:
+ shuffle = false;
+ loopStatus = "Playlist";
+ break;
+ case QIviMediaPlayer::Shuffle:
+ shuffle = true;
+ loopStatus = "None";
+ break;
+ default:
+ qWarning() << "Illegal play mode: " << playMode;
+ return;
+ }
+
+ m_dbusPlayer->setShuffle(shuffle);
+ m_dbusPlayer->setLoopStatus(loopStatus);
+}
+
+void MediaPlayerBackend::setPosition(qint64 position)
+{
+ m_dbusPlayer->SetPosition(m_currentTrack, position * 1000);
+}
+
+bool MediaPlayerBackend::canReportCount()
+{
+ return true;
+}
+
+/* This doesn't need to be a Future right now, since it is only called from
+ * fetchOrUpdate, but I keep this as a Future so that it can be used
+ * asynchronously if needed.. in the future. */
+QFuture<QVariantList> MediaPlayerBackend::itemsForMPRIS2Object(QList<QDBusObjectPath> objs)
+{
+ /* Get track metadata in own thread, since this may take a while */
+ return QtConcurrent::run(&m_threadPool, [=]() -> QVariantList {
+ auto reply = m_dbusTrackList->GetTracksMetadata(objs);
+
+ reply.waitForFinished();
+ QVariantList items;
+
+ QList<QMap<QString, QVariant> > objects = reply.argumentAt<0>();
+ for (int i = 0; i < objects.length(); ++i) {
+ QMap<QString, QVariant> dbusItem = objects.at(i);
+ QIviAudioTrackItem item;
+ item = audioTrackFromMPRIS2Object(dbusItem);
+ items.append(QVariant::fromValue(item));
+ }
+ return items;
+ });
+}
+
+void MediaPlayerBackend::fetchData(int start, int count)
+{
+ fetchOrUpdate(start, count, true /* Do a fetch, not an update */);
+}
+
+void MediaPlayerBackend::fetchOrUpdate(int start, int count, bool fetch)
+{
+ /* Do fetch or update operation in own thread, since it may take a while */
+ QtConcurrent::run(&m_threadPool, [=]() {
+ QList<QDBusObjectPath> newTracks = m_dbusTrackList->tracks();
+ QVariantList list;
+ if (start < newTracks.length())
+ list = itemsForMPRIS2Object(newTracks.mid(start, count)).result();
+
+ emit countChanged(newTracks.length());
+
+ if (fetch)
+ emit dataFetched(list, start, list.count() >= count);
+ else {
+ /* TODO: Don't invalidate the entire list, just reflect the modifications made */
+ emit dataChanged(QVariantList(), 0, m_tracks.count());
+ emit dataChanged(list, 0, 0);
+ }
+
+ m_tracks = newTracks;
+ });
+}
+
+void MediaPlayerBackend::insert(int index, const QIviPlayableItem *item)
+{
+ Q_UNUSED(index)
+ Q_UNUSED(item)
+ qWarning() << "Insertion is not supported";
+}
+
+void MediaPlayerBackend::remove(int index)
+{
+ Q_UNUSED(index)
+ qWarning() << "Removal is not supported";
+}
+
+void MediaPlayerBackend::move(int cur_index, int new_index)
+{
+ Q_UNUSED(cur_index)
+ Q_UNUSED(new_index)
+ qWarning() << "Moving is not supported";
+}
+
+void MediaPlayerBackend::setCurrentIndex(int index)
+{
+ if (index >= 0 && index < m_tracks.length()) {
+ m_dbusTrackList->GoTo(m_tracks[index]);
+ m_currentTrack = m_tracks[index];
+ emit currentIndexChanged(index);
+ } else
+ qWarning() << "Supplied index is out of range";
+}
diff --git a/src/plugins/ivimedia/media_simulator_mpris/mediaplayerbackend.h b/src/plugins/ivimedia/media_simulator_mpris/mediaplayerbackend.h
new file mode 100644
index 0000000..efc3a39
--- /dev/null
+++ b/src/plugins/ivimedia/media_simulator_mpris/mediaplayerbackend.h
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** 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 MEDIAPLAYERBACKEND_H
+#define MEDIAPLAYERBACKEND_H
+
+#include <QtConcurrent/QtConcurrent>
+#include <QtMultimedia/QMediaPlayer>
+#include <QtIviMedia/QIviMediaPlayerBackendInterface>
+#include "mediaplayer2_interface.h"
+
+class MediaPlayerBackend : public QIviMediaPlayerBackendInterface
+{
+ Q_OBJECT
+
+public:
+ MediaPlayerBackend(const QString &dbusServiceName, const QDBusConnection &dbusConnection, QObject *parent = nullptr);
+
+ 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() override;
+ virtual void fetchData(int start, int count) 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;
+
+signals:
+ void initializationDone();
+
+private Q_SLOTS:
+ void onPropertiesChanged(const QString &interface, const QVariantMap &changed_properties, const QStringList &invalidated_properties);
+ void onSeeked(qlonglong position);
+
+private:
+ QThreadPool m_threadPool;
+ OrgMprisMediaPlayer2PlayerInterface *m_dbusPlayer;
+ OrgFreedesktopDBusPropertiesInterface *m_dbusPlayerProperties;
+ OrgMprisMediaPlayer2TrackListInterface *m_dbusTrackList;
+ QList<QDBusObjectPath> m_tracks;
+ QDBusObjectPath m_currentTrack;
+
+ void updateTrackIndex(const QDBusObjectPath &newTrackId);
+ void updateTrackIndex(const QVariantMap &newTrack);
+ QIviAudioTrackItem audioTrackFromMPRIS2Object(const QVariantMap &metadata);
+ QFuture<QVariantList> itemsForMPRIS2Object(QList<QDBusObjectPath> obj);
+ void fetchOrUpdate(int start, int count, bool fetch);
+ void handlePlaybackStatus(const QString &playbackStatus);
+ void handlePosition(qlonglong position);
+};
+
+#endif // MEDIAPLAYERBACKEND_H
diff --git a/src/ivivehiclefunctions/qtivivehiclefunctionsglobal_p.h b/src/plugins/ivimedia/media_simulator_mpris/mediaplugin.cpp
index c782264..0e670c0 100644
--- a/src/ivivehiclefunctions/qtivivehiclefunctionsglobal_p.h
+++ b/src/plugins/ivimedia/media_simulator_mpris/mediaplugin.cpp
@@ -39,21 +39,33 @@
**
****************************************************************************/
-#ifndef QIVIVEHICLEFUNCTIONSGLOBAL_P_H
-#define QIVIVEHICLEFUNCTIONSGLOBAL_P_H
-
-//
-// 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 <QtIviVehicleFunctions/private/qtivivehiclefunctions-config_p.h>
-#include <QtIviVehicleFunctions/qtivivehiclefunctionsglobal.h>
-
-#endif // QIVIVEHICLEFUNCTIONSGLOBAL_P_H
+#include "mediaplayerbackend.h"
+#include "mediaplugin.h"
+
+#include <QtIviMedia/QIviMediaPlayer>
+
+#include <QStringList>
+#include <QtDebug>
+
+#include "mediaplayer2_interface.h"
+
+MediaPlugin::MediaPlugin(QObject *parent)
+ : QObject(parent)
+{
+ m_player = new MediaPlayerBackend("org.mpris.MediaPlayer2.vlc", QDBusConnection::sessionBus(), this);
+}
+
+QStringList MediaPlugin::interfaces() const
+{
+ QStringList list;
+ list << QIviMediaPlayer_iid;
+ return list;
+}
+
+QIviFeatureInterface *MediaPlugin::interfaceInstance(const QString &interface) const
+{
+ if (interface == QIviMediaPlayer_iid)
+ return m_player;
+
+ return nullptr;
+}
diff --git a/src/plugins/ivivehiclefunctions/vehiclefunction_simulator/vehicleplugin.h b/src/plugins/ivimedia/media_simulator_mpris/mediaplugin.h
index 1d69cbb..a3a3979 100644
--- a/src/plugins/ivivehiclefunctions/vehiclefunction_simulator/vehicleplugin.h
+++ b/src/plugins/ivimedia/media_simulator_mpris/mediaplugin.h
@@ -39,29 +39,28 @@
**
****************************************************************************/
-#ifndef VEHICLEPLUGIN_H
-#define VEHICLEPLUGIN_H
+
+#ifndef MEDIAPLUGIN_H
+#define MEDIAPLUGIN_H
#include <QtIviCore/QIviServiceInterface>
-class ClimateControlBackend;
-class WindowControlBackend;
+class MediaPlayerBackend;
-class VehiclePlugin : public QObject, QIviServiceInterface
+class MediaPlugin : public QObject, QIviServiceInterface
{
Q_OBJECT
- Q_PLUGIN_METADATA(IID QIviServiceInterface_iid FILE "vehiclefunction_simulator.json")
+ Q_PLUGIN_METADATA(IID QIviServiceInterface_iid FILE "media_simulator_mpris.json")
Q_INTERFACES(QIviServiceInterface)
public:
- VehiclePlugin(QObject *parent = 0);
+ explicit MediaPlugin(QObject *parent = nullptr);
QStringList interfaces() const;
- QObject *interfaceInstance(const QString& interface) const;
+ QIviFeatureInterface *interfaceInstance(const QString &interface) const;
private:
- ClimateControlBackend *m_climate;
- WindowControlBackend *m_window;
+ MediaPlayerBackend *m_player;
};
-#endif // VEHICLEPLUGIN_H
+#endif // MEDIAPLUGIN_H
diff --git a/src/plugins/ivimedia/media_simulator_mpris/org.mpris.MediaPlayer2.xml b/src/plugins/ivimedia/media_simulator_mpris/org.mpris.MediaPlayer2.xml
new file mode 100644
index 0000000..c69642e
--- /dev/null
+++ b/src/plugins/ivimedia/media_simulator_mpris/org.mpris.MediaPlayer2.xml
@@ -0,0 +1,113 @@
+<node>
+ <interface name="org.mpris.MediaPlayer2.Player">
+ <method name="Next"/>
+ <method name="Previous"/>
+ <method name="Pause"/>
+ <method name="PlayPause"/>
+ <method name="Stop"/>
+ <method name="Play"/>
+ <method name="Seek">
+ <arg direction="in" type="x" name="Offset"/>
+ </method>
+ <method name="SetPosition">
+ <arg direction="in" type="o" name="TrackId"/>
+ <arg direction="in" type="x" name="Position"/>
+ </method>
+ <method name="OpenUri">
+ <arg direction="in" type="s"/>
+ </method>
+ <!-- Signals -->
+ <signal name="Seeked">
+ <arg type="x" name="Position"/>
+ </signal>
+ <!-- Properties -->
+ <property access="read" type="s" name="PlaybackStatus"/>
+ <property access="readwrite" type="s" name="LoopStatus"/>
+ <property access="readwrite" type="d" name="Rate"/>
+ <property access="readwrite" type="b" name="Shuffle"/>
+ <property access="read" type="a{sv}" name="Metadata">
+ <annotation value="QVariantMap" name="org.qtproject.QtDBus.QtTypeName"/>
+ </property>
+ <property access="readwrite" type="d" name="Volume"/>
+ <property access="read" type="x" name="Position"/>
+ <property access="read" type="d" name="MinimumRate"/>
+ <property access="read" type="d" name="MaximumRate"/>
+ <property access="read" type="b" name="CanGoNext"/>
+ <property access="read" type="b" name="CanGoPrevious"/>
+ <property access="read" type="b" name="CanPlay"/>
+ <property access="read" type="b" name="CanPause"/>
+ <property access="read" type="b" name="CanSeek"/>
+ <property access="read" type="b" name="CanControl"/>
+ </interface>
+ <interface name="org.freedesktop.DBus.Properties">
+ <method name="Get">
+ <arg name="interface_name" type="s" direction="in"/>
+ <arg name="property_name" type="s" direction="in"/>
+ <arg name="value" type="v" direction="out"/>
+ </method>
+ <method name="Set">
+ <arg name="interface_name" type="s" direction="in"/>
+ <arg name="property_name" type="s" direction="in"/>
+ <arg name="value" type="v" direction="in"/>
+ </method>
+ <method name="GetAll">
+ <arg name="interface_name" type="s" direction="in"/>
+ <arg name="values" type="a{sv}" direction="out"/>
+ <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QVariantMap"/>
+ </method>
+ <signal name="PropertiesChanged">
+ <arg name="interface" type="s"/>
+ <arg name="changed_properties" type="a{sv}"/>
+ <annotation name="org.qtproject.QtDBus.QtTypeName.Out1" value="QVariantMap"/>
+ <arg name="invalidated_properties" type="as"/>
+ </signal>
+ </interface>
+ <interface name="org.freedesktop.DBus.Introspectable">
+ <method name="Introspect">
+ <arg name="xml_data" type="s" direction="out"/>
+ </method>
+ </interface>
+ <interface name="org.freedesktop.DBus.Peer">
+ <method name="Ping"/>
+ <method name="GetMachineId">
+ <arg name="machine_uuid" type="s" direction="out"/>
+ </method>
+ </interface>
+ <interface name="org.mpris.MediaPlayer2.TrackList">
+ <method name="GetTracksMetadata">
+ <arg direction="in" name="TrackIds" type="ao"/>
+ <arg direction="out" name="Metadata" type="aa{sv}" />
+ <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QList&lt;QVariantMap&gt;" />
+ </method>
+ <method name="AddTrack">
+ <arg direction="in" name="Uri" type="s"/>
+ <arg direction="in" name="AfterTrack" type="o"/>
+ <arg direction="in" name="SetAsCurrent" type="b"/>
+ </method>
+ <method name="RemoveTrack">
+ <arg direction="in" name="TrackId" type="o"/>
+ </method>
+ <method name="GoTo">
+ <arg direction="in" name="TrackId" type="o"/>
+ </method>
+ <signal name="TrackListReplaced">
+ <arg name="Tracks" type="ao"/>
+ <arg name="CurrentTrack" type="o"/>
+ </signal>
+ <signal name="TrackAdded">
+ <arg name="Metadata" type="a{sv}" />
+ <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QList&lt;QVariantMap&gt;"/>
+ <arg name="AfterTrack" type="o"/>
+ </signal>
+ <signal name="TrackRemoved">
+ <arg name="TrackId" type="o"/>
+ </signal>
+ <signal name="TrackMetadataChanged">
+ <arg name="TrackId" type="o"/>
+ <arg name="Metadata" type="a{sv}" />
+ <annotation name="org.qtproject.QtDBus.QtTypeName.Out1" value="QList&lt;QVariantMap&gt;"/>
+ </signal>
+ <property name="Tracks" type="ao" access="read"/>
+ <property name="CanEditTracks" type="b" access="read"/>
+ </interface>
+</node>
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/vehiclefunction_simulator/vehicleplugin.cpp b/src/plugins/ivivehiclefunctions/ivivehiclefunctions.cpp
index f89d1d7..f68af75 100644
--- a/src/plugins/ivivehiclefunctions/vehiclefunction_simulator/vehicleplugin.cpp
+++ b/src/plugins/ivivehiclefunctions/ivivehiclefunctions.cpp
@@ -1,6 +1,7 @@
/****************************************************************************
**
** 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.
@@ -39,34 +40,22 @@
**
****************************************************************************/
-#include "vehicleplugin.h"
-#include "climatecontrolbackend.h"
-#include "windowcontrolbackend.h"
+#include "qiviclimatecontrolbackend.h"
+#include "qiviconcretewindowcontrolbackend.h"
+#include "qtivivehiclefunctionsplugin.h"
-#include <QtIviVehicleFunctions/QIviClimateControlBackendInterface>
-#include <QStringList>
+QT_BEGIN_NAMESPACE
-VehiclePlugin::VehiclePlugin(QObject *parent) :
- QObject(parent),
- m_climate(new ClimateControlBackend(this)),
- m_window(new WindowControlBackend(this))
+extern QVector<QIviFeatureInterface *> vehicleFunctionsInterfaceBuilder(QtIviVehicleFunctionsPlugin *plugin)
{
+ const QStringList interafaces = plugin->interfaces();
+ QVector<QIviFeatureInterface *> res;
+ Q_ASSERT(interafaces.size() == 2);
+ Q_ASSERT(interafaces.indexOf(QtIviVehicleFunctions_QIviClimateControl_iid) == 0);
+ Q_ASSERT(interafaces.indexOf(QtIviVehicleFunctions_QIviWindowControl_iid) == 1);
+ res << new QIviClimateControlBackend(plugin);
+ res << new QIviConcreteWindowControlBackend(plugin);
+ return res;
}
-QStringList VehiclePlugin::interfaces() const
-{
- QStringList list;
- list << QIviClimateControl_iid;
- list << QIviWindowControl_iid;
- return list;
-}
-
-QObject *VehiclePlugin::interfaceInstance(const QString &interface) const
-{
- if (interface == QIviClimateControl_iid)
- return m_climate;
- else if (interface == QIviWindowControl_iid)
- return m_window;
-
- return 0;
-}
+QT_END_NAMESPACE
diff --git a/src/plugins/ivivehiclefunctions/ivivehiclefunctions.pro b/src/plugins/ivivehiclefunctions/ivivehiclefunctions.pro
index c790087..55cf52f 100644
--- a/src/plugins/ivivehiclefunctions/ivivehiclefunctions.pro
+++ b/src/plugins/ivivehiclefunctions/ivivehiclefunctions.pro
@@ -1,3 +1,27 @@
-TEMPLATE = subdirs
-SUBDIRS = vehiclefunction_simulator
+TARGET = vehiclefunction_simulator
+QT += core ivicore ivivehiclefunctions
+CONFIG += c++11 ivigenerator
+
+CMAKE_MODULE_TESTS = '-'
+
+QFACE_FORMAT = backend_simulator
+QFACE_MODULE_NAME = QtIviVehicleFunctions
+QFACE_SOURCES += ../../ivivehiclefunctions/ivivehiclefunctions.qface
+
+SOURCES += \
+ ivivehiclefunctions.cpp \
+ qiviconcretewindowcontrolbackend.cpp
+
+HEADERS += \
+ qiviconcretewindowcontrolbackend.h
+
+OTHER_FILES += \
+ $$PWD/doc/*.qdocconf \
+ $$PWD/doc/src/*.qdoc
+
+PLUGIN_TYPE = qtivi
+PLUGIN_EXTENDS = qtivi
+PLUGIN_CLASS_NAME = QIviClimateControlBackendInterface
+
+load(qt_plugin)
diff --git a/src/plugins/ivivehiclefunctions/qiviconcretewindowcontrolbackend.cpp b/src/plugins/ivivehiclefunctions/qiviconcretewindowcontrolbackend.cpp
new file mode 100644
index 0000000..ce597ed
--- /dev/null
+++ b/src/plugins/ivivehiclefunctions/qiviconcretewindowcontrolbackend.cpp
@@ -0,0 +1,192 @@
+/****************************************************************************
+**
+** 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
+**
+****************************************************************************/
+
+#include "qiviconcretewindowcontrolbackend.h"
+
+#include <QDebug>
+
+QT_BEGIN_NAMESPACE
+
+WindowTimer::WindowTimer(const QString &zone, bool isBlind, QIviConcreteWindowControlBackend *backend)
+ : QObject(backend)
+ , m_timer(new QTimer(this))
+ , m_opening(true)
+ , m_currentValue(0)
+ , m_interval(4)
+ , m_zone(zone)
+ , m_blind(isBlind)
+ , m_backend(backend)
+{
+ m_timer->setInterval(1000);
+ connect(m_timer, &QTimer::timeout, this, &WindowTimer::checkValue);
+}
+
+void WindowTimer::setOpeningTime(int intervalInSeconds)
+{
+ m_interval = intervalInSeconds;
+}
+
+void WindowTimer::open()
+{
+ m_opening = true;
+ m_timer->start();
+}
+
+void WindowTimer::close()
+{
+ m_opening = false;
+ m_timer->start();
+}
+
+void WindowTimer::checkValue()
+{
+ if (m_opening)
+ m_currentValue++;
+ else
+ m_currentValue--;
+
+ QtIviVehicleFunctionsModule::WindowState state = QtIviVehicleFunctionsModule::Closed;
+ if (m_currentValue <= 0) {
+ m_currentValue = 0;
+ m_timer->stop();
+ state = QtIviVehicleFunctionsModule::Closed;
+ } else if (m_currentValue >= m_interval) {
+ m_currentValue = m_interval;
+ m_timer->stop();
+ state = QtIviVehicleFunctionsModule::FullyOpen;
+ } else {
+ state = QtIviVehicleFunctionsModule::Open;
+ }
+
+ if (m_blind) {
+ m_backend->setBlindState(state, m_zone);
+ } else {
+ m_backend->setWindowState(state, m_zone);
+ }
+}
+
+
+QIviConcreteWindowControlBackend::QIviConcreteWindowControlBackend(QObject *parent)
+ : QIviWindowControlBackend(parent)
+{
+ const auto zones = availableZones();
+ for (const QString &zone : zones) {
+ m_zoneWindowTimers[zone] = new WindowTimer(zone, false, this);
+ m_zoneBlindTimers[zone] = new WindowTimer(zone, true, this);
+ }
+}
+
+QIviConcreteWindowControlBackend::~QIviConcreteWindowControlBackend()
+{
+}
+
+void QIviConcreteWindowControlBackend::setBlindMode(QtIviVehicleFunctionsModule::BlindMode blindMode, const QString &zone)
+{
+ if (!m_zoneMap.contains(zone))
+ return;
+ if (m_zoneMap[zone].blindMode == blindMode)
+ return;
+
+ if (blindMode == QtIviVehicleFunctionsModule::BlindOpen)
+ m_zoneBlindTimers[zone]->open();
+ else if (blindMode == QtIviVehicleFunctionsModule::BlindClosed)
+ m_zoneBlindTimers[zone]->close();
+
+ QIviWindowControlBackend::setBlindMode(blindMode, zone);
+}
+
+void QIviConcreteWindowControlBackend::open(const QString &zone)
+{
+ if (!m_zoneMap.contains(zone))
+ return;
+
+ if (m_zoneMap[zone].state == QtIviVehicleFunctionsModule::Open)
+ return;
+
+ qWarning() << "SIMULATION open Window:" << zone;
+ m_zoneWindowTimers[zone]->open();
+}
+
+void QIviConcreteWindowControlBackend::close(const QString &zone)
+{
+ if (!m_zoneMap.contains(zone))
+ return;
+
+ if (m_zoneMap[zone].state == QtIviVehicleFunctionsModule::Closed)
+ return;
+
+ qWarning() << "SIMULATION close Window:" << zone;
+ m_zoneWindowTimers[zone]->close();
+}
+
+QtIviVehicleFunctionsModule::WindowState QIviConcreteWindowControlBackend::windowState(QString zone)
+{
+ Q_ASSERT(m_zoneMap.contains(zone));
+ return m_zoneMap[zone].state;
+}
+
+void QIviConcreteWindowControlBackend::setWindowState(QtIviVehicleFunctionsModule::WindowState state, const QString &zone)
+{
+ if (m_zoneMap[zone].state == state)
+ return;
+ qWarning() << "SIMULATION window state for Zone" << zone << "changed to" << state;
+ m_zoneMap[zone].state = state;
+ emit stateChanged(state, zone);
+}
+
+QtIviVehicleFunctionsModule::WindowState QIviConcreteWindowControlBackend::blindState(QString zone)
+{
+ Q_ASSERT(m_zoneMap.contains(zone));
+ return m_zoneMap[zone].blindState;
+}
+
+void QIviConcreteWindowControlBackend::setBlindState(QtIviVehicleFunctionsModule::WindowState state, const QString &zone)
+{
+ if (m_zoneMap[zone].blindState == state)
+ return;
+ qWarning() << "SIMULATION blind state for Zone" << zone << "changed to" << state;
+ m_zoneMap[zone].blindState = state;
+ emit blindStateChanged(state, zone);
+}
+
+
+QT_END_NAMESPACE
diff --git a/src/plugins/ivivehiclefunctions/vehiclefunction_simulator/windowcontrolbackend.h b/src/plugins/ivivehiclefunctions/qiviconcretewindowcontrolbackend.h
index 92aeb07..58e91e1 100644
--- a/src/plugins/ivivehiclefunctions/vehiclefunction_simulator/windowcontrolbackend.h
+++ b/src/plugins/ivivehiclefunctions/qiviconcretewindowcontrolbackend.h
@@ -1,6 +1,7 @@
/****************************************************************************
**
** 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.
@@ -39,20 +40,19 @@
**
****************************************************************************/
-#ifndef WINDOWCONTROLBACKEND_H
-#define WINDOWCONTROLBACKEND_H
+#ifndef QTIVIVEHICLEFUNCTIONS_QIVICONCRETEWINDOWCONTROLBACKEND_H_
+#define QTIVIVEHICLEFUNCTIONS_QIVICONCRETEWINDOWCONTROLBACKEND_H_
-#include <QObject>
+#include "qiviwindowcontrolbackend.h"
#include <QTimer>
-#include <QtIviVehicleFunctions/QIviWindowControlBackendInterface>
-class WindowControlBackend;
+QT_BEGIN_NAMESPACE
+
+class QIviConcreteWindowControlBackend;
class WindowTimer : public QObject
{
- Q_OBJECT
-
public:
- WindowTimer(const QString &zone, bool isBlind, WindowControlBackend *backend);
+ WindowTimer(const QString &zone, bool isBlind, QIviConcreteWindowControlBackend *backend);
void setOpeningTime(int intervalInSeconds);
void open();
@@ -68,42 +68,29 @@ private:
int m_interval;
QString m_zone;
bool m_blind;
- WindowControlBackend *m_backend;
+ QIviConcreteWindowControlBackend *m_backend;
};
-class WindowControlBackend : public QIviWindowControlBackendInterface
+class QIviConcreteWindowControlBackend : public QIviWindowControlBackend
{
public:
- WindowControlBackend(QObject *parent = 0);
- ~WindowControlBackend();
+ explicit QIviConcreteWindowControlBackend(QObject *parent = nullptr);
+ ~QIviConcreteWindowControlBackend();
- QStringList availableZones() const;
- void initializeAttributes();
+ virtual void setBlindMode(QtIviVehicleFunctionsModule::BlindMode blindMode, const QString &zone) override;
+ virtual void open(const QString &zone) override;
+ virtual void close(const QString &zone) override;
- void setHeaterMode(QIviWindowControl::HeaterMode value, const QString &zone);
- void setBlindMode(QIviWindowControl::BlindMode value, const QString &zone);
- void open(const QString &zone);
- void close(const QString &zone);
+ QtIviVehicleFunctionsModule::WindowState windowState(QString zone);
+ void setWindowState(QtIviVehicleFunctionsModule::WindowState state, const QString &zone);
+ QtIviVehicleFunctionsModule::WindowState blindState(QString zone);
+ void setBlindState(QtIviVehicleFunctionsModule::WindowState state, const QString &zone);
private:
-
- struct ZoneBackend {
- QIviWindowControl::HeaterMode heaterMode;
- QIviPropertyAttribute<QIviWindowControl::HeaterMode> heaterModeAttribute;
- bool heaterEnabled;
- QIviPropertyAttribute<bool> heaterAttribute;
- QIviWindowControl::BlindMode blindMode;
- QIviPropertyAttribute<QIviWindowControl::BlindMode> blindModeAttribute;
- QIviWindowControl::State blindState;
- QIviPropertyAttribute<QIviWindowControl::State> blindStateAttribute;
- WindowTimer *blindTimer;
- QIviWindowControl::State state;
- QIviPropertyAttribute<QIviWindowControl::State> stateAttribute;
- WindowTimer *stateTimer;
- };
-
- QMap<QString,ZoneBackend> m_zoneMap;
- friend class WindowTimer;
+ QMap<QString,WindowTimer*> m_zoneWindowTimers;
+ QMap<QString,WindowTimer*> m_zoneBlindTimers;
};
-#endif // WINDOWCONTROLBACKEND_H
+QT_END_NAMESPACE
+
+#endif // QTIVIVEHICLEFUNCTIONS_QIVICONCRETEWINDOWCONTROLBACKEND_H_
diff --git a/src/plugins/ivivehiclefunctions/vehiclefunction_simulator/climatecontrolbackend.cpp b/src/plugins/ivivehiclefunctions/vehiclefunction_simulator/climatecontrolbackend.cpp
deleted file mode 100644
index 85d576c..0000000
--- a/src/plugins/ivivehiclefunctions/vehiclefunction_simulator/climatecontrolbackend.cpp
+++ /dev/null
@@ -1,318 +0,0 @@
-/****************************************************************************
-**
-** 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 "climatecontrolbackend.h"
-
-#include <QDebug>
-
-ClimateControlBackend::ClimateControlBackend(QObject *parent) :
- QIviClimateControlBackendInterface(parent),
- m_flowDirection(QIviClimateControl::Floor | QIviClimateControl::Dashboard),
- m_airCondition(true),
- m_heater(true),
- m_airRecirculation(false),
- m_zoneSynchronization(false),
- m_defrost(false),
- m_steeringWheelHeater(0),
- m_fanSpeed(2),
- m_recirculationMode(QIviClimateControl::RecirculationOff),
- m_recirculationSensitivityLevel(0),
- m_climateMode(QIviClimateControl::ClimateOn),
- m_automaticClimateFanIntensityLevel(0)
-{
-
- ZoneBackend leftZone;
- leftZone.seatCooler = 10;
- leftZone.seatCoolerAttribute = QIviPropertyAttribute<int>(0, 10);
- leftZone.seatHeater = 10;
- leftZone.seatHeaterAttribute = QIviPropertyAttribute<int>(0, 10);
- leftZone.targetTemperature = 20;
- leftZone.targetTemperatureAttribute = QIviPropertyAttribute<int>(16, 28);
- m_zoneMap.insert("FrontLeft", leftZone);
-
- ZoneBackend rightZone;
- rightZone.seatCooler = 5;
- rightZone.seatCoolerAttribute = QIviPropertyAttribute<int>(0, 10);
- rightZone.seatHeater = 0;
- rightZone.seatHeaterAttribute = QIviPropertyAttribute<int>(0, 10);
- rightZone.targetTemperature = 20;
- rightZone.targetTemperatureAttribute = QIviPropertyAttribute<int>(16, 28);
- m_zoneMap.insert("FrontRight", rightZone);
-
- ZoneBackend rearZone;
- rearZone.seatCooler = 0;
- rearZone.seatCoolerAttribute = QIviPropertyAttribute<int>();
- rearZone.seatHeater = 0;
- rearZone.seatHeaterAttribute = QIviPropertyAttribute<int>();
- rearZone.targetTemperature = 20;
- rearZone.targetTemperatureAttribute = QIviPropertyAttribute<int>(16, 28);
- m_zoneMap.insert("Rear", rearZone);
-}
-
-ClimateControlBackend::~ClimateControlBackend()
-{
-}
-
-QStringList ClimateControlBackend::availableZones() const
-{
- return m_zoneMap.keys();
-}
-
-void ClimateControlBackend::initializeAttributes()
-{
- QVector<QIviClimateControl::AirflowDirections> airflow;
- airflow << (QIviClimateControl::Floor | QIviClimateControl::Dashboard) << QIviClimateControl::Floor << QIviClimateControl::Dashboard;
- emit airflowDirectionsAttributeChanged(QIviPropertyAttribute<QIviClimateControl::AirflowDirections>(airflow));
- emit airflowDirectionsChanged(m_flowDirection);
- emit airConditioningAttributeChanged(QIviPropertyAttribute<bool>(true));
- emit airConditioningEnabledChanged(m_airCondition);
- emit heaterAttributeChanged(QIviPropertyAttribute<bool>(true));
- emit heaterEnabledChanged(m_heater);
- emit zoneSynchronizationEnabledChanged(m_zoneSynchronization);
- emit zoneSynchronizationAttributeChanged(QIviPropertyAttribute<bool>(true));
- emit defrostEnabledChanged(m_defrost);
- emit defrostAttributeChanged(QIviPropertyAttribute<bool>(true));
- emit steeringWheelHeaterAttributeChanged(QIviPropertyAttribute<int>(0, 10));
- emit steeringWheelHeaterChanged(m_steeringWheelHeater);
- emit fanSpeedLevelAttributeChanged(QIviPropertyAttribute<int>(0, 6));
- emit fanSpeedLevelChanged(m_fanSpeed);
-
- QVector<QIviClimateControl::RecirculationMode> recirculation;
- recirculation << QIviClimateControl::RecirculationOff << QIviClimateControl::RecirculationOn;
- emit recirculationModeChanged(m_recirculationMode);
- emit recirculationModeAttributeChanged(QIviPropertyAttribute<QIviClimateControl::RecirculationMode>(recirculation));
- emit recirculationSensitivityLevelChanged(m_recirculationSensitivityLevel);
- emit recirculationSensitivityLevelAttributeChanged(QIviPropertyAttribute<int>(false));
- emit recirculationEnabledChanged(m_airRecirculation);
- emit recirculationAttributeChanged(QIviPropertyAttribute<bool>(true));
-
- QVector<QIviClimateControl::ClimateMode> climate;
- climate << QIviClimateControl::ClimateOff << QIviClimateControl::ClimateOn;
- emit climateModeChanged(m_climateMode);
- emit climateModeAttributeChanged(QIviPropertyAttribute<QIviClimateControl::ClimateMode>(climate));
- emit automaticClimateFanIntensityLevelChanged(m_automaticClimateFanIntensityLevel);
- emit automaticClimateFanIntensityLevelAttributeChanged(QIviPropertyAttribute<int>(false));
-
- const auto zones = availableZones();
- for (const QString &zone : zones) {
- emit targetTemperatureAttributeChanged(m_zoneMap[zone].targetTemperatureAttribute, zone);
- emit targetTemperatureChanged(m_zoneMap[zone].targetTemperature, zone);
- emit seatCoolerAttributeChanged(m_zoneMap[zone].seatCoolerAttribute, zone);
- emit seatCoolerChanged(m_zoneMap[zone].seatCooler, zone);
- emit seatHeaterAttributeChanged(m_zoneMap[zone].seatHeaterAttribute, zone);
- emit seatHeaterChanged(m_zoneMap[zone].seatHeater, zone);
- }
-}
-
-void ClimateControlBackend::setTargetTemperature(int val, const QString &zone)
-{
- if (!m_zoneMap.contains(zone))
- return;
-
- if (m_zoneMap[zone].targetTemperature == val)
- return;
-
- qWarning() << "SIMULATION TargetTemperature for Zone" << zone << "changed to" << val;
-
- m_zoneMap[zone].targetTemperature = val;
- emit targetTemperatureChanged(val, zone);
-}
-
-void ClimateControlBackend::setSeatCooler(int val, const QString &zone)
-{
- if (!m_zoneMap.contains(zone))
- return;
-
- if (m_zoneMap[zone].seatCooler == val)
- return;
-
- qWarning() << "SIMULATION SeatCooler for Zone" << zone << "changed to" << val;
-
- m_zoneMap[zone].seatCooler = val;
- emit seatCoolerChanged(val, zone);
-}
-
-void ClimateControlBackend::setSeatHeater(int val, const QString &zone)
-{
- if (!m_zoneMap.contains(zone))
- return;
-
- if (m_zoneMap[zone].seatHeater == val)
- return;
-
- qWarning() << "SIMULATION SeatHeater for Zone" << zone << "changed to" << val;
-
- m_zoneMap[zone].seatHeater = val;
- emit seatHeaterChanged(val, zone);
-}
-
-void ClimateControlBackend::setSteeringWheelHeater(int val, const QString &zone)
-{
- if (!zone.isEmpty() || m_steeringWheelHeater == val)
- return;
-
- if (val < 0 || val > 10) {
- qWarning() << "SIMULATION SteeringWheelHeater change out of range (0-10)" << val;
- emit steeringWheelHeaterChanged(m_steeringWheelHeater);
- return;
- }
-
- qWarning() << "SIMULATION SteeringWheelHeater changed to" << val;
-
- m_steeringWheelHeater = val;
- emit steeringWheelHeaterChanged(val);
-}
-
-void ClimateControlBackend::setFanSpeedLevel(int speed, const QString &zone)
-{
- if (!zone.isEmpty() || m_fanSpeed == speed)
- return;
-
- if (speed < 0 || speed > 10) {
- qWarning() << "SIMULATION FanSpeedLevel change out of range (0-10)" << speed;
- emit fanSpeedLevelChanged(m_fanSpeed);
- return;
- }
-
- qWarning() << "SIMULATION FanSpeedLevel changed to" << speed;
-
- m_fanSpeed = speed;
- emit fanSpeedLevelChanged(speed, zone);
-}
-
-void ClimateControlBackend::setAirflowDirections(QIviClimateControl::AirflowDirections direction, const QString &zone)
-{
- if (!zone.isEmpty() || m_flowDirection == direction)
- return;
-
- qWarning() << "SIMULATION AirflowDirections changed to" << direction;
-
- m_flowDirection = direction;
- emit airflowDirectionsChanged(direction);
-}
-
-void ClimateControlBackend::setAirConditioningEnabled(bool val, const QString &zone)
-{
- if (!zone.isEmpty()|| m_airCondition == val)
- return;
-
- qWarning() << "SIMULATION AirConditionEnabled changed to" << val;
-
- m_airCondition = val;
- emit airConditioningEnabledChanged(val);
-}
-
-void ClimateControlBackend::setHeaterEnabled(bool val, const QString &zone)
-{
- if (!zone.isEmpty() || m_heater == val)
- return;
-
- qWarning() << "SIMULATION HeaterEnabled changed to" << val;
-
- m_heater = val;
- emit heaterEnabledChanged(val);
-}
-
-void ClimateControlBackend::setZoneSynchronizationEnabled(bool zoneSynchronization, const QString &zone)
-{
- if (!zone.isEmpty() || m_zoneSynchronization == zoneSynchronization)
- return;
-
- qWarning() << "SIMULATION ZoneSynchronization changed to" << zoneSynchronization;
-
- m_zoneSynchronization = zoneSynchronization;
- emit zoneSynchronizationEnabledChanged(zoneSynchronization);
-}
-
-void ClimateControlBackend::setDefrostEnabled(bool defrost, const QString &zone)
-{
- if (!zone.isEmpty() || m_defrost == defrost)
- return;
-
- qWarning() << "SIMULATION Defrost changed to" << defrost;
-
- m_defrost = defrost;
- emit defrostEnabledChanged(defrost);
-}
-
-void ClimateControlBackend::setRecirculationMode(QIviClimateControl::RecirculationMode recirculationMode, const QString &zone)
-{
- if (!zone.isEmpty() || m_recirculationMode == recirculationMode)
- return;
-
- qWarning() << "SIMULATION RecirculationMode changed to" << recirculationMode;
-
- m_recirculationMode = recirculationMode;
- emit recirculationModeChanged(recirculationMode);
-
- bool recirculation = (m_recirculationMode == QIviClimateControl::RecirculationOn);
- if (recirculation != m_airRecirculation) {
- qWarning() << "SIMULATION recirculation changed to" << recirculation;
-
- m_airRecirculation = recirculation;
- emit recirculationEnabledChanged(m_airRecirculation);
- }
-}
-
-void ClimateControlBackend::setRecirculationSensitivityLevel(int recirculationSensitivityLevel, const QString &zone)
-{
- Q_UNUSED(recirculationSensitivityLevel);
- Q_UNUSED(zone);
- qWarning() << "SIMULATION Setting RecirculationSensitivityLevel is not supported!";
-}
-
-void ClimateControlBackend::setClimateMode(QIviClimateControl::ClimateMode climateMode, const QString &zone)
-{
- if (!zone.isEmpty() || m_climateMode == climateMode)
- return;
-
- qWarning() << "SIMULATION ZoneSynchronization changed to" << climateMode;
-
- m_climateMode = climateMode;
- emit climateModeChanged(climateMode);
-}
-
-void ClimateControlBackend::setAutomaticClimateFanIntensityLevel(int automaticClimateFanIntensityLevel, const QString &zone)
-{
- Q_UNUSED(automaticClimateFanIntensityLevel);
- Q_UNUSED(zone);
- qWarning() << "SIMULATION Setting AutomaticClimateFanIntensityLevel is not supported!";
-}
diff --git a/src/plugins/ivivehiclefunctions/vehiclefunction_simulator/climatecontrolbackend.h b/src/plugins/ivivehiclefunctions/vehiclefunction_simulator/climatecontrolbackend.h
deleted file mode 100644
index 3fb7a68..0000000
--- a/src/plugins/ivivehiclefunctions/vehiclefunction_simulator/climatecontrolbackend.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/****************************************************************************
-**
-** 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 CLIMATECONTROLBACKEND_H
-#define CLIMATECONTROLBACKEND_H
-
-#include <QObject>
-#include <QtIviVehicleFunctions/QIviClimateControlBackendInterface>
-
-class ClimateControlBackend : public QIviClimateControlBackendInterface
-{
-public:
- ClimateControlBackend(QObject *parent = 0);
- ~ClimateControlBackend();
-
-public:
- QStringList availableZones() const;
-
- void initializeAttributes();
-
- void setTargetTemperature(int val, const QString &zone);
- void setSeatCooler(int val, const QString &zone);
- void setSeatHeater(int val, const QString &zone);
- void setSteeringWheelHeater(int val, const QString &zone);
- void setFanSpeedLevel(int, const QString &zone);
- void setAirflowDirections(QIviClimateControl::AirflowDirections direction, const QString &zone);
- void setAirConditioningEnabled(bool val, const QString &zone);
- void setHeaterEnabled(bool val, const QString &zone);
- void setZoneSynchronizationEnabled(bool zoneSynchronization, const QString &zone);
- void setDefrostEnabled(bool defrost, const QString &zone);
- void setRecirculationMode(QIviClimateControl::RecirculationMode recirculationMode, const QString &zone);
- void setRecirculationSensitivityLevel(int recirculationSensitivityLevel, const QString &zone);
- void setClimateMode(QIviClimateControl::ClimateMode climateMode, const QString &zone);
- void setAutomaticClimateFanIntensityLevel(int automaticClimateFanIntensityLevel, const QString &zone);
-
-private:
-
- QIviClimateControl::AirflowDirections m_flowDirection;
- bool m_airCondition;
- bool m_heater;
- bool m_airRecirculation;
- bool m_zoneSynchronization;
- bool m_defrost;
- int m_steeringWheelHeater;
- int m_fanSpeed;
- QIviClimateControl::RecirculationMode m_recirculationMode;
- int m_recirculationSensitivityLevel;
- QIviClimateControl::ClimateMode m_climateMode;
- int m_automaticClimateFanIntensityLevel;
-
- struct ZoneBackend {
- int targetTemperature;
- QIviPropertyAttribute<int> targetTemperatureAttribute;
- int seatCooler;
- QIviPropertyAttribute<int> seatCoolerAttribute;
- int seatHeater;
- QIviPropertyAttribute<int> seatHeaterAttribute;
- };
-
- QMap<QString,ZoneBackend> m_zoneMap;
-};
-
-#endif // CLIMATECONTROLBACKEND_H
diff --git a/src/plugins/ivivehiclefunctions/vehiclefunction_simulator/vehiclefunction_simulator.json b/src/plugins/ivivehiclefunctions/vehiclefunction_simulator/vehiclefunction_simulator.json
deleted file mode 100644
index 3241da4..0000000
--- a/src/plugins/ivivehiclefunctions/vehiclefunction_simulator/vehiclefunction_simulator.json
+++ /dev/null
@@ -1,3 +0,0 @@
-{
- "interfaces" : [ "org.qt-project.qtivi.ClimateControl/1.0", "org.qt-project.qtivi.WindowControl/1.0" ]
-}
diff --git a/src/plugins/ivivehiclefunctions/vehiclefunction_simulator/vehiclefunction_simulator.pro b/src/plugins/ivivehiclefunctions/vehiclefunction_simulator/vehiclefunction_simulator.pro
deleted file mode 100644
index 923cc45..0000000
--- a/src/plugins/ivivehiclefunctions/vehiclefunction_simulator/vehiclefunction_simulator.pro
+++ /dev/null
@@ -1,20 +0,0 @@
-TARGET = vehiclefunction_simulator
-
-PLUGIN_TYPE = qtivi
-PLUGIN_EXTENDS = qtivi
-PLUGIN_CLASS_NAME = QIviClimateControlBackendInterface
-
-QT += core ivicore ivivehiclefunctions
-
-load(qt_plugin)
-
-
-SOURCES += vehicleplugin.cpp \
- climatecontrolbackend.cpp \
- windowcontrolbackend.cpp
-
-HEADERS += vehicleplugin.h \
- climatecontrolbackend.h \
- windowcontrolbackend.h
-
-DISTFILES += vehiclefunction_simulator.json
diff --git a/src/plugins/ivivehiclefunctions/vehiclefunction_simulator/windowcontrolbackend.cpp b/src/plugins/ivivehiclefunctions/vehiclefunction_simulator/windowcontrolbackend.cpp
deleted file mode 100644
index 021db82..0000000
--- a/src/plugins/ivivehiclefunctions/vehiclefunction_simulator/windowcontrolbackend.cpp
+++ /dev/null
@@ -1,311 +0,0 @@
-/****************************************************************************
-**
-** 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 "windowcontrolbackend.h"
-
-WindowTimer::WindowTimer(const QString &zone, bool isBlind, WindowControlBackend *backend)
- : QObject(backend)
- , m_timer(new QTimer(this))
- , m_opening(true)
- , m_currentValue(0)
- , m_interval(4)
- , m_zone(zone)
- , m_blind(isBlind)
- , m_backend(backend)
-{
- m_timer->setInterval(1000);
- connect(m_timer, &QTimer::timeout, this, &WindowTimer::checkValue);
-}
-
-void WindowTimer::setOpeningTime(int intervalInSeconds)
-{
- m_interval = intervalInSeconds;
-}
-
-void WindowTimer::open()
-{
- m_opening = true;
- m_timer->start();
-}
-
-void WindowTimer::close()
-{
- m_opening = false;
- m_timer->start();
-}
-
-void WindowTimer::checkValue()
-{
- if (m_opening)
- m_currentValue++;
- else
- m_currentValue--;
-
- QIviWindowControl::State state = QIviWindowControl::Closed;
- if (m_currentValue <= 0) {
- m_currentValue = 0;
- m_timer->stop();
- state = QIviWindowControl::Closed;
- } else if (m_currentValue >= m_interval) {
- m_currentValue = m_interval;
- m_timer->stop();
- state = QIviWindowControl::FullyOpen;
- } else {
- state = QIviWindowControl::Open;
- }
-
- if (m_blind) {
- if (m_backend->m_zoneMap[m_zone].blindState == state)
- return;
- qWarning() << "SIMULATION blind state for Zone" << m_zone << "changed to" << state;
- m_backend->m_zoneMap[m_zone].blindState = state;
- emit m_backend->blindStateChanged(state, m_zone);
- } else {
- if (m_backend->m_zoneMap[m_zone].state == state)
- return;
- qWarning() << "SIMULATION window state for Zone" << m_zone << "changed to" << state;
- m_backend->m_zoneMap[m_zone].state = state;
- emit m_backend->stateChanged(state, m_zone);
- }
-}
-
-WindowControlBackend::WindowControlBackend(QObject *parent)
- : QIviWindowControlBackendInterface(parent)
-{
- // No Blind in the front
- ZoneBackend frontLeft;
- frontLeft.heaterMode = QIviWindowControl::HeaterOff;
- frontLeft.heaterModeAttribute = QIviPropertyAttribute<QIviWindowControl::HeaterMode>(QVector<QIviWindowControl::HeaterMode>({QIviWindowControl::HeaterOff, QIviWindowControl::HeaterOn}));
- frontLeft.heaterEnabled = false;
- frontLeft.heaterAttribute = QIviPropertyAttribute<bool>(true);
- frontLeft.blindMode = QIviWindowControl::BlindClosed;
- frontLeft.blindModeAttribute = QIviPropertyAttribute<QIviWindowControl::BlindMode>(false);
- frontLeft.blindState = QIviWindowControl::Closed;
- frontLeft.blindStateAttribute = QIviPropertyAttribute<QIviWindowControl::State>(false);
- frontLeft.blindTimer = new WindowTimer("FrontLeft", true, this);
- frontLeft.state = QIviWindowControl::Closed;
- frontLeft.stateAttribute = QIviPropertyAttribute<QIviWindowControl::State>({QIviWindowControl::Closed, QIviWindowControl::Open, QIviWindowControl::FullyOpen});
- frontLeft.stateTimer = new WindowTimer("FrontLeft", false, this);
- m_zoneMap.insert("FrontLeft", frontLeft);
-
- ZoneBackend frontRight;
- frontRight.heaterMode = QIviWindowControl::HeaterOff;
- frontRight.heaterModeAttribute = QIviPropertyAttribute<QIviWindowControl::HeaterMode>(QVector<QIviWindowControl::HeaterMode>({QIviWindowControl::HeaterOff, QIviWindowControl::HeaterOn}));
- frontRight.heaterEnabled = false;
- frontRight.heaterAttribute = QIviPropertyAttribute<bool>(true);
- frontRight.blindMode = QIviWindowControl::BlindClosed;
- frontRight.blindModeAttribute = QIviPropertyAttribute<QIviWindowControl::BlindMode>(false);
- frontRight.blindState = QIviWindowControl::Closed;
- frontRight.blindStateAttribute = QIviPropertyAttribute<QIviWindowControl::State>(false);
- frontRight.blindTimer = new WindowTimer("FrontRight", true, this);
- frontRight.state = QIviWindowControl::Closed;
- frontRight.stateAttribute = QIviPropertyAttribute<QIviWindowControl::State>({QIviWindowControl::Closed, QIviWindowControl::Open, QIviWindowControl::FullyOpen});
- frontRight.stateTimer = new WindowTimer("FrontRight", false, this);
- m_zoneMap.insert("FrontRight", frontRight);
-
- // Everything in the rear
- ZoneBackend rearLeft;
- rearLeft.heaterMode = QIviWindowControl::HeaterOff;
- rearLeft.heaterModeAttribute = QIviPropertyAttribute<QIviWindowControl::HeaterMode>(QVector<QIviWindowControl::HeaterMode>({QIviWindowControl::HeaterOff, QIviWindowControl::HeaterOn}));
- rearLeft.heaterEnabled = false;
- rearLeft.heaterAttribute = QIviPropertyAttribute<bool>(true);
- rearLeft.blindMode = QIviWindowControl::BlindClosed;
- rearLeft.blindModeAttribute = QIviPropertyAttribute<QIviWindowControl::BlindMode>(QVector<QIviWindowControl::BlindMode>({QIviWindowControl::BlindClosed, QIviWindowControl::BlindOpen}));
- rearLeft.blindState = QIviWindowControl::Closed;
- rearLeft.blindStateAttribute = QIviPropertyAttribute<QIviWindowControl::State>(false);
- rearLeft.blindTimer = new WindowTimer("RearLeft", true, this);
- rearLeft.state = QIviWindowControl::Closed;
- rearLeft.stateAttribute = QIviPropertyAttribute<QIviWindowControl::State>({QIviWindowControl::Closed, QIviWindowControl::Open, QIviWindowControl::FullyOpen});
- rearLeft.stateTimer = new WindowTimer("RearLeft", false, this);
- m_zoneMap.insert("RearLeft", rearLeft);
-
- ZoneBackend rearRight;
- rearRight.heaterMode = QIviWindowControl::HeaterOff;
- rearRight.heaterModeAttribute = QIviPropertyAttribute<QIviWindowControl::HeaterMode>(QVector<QIviWindowControl::HeaterMode>({QIviWindowControl::HeaterOff, QIviWindowControl::HeaterOn}));
- rearRight.heaterEnabled = false;
- rearRight.heaterAttribute = QIviPropertyAttribute<bool>(true);
- rearRight.blindMode = QIviWindowControl::BlindClosed;
- rearRight.blindModeAttribute = QIviPropertyAttribute<QIviWindowControl::BlindMode>(QVector<QIviWindowControl::BlindMode>({QIviWindowControl::BlindClosed, QIviWindowControl::BlindOpen}));
- rearRight.blindState = QIviWindowControl::Closed;
- rearRight.blindStateAttribute = QIviPropertyAttribute<QIviWindowControl::State>({QIviWindowControl::Closed, QIviWindowControl::Open, QIviWindowControl::FullyOpen});
- rearRight.blindTimer = new WindowTimer("RearRight", true, this);
- rearRight.state = QIviWindowControl::Closed;
- rearRight.stateAttribute = QIviPropertyAttribute<QIviWindowControl::State>({QIviWindowControl::Closed, QIviWindowControl::Open, QIviWindowControl::FullyOpen});
- rearRight.stateTimer = new WindowTimer("RearRight", false, this);
- m_zoneMap.insert("RearRight", rearRight);
-
- // Just heating in the back window
- ZoneBackend rear;
- rear.heaterMode = QIviWindowControl::HeaterOff;
- rear.heaterModeAttribute = QIviPropertyAttribute<QIviWindowControl::HeaterMode>(QVector<QIviWindowControl::HeaterMode>({QIviWindowControl::HeaterOff, QIviWindowControl::HeaterOn}));
- rear.heaterEnabled = false;
- rear.heaterAttribute = QIviPropertyAttribute<bool>(true);
- rear.blindMode = QIviWindowControl::BlindClosed;
- rear.blindModeAttribute = QIviPropertyAttribute<QIviWindowControl::BlindMode>(false);
- rear.blindState = QIviWindowControl::Closed;
- rear.blindStateAttribute = QIviPropertyAttribute<QIviWindowControl::State>(false);
- rear.blindTimer = nullptr;
- rear.state = QIviWindowControl::Closed;
- rear.stateAttribute = QIviPropertyAttribute<QIviWindowControl::State>(false);
- rear.stateTimer = nullptr;
- m_zoneMap.insert("Rear", rear);
-
- // Just no heater in the roof
- ZoneBackend roof;
- roof.heaterMode = QIviWindowControl::HeaterOff;
- roof.heaterModeAttribute = QIviPropertyAttribute<QIviWindowControl::HeaterMode>(false);
- roof.heaterEnabled = false;
- roof.heaterAttribute = QIviPropertyAttribute<bool>(true);
- roof.blindMode = QIviWindowControl::BlindClosed;
- roof.blindModeAttribute = QIviPropertyAttribute<QIviWindowControl::BlindMode>(QVector<QIviWindowControl::BlindMode>({QIviWindowControl::BlindClosed, QIviWindowControl::BlindOpen}));
- roof.blindState = QIviWindowControl::Closed;
- roof.blindStateAttribute = QIviPropertyAttribute<QIviWindowControl::State>({QIviWindowControl::Closed, QIviWindowControl::Open, QIviWindowControl::FullyOpen});
- roof.blindTimer = new WindowTimer("Roof", true, this);
- roof.state = QIviWindowControl::Closed;
- roof.stateAttribute = QIviPropertyAttribute<QIviWindowControl::State>({QIviWindowControl::Closed, QIviWindowControl::Open, QIviWindowControl::FullyOpen});
- roof.stateTimer = new WindowTimer("Roof", false, this);
- m_zoneMap.insert("Roof", roof);
-}
-
-WindowControlBackend::~WindowControlBackend()
-{
-}
-
-QStringList WindowControlBackend::availableZones() const
-{
- return m_zoneMap.keys();
-}
-
-void WindowControlBackend::initializeAttributes()
-{
- const auto zones = availableZones();
- for (const QString &zone : zones) {
- emit heaterModeChanged(m_zoneMap[zone].heaterMode, zone);
- emit heaterModeAttributeChanged(m_zoneMap[zone].heaterModeAttribute, zone);
- emit heaterEnabledChanged(m_zoneMap[zone].heaterEnabled, zone);
- emit heaterAttributeChanged(m_zoneMap[zone].heaterAttribute, zone);
- emit blindModeChanged(m_zoneMap[zone].blindMode, zone);
- emit blindModeAttributeChanged(m_zoneMap[zone].blindModeAttribute, zone);
- emit blindStateChanged(m_zoneMap[zone].blindState, zone);
- emit blindStateAttributeChanged(m_zoneMap[zone].blindStateAttribute, zone);
- emit stateChanged(m_zoneMap[zone].state, zone);
- emit stateAttributeChanged(m_zoneMap[zone].stateAttribute, zone);
- }
-}
-
-void WindowControlBackend::setHeaterMode(QIviWindowControl::HeaterMode value, const QString &zone)
-{
- if (!m_zoneMap.contains(zone))
- return;
-
- if (m_zoneMap[zone].heaterMode == value)
- return;
-
- if (!m_zoneMap[zone].heaterModeAttribute.availableValues().contains(value)) {
- qWarning() << "SIMULATION HeaterMode" << zone << "is not supported.";
- return;
- }
-
- qWarning() << "SIMULATION HeaterMode for Zone" << zone << "changed to" << value;
-
- m_zoneMap[zone].heaterMode = value;
- emit heaterModeChanged(value, zone);
-
- m_zoneMap[zone].heaterEnabled = (value == QIviWindowControl::HeaterOn);
- emit heaterEnabledChanged(m_zoneMap[zone].heaterEnabled, zone);
-}
-
-void WindowControlBackend::setBlindMode(QIviWindowControl::BlindMode value, const QString &zone)
-{
- if (!m_zoneMap.contains(zone))
- return;
-
- if (m_zoneMap[zone].blindMode == value)
- return;
-
- if (!m_zoneMap[zone].blindModeAttribute.availableValues().contains(value)) {
- qWarning() << "SIMULATION HeaterMode" << zone << "is not supported.";
- return;
- }
-
- qWarning() << "SIMULATION BlindMode for Zone" << zone << "changed to" << value;
-
- if (value == QIviWindowControl::BlindOpen)
- m_zoneMap[zone].blindTimer->open();
- else if (value == QIviWindowControl::BlindClosed)
- m_zoneMap[zone].blindTimer->close();
- m_zoneMap[zone].blindMode = value;
- emit blindModeChanged(value, zone);
-}
-
-void WindowControlBackend::open(const QString &zone)
-{
- if (!m_zoneMap.contains(zone))
- return;
-
- if (m_zoneMap[zone].state == QIviWindowControl::Open)
- return;
-
- if (!m_zoneMap[zone].stateAttribute.isAvailable()) {
- qWarning() << "SIMULATION opening Window" << zone << "is not possible.";
- return;
- }
-
- qWarning() << "SIMULATION open Window:" << zone;
- m_zoneMap[zone].stateTimer->open();
-}
-
-void WindowControlBackend::close(const QString &zone)
-{
- if (!m_zoneMap.contains(zone))
- return;
-
- if (m_zoneMap[zone].state == QIviWindowControl::Closed)
- return;
-
- if (!m_zoneMap[zone].stateAttribute.isAvailable()) {
- qWarning() << "SIMULATION closing Window" << zone << "is not possible.";
- return;
- }
-
- qWarning() << "SIMULATION close Window:" << zone;
- m_zoneMap[zone].stateTimer->close();
-}
diff --git a/src/plugins/plugins.pro b/src/plugins/plugins.pro
index deff5f5..549db23 100644
--- a/src/plugins/plugins.pro
+++ b/src/plugins/plugins.pro
@@ -1,4 +1,4 @@
TEMPLATE = subdirs
-SUBDIRS = ivivehiclefunctions \
- ivimedia
+SUBDIRS = ivimedia
+qtHaveModule(ivivehiclefunctions): SUBDIRS += ivivehiclefunctions
diff --git a/src/src.pro b/src/src.pro
index 3293e88..bb21da8 100644
--- a/src/src.pro
+++ b/src/src.pro
@@ -3,20 +3,48 @@ TEMPLATE = subdirs
# Include the config.pri from the build folder as the qtgenivieextras-config.pri is copied
# while syncqt is running for the module and this is not done yet.
include($$OUT_PWD/geniviextras/qtgeniviextras-config.pri)
-QT_FOR_CONFIG += geniviextras-private
+include($$OUT_PWD/ivicore/qtivicore-config.pri)
+QT_FOR_CONFIG += geniviextras-private ivicore ivicore-private
+
+!qtConfig(host-tools-only) {
+ !qtConfig(geniviextras-only) {
+ SUBDIRS = ivicore \
+ ivimedia \
+ plugins \
+ imports \
+ doc
+
+ qtConfig(ivigenerator): {
+ SUBDIRS += ivivehiclefunctions
+ ivivehiclefunctions.depends = ivicore
+ !qtConfig(system-ivigenerator): ivivehiclefunctions.depends += sub-ivigenerator
+ plugins.depends += ivivehiclefunctions
+ imports.depends += ivivehiclefunctions
+ }
+
+ ivimedia.depends = ivicore
+ plugins.depends += ivimedia
+ imports.depends += ivimedia
+ }
+
+ qtConfig(dlt): SUBDIRS += geniviextras
+}
!qtConfig(geniviextras-only) {
- SUBDIRS = ivicore \
- ivivehiclefunctions \
- ivimedia \
- plugins \
- imports \
- doc
-
- ivivehiclefunctions.depends = ivicore
- ivimedia.depends = ivicore
- plugins.depends = ivivehiclefunctions ivimedia
- imports.depends = ivivehiclefunctions ivimedia
+ qtConfig(ivigenerator) {
+ !qtConfig(system-ivigenerator) {
+ src_tools_ivigenerator.subdir = tools/ivigenerator
+ src_tools_ivigenerator.target = sub-ivigenerator
+ SUBDIRS += src_tools_ivigenerator
+ }
+
+ qtConfig(simulator) {
+ src_tools_ivivehiclefunctions-controller.subdir = tools/vehiclefunctions-controller
+ !qtConfig(system-ivigenerator): src_tools_ivivehiclefunctions-controller.depends += sub-ivigenerator
+ src_tools_ivivehiclefunctions-controller.target = sub-ivivehiclefunctions-controller
+ SUBDIRS += src_tools_ivivehiclefunctions-controller
+ }
+ }
}
-qtConfig(dlt): SUBDIRS += geniviextras
+
diff --git a/src/tools/ivigenerator/deploy-virtualenv-files.txt b/src/tools/ivigenerator/deploy-virtualenv-files.txt
new file mode 100644
index 0000000..4874cd7
--- /dev/null
+++ b/src/tools/ivigenerator/deploy-virtualenv-files.txt
@@ -0,0 +1,147 @@
+LICENSE.txt
+_*.py
+abc.py
+aifc.py
+antigravity.py
+argparse.py
+ast.py
+asynchat.py
+asyncore.py
+bdb.py
+binhex.py
+bz2.py
+cProfile.py
+calendar.py
+cgi.py
+cgitb.py
+chunk.py
+cmd.py
+code.py
+codeop.py
+colorsys.py
+compileall.py
+configparser.py
+contextlib.py
+crypt.py
+csv.py
+datetime.py
+decimal.py
+difflib.py
+dis.py
+doctest.py
+dummy_threading.py
+filecmp.py
+fileinput.py
+formatter.py
+fractions.py
+ftplib.py
+getopt.py
+getpass.py
+gettext.py
+glob.py
+gzip.py
+imaplib.py
+imghdr.py
+inspect.py
+ipaddress.py
+lzma.py
+macpath.py
+macurl2path.py
+mailbox.py
+mailcap.py
+mimetypes.py
+modulefinder.py
+netrc.py
+nntplib.py
+nturl2path.py
+numbers.py
+opcode.py
+optparse.py
+pathlib.py
+pdb.py
+pickle.py
+pickletools.py
+pipes.py
+pkgutil.py
+platform.py
+plistlib.py
+poplib.py
+pprint.py
+profile.py
+pstats.py
+pty.py
+py_compile.py
+pyclbr.py
+pydoc.py
+queue.py
+quopri.py
+runpy.py
+sched.py
+secrets.py
+selectors.py
+shelve.py
+shlex.py
+signal.py
+smtpd.py
+smtplib.py
+sndhdr.py
+socket.py
+socketserver.py
+ssl.py
+statistics.py
+string.py
+stringprep.py
+subprocess.py
+sunau.py
+symbol.py
+symtable.py
+sysconfig.py
+tabnanny.py
+telnetlib.py
+textwrap.py
+this.py
+threading.py
+timeit.py
+trace.py
+traceback.py
+tracemalloc.py
+tty.py
+turtle.py
+typing.py
+uu.py
+uuid.py
+wave.py
+webbrowser.py
+xdrlib.py
+zipapp.py
+zipfile.py
+enum.py
+asyncio
+collections
+concurrent
+config-*
+ctypes
+curses
+dbm
+distutils
+email
+encodings
+ensurepip
+html
+http
+idlelib
+importlib
+json
+lib-dynload
+lib2to3
+logging
+multiprocessing
+pydoc_data
+sqlite3
+tkinter
+turtledemo
+unittest
+urllib
+venv
+wsgiref
+xml
diff --git a/src/tools/ivigenerator/deploy-virtualenv.bat b/src/tools/ivigenerator/deploy-virtualenv.bat
new file mode 100644
index 0000000..e5e0b92
--- /dev/null
+++ b/src/tools/ivigenerator/deploy-virtualenv.bat
@@ -0,0 +1,91 @@
+@ECHO OFF
+:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+::
+:: 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:GPL-EXCEPT-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 General Public License Usage
+:: Alternatively, this file may be used under the terms of the GNU
+:: General Public License version 3 as published by the Free Software
+:: Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+:: 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-3.0.html.
+::
+:: $QT_END_LICENSE$
+::
+:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
+
+SET SCRIPT=%~dp0
+
+IF %1%=="" (
+ call:usage
+)
+
+SET VIRTUALENV=%1%
+IF NOT EXIST %VIRTUALENV% (
+ call:usage
+)
+
+IF NOT EXIST %VIRTUALENV%\Lib (
+ call:usage
+)
+
+SET VIRTUALENV_LIB=%VIRTUALENV%\lib
+SET LIB_FOLDER=%VIRTUALENV_LIB%
+FOR %%F in (%VIRTUALENV_LIB%\python*) DO (
+ IF EXIST %%~fF (
+ SET LIB_FOLDER=%%~fF
+ SET PYTHON_VERSION=%%~nF
+ )
+)
+
+IF NOT EXIST %LIB_FOLDER%\orig-prefix.txt (
+ echo "orig-prefix.txt doesn't exist";
+ exit 1
+)
+
+SET /p ORIG_PREFIX=<%LIB_FOLDER%\orig-prefix.txt
+SET ORIG_LIB=%ORIG_PREFIX%\lib\%PYTHON_VERSION%
+IF NOT EXIST "%ORIG_LIB%" (
+ echo "%ORIG_LIB% doesn't exist"
+ exit 1
+)
+
+echo "copying files from %ORIG_LIB% to %VIRTUALENV_LIB%"
+FOR /f %%i in (%SCRIPT%\deploy-virtualenv-files.txt) DO (
+ IF EXIST "%ORIG_LIB%%%i\" (
+ IF NOT EXIST %VIRTUALENV_LIB%\%%i mkdir %VIRTUALENV_LIB%\%%i
+ xcopy %ORIG_LIB%%%i %VIRTUALENV_LIB%\%%i /E /Q /H /Y >NUL 2>&1
+ ) else (
+ xcopy %ORIG_LIB%%%i %VIRTUALENV_LIB% /H /Q /Y >NUL 2>&1
+ )
+)
+
+IF EXIST %ORIG_PREFIX%\DLLs\ (
+ IF NOT EXIST %VIRTUALENV%\DLLs mkdir %VIRTUALENV%\DLLs
+ xcopy %ORIG_PREFIX%\DLLs %VIRTUALENV%\DLLs /E /Q /H /Y >NUL 2>&1
+)
+
+echo "done"
+
+EXIT /B %ERRORLEVEL%
+
+:: Functions
+
+:usage
+echo "deploy-virtualenv.bat <virtualenv>"
+EXIT 1
+
+
diff --git a/src/tools/ivigenerator/deploy-virtualenv.sh b/src/tools/ivigenerator/deploy-virtualenv.sh
new file mode 100755
index 0000000..41b9a07
--- /dev/null
+++ b/src/tools/ivigenerator/deploy-virtualenv.sh
@@ -0,0 +1,105 @@
+#!/bin/bash
+
+#############################################################################
+##
+## 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:GPL-EXCEPT-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 General Public License Usage
+## Alternatively, this file may be used under the terms of the GNU
+## General Public License version 3 as published by the Free Software
+## Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
+## 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-3.0.html.
+##
+## $QT_END_LICENSE$
+##
+#############################################################################
+
+SCRIPT=$(dirname $0)
+usage()
+{
+ echo "deploy-virtualenv.sh <virtualenv>"
+ exit 1
+}
+
+[ "$#" -lt 1 ] && usage
+VIRTUALENV="${@: -1}"
+[ ! -d "$VIRTUALENV" ] && usage
+[ ! -d "$VIRTUALENV/lib" ] && usage
+VIRTUALENV_LIB=$VIRTUALENV/lib
+for file in "$VIRTUALENV_LIB"/python* ; do
+ if [[ -d $file ]] ; then
+ LIB_FOLDER=$file
+ PYTHON_VERSION=$(basename "$file")
+ break
+ fi
+done
+[ ! -d "$LIB_FOLDER" ] && usage
+if [[ ! -e "$LIB_FOLDER/orig-prefix.txt" ]] ; then
+ echo "orig-prefix.txt doesn't exist";
+ exit 1
+fi
+
+# If the python executable has a dependency towards a libpython
+# copy the file and add it as LD_LIBRARY_PATH to the activate script
+LIBPYTHON=`ldd $VIRTUALENV/bin/python | awk '{print $3}' | grep python`
+if [[ -e "$LIBPYTHON" ]] ; then
+ echo "copying $LIBPYTHON"
+ cp -Lf "$LIBPYTHON" "$VIRTUALENV/bin"
+fi
+
+# Find all the locations used for the system python files
+# They are located in prefix, but we don't know the sub-folder (it is lib on most systems, but lib64 on some others)
+ORIG_PREFIX=$(<"$LIB_FOLDER"/orig-prefix.txt)
+ORIG_LIBS=`$VIRTUALENV/bin/python3 -c "import sys; print ('\n'.join(path for path in sys.path))" | grep $ORIG_PREFIX`
+
+if [[ ! -e "$SCRIPT/deploy-virtualenv-files.txt" ]] ; then
+ echo "$SCRIPT/deploy-virtualenv-files.txt doesn't exist";
+ exit 1
+fi
+
+for ORIG_LIB in ${ORIG_LIBS} ; do
+ echo "copying files from $ORIG_LIB to $LIB_FOLDER"
+ FILES=$(<$SCRIPT/deploy-virtualenv-files.txt)
+ for file in ${FILES} ; do
+ expand_wildcard=($ORIG_LIB/$file)
+ [ ! -e "$expand_wildcard" ] && continue;
+ cp -rLf "$ORIG_LIB"/$file "$LIB_FOLDER/"
+ done
+done
+
+# random.py is needed in order to generate temp directories from python
+# It is based on hashlib, which needs libcrypto and libssl to work.
+# As there is no compatibility for openssl libs, we need to copy
+# them to the bin folder similar to libpython
+HASHLIB=`find $LIB_FOLDER/lib-dynload -iname '_hashlib*'`
+if [[ -e "$HASHLIB" ]] ; then
+ LIBCRYPTO=`ldd $HASHLIB | awk '{print $3}' | grep crypto`
+ echo "copying $LIBCRYPTO"
+ cp -Lf "$LIBCRYPTO" "$VIRTUALENV/bin"
+ LIBSSL=`ldd $HASHLIB | awk '{print $3}' | grep ssl`
+ echo "copying $LIBSSL"
+ cp -Lf "$LIBSSL" "$VIRTUALENV/bin"
+fi
+
+if [ "$(readlink -- "$VIRTUALENV/lib64")" != "lib" ] ; then
+ rm -f "$VIRTUALENV/lib64"
+ cd "$VIRTUALENV"
+ ln -s lib lib64
+ cd -
+fi
+
+echo "done"
diff --git a/src/tools/ivigenerator/generate.py b/src/tools/ivigenerator/generate.py
new file mode 100755
index 0000000..08f9af6
--- /dev/null
+++ b/src/tools/ivigenerator/generate.py
@@ -0,0 +1,608 @@
+#!/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 re
+import os
+import click
+import logging.config
+import yaml
+import json
+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, Parameter, Field, Struct
+
+here = Path(__file__).dirname()
+
+log = logging.getLogger(__file__)
+
+Filters.classPrefix = ''
+
+builtin_config = {}
+IVI_DEFAULT_TEMPLATES = ['frontend', 'backend_simulator', 'generation_validator', 'control_panel']
+
+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 default_type_value(symbol):
+ """
+ Find the default value for the type. Models are initialized as nullptr
+ """
+ prefix = Filters.classPrefix
+ t = symbol.type # type: qface.domain.TypeSymbol
+ if t.is_primitive:
+ if t.is_int:
+ return 'int(0)'
+ if t.is_bool:
+ return 'bool(false)'
+ if t.is_string:
+ return 'QString()'
+ if t.is_real:
+ return 'qreal(0.0)'
+ if t.is_variant:
+ return 'QVariant()'
+ elif t.is_void:
+ return ''
+ elif t.is_enum:
+ module_name = t.reference.module.module_name
+ value = next(iter(t.reference.members))
+ return '{0}{1}Module::{2}'.format(prefix, module_name, value)
+ elif t.is_flag:
+ return '0'
+ elif symbol.type.is_list:
+ nested = Filters.returnType(symbol.type.nested)
+ return 'QVariantList()'.format(nested)
+ elif symbol.type.is_struct:
+ return '{0}{1}()'.format(prefix, symbol.type)
+ elif symbol.type.is_model:
+ return 'nullptr'
+ return 'XXX'
+
+
+def default_value(symbol, zone='='):
+ """
+ Find the default value used by the simulator backend
+ """
+ res = default_type_value(symbol)
+ if symbol.type.is_model:
+ nested = symbol.type.nested
+ # TODO: find a way of passing parent object
+ return 'new {0}Model(parent)'.format(nested)
+ if 'config_simulator' in symbol.tags and 'default' in symbol.tags['config_simulator']:
+ res = symbol.tags['config_simulator']['default']
+ if isinstance(res, dict):
+ if zone in res:
+ res = res[zone]
+ else:
+ res = res['=']
+ t = symbol.type
+ if t.is_enum:
+ module_name = t.reference.module.module_name
+ return enum_value(res, 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 res:
+ return 'true'
+ else:
+ return 'false'
+ if t.is_string:
+ return '"{0}"'.format(re.escape(res))
+ return res
+
+
+def parameter_type(symbol):
+ """
+ Return the parameter declaration for properties, handle camel case module name
+ """
+ prefix = Filters.classPrefix
+ if symbol.type.is_enum or symbol.type.is_flag:
+ return '{0}{1}Module::{2} {3}'.format(prefix, symbol.module.module_name, flag_type(symbol), symbol)
+ if symbol.type.is_void or symbol.type.is_primitive:
+ if symbol.type.name == 'string':
+ return 'const QString &{0}'.format(symbol)
+ if symbol.type.name == 'var':
+ return 'const QVariant &{0}'.format(symbol)
+ if symbol.type.name == 'real':
+ return 'qreal {0}'.format(symbol)
+ return '{0} {1}'.format(symbol.type, symbol)
+ elif symbol.type.is_list:
+ nested = return_type(symbol.type.nested)
+ return 'const QVariantList &{1}'.format(nested, symbol)
+ elif symbol.type.is_model:
+ nested = symbol.type.nested
+ if nested.is_primitive:
+ return '{0}VariantModel *{1}'.format(prefix, symbol)
+ elif nested.is_complex:
+ return '{0}{1}Model *{2}'.format(prefix, nested, symbol)
+ else:
+ return 'const {0}{1} &{2}'.format(prefix, symbol.type, symbol)
+ return 'QFace Error: Unknown parameter {0} of type {1}'.format(symbol, symbol.type)
+
+
+def return_type(symbol):
+ """
+ Return the type declaration for properties, handle camel case module name
+ """
+ prefix = Filters.classPrefix
+ if symbol.type.is_enum or symbol.type.is_flag:
+ return('{0}{1}Module::{2}'.format(prefix, symbol.module.module_name, flag_type(symbol)))
+ if symbol.type.is_void or symbol.type.is_primitive:
+ if symbol.type.name == 'string':
+ return 'QString'
+ if symbol.type.name == 'var':
+ return 'QVariant'
+ if symbol.type.name == 'real':
+ return 'qreal'
+ return symbol.type.name
+ elif symbol.type.is_list:
+ nested = return_type(symbol.type.nested)
+ return 'QVariantList'.format(nested)
+ elif symbol.type.is_model:
+ nested = symbol.type.nested
+ if nested.is_primitive:
+ return '{0}VariantModel *'.format(prefix)
+ elif nested.is_complex:
+ return '{0}{1}Model *'.format(prefix, nested)
+ else:
+ return '{0}{1}'.format(prefix, symbol.type)
+ return 'QFace Error: Unknown symbol {0} of type {1}'.format(symbol, symbol.type)
+
+
+def flag_type(symbol):
+ """
+ Return the annotation for the flag type if available, the plural otherwise
+ """
+ actualType = symbol
+ if symbol.type.reference:
+ actualType = symbol.type.reference
+ if actualType.is_flag:
+ if 'config' in actualType.tags and 'type' in actualType.tags['config']:
+ return actualType.tags['config']['type']
+ return '{0}s'.format(actualType)
+ return actualType
+
+
+def domain_values(symbol):
+ """
+ Returns domain values for property (if defined by @domain)
+ """
+ if type(symbol) is Property:
+ if 'config_simulator' in symbol.tags:
+ if 'domain' in symbol.tags['config_simulator']:
+ return symbol.tags['config_simulator']['domain']
+ return None
+
+def getter_name(symbol):
+ """
+ Returns the getter name of the property
+ """
+ if type(symbol) is Property:
+ if 'config' in symbol.tags and 'getter_name' in symbol.tags['config']:
+ return symbol.tags['config']['getter_name']
+ return symbol
+
+def setter_name(symbol):
+ """
+ Returns the setter name of the property
+ """
+ if type(symbol) is Property:
+ if 'config' in symbol.tags and 'setter_name' in symbol.tags['config']:
+ return symbol.tags['config']['setter_name']
+ return 'set' + symbol.name[0].upper() + symbol.name[1:]
+
+def range_value(symbol, index, key):
+ """
+ Returns value for property (if defined by @range index or key)
+ """
+ if type(symbol) is Property and symbol.type.is_int or symbol.type.is_real:
+ if 'config_simulator' in symbol.tags:
+ if 'range' in symbol.tags['config_simulator']:
+ return symbol.tags['config_simulator']['range'][index]
+ if key in symbol.tags['config_simulator']:
+ return symbol.tags['config_simulator'][key]
+ return None
+
+
+def range_high(symbol):
+ """
+ Returns maximum value for property (if defined by @range or @maximum)
+ """
+ return range_value(symbol, 1, 'maximum')
+
+
+def range_low(symbol):
+ """
+ Returns minimum value for property (if defined by @range or @minimum)
+ """
+ return range_value(symbol, 0, 'minimum')
+
+
+def has_domains(properties):
+ """
+ Returns true if any property has range or domain tags
+ """
+ for property in properties:
+ if 'config_simulator' in property.tags:
+ for p in ['range', 'domain', 'minimum', 'maximum']:
+ if p in property.tags['config_simulator']:
+ return True
+ return False
+
+def strip_QT(s):
+ """
+ If the given string starts with QT, stip it away.
+ """
+ s = str(s)
+ if s.startswith('QT'):
+ return s[2:]
+ return s
+
+def json_domain(properties):
+ """
+ Returns property domains formated in json
+ """
+ data = {}
+ if len(properties):
+ data["iviVersion"] = builtin_config["VERSION"]
+ for property in properties:
+ if 'config_simulator' in property.tags:
+ for p in ['range', 'domain', 'minimum', 'maximum']:
+ if p in property.tags['config_simulator']:
+ if not property.name in data:
+ data[property.name] = {}
+ data[property.name][p] = property.tags['config_simulator'][p]
+ return json.dumps(data, separators=(',', ':'))
+
+
+def jsonify(obj):
+ """
+ This is copied from QFace (qface/filters.py), should be replaced with
+ original when it's released
+ """
+ try:
+ # all symbols have a toJson method, try it
+ return json.dumps(obj.toJson(), indent=' ')
+ except AttributeError:
+ pass
+ return json.dumps(obj, indent=' ')
+
+
+def lower_first_filter(s):
+ s = str(s)
+ return s[0].lower() + s[1:]
+
+def qml_control_properties(symbol, backend_object):
+ """
+ Returns properties of the QML control matching to this
+ IDL type (e.g. min/max properties)
+ """
+ prop_str = lower_first_filter(symbol) + "Control"
+ if isinstance(symbol, Property):
+ top = range_high(symbol)
+ bottom = range_low(symbol)
+ binding = "value: {0}.{1};".format(backend_object, symbol.name)
+ if top is not None and bottom is not None:
+ return 'id: {0}; from: {1}; to: {2}; {3}'.format(prop_str, bottom, top, binding)
+
+ if top is not None or bottom is not None:
+ if top is None:
+ return 'id: {0}; from: {1}; to:100000; {2}'.format(prop_str, bottom, binding)
+ elif bottom is None:
+ return 'id: {0}; from:-100000; to: {1}; {2}'.format(prop_str, top, binding)
+
+ values = domain_values(symbol)
+ if values is None and (symbol.type.is_enum or symbol.type.is_flag):
+ values_string = ' '.join('ListElement {{ key: "{0}"; value: {1}.{0} }}'.format(e, qml_type(symbol.interface)) for e in symbol.type.reference.members)
+ return 'id: {0}; textRole: "key"; {2} model: ListModel {{ {1} }}'.format(prop_str, values_string, binding)
+ if values is not None:
+ values_string = ','.join('"'+str(e)+'"' for e in values)
+ return 'id: {0}; model: [ {1} ]; '.format(prop_str, values_string)
+ if symbol.type.is_bool:
+ binding = "checked: {0}.{1};".format(backend_object, symbol.name)
+ return 'id: {0}; {1}'.format(prop_str, binding)
+ if symbol.type.is_real or symbol.type.is_int or symbol.type.is_string:
+ binding = "text: {0}.{1};".format(backend_object, symbol.name)
+ return 'id: {0}; {1}'.format(prop_str, binding)
+
+ if isinstance(symbol, Parameter):
+ return 'id: {1}Param{0}'.format(prop_str, symbol.operation)
+ if isinstance(symbol, Field):
+ return 'id: {1}_{0}'.format(prop_str, lower_first_filter(symbol.struct))
+
+def qml_control_signal_parameters(symbol):
+ """
+ Returns the parameters for calling the signal using the values from the ui controls
+ """
+ return ', '.join('{0}Param{1}Control.{2}'.format(e.operation, lower_first_filter(e), qml_binding_property(e)) for e in symbol.parameters)
+
+def qml_meta_control_name(symbol):
+ """
+ Returns name of the QML control needed to display this type based on the meta
+ data of the symbol -- if symbol has some meta data (e.g. value limits or domain)
+ then control name is taken based on these constraints. Otherwise returns None.
+ """
+ top = range_high(symbol)
+ bottom = range_low(symbol)
+ if top is not None and bottom is not None:
+ return 'Slider'
+
+ if top is not None or bottom is not None:
+ return 'SpinBox'
+
+ values = domain_values(symbol)
+ if values is not None:
+ return "ComboBox"
+
+def qml_type_control_name(symbol):
+ """
+ Returns name of the QML control inferred based on the type of the symbol.
+ """
+ t = symbol.type
+ if t.is_string or t.is_int or t.is_real:
+ return "TextField"
+ elif t.is_bool:
+ return "CheckBox"
+ elif t.is_enum:
+ if t.reference.is_enum:
+ return "EnumControl"
+ elif t.reference.is_flag:
+ return "FlagControl"
+ elif t.is_flag:
+ return "FlagControl"
+ return "TextField"
+
+
+def qml_control_name(symbol):
+ """
+ Returns name of the QML control for the symbol. First it checks meta data (as it may
+ influence the control type) and if nothing is defined there, it falls back to the
+ symbol actual type.
+ """
+ # First try to calculate control name based on the tags
+ control_name = qml_meta_control_name(symbol)
+ # If nothing is defined, calculate it based on its type
+ if control_name is None:
+ control_name = qml_type_control_name(symbol)
+ return control_name
+
+
+def qml_control(symbol, backend_object):
+ """
+ Returns QML code for the control (or group of controls) to represent the editing UI for the symbol.
+ """
+
+ if symbol.type.is_struct:
+ return qml_struct_control(symbol)
+
+ return "{0} {{ {1} }}".format(qml_control_name(symbol), qml_control_properties(symbol, backend_object))
+
+
+def qml_binding_property(symbol):
+ """
+ :param symbol: property which is being bound by the control
+ :return: name of the property of the QML control to be bound with
+ """
+ control_name = qml_control_name(symbol)
+ if control_name == "CheckBox":
+ return "checked"
+ elif control_name == "Slider" or control_name == "SpinBox" or control_name == "FlagControl" or control_name == "EnumControl":
+ return "value"
+ elif control_name == "TextField":
+ return "text"
+ elif control_name == "ComboBox":
+ return "currentIndex"
+
+def qml_struct_control(symbol):
+ if symbol.type.is_struct and symbol.type.reference.fields:
+ result = "Rectangle { ColumnLayout { "
+ for field in symbol.type.reference.fields:
+ result += qml_control(field)
+ result += "}}"
+ return result
+
+
+def qml_type(interface):
+ """
+ :param interface:
+ :return: Returns the name of the interface for using in QML. This name is defined in the IDL under
+ the "config" tag as "qml_type". This annotation is optional, if not provided, the interface name is
+ used.
+ """
+ result = interface.name
+ if 'qml_type' in interface.tags['config']:
+ result = interface.tags['config']['qml_type']
+ return result
+
+
+def model_type(symbol):
+ if symbol.type.is_model:
+ nested = symbol.type.nested
+ return '{0}Model'.format(nested)
+ return None
+
+
+def generate(tplconfig, moduleConfig, src, dst):
+ log.debug('run {0} {1}'.format(src, dst))
+ FileSystem.strict = True
+ Generator.strict = True
+ system = FileSystem.parse(src)
+ generator = Generator(search_path=tplconfig)
+ generator.register_filter('return_type', return_type)
+ generator.register_filter('parameter_type', parameter_type)
+ generator.register_filter('getter_name', getter_name)
+ generator.register_filter('setter_name', setter_name)
+ generator.register_filter('default_type_value', default_type_value)
+ generator.register_filter('default_value', default_value)
+ generator.register_filter('model_type', model_type)
+ generator.register_filter('flag_type', flag_type)
+ generator.register_filter('parse_doc', parse_doc)
+ generator.register_filter('lowerfirst', lower_first_filter)
+ generator.register_filter('range_low', range_low)
+ generator.register_filter('range_high', range_high)
+ generator.register_filter('strip_QT', strip_QT)
+ generator.register_filter('domain_values', domain_values)
+ 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)
+ generator.register_filter('jsonify', jsonify)
+ generator.register_filter('has_domains', has_domains)
+ generator.register_filter('json_domain', json_domain)
+ generator.register_filter('qml_type', qml_type)
+ generator.register_filter('qml_control', qml_control)
+ generator.register_filter('qml_binding_property', qml_binding_property)
+ generator.register_filter('qml_control_signal_parameters', qml_control_signal_parameters)
+
+ srcFile = os.path.basename(src[0])
+ srcBase = os.path.splitext(srcFile)[0]
+ ctx = {'dst': dst, 'qtASVersion': builtin_config["VERSION"], 'srcFile':srcFile, 'srcBase':srcBase, 'features': builtin_config["FEATURES"]}
+ gen_config = yaml.load(open(here / '{0}.yaml'.format(os.path.basename(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})
+ interface_rules = gen_config['generate_rules']['interface_rules']
+ if interface_rules is None: interface_rules = []
+ for rule in interface_rules:
+ preserve = rule['preserve'] if 'preserve' in rule else False
+ generator.write(rule['dest_file'], rule['template_file'], ctx, preserve)
+ if 'struct_rules' in gen_config['generate_rules'] and isinstance(gen_config['generate_rules']['struct_rules'], list):
+ for struct in module.structs:
+ log.debug('generate code for struct %s', struct)
+ struct.add_tag('config')
+ ctx.update({'struct': struct})
+ 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(format, moduleConfig, src, dst):
+ if format in IVI_DEFAULT_TEMPLATES:
+ tplConfig = 'templates_{0}'.format(format)
+ generate(here / tplConfig, moduleConfig, src, dst)
+ else:
+ if os.path.exists(format):
+ generate(format, moduleConfig, src, dst)
+ else:
+ print('Format "{0}" is invalid. Should be one of {1} or an existing template folder'.format(format, IVI_DEFAULT_TEMPLATES))
+
+
+@click.command()
+@click.option('--reload/--no-reload', default=False)
+@click.option('--format', '-f', multiple=False)
+@click.option('--module', default=False)
+@click.option('--validation_info', 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, validation_info):
+ """Takes several files or directories as src and generates the code
+ in the given dst directory."""
+
+ global builtin_config
+ builtin_config_path = here / '.config'
+ if 'IVIGENERATOR_CONFIG' in os.environ:
+ builtin_config_path = os.environ['IVIGENERATOR_CONFIG']
+ builtin_config = yaml.load(open(builtin_config_path))
+ if not 'VERSION' in builtin_config or not 'FEATURES' in builtin_config:
+ sys.exit("Invalid builtin config")
+
+ if reload:
+ script = '{0} {1} {2}'.format(Path(__file__).abspath(), ' '.join(src), dst)
+ monitor(src, script)
+ else:
+ moduleConfig = {
+ "module": module,
+ "validation_info": validation_info
+ }
+ run(format, moduleConfig, src, dst)
+
+
+if __name__ == '__main__':
+ app()
diff --git a/src/tools/ivigenerator/ivigenerator.pri b/src/tools/ivigenerator/ivigenerator.pri
new file mode 100644
index 0000000..0e11202
--- /dev/null
+++ b/src/tools/ivigenerator/ivigenerator.pri
@@ -0,0 +1,5 @@
+# TODO: Turn this into a proper target so we can build it?
+QFACE_SOURCES = $$PWD/example/com.pelagicore.ivi.climate.qface
+QFACE_MODULE_NAME = "climate"
+
+include(ivigenerator.prf)
diff --git a/src/tools/ivigenerator/ivigenerator.pro b/src/tools/ivigenerator/ivigenerator.pro
new file mode 100644
index 0000000..e56bc41
--- /dev/null
+++ b/src/tools/ivigenerator/ivigenerator.pro
@@ -0,0 +1,121 @@
+TEMPLATE = aux
+
+QT_FOR_CONFIG += ivicore
+
+!contains(CONFIG, no_internal_qface): include(qface_internal_build.pri)
+
+# Make sure to only build this once in a debug_and_release config
+# This needs to be the last step as it unsets other configs and may have side effects
+CONFIG -= debug_and_release
+
+templates_frontend.files += \
+ templates_frontend/backendinterface.cpp.tpl \
+ templates_frontend/backendinterface.h.tpl \
+ templates_frontend/generated_comment.cpp.tpl \
+ templates_frontend/global.h.tpl \
+ templates_frontend/interface.cpp.tpl \
+ templates_frontend/interface.h.tpl \
+ templates_frontend/interface_p.h.tpl \
+ templates_frontend/module.cpp.tpl \
+ templates_frontend/module.h.tpl \
+ templates_frontend/module.pri.tpl \
+ templates_frontend/modulefactory.cpp.tpl \
+ templates_frontend/modulefactory.h.tpl \
+ templates_frontend/struct.cpp.tpl \
+ templates_frontend/struct.h.tpl \
+ templates_frontend/structmodel.cpp.tpl \
+ templates_frontend/structmodel.h.tpl \
+ templates_frontend/structmodel_p.h.tpl \
+ templates_frontend/utils.tpl
+templates_frontend.path = $$[QT_HOST_BINS]/ivigenerator/templates_frontend
+
+templates_backend_simulator.files += \
+ templates_backend_simulator/backend.cpp.tpl \
+ templates_backend_simulator/backend.h.tpl \
+ templates_backend_simulator/backend_range.cpp.tpl \
+ templates_backend_simulator/generated_comment.cpp.tpl \
+ templates_backend_simulator/plugin.cpp.tpl \
+ templates_backend_simulator/plugin.h.tpl \
+ templates_backend_simulator/plugin.json \
+ templates_backend_simulator/plugin.pri.tpl \
+ templates_backend_simulator/plugin.pro \
+ templates_backend_simulator/utils.tpl
+templates_backend_simulator.path = $$[QT_HOST_BINS]/ivigenerator/templates_backend_simulator
+
+templates_generation_validator.files += \
+ templates_generation_validator/generated_comment.cpp.tpl \
+ templates_generation_validator/generationstatusitem.cpp.tpl \
+ templates_generation_validator/generationstatusitem.h.tpl \
+ templates_generation_validator/main.cpp.tpl \
+ templates_generation_validator/main.qml.tpl \
+ templates_generation_validator/qml.qrc.tpl \
+ templates_generation_validator/ui.pri.tpl \
+ templates_generation_validator/validationstatus.cpp.tpl \
+ templates_generation_validator/validationstatus.h.tpl
+templates_generation_validator.path = $$[QT_HOST_BINS]/ivigenerator/templates_generation_validator
+
+templates_control_panel.files += \
+ templates_control_panel/EnumControl.qml.tpl \
+ templates_control_panel/FlagControl.qml.tpl \
+ templates_control_panel/generated_comment.cpp.tpl \
+ templates_control_panel/global.h.tpl \
+ templates_control_panel/interface.cpp.tpl \
+ templates_control_panel/interface.h.tpl \
+ templates_control_panel/interface.qml.tpl \
+ templates_control_panel/main.cpp.tpl \
+ templates_control_panel/main.qml.tpl \
+ templates_control_panel/module.cpp.tpl \
+ templates_control_panel/module.h.tpl \
+ templates_control_panel/qml.qrc.tpl \
+ templates_control_panel/ui.pri.tpl \
+ templates_control_panel/utils.tpl
+templates_control_panel.path = $$[QT_HOST_BINS]/ivigenerator/templates_control_panel
+
+generator.files += \
+ generate.py \
+ $$OUT_PWD/.config \
+ templates_frontend.yaml \
+ templates_backend_simulator.yaml \
+ templates_generation_validator.yaml \
+
+generator.path = $$[QT_HOST_BINS]/ivigenerator
+
+qtConfig(simulator) {
+ generator.files += templates_control_panel.yaml
+ INSTALLS += templates_control_panel
+}
+
+INSTALLS += templates_frontend templates_backend_simulator templates_generation_validator generator
+
+# Ensure files are installed to qtbase for non-prefixed builds
+!force_independent:if(!debug_and_release|!build_all|CONFIG(release, debug|release)) {
+ for (install_target, INSTALLS) {
+ path = $$eval($${install_target}.path)
+ $${install_target}_copy.input = $${install_target}.files
+ $${install_target}_copy.output = $$path/${QMAKE_FILE_IN_BASE}${QMAKE_FILE_EXT}
+ $${install_target}_copy.commands = $$sprintf($$QMAKE_MKDIR_CMD, "$$path") $$escape_expand(\n\t)
+ contains($${install_target}.CONFIG, directory): $${install_target}_copy.commands += $$QMAKE_COPY_DIR ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT}
+ else: $${install_target}_copy.commands += $$QMAKE_COPY ${QMAKE_FILE_IN} ${QMAKE_FILE_OUT}
+ $${install_target}_copy.name = COPY ${QMAKE_FILE_IN}
+ $${install_target}_copy.CONFIG = no_link target_predeps no_clean
+ QMAKE_EXTRA_COMPILERS += $${install_target}_copy
+ }
+}
+
+defineTest(createConfig) {
+ write_file($$OUT_PWD/.config, $$list("---"))
+ for(var, ARGS) {
+ isEmpty($$var):out = "$$var: ~"
+ else:count($$var, 1):out = "$$var: \"$$first($$var)\""
+ else {
+ out = "$$var:"
+ for(val, $$var):out += " - \"$$val\""
+ out=$$join(out, "$$escape_expand(\\n)")
+ }
+ write_file($$OUT_PWD/.config, out, append)
+ }
+}
+
+VERSION = $$MODULE_VERSION
+FEATURES = $${QT.ivicore.enabled_features}
+createConfig(VERSION, FEATURES)
diff --git a/src/tools/ivigenerator/qface_internal_build.pri b/src/tools/ivigenerator/qface_internal_build.pri
new file mode 100644
index 0000000..0ffcc9f
--- /dev/null
+++ b/src/tools/ivigenerator/qface_internal_build.pri
@@ -0,0 +1,92 @@
+QFACE_SOURCE_DIR = $$QTIVI_ROOT/src/3rdparty/qface
+
+# only create the environment once
+debug_and_release:build_pass:CONFIG(release, debug|release) {
+ return();
+}
+
+!exists($$QFACE_SOURCE_DIR/setup.py): error("Couldn't find $$QFACE_SOURCE_DIR: Please make sure all submodules are initialized")
+
+include($$shadowed($$PWD/../../ivicore/qtivicore-config.pri))
+
+VIRTUALENV_EXE = $$QMAKE_PYTHON3_LOCATION -m virtualenv
+# virtualenv is always using the default interpreter, which is python2 on many systems"
+# by adding -p we enforce that the python3 interpreter is used and make sure python3 is installed in the virtualenv
+VIRTUALENV_EXE += " -p $$QMAKE_PYTHON3_LOCATION"
+
+# Use a Python virtualenv for installing qface, so we don't pollute the user environment
+# On some systems virtualenv --always-copy doesn't work (https://github.com/pypa/virtualenv/issues/565).
+# To workaround the problem, we need to manually create the folder and create the virtualenv from
+# inside
+equals(QMAKE_HOST.os, Windows): qtivi_qface_virtualenv.target = qtivi_qface_virtualenv/Scripts/python.exe
+else: qtivi_qface_virtualenv.target = qtivi_qface_virtualenv/bin/python
+qtivi_qface_virtualenv.commands = \
+ $(MKDIR) qtivi_qface_virtualenv $$escape_expand(\n\t) \
+ cd qtivi_qface_virtualenv && $$VIRTUALENV_EXE --always-copy . $$escape_expand(\n\t) \
+ cd qtivi_qface_virtualenv && $$VIRTUALENV_EXE --relocatable . $$escape_expand(\n\t) \
+ @echo "Set up virtualenv for qface, name: qtivi_qface_virtualenv"
+QMAKE_EXTRA_TARGETS += qtivi_qface_virtualenv
+
+equals(QMAKE_HOST.os, Windows): VIRTUALENV_ACTIVATION = qtivi_qface_virtualenv\Scripts\activate &&
+else: VIRTUALENV_ACTIVATION = . qtivi_qface_virtualenv/bin/activate &&
+
+# Create the forceRebuild file during the qmake run.
+# This file is used as a dependency in other Makefiles.
+# Once the virtualenv is created and setup the file will
+# be touched to recreate theses Makefiles.
+write_file($$OUT_PWD/forceRebuild)
+
+PYTHON3_SHORT_VERSION_SPLITTED = $$split(QMAKE_PYTHON3_VERSION, .)
+PYTHON3_SHORT_VERSION = $$member(PYTHON3_SHORT_VERSION_SPLITTED, 0).$$member(PYTHON3_SHORT_VERSION_SPLITTED, 1)
+# Always run this target
+equals(QMAKE_HOST.os, Windows): qtivi_qface_install.target = qtivi_qface_virtualenv/Lib/site-packages/qface
+else: qtivi_qface_install.target = qtivi_qface_virtualenv/lib/python$${PYTHON3_SHORT_VERSION}/site-packages/qface
+qtivi_qface_install.depends = $${qtivi_qface_virtualenv.target}
+qtivi_qface_install.depends += $$QFACE_SOURCE_DIR/setup.py
+qtivi_qface_install.depends += $$QFACE_SOURCE_DIR/requirements.txt
+qtivi_qface_install.depends += $$QFACE_SOURCE_DIR/qface/__about__.py
+qtivi_qface_install.commands = $$VIRTUALENV_ACTIVATION \
+ pip3 install --upgrade $$shell_path($$QFACE_SOURCE_DIR) $$escape_expand(\n\t) \
+ @echo "Installed qface development version into qtivi_qface_virtualenv" $$escape_expand(\n\t)
+equals(QMAKE_HOST.os, Windows): qtivi_qface_install.commands += @COPY /B $$shell_path($$OUT_PWD/forceRebuild)+,, $$shell_path($$OUT_PWD/forceRebuild) >NUL
+else: qtivi_qface_install.commands += @touch $$OUT_PWD/forceRebuild
+QMAKE_EXTRA_TARGETS += qtivi_qface_install
+
+# We need to make the virtualenv first deployable
+# Otherwise it still needs some modules from the system
+deploy_virtualenv.target = .stamp-deploy_virtualenv
+equals(QMAKE_HOST.os, Windows) {
+ deploy_virtualenv.commands = $$PWD/deploy-virtualenv.bat qtivi_qface_virtualenv $$escape_expand(\n\t)
+ deploy_virtualenv.commands += @type nul > $$shell_path($$OUT_PWD/.stamp-deploy_virtualenv)
+} else {
+ deploy_virtualenv.commands = $$PWD/deploy-virtualenv.sh qtivi_qface_virtualenv $$escape_expand(\n\t)
+ deploy_virtualenv.commands += @touch $$OUT_PWD/.stamp-deploy_virtualenv
+}
+deploy_virtualenv.depends = $${qtivi_qface_install.target}
+QMAKE_EXTRA_TARGETS += deploy_virtualenv
+PRE_TARGETDEPS += $${deploy_virtualenv.target}
+
+virtualenv.files = $$OUT_PWD/qtivi_qface_virtualenv
+virtualenv.path = $$[QT_HOST_BINS]/ivigenerator
+virtualenv.depends = deploy_virtualenv
+virtualenv.CONFIG = no_check_exist directory no_build
+
+INSTALLS += virtualenv
+
+# On osx the hidden .Python file is needed in the installed virtualenv as well
+# this file is not installed by the directory config, so we need to install it manually
+osx {
+ virtualenv-python.files = $$OUT_PWD/qtivi_qface_virtualenv/.Python
+ virtualenv-python.path = $$[QT_HOST_BINS]/ivigenerator/qtivi_qface_virtualenv
+ # In case the file doesn't exist, touch creates it and fixes the install target
+ virtualenv-python.extra = @touch $$OUT_PWD/qtivi_qface_virtualenv/.Python
+ virtualenv-python.CONFIG = no_check_exist
+ INSTALLS += virtualenv-python
+}
+
+# Create the ivigenerator when the prepare_docs target is run, to generate the code
+# and have it ready when qdoc parses it for the documentation
+prepare_docs {
+ prepare_docs.depends += $${deploy_virtualenv.target}
+ QMAKE_EXTRA_TARGETS += prepare_docs
+}
diff --git a/src/tools/ivigenerator/templates_backend_simulator.yaml b/src/tools/ivigenerator/templates_backend_simulator.yaml
new file mode 100644
index 0000000..0c3708d
--- /dev/null
+++ b/src/tools/ivigenerator/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: "{{srcBase|lower}}.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/tools/ivigenerator/templates_backend_simulator/backend.cpp.tpl b/src/tools/ivigenerator/templates_backend_simulator/backend.cpp.tpl
new file mode 100644
index 0000000..2c8f98d
--- /dev/null
+++ b/src/tools/ivigenerator/templates_backend_simulator/backend.cpp.tpl
@@ -0,0 +1,257 @@
+{#
+# 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"
+
+{% for property in interface.properties %}
+{% if property.type.is_model %}
+#include "{{property|model_type|lower}}.h"
+{% endif %}
+{% endfor %}
+
+#include <QDebug>
+
+{% if 'simulator' in features %}
+#include <QtSimulator>
+{% endif %}
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \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|default_value}})
+{% endif %}
+{% endfor %}
+{% if 'simulator' in features %}
+ , mWorker(nullptr)
+{% endif %}
+{
+
+ {{module.module_name}}Module::registerTypes();
+{% 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|default_value(zone_name)}};
+{% 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 %}
+
+{% if 'simulator' in features %}
+ qDebug() << "CONNECTING";
+ mConnection = new QSimulatorConnection("{{interface}}", QVersionNumber(1, 0, 0));
+ mConnection->addPeerInfo("versionInfo", "1.0.0");
+ mConnection->addPeerInfo("name", "{{class}}");
+ QString hostname = QSimulatorConnection::simulatorHostName(false);
+ if (hostname.isEmpty())
+ hostname = QLatin1String("localhost");
+ mWorker = mConnection->connectToHost(hostname, 0xbeef+3);
+ if (!mWorker)
+ return;
+
+ mWorker->addReceiver(this);
+{% endif %}
+}
+
+{% for property in interface.properties %}
+{% if not property.readonly and not property.const %}
+/*!
+ \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 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;
+{% include "backend_range.cpp.tpl" %}
+ qWarning() << "SIMULATION {{ property | upperfirst }} for Zone" << zone << "changed to" << {{property}};
+
+ m_zoneMap[zone].{{property}} = {{property}};
+ emit {{ property }}Changed({{property}}, zone);
+
+{% if 'simulator' in features %}
+ if (mWorker)
+ mWorker->call("{{property|setter_name}}", {{property}}, zone);
+{% endif %}
+{% else %}
+ if ({% if interface_zoned %}!zone.isEmpty() || {%endif%}m_{{ property }} == {{property}})
+ return;
+{% include "backend_range.cpp.tpl" %}
+ qWarning() << "SIMULATION {{ property | upperfirst }} changed to" << {{property}};
+
+ m_{{property}} = {{property}};
+ emit {{property}}Changed(m_{{property}}{% if interface_zoned%}, QString(){% endif %});
+{% if 'simulator' in features %}
+ if (mWorker)
+ mWorker->call("{{property|setter_name}}", {{property}}{% if interface_zoned%}, QString(){% endif %});
+{% endif %}
+{% 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}}){%if operation.const %} const{% endif %}
+
+{
+{% for operation_parameter in operation.parameters %}
+ Q_UNUSED({{operation_parameter.name}});
+{% endfor %}
+{% if interface_zoned %}
+ Q_UNUSED(zone);
+{% endif %}
+{% set function_parameters = operation.parameters|join(', ') %}
+{% if interface_zoned %}
+{% if operation.parameters|length %}
+{% set function_parameters = function_parameters + ', ' %}
+{% endif %}
+{% set function_parameters = function_parameters + 'zone' %}
+{% endif%}
+
+{% if 'simulator' in features %}
+ if (mWorker)
+ mWorker->call("{{operation}}" {% if function_parameters is not equalto "" %}, {{function_parameters}} {% endif %});
+{% endif %}
+
+ qWarning() << "Not implemented!";
+ return {{operation|default_value}};
+}
+
+{% endfor %}
+
+QT_END_NAMESPACE
diff --git a/src/tools/ivigenerator/templates_backend_simulator/backend.h.tpl b/src/tools/ivigenerator/templates_backend_simulator/backend.h.tpl
new file mode 100644
index 0000000..85529fc
--- /dev/null
+++ b/src/tools/ivigenerator/templates_backend_simulator/backend.h.tpl
@@ -0,0 +1,122 @@
+{#
+# 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 %}
+
+QT_BEGIN_NAMESPACE
+
+{% if 'simulator' in features %}
+class QSimulatorConnection;
+class QSimulatorConnectionWorker;
+{% endif %}
+
+class {{class}} : public {{class}}Interface
+{
+ Q_OBJECT
+
+public:
+ explicit {{class}}(QObject *parent = nullptr);
+ ~{{class}}();
+
+{% if interface_zoned %}
+ QStringList availableZones() const override;
+{% endif %}
+
+ void initialize() override;
+public Q_SLOTS:
+{% for property in interface.properties %}
+{% if not property.readonly and not property.const %}
+{% 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 %}
+{% 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){%if operation.const %} const{% endif %} override;
+{% else %}
+ virtual {{operation|return_type}} {{operation}}(const QString &zone){%if operation.const %} const{% endif %} override;
+{% endif %}
+{% else %}
+ virtual {{operation|return_type}} {{operation}}({{operation.parameters|map('parameter_type')|join(', ')}}){%if operation.const %} const{% endif %} override;
+{% endif %}
+{% endfor %}
+
+protected:
+{% 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 %}
+{% if 'simulator' in features %}
+ QSimulatorConnection *mConnection;
+ QSimulatorConnectionWorker *mWorker;
+{% endif %}
+};
+
+QT_END_NAMESPACE
+
+#endif // {{oncedefine}}
diff --git a/src/tools/ivigenerator/templates_backend_simulator/backend_range.cpp.tpl b/src/tools/ivigenerator/templates_backend_simulator/backend_range.cpp.tpl
new file mode 100644
index 0000000..7d03d76
--- /dev/null
+++ b/src/tools/ivigenerator/templates_backend_simulator/backend_range.cpp.tpl
@@ -0,0 +1,67 @@
+{#
+# 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
+#}
+{% set range_low_val = property|range_low %}
+{% set range_high_val = property|range_high %}
+{% set domain_val = property|domain_values %}
+{% if range_low_val or range_high_val or domain_val %}
+{% if range_low_val and range_high_val %}
+{% set condition = property ~ ' < ' ~ range_low_val ~ ' || ' ~ property ~ ' > ' ~ range_high_val %}
+{% set message = range_low_val ~ '-' ~ range_high_val %}
+{% elif range_low_val %}
+{% set condition = property ~ ' < ' ~ range_low_val %}
+{% set message = '>' ~ range_low_val %}
+{% elif range_high_val %}
+{% set condition = property ~ ' > ' ~ range_high_val %}
+{% set message = '<' ~ range_high_val %}
+{% elif domain_val %}
+{% set condition = "!domain.contains(" ~ property ~ ")" %}
+{% set message = domain_val %}
+ static QVector<{{ property|return_type }}> domain({{domain_val|replace("'", "\"")|replace("[", "{")|replace("]", "}")}});
+{% endif %}
+ if ({{condition}}) {
+ qWarning() << "SIMULATION {{property}} change out of range ({{message}}):" << {{property}};
+{% if zoned and interface_zoned %}
+ emit {{property}}Changed({{property}}, zone);
+{% else %}
+ emit {{property}}Changed(m_{{property}}{% if interface_zoned%}, QString(){% endif %});
+{% endif %}
+ return;
+ }
+{% endif %}
diff --git a/src/tools/ivigenerator/templates_backend_simulator/generated_comment.cpp.tpl b/src/tools/ivigenerator/templates_backend_simulator/generated_comment.cpp.tpl
new file mode 100644
index 0000000..b6c2e74
--- /dev/null
+++ b/src/tools/ivigenerator/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/tools/ivigenerator/templates_backend_simulator/plugin.cpp.tpl b/src/tools/ivigenerator/templates_backend_simulator/plugin.cpp.tpl
new file mode 100644
index 0000000..9a10171
--- /dev/null
+++ b/src/tools/ivigenerator/templates_backend_simulator/plugin.cpp.tpl
@@ -0,0 +1,94 @@
+{#
+# 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>
+
+QT_BEGIN_NAMESPACE
+
+{% if module.tags.config.interfaceBuilder %}
+extern {{class}}::InterfaceBuilder {{module.tags.config.interfaceBuilder}};
+{% endif %}
+
+/*!
+ \class {{class}}
+ \inmodule {{module}}
+
+*/
+/*! \internal */
+{{class}}::{{class}}(QObject *parent)
+ : QObject(parent)
+{
+{% if module.tags.config.interfaceBuilder %}
+ m_interfaces = {{module.tags.config.interfaceBuilder}}(this);
+ Q_ASSERT(m_interfaces.size() == interfaces().size());
+{% else %}
+{% for interface in module.interfaces %}
+ m_interfaces << new {{interface}}Backend(this);
+{% endfor %}
+{% endif %}
+}
+
+/*! \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
+{
+ int index = interfaces().indexOf(interface);
+ return index < 0 ? nullptr : m_interfaces.at(index);
+}
+
+QT_END_NAMESPACE
diff --git a/src/tools/ivigenerator/templates_backend_simulator/plugin.h.tpl b/src/tools/ivigenerator/templates_backend_simulator/plugin.h.tpl
new file mode 100644
index 0000000..fb4dacd
--- /dev/null
+++ b/src/tools/ivigenerator/templates_backend_simulator/plugin.h.tpl
@@ -0,0 +1,72 @@
+{#
+# 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 <QVector>
+#include <QtIviCore/QIviServiceInterface>
+
+QT_BEGIN_NAMESPACE
+
+class {{class}} : public QObject, QIviServiceInterface
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID QIviServiceInterface_iid FILE "{{module.module_name|lower}}.json")
+ Q_INTERFACES(QIviServiceInterface)
+
+public:
+ typedef QVector<QIviFeatureInterface *> (InterfaceBuilder)({{class}} *);
+
+ explicit {{class}}(QObject *parent = nullptr);
+
+ QStringList interfaces() const;
+ QIviFeatureInterface* interfaceInstance(const QString& interface) const;
+
+private:
+ QVector<QIviFeatureInterface *> m_interfaces;
+};
+
+QT_END_NAMESPACE
+
+#endif // {{oncedefine}}
diff --git a/src/tools/ivigenerator/templates_backend_simulator/plugin.json b/src/tools/ivigenerator/templates_backend_simulator/plugin.json
new file mode 100644
index 0000000..5575ee5
--- /dev/null
+++ b/src/tools/ivigenerator/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/tools/ivigenerator/templates_backend_simulator/plugin.pri.tpl b/src/tools/ivigenerator/templates_backend_simulator/plugin.pri.tpl
new file mode 100644
index 0000000..7140507
--- /dev/null
+++ b/src/tools/ivigenerator/templates_backend_simulator/plugin.pri.tpl
@@ -0,0 +1,61 @@
+{#
+# 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.
+#############################################################################
+
+{% if 'simulator' in features %}
+QT += simulator
+{% endif %}
+
+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
+
+OTHER_FILES += \
+ $$PWD/{{module.module_name|lower}}.json
diff --git a/src/tools/ivigenerator/templates_backend_simulator/plugin.pro b/src/tools/ivigenerator/templates_backend_simulator/plugin.pro
new file mode 100644
index 0000000..cf274d8
--- /dev/null
+++ b/src/tools/ivigenerator/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/tools/ivigenerator/templates_backend_simulator/utils.tpl b/src/tools/ivigenerator/templates_backend_simulator/utils.tpl
new file mode 100644
index 0000000..e5cd338
--- /dev/null
+++ b/src/tools/ivigenerator/templates_backend_simulator/utils.tpl
@@ -0,0 +1,9 @@
+{% macro format_comments(comments) -%}
+{% with doc = comments|parse_doc -%}
+{% if doc.brief %} \brief {{doc.brief|join(' ')| wordwrap(width=100, wrapstring='\n ')}}
+{% endif %}
+
+{% if doc.description %}
+ {{doc.description|join(' ')| wordwrap(width=100, wrapstring='\n ')}}{% endif %}
+{% endwith -%}
+{% endmacro -%}
diff --git a/src/tools/ivigenerator/templates_control_panel.yaml b/src/tools/ivigenerator/templates_control_panel.yaml
new file mode 100644
index 0000000..31aa682
--- /dev/null
+++ b/src/tools/ivigenerator/templates_control_panel.yaml
@@ -0,0 +1,27 @@
+generate_rules:
+ module_rules:
+ - dest_file: 'main.cpp'
+ template_file: 'main.cpp.tpl'
+ - dest_file: 'main.qml'
+ template_file: 'main.qml.tpl'
+ - dest_file: 'qml.qrc'
+ template_file: 'qml.qrc.tpl'
+ - dest_file: "{{srcBase|lower}}.pri"
+ template_file: "ui.pri.tpl"
+ - 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: "FlagControl.qml"
+ template_file: "FlagControl.qml.tpl"
+ - dest_file: "EnumControl.qml"
+ template_file: "EnumControl.qml.tpl"
+ interface_rules:
+ - dest_file: '{{interface}}ControlUi.qml'
+ template_file: 'interface.qml.tpl'
+ - dest_file: '{{interface|lower}}.cpp'
+ template_file: 'interface.cpp.tpl'
+ - dest_file: '{{interface|lower}}.h'
+ template_file: 'interface.h.tpl'
diff --git a/src/tools/ivigenerator/templates_control_panel/EnumControl.qml.tpl b/src/tools/ivigenerator/templates_control_panel/EnumControl.qml.tpl
new file mode 100644
index 0000000..9f517e6
--- /dev/null
+++ b/src/tools/ivigenerator/templates_control_panel/EnumControl.qml.tpl
@@ -0,0 +1,31 @@
+import QtQuick 2.7
+import QtQuick.Controls 2.1
+
+ComboBox {
+ id: root
+
+ property var value: 0
+
+ FontMetrics {
+ font: root.font
+ id: _metrics
+ }
+
+ Binding {
+ target: root
+ property: "value"
+ value: model.get(currentIndex).value
+ }
+
+ onValueChanged: {
+ for(var i=0; i<model.count; i++) {
+ if (model.get(i).value == value) {
+ //Make the ComboBox as big as it's content
+ root.implicitWidth = _metrics.boundingRect(model.get(i).key).width + 100
+ currentIndex = i;
+ return;
+ }
+ }
+ console.warn("Couldn't find the value in the EnumControl model: " + value);
+ }
+}
diff --git a/src/tools/ivigenerator/templates_control_panel/FlagControl.qml.tpl b/src/tools/ivigenerator/templates_control_panel/FlagControl.qml.tpl
new file mode 100644
index 0000000..9e5abc6
--- /dev/null
+++ b/src/tools/ivigenerator/templates_control_panel/FlagControl.qml.tpl
@@ -0,0 +1,29 @@
+import QtQuick 2.0
+import QtQuick.Controls 2.1
+import QtQuick.Layouts 1.1
+
+RowLayout {
+ id: root
+ property alias model: repeater.model
+ property int value
+ property string textRole
+
+ spacing: 2
+
+ Repeater {
+ id: repeater
+ RowLayout {
+ Text { text: model[textRole] }
+ CheckBox {
+ id: checkBox
+ checked: root.value & model.value;
+ onClicked: {
+ if (checked)
+ root.value |= model.value
+ else
+ root.value &= ~model.value
+ }
+ }
+ }
+ }
+}
diff --git a/src/tools/ivigenerator/templates_control_panel/generated_comment.cpp.tpl b/src/tools/ivigenerator/templates_control_panel/generated_comment.cpp.tpl
new file mode 100644
index 0000000..b6c2e74
--- /dev/null
+++ b/src/tools/ivigenerator/templates_control_panel/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/tools/ivigenerator/templates_control_panel/global.h.tpl b/src/tools/ivigenerator/templates_control_panel/global.h.tpl
new file mode 100644
index 0000000..f2be24c
--- /dev/null
+++ b/src/tools/ivigenerator/templates_control_panel/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/tools/ivigenerator/templates_control_panel/interface.cpp.tpl b/src/tools/ivigenerator/templates_control_panel/interface.cpp.tpl
new file mode 100644
index 0000000..33f5415
--- /dev/null
+++ b/src/tools/ivigenerator/templates_control_panel/interface.cpp.tpl
@@ -0,0 +1,257 @@
+{#
+# 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 interface_zoned = interface.tags.config and interface.tags.config.zoned %}
+{% include 'generated_comment.cpp.tpl' %}
+{% import 'utils.tpl' as utils %}
+
+#include "{{class|lower}}.h"
+
+#include <QQmlEngine>
+#include <QDebug>
+#include <QtSimulator>
+
+namespace {
+const QString INITIAL_MAIN_ZONE = "MainZone";
+}
+
+QT_BEGIN_NAMESPACE
+
+{% if interface.tags.config.zoned %}
+{{class}}::{{class}}(const QString &zone, QObject *parent)
+ : QObject(parent)
+ , m_currentZone(zone)
+{
+ if (!zone.isEmpty()) {
+ return;
+ }
+
+ //Add ourself to the available zones to make it available to the UI and still keep the code clean
+ m_zoneHash.insert(INITIAL_MAIN_ZONE, this);
+ m_zoneMap.insert(INITIAL_MAIN_ZONE, QVariant::fromValue(this));
+
+ {% set zones = interface.tags.config_simulator.zones if interface.tags.config_simulator else {} %}
+ {% for zone_name, zone_id in zones.items() %}
+ addZone(QLatin1String("{{zone_id}}"));
+ {% for property in interface.properties %}
+ {% if property.tags.config_simulator and property.tags.config_simulator.zoned %}
+ m_zoneHash[QLatin1String("{{zone_id}}")]->m_{{property}} = {{property|default_value(zone_name)}};
+ {% endif %}
+ {% endfor %}
+ {% endfor %}
+{% else %}
+{{class}}::{{class}}(QObject *parent)
+ : QObject(parent)
+{
+{% endif %}
+ QVariantMap peerInfo{{ '{{' }}"control_panel",""{{ '}}' }};
+ QSimulatorServer *server = {{module.module_name}}Module::simulationServer();
+ server->registerServer("{{interface}}", QVersionNumber(1, 0, 0), peerInfo, [=](QSimulatorConnectionWorker *client) {
+ m_worker = client;
+ connect(m_worker, &QSimulatorConnectionWorker::disconnected, this, [=]() {
+ qDebug() << "DISCONNECTED";
+ //Deleting it on the mainZone is enough as QPointer does the rest of the work for us.
+ m_worker = 0;
+ });
+ m_worker->addReceiver(this);
+ qDebug() << "connected: " << client->peerInfo();
+{% if interface.tags.config.zoned %}
+ auto i = m_zoneHash.constBegin();
+ while (i != m_zoneHash.constEnd()) {
+ i.value()->m_worker = client;
+{% for property in interface.properties %}
+{% set function_name = property|setter_name %}
+{% if property.readonly or property.const %}
+{% set function_name = property.name + 'Changed' %}
+{% endif %}
+ m_worker->call("{{function_name}}", i.value()->m_{{property}}, i.value()->m_currentZone);
+{% endfor %}
+ ++i;
+ }
+{% else %}
+{% for property in interface.properties %}
+{% set function_name = property|setter_name %}
+{% if property.readonly or property.const %}
+{% set function_name = property.name + 'Changed' %}
+{% endif %}
+ m_worker->call("{{function_name}}", m_{{property}});
+{% endfor %}
+{% endif %}
+ });
+}
+
+{{class}}::~{{class}}()
+{
+}
+
+void {{class}}::registerQmlTypes(const QString& uri, int majorVersion, int minorVersion, const QString& qmlName)
+{
+{% if 'singleton' in interface.tags %}
+ qmlRegisterSingletonType<{{class}}>(uri.toLatin1(), majorVersion, minorVersion, "{{interface}}", {{class|lower}}_singletontype_provider);
+{% else %}
+ qmlRegisterType<{{class}}>(uri.toLatin1(), majorVersion, minorVersion, qmlName.toLatin1());
+{% endif %}
+}
+
+{% if interface.tags.config.zoned %}
+void {{class}}::addZone(const QString &newZone)
+{
+ if (!m_currentZone.isEmpty()) {
+ qWarning("Adding a new zone is only possible from the root zone.");
+ return;
+ }
+
+ if (m_zoneHash.contains(newZone))
+ return;
+
+ {{class}} *zoneObject = new {{class}}(newZone, this);
+ zoneObject->m_worker = m_worker;
+ m_zoneHash.insert(newZone, zoneObject);
+ m_zoneMap.insert(newZone, QVariant::fromValue(zoneObject));
+
+ emit zonesChanged();
+}
+
+QStringList {{class}}::zones() const
+{
+ return m_zoneMap.keys();
+}
+
+
+QString {{class}}::currentZone() const
+{
+ return m_currentZone;
+}
+
+QVariantMap {{class}}::zoneAt() const
+{
+ return m_zoneMap;
+}
+{% endif %}
+
+{% for property in interface.properties %}
+
+{{property|return_type}} {{class}}::{{property|getter_name}}() const
+{
+ return m_{{property}};
+}
+
+void {{class}}::{{property|setter_name}}({{ property|parameter_type }})
+{
+ if (m_{{property}} == {{property}})
+ return;
+ m_{{property}} = {{property}};
+ emit {{property}}Changed({{property}});
+ auto w = worker();
+ if (w)
+{% set function_name = property|setter_name %}
+{% if property.readonly or property.const %}
+{% set function_name = property.name + 'Changed' %}
+{% endif %}
+{% if interface.tags.config.zoned %}
+ w->call("{{function_name}}", {{property}}, m_currentZone);
+{% else %}
+ w->call("{{function_name}}", {{property}});
+{% endif %}
+}
+
+{% if interface.tags.config.zoned %}
+void {{class}}::{{property|setter_name}}({{property|parameter_type}}, const QString &zone)
+{
+ QString z = zone;
+ if (z.isEmpty())
+ z = INITIAL_MAIN_ZONE;
+
+ if (!m_zoneMap.contains(z)) {
+ return;
+ }
+
+ // the setter cannot be used as it would update the simulation connection
+ // and by this create a async loop
+ if (m_zoneHash[z]->m_{{property}} == {{property}})
+ return;
+ m_zoneHash[z]->m_{{property}} = {{property}};
+ emit m_zoneHash[z]->{{property}}Changed({{property}});
+}
+{% endif %}
+
+{% endfor %}
+
+{% for signal in interface.signals %}
+void {{class}}::{{signal}}({{signal.parameters|map('parameter_type')|join(', ')}})
+{
+ auto w = worker();
+ if (w)
+ w->call("{{signal}}", {{signal.parameters|join(', ')}}{% if interface.tags.config.zoned %}, m_currentZone{% endif %});
+}
+
+{% endfor %}
+
+{% if interface_zoned %}
+{% for operation in interface.operations %}
+void {{class}}::{{operation}}({{operation.parameters|map('parameter_type')|join(', ')}}{%if operation.parameters|count %}, {% endif %}const QString &zone)
+{
+ QString z = zone;
+ if (z.isEmpty())
+ z = INITIAL_MAIN_ZONE;
+
+ if (!m_zoneMap.contains(z)) {
+ return;
+ }
+
+ emit m_zoneHash[z]->{{operation}}({{operation.parameters|join(', ')}});
+}
+{% endfor %}
+{% endif %}
+
+QSimulatorConnectionWorker *{{class}}::worker()
+{
+{% if interface.tags.config.zoned %}
+ if (m_currentZone.isEmpty())
+ return m_worker;
+ {{class}}* globalZone = qobject_cast<{{class}}*>(parent());
+ if (globalZone)
+ return globalZone->m_worker;
+ return nullptr;
+{% else %}
+ return m_worker;
+{% endif %}
+}
+
+QT_END_NAMESPACE
diff --git a/src/tools/ivigenerator/templates_control_panel/interface.h.tpl b/src/tools/ivigenerator/templates_control_panel/interface.h.tpl
new file mode 100644
index 0000000..f6c245f
--- /dev/null
+++ b/src/tools/ivigenerator/templates_control_panel/interface.h.tpl
@@ -0,0 +1,135 @@
+{#
+# 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) %}
+{% set interface_zoned = interface.tags.config and interface.tags.config.zoned %}
+{% include 'generated_comment.cpp.tpl' %}
+
+#ifndef {{oncedefine}}
+#define {{oncedefine}}
+
+#include "{{module.module_name|lower}}module.h"
+
+#include <QObject>
+#include <QHash>
+#include <QVariantMap>
+
+QT_BEGIN_NAMESPACE
+
+class {{class}}Private;
+class {{class}}BackendInterface;
+class QSimulatorConnectionWorker;
+
+class {{exportsymbol}} {{class}} : public QObject {
+ Q_OBJECT
+{% if interface_zoned %}
+ Q_PROPERTY(QString currentZone READ currentZone NOTIFY currentZoneChanged)
+ Q_PROPERTY(QStringList zones READ zones NOTIFY zonesChanged)
+ Q_PROPERTY(QVariantMap zoneAt READ zoneAt NOTIFY zonesChanged)
+{% endif %}
+{% for property in interface.properties %}
+ Q_PROPERTY({{property|return_type}} {{property}} READ {{property|getter_name}} WRITE {{property|setter_name}} NOTIFY {{property}}Changed)
+{% endfor %}
+ Q_CLASSINFO("IviPropertyDomains", "{{ interface.properties|json_domain|replace("\"", "\\\"") }}")
+public:
+{% if interface_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, const QString& qmlName = "");
+
+{% if interface_zoned %}
+ Q_INVOKABLE void addZone(const QString& newZone);
+ QString currentZone() const;
+ QStringList zones() const;
+ QVariantMap zoneAt() const;
+{% endif %}
+{% for property in interface.properties %}
+ {{property|return_type}} {{property|getter_name}}() const;
+{% endfor %}
+
+public Q_SLOTS:
+{% for property in interface.properties %}
+ void {{property|setter_name}}({{property|parameter_type}});
+{% if interface_zoned %}
+ void {{property|setter_name}}({{property|parameter_type}}, const QString &zone);
+{% endif %}
+{% endfor %}
+{% for signal in interface.signals %}
+ void {{signal}}({{signal.parameters|map('parameter_type')|join(', ')}});
+{% endfor %}
+
+Q_SIGNALS:
+{% for operation in interface.operations %}
+ void {{operation}}({{operation.parameters|map('parameter_type')|join(', ')}});
+{% endfor %}
+{% if interface_zoned %}
+ void currentZoneChanged();
+ void zonesChanged();
+{% endif %}
+{% for property in interface.properties %}
+ void {{property}}Changed({{property|parameter_type}});
+{% endfor %}
+
+private Q_SLOTS:
+{% if interface_zoned %}
+{% for operation in interface.operations %}
+ void {{operation}}({{operation.parameters|map('parameter_type')|join(', ')}}{%if operation.parameters|count %}, {% endif %}const QString &zone);
+{% endfor %}
+{% endif %}
+private:
+ QSimulatorConnectionWorker *worker();
+{% for property in interface.properties %}
+ {{ property|return_type }} m_{{ property }};
+{% endfor %}
+{% if interface_zoned %}
+ QHash<QString,{{class}}*> m_zoneHash;
+ QVariantMap m_zoneMap;
+ QString m_currentZone;
+{% endif %}
+ QSimulatorConnectionWorker *m_worker;
+};
+
+QT_END_NAMESPACE
+
+#endif // {{oncedefine}}
diff --git a/src/tools/ivigenerator/templates_control_panel/interface.qml.tpl b/src/tools/ivigenerator/templates_control_panel/interface.qml.tpl
new file mode 100644
index 0000000..83d60b4
--- /dev/null
+++ b/src/tools/ivigenerator/templates_control_panel/interface.qml.tpl
@@ -0,0 +1,189 @@
+{#
+# 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 backend_obj = '{0}{1}Id'.format(interface, 'Object') %}
+{% set backend_obj = backend_obj[0].lower() + backend_obj[1:] %}
+import QtQuick 2.7
+import QtQuick.Window 2.2
+import QtQuick.Controls 2.1
+import QtQuick.Layouts 1.1
+import QtIvi.ControlPanel 1.0
+
+Flickable {
+ id: {{interface|lowerfirst}}
+ flickableDirection: Flickable.VerticalFlick
+ clip: true
+ ScrollBar.vertical: ScrollBar {}
+ contentHeight: layout.childrenRect.height
+
+ {{interface|qml_type}} {
+ id: {{backend_obj}}
+ }
+
+{% if interface.tags.config.zoned %}
+ property {{interface|qml_type}} currentZoneObject: {{backend_obj}}.zoneAt[comboZones.displayText]
+{% endif %}
+
+ ColumnLayout {
+ id: layout
+ anchors.fill: parent
+{% if interface.tags.config.zoned %}
+ RowLayout {
+ Text {
+ text: "Zone: "
+ }
+ ComboBox {
+ width: 250
+ id: comboZones
+ editable: true
+ model: {{backend_obj}}.zones
+ currentIndex: {{backend_obj}}.zones.indexOf("MainZone")
+ }
+ Button {
+ text:"+"
+ width: 20
+ height: 20
+ onClicked: {
+ var zoneName = comboZones.editText;
+ {{backend_obj}}.addZone(zoneName)
+ }
+ }
+ }
+{% endif %}
+
+ ToolSeparator {
+ Layout.fillWidth: true
+ orientation: Qt.Horizontal
+ }
+
+{% for property in interface.properties %}
+{% if interface.tags.config.zoned %}
+{% set backend_obj = 'currentZoneObject' %}
+{% endif %}
+ RowLayout {
+ height: 30
+ Layout.fillWidth: true
+ Text {
+ text: "{{property|upperfirst}}: "
+ }
+
+ Connections {
+ target: {{property|lowerfirst}}Control
+ on{{property|qml_binding_property|upperfirst}}Changed: {
+ {{backend_obj}}.{{property}} = {{property|lowerfirst}}Control.{{property|qml_binding_property}}
+ }
+ }
+
+ Binding {
+ target: {{property|lowerfirst}}Control
+ property: "{{property|qml_binding_property}}"
+ value: {{backend_obj}}.{{property}}
+ }
+
+ {{property|qml_control(backend_obj)}}
+ }
+{% endfor %}
+{% if interface.signals|count %}
+ ToolSeparator {
+ orientation: Qt.Horizontal
+ Layout.fillWidth: true
+ }
+
+ Text {
+ text: "Signals"
+ }
+{% for signal in interface.signals %}
+ // Button for signal call
+ RowLayout {
+ spacing: 2
+ height: 20
+ Button {
+ text: "{{signal}}"
+ onClicked: {{backend_obj}}.{{signal}}({{signal|qml_control_signal_parameters}});
+ }
+{% for param in signal.parameters %}
+ Text {
+ text: "{{param}}"
+ }
+ {{param|qml_control(backend_obj)}}
+
+{% endfor%}
+ }
+{% endfor %}
+{% endif %}
+{% if interface.operations|count %}
+
+ ToolSeparator {
+ orientation: Qt.Horizontal
+ Layout.fillWidth: true
+ }
+
+ Text {
+ text: "Operations"
+ }
+
+ TextArea {
+ id: operationArea
+ readOnly: true
+ placeholderText: "The called operations will be logged here"
+ Layout.fillWidth: true
+ }
+{% for operation in interface.operations %}
+{% if interface.tags.config.zoned %}
+{% set backend_obj = 'currentZoneObject' %}
+{% endif %}
+ Connections {
+ target: {{backend_obj}}
+ on{{operation|upperfirst}}: {
+ operationArea.text += "{{operation}}("
+{% for parameter in operation.parameters %}
+ + "{{parameter}}: " + {{parameter}}
+{% endfor %}
+ + ")\n"
+ }
+ }
+{% endfor %}
+{% endif %}
+ Item {
+ //spacer
+ Layout.fillHeight: true
+ }
+ }
+}
diff --git a/src/tools/ivigenerator/templates_control_panel/main.cpp.tpl b/src/tools/ivigenerator/templates_control_panel/main.cpp.tpl
new file mode 100644
index 0000000..5a3ae52
--- /dev/null
+++ b/src/tools/ivigenerator/templates_control_panel/main.cpp.tpl
@@ -0,0 +1,64 @@
+{#
+# 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" %}
+
+#include <QGuiApplication>
+#include <QQmlApplicationEngine>
+
+#include "{{module.module_name|lower}}module.h"
+{% for iface in module.interfaces %}
+#include "{{iface|lower}}.h"
+{% endfor %}
+
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+
+ {{module.module_name}}Module::registerTypes();
+{% for interface in module.interfaces %}
+ {{interface}}::registerQmlTypes(QLatin1String("QtIvi.ControlPanel"), 1, 0,
+ QLatin1String("{{interface|qml_type}}"));
+{% endfor %}
+ QQmlApplicationEngine engine;
+ engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
+
+ return app.exec();
+}
diff --git a/src/tools/ivigenerator/templates_control_panel/main.qml.tpl b/src/tools/ivigenerator/templates_control_panel/main.qml.tpl
new file mode 100644
index 0000000..a469007
--- /dev/null
+++ b/src/tools/ivigenerator/templates_control_panel/main.qml.tpl
@@ -0,0 +1,78 @@
+{#
+# 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 QtQuick 2.7
+import QtQuick.Window 2.2
+import QtQuick.Controls 2.1
+import QtQuick.Layouts 1.3
+import QtIvi.ControlPanel 1.0
+
+ApplicationWindow {
+ visible: true
+ width: 640
+ height: 800
+ title: qsTr("QtIVI {{module.module_name}}")
+
+ ColumnLayout {
+ anchors.fill: parent
+ anchors.margins: 5
+
+ TabBar {
+ id: bar
+ Layout.fillWidth: true
+ {% for interface in module.interfaces %}
+ TabButton {
+ text: "{{interface|qml_type}}"
+ }
+ {% endfor %}
+ }
+
+ StackLayout {
+ Layout.fillWidth: true
+ currentIndex: bar.currentIndex
+ {% for interface in module.interfaces %}
+ {{interface}}ControlUi {
+ id: {{interface|lowerfirst}}
+ }
+ {% endfor %}
+ }
+ }
+}
diff --git a/src/tools/ivigenerator/templates_control_panel/module.cpp.tpl b/src/tools/ivigenerator/templates_control_panel/module.cpp.tpl
new file mode 100644
index 0000000..6659acb
--- /dev/null
+++ b/src/tools/ivigenerator/templates_control_panel/module.cpp.tpl
@@ -0,0 +1,146 @@
+{#
+# 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"
+{% for interface in module.interfaces %}
+#include "{{interface|lower}}.h"
+{% endfor %}
+#include <QQmlEngine>
+#include <QDebug>
+#include <QDataStream>
+#include <QtSimulator>
+
+QT_BEGIN_NAMESPACE
+
+/*! \internal */
+QObject* {{class|lower}}_singletontype_provider(QQmlEngine*, QJSEngine*)
+{
+ return nullptr; //new {{class}}Factory();
+}
+
+/*!
+ \class {{class}}
+ \inmodule {{module}}
+
+{{ utils.format_comments(module.comment) }}
+*/
+{{class}}::{{class}}(QObject *parent)
+ : QObject(parent)
+{
+}
+
+{% for enum in module.enums %}
+{{class}}::{{enum}} {{class}}::to{{enum}}(quint8 v, bool *ok) {
+ if (ok) {
+ *ok = true;
+ }
+ switch (v) {
+{% for member in enum.members %}
+ case {{member.value}}: return {{member.name}};
+{% endfor %}
+ default:
+ if (ok) {
+ *ok = false;
+ }
+ return {{enum.members|first}};
+ }
+}
+{% endfor %}
+
+/*! \internal */
+void {{class}}::registerTypes()
+{
+{% for enum in module.enums %}
+ qRegisterMetaType<{{class}}::{{enum|flag_type}}>();
+ qRegisterMetaTypeStreamOperators<{{class}}::{{enum|flag_type}}>();
+{% endfor %}
+{% for struct in module.structs %}
+ qRegisterMetaType<{{struct}}>();
+{% 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 %}
+}
+
+QSimulatorServer *{{class}}::simulationServer()
+{
+ static QSimulatorServer *server = nullptr;
+
+ if (!server) {
+ server = new QSimulatorServer;
+ QString error;
+ server->startServer(0xbeef+3, &error);
+ if (!error.isEmpty())
+ qWarning("ERROR: %s", qPrintable(error));
+ }
+
+ return server;
+}
+
+{% for enum in module.enums %}
+QDataStream &operator<<(QDataStream &out, {{class}}::{{enum|flag_type}} var)
+{
+ out << (quint8)var;
+ return out;
+}
+QDataStream &operator>>(QDataStream &in, {{class}}::{{enum|flag_type}} &var)
+{
+ bool ok;
+ quint8 val;
+ in >> val;
+ var = {{class}}::to{{enum}}(val, &ok);
+ if (!ok) {
+ qWarning() << "Received an invalid enum value for type {{class}}::{{enum|flag_type}}, value =" << var;
+ }
+ return in;
+}
+{% endfor %}
+
+QT_END_NAMESPACE
diff --git a/src/tools/ivigenerator/templates_control_panel/module.h.tpl b/src/tools/ivigenerator/templates_control_panel/module.h.tpl
new file mode 100644
index 0000000..15f81f2
--- /dev/null
+++ b/src/tools/ivigenerator/templates_control_panel/module.h.tpl
@@ -0,0 +1,87 @@
+{#
+# 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 QSimulatorServer;
+
+class {{exportsymbol}} {{class}} : public QObject {
+ Q_OBJECT
+public:
+ {{class}}(QObject *parent=0);
+
+{% for enum in module.enums %}
+ enum {{enum}} {
+ {% for member in enum.members %}
+ {{member.name}} = {{member.value}}, {{member.comment}}
+ {% endfor %}
+ };
+{% if enum.is_flag %}
+ Q_DECLARE_FLAGS({{enum|flag_type}}, {{enum}})
+ Q_FLAG({{enum|flag_type}})
+{% else %}
+ Q_ENUM({{enum}})
+{% endif %}
+ static {{enum}} to{{enum}}(quint8 v, bool *ok);
+{% endfor %}
+
+ static void registerTypes();
+ static void registerQmlTypes(const QString& uri, int majorVersion = 1, int minorVersion = 0);
+
+ static QSimulatorServer *simulationServer();
+};
+
+{% for enum in module.enums %}
+QDataStream &operator<<(QDataStream &out, {{class}}::{{enum|flag_type}} var);
+QDataStream &operator>>(QDataStream &in, {{class}}::{{enum|flag_type}} &var);
+{% endfor %}
+
+QT_END_NAMESPACE
+
+#endif // {{oncedefine}}
diff --git a/src/tools/ivigenerator/templates_control_panel/qml.qrc.tpl b/src/tools/ivigenerator/templates_control_panel/qml.qrc.tpl
new file mode 100644
index 0000000..365d76f
--- /dev/null
+++ b/src/tools/ivigenerator/templates_control_panel/qml.qrc.tpl
@@ -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
+#}
+<RCC>
+ <qresource prefix="/">
+ <file>main.qml</file>
+ <file>EnumControl.qml</file>
+ <file>FlagControl.qml</file>
+{% for interface in module.interfaces %}
+ <file>{{interface}}ControlUi.qml</file>
+{% endfor %}
+ </qresource>
+</RCC>
diff --git a/src/tools/ivigenerator/templates_control_panel/ui.pri.tpl b/src/tools/ivigenerator/templates_control_panel/ui.pri.tpl
new file mode 100644
index 0000000..f96eacc
--- /dev/null
+++ b/src/tools/ivigenerator/templates_control_panel/ui.pri.tpl
@@ -0,0 +1,23 @@
+#############################################################################
+## This is an auto-generated file.
+## Do not edit! All changes made to it will be lost.
+#############################################################################
+
+DEFINES += QT_BUILD_{{module.module_name|upper}}_LIB
+
+SOURCES += \
+ $$PWD/main.cpp \
+{% for interface in module.interfaces %}
+ $$PWD/{{interface|lower}}.cpp \
+{% endfor %}
+ $$PWD/{{module.module_name|lower}}module.cpp
+
+HEADERS += \
+{% for interface in module.interfaces %}
+ $$PWD/{{interface|lower}}.h \
+{% endfor %}
+ $$PWD/{{module.module_name|lower}}module.h \
+ $$PWD/{{module.module_name|lower}}global.h
+
+RESOURCES += $$PWD/qml.qrc
+QT *= simulator
diff --git a/src/tools/ivigenerator/templates_control_panel/utils.tpl b/src/tools/ivigenerator/templates_control_panel/utils.tpl
new file mode 100644
index 0000000..42ffa5e
--- /dev/null
+++ b/src/tools/ivigenerator/templates_control_panel/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/tools/ivigenerator/templates_frontend.yaml b/src/tools/ivigenerator/templates_frontend.yaml
new file mode 100644
index 0000000..f993e80
--- /dev/null
+++ b/src/tools/ivigenerator/templates_frontend.yaml
@@ -0,0 +1,36 @@
+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.module_name|lower}}modulefactory.h"
+ template_file: "modulefactory.h.tpl"
+ - dest_file: "{{module.module_name|lower}}modulefactory.cpp"
+ template_file: "modulefactory.cpp.tpl"
+ - dest_file: "{{srcBase|lower}}.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:
+ - dest_file: '{{struct|lower}}.h'
+ template_file: 'struct.h.tpl'
+ - dest_file: '{{struct|lower}}.cpp'
+ template_file: 'struct.cpp.tpl'
+ - dest_file: '{{struct|lower}}model.h'
+ template_file: 'structmodel.h.tpl'
+ - dest_file: '{{struct|lower}}model_p.h'
+ template_file: 'structmodel_p.h.tpl'
+ - dest_file: '{{struct|lower}}model.cpp'
+ template_file: 'structmodel.cpp.tpl'
diff --git a/src/tools/ivigenerator/templates_frontend/backendinterface.cpp.tpl b/src/tools/ivigenerator/templates_frontend/backendinterface.cpp.tpl
new file mode 100644
index 0000000..c4e453e
--- /dev/null
+++ b/src/tools/ivigenerator/templates_frontend/backendinterface.cpp.tpl
@@ -0,0 +1,162 @@
+{#
+# 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' %}
+{% import 'utils.tpl' as utils %}
+
+#include "{{class|lower}}.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \class {{class}}
+ \inmodule {{module}}
+ \ingroup backends
+{% if interface.tags.config.zoned %}
+ \inherits QIviZonedFeatureInterface
+{% else %}
+ \inherits QIviFeatureInterface
+{% endif %}
+ \keyword {{interface.tags.config.id}}
+
+ \brief Backend interface for {{interface}}.
+ The {{class}} is the interface used by \l {{interface}}
+
+ The interface is discovered by a \l {{interface}} object, which connects to it and sets up
+ the connections to it.
+
+ \sa {{interface}}
+ */
+{{class}}::{{class}}(QObject *parent)
+{% if interface.tags.config.zoned %}
+ : QIviZonedFeatureInterface(parent)
+{% else %}
+ : QIviFeatureInterface(parent)
+{% endif %}
+{
+}
+
+{{class}}::~{{class}}()
+{
+}
+
+{% for property in interface.properties %}
+{% if not property.readonly and not property.const %}
+/*!
+{% if interface.tags.config.zoned %}
+ \fn void {{class}}::{{property|setter_name}}({{ property|parameter_type }}, const QString &zone);
+{% else %}
+ \fn void {{class}}::{{property|setter_name}}({{ property|parameter_type }});
+{% endif %}
+
+ Setter for {{interface}}::{{property}}.
+ Sets the property \e {{property}} to the new value passed by \a {{property}}.
+
+{% if interface.tags.config.zoned %}
+ The value of \a zone indicates the zone this property should be changed in.
+{% endif %}
+
+ This method is expected to emit a \l {{property}}Changed() signal when the internal state changes
+ due to this function call. The signal is even expected to be emitted if the given \a {{property}} is out of range and no
+ actual change takes place.
+
+ \sa {{property}}Changed()
+*/
+{% endif %}
+{% endfor %}
+{% for operation in interface.operations %}
+/*!
+{% if interface.tags.config.zoned %}
+{% if operation.parameters|length %}
+ \fn {{operation|return_type}} {{class}}::{{operation}}({{operation.parameters|map('parameter_type')|join(', ')}}, const QString &zone){%if operation.const %} const{% endif %};
+{% else %}
+ \fn {{operation|return_type}} {{class}}::{{operation}}(const QString &zone){%if operation.const %} const{% endif %};
+{% endif %}
+{% else %}
+ \fn {{operation|return_type}} {{class}}::{{operation}}({{operation.parameters|map('parameter_type')|join(', ')}}){%if operation.const %} const{% endif %};
+{% endif %}
+
+{{ utils.format_comments(operation.comment) }}
+
+{% if interface.tags.config.zoned %}
+ The value of \a zone indicates the zone this operation should be done in.
+{% endif %}
+*/
+{% endfor %}
+
+{% for signal in interface.signals %}
+/*!
+{% if interface.tags.config.zoned %}
+{% if signal.parameters|length %}
+ \fn void {{class}}::{{signal}}({{signal.parameters|map('parameter_type')|join(', ')}}, const QString &zone = QString());
+{% else %}
+ \fn void {{class}}::{{signal}}(const QString &zone = QString());
+{% endif %}
+{% else %}
+ \fn void {{class}}::{{signal}}({{signal.parameters|map('parameter_type')|join(', ')}});
+{% endif %}
+{{ utils.format_comments(signal.comment) }}
+
+{% if interface.tags.config.zoned %}
+ The value of \a zone indicates the zone this operation should be done in.
+{% endif %}
+*/
+{% endfor %}
+{% for property in interface.properties %}
+/*!
+{% if interface.tags.config.zoned %}
+ \fn void {{class}}::{{property}}Changed({{ property|parameter_type }}, const QString &zone);
+{% else %}
+ \fn void {{class}}::{{property}}Changed({{ property|parameter_type }});
+{% endif %}
+
+ The signal is emitted when the \e {{property}} property changed to \a {{property}}.
+
+{% if interface.tags.config.zoned %}
+ The value of \a zone indicates the zone this property should be changed in.
+{% endif %}
+
+{% if not property.readonly and not property.const %}
+ \sa {{property|setter_name}}
+{% endif %}
+ \sa {{interface}}::{{property}}
+*/
+{% endfor %}
+
+QT_END_NAMESPACE
diff --git a/src/tools/ivigenerator/templates_frontend/backendinterface.h.tpl b/src/tools/ivigenerator/templates_frontend/backendinterface.h.tpl
new file mode 100644
index 0000000..eba6196
--- /dev/null
+++ b/src/tools/ivigenerator/templates_frontend/backendinterface.h.tpl
@@ -0,0 +1,114 @@
+{#
+# 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) %}
+{% set exportsymbol = 'Q_{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/QIviZonedFeatureInterface>
+{% else %}
+#include <QtIviCore/QIviFeatureInterface>
+{% endif %}
+
+QT_BEGIN_NAMESPACE
+
+{% if interface.tags.config.zoned %}
+class {{exportsymbol}} {{class}} : public QIviZonedFeatureInterface
+{% else %}
+class {{exportsymbol}} {{class}} : public QIviFeatureInterface
+{% endif %}
+{
+ Q_OBJECT
+public:
+ explicit {{class}}(QObject *parent = nullptr);
+ ~{{class}}();
+
+{% for property in interface.properties %}
+{% if not property.readonly and not property.const %}
+{% if interface.tags.config.zoned %}
+ virtual void {{property|setter_name}}({{ property|parameter_type }}, const QString &zone) = 0;
+{% else %}
+ virtual void {{property|setter_name}}({{ property|parameter_type }}) = 0;
+{% endif %}
+{% 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){%if operation.const %} const{% endif %} = 0;
+{% else %}
+ virtual {{operation|return_type}} {{operation}}(const QString &zone){%if operation.const %} const{% endif %} = 0;
+{% endif %}
+{% else %}
+ virtual {{operation|return_type}} {{operation}}({{operation.parameters|map('parameter_type')|join(', ')}}){%if operation.const %} const{% endif %} = 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/tools/ivigenerator/templates_frontend/generated_comment.cpp.tpl b/src/tools/ivigenerator/templates_frontend/generated_comment.cpp.tpl
new file mode 100644
index 0000000..95878f2
--- /dev/null
+++ b/src/tools/ivigenerator/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/tools/ivigenerator/templates_frontend/global.h.tpl b/src/tools/ivigenerator/templates_frontend/global.h.tpl
new file mode 100644
index 0000000..a98c1ae
--- /dev/null
+++ b/src/tools/ivigenerator/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|strip_QT}}_LIB)
+# define Q_{{exportsymbol}}_EXPORT Q_DECL_EXPORT
+# else
+# define Q_{{exportsymbol}}_EXPORT Q_DECL_IMPORT
+# endif
+#else
+# define Q_{{exportsymbol}}_EXPORT
+#endif
+
+QT_END_NAMESPACE
+
+#endif // {{oncedefine}}
diff --git a/src/tools/ivigenerator/templates_frontend/interface.cpp.tpl b/src/tools/ivigenerator/templates_frontend/interface.cpp.tpl
new file mode 100644
index 0000000..0026d0a
--- /dev/null
+++ b/src/tools/ivigenerator/templates_frontend/interface.cpp.tpl
@@ -0,0 +1,421 @@
+{#
+# 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"
+
+{% for property in interface.properties %}
+{% if property.type.is_model %}
+#include "{{property|model_type|lower}}.h"
+{% endif %}
+{% endfor %}
+
+#include <QQmlEngine>
+#include <QIviServiceObject>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \class {{interface}}
+ \inmodule {{module}}
+{{ utils.format_comments(interface.comment) }}
+*/
+
+/*!
+ \qmltype {{interface|qml_type}}
+ \instantiates {{interface}}
+{% if module.tags.config.qml_name is defined %}
+ \inqmlmodule {{module.tags.config.qml_name}}
+{% endif %}
+{% if interface.tags.config.zoned %}
+ \inherits AbstractZonedFeature
+{% else %}
+ \inherits AbstractFeature
+{% endif %}
+
+{{ 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_type_value}})
+{% endfor %}
+{
+{% if not module.tags.config.disablePrivateIVI %}
+ m_supportsPropertyOverriding = true;
+{% endif %}
+}
+
+/*! \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_type_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;
+{% if not module.tags.config.disablePrivateIVI %}
+ if (Q_UNLIKELY(m_propertyOverride)) {
+ const int pi = f->metaObject()->indexOfProperty("{{property}}");
+ if (m_propertyOverride->isOverridden(pi)) {
+ QVariant v = qVariantFromValue<{{property|return_type}}>({{property}});
+ m_propertyOverride->setProperty(pi, v);
+ return;
+ }
+ }
+{% endif %}
+ if ({{class}}Private::get(f)->m_{{property}} != {{property}}) {
+ {{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 %}
+{% for signal in interface.signals %}
+/*! \internal */
+{% if interface.tags.config.zoned %}
+void {{class}}Private::on{{signal|upperfirst}}({{signal.parameters|map('parameter_type')|join(', ')}}, const QString &zone)
+{
+ auto q = getParent();
+ auto f = qobject_cast<{{class}}*>(q->zoneAt(zone));
+ if (!f)
+ f = q;
+ if (f->zone() != zone)
+ return;
+ emit f->{{signal}}({{signal.parameters|join(', ')}});
+}
+{% else %}
+void {{class}}Private::on{{signal|upperfirst}}({{signal.parameters|map('parameter_type')|join(', ')}})
+{
+ auto q = getParent();
+ emit q->{{signal}}({{signal.parameters|join(', ')}});
+}
+{% endif %}
+
+{% endfor %}
+
+{% if not module.tags.config.disablePrivateIVI %}
+bool {{class}}Private::notify(const QByteArray &propertyName, const QVariant &value)
+{
+ auto q = getParent();
+{% for property in interface.properties %}
+ if (propertyName == QByteArray("{{property}}")) {
+ emit q->{{property}}Changed(value.value<{{property|return_type}}>());
+ return true;
+ }
+{% endfor %}
+{% if interface.tags.config.zoned %}
+ return QIviAbstractZonedFeaturePrivate::notify(propertyName, value);
+{% else %}
+ return QIviAbstractFeaturePrivate::notify(propertyName, value);
+{% endif %}
+}
+{% endif %}
+
+{% if module.tags.config.disablePrivateIVI %}
+{% if interface.tags.config.zoned %}
+/*!
+ Default constructs an instance of {{class}} to the given \a zone.
+
+ 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.
+*/
+{{class}}::{{class}}(const QString &zone, QObject *parent)
+ : QIviAbstractZonedFeature(QLatin1String({{module.module_name}}_{{interface}}_iid), zone, parent)
+{% else %}
+/*!
+ Default constructs an instance of {{class}}.
+*/
+{{class}}::{{class}}(QObject *parent)
+ : QIviAbstractFeature({{module.module_name}}_{{interface}}_iid, parent)
+{% endif %}
+ , m_helper(new {{class}}Private(this))
+{% else %}
+{% if interface.tags.config.zoned %}
+/*!
+ Default constructs an instance of {{class}} to the given \a zone.
+
+ 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.
+*/
+{{class}}::{{class}}(const QString &zone, QObject *parent)
+ : QIviAbstractZonedFeature(*new {{class}}Private(QLatin1String({{module.module_name}}_{{interface}}_iid), zone, this), parent)
+{% else %}
+/*!
+ Default constructs an instance of {{class}}.
+*/
+{{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|qml_type}}");
+{% endif %}
+}
+
+{% for property in interface.properties %}
+
+/*!
+ \property {{class}}::{{property}}
+{{ utils.format_comments(property.comment) }}
+{% if property.const %}
+ \note This property is constant and the value will not change once the plugin is initialized.
+{% endif %}
+*/
+
+/*!
+ \qmlproperty {{property|return_type}} {{interface|qml_type}}::{{property}}
+{{ utils.format_comments(property.comment) }}
+{% if property.const %}
+ \note This property is constant and the value will not change once the plugin is initialized.
+{% endif %}
+*/
+{{property|return_type}} {{class}}::{{property|getter_name}}() const
+{
+ const auto d = {{class}}Private::get(this);
+{% if not module.tags.config.disablePrivateIVI %}
+ if (Q_UNLIKELY(d->m_propertyOverride))
+ return d->m_propertyOverride->property(metaObject()->indexOfProperty("{{property}}")).value<{{property|return_type}}>();
+{% endif %}
+ return d->m_{{property}};
+}
+{% if not property.readonly and not property.const %}
+
+void {{class}}::{{property|setter_name}}({{ property|parameter_type }})
+{
+ auto d = {{class}}Private::get(this);
+ bool forceUpdate = false;
+{% if not module.tags.config.disablePrivateIVI %}
+ if (Q_UNLIKELY(d->m_propertyOverride)) {
+ const int pi = metaObject()->indexOfProperty("{{property}}");
+ if (d->m_propertyOverride->isOverridden(pi)) {
+ emit {{property}}Changed(d->m_propertyOverride->property(pi).value<{{property|return_type}}>());
+ return;
+ }
+ forceUpdate = property("{{property}}DirtyOverride").isValid();
+ if (forceUpdate)
+ setProperty("{{property}}DirtyOverride", {});
+ QVariant v = qVariantFromValue<{{property|return_type}}>({{property}});
+ d->m_propertyOverride->setProperty(pi, v);
+ }
+{% endif %}
+ if (!forceUpdate && d->m_{{property}} == {{property}})
+ return;
+ if ({{class}}BackendInterface *backend = qobject_cast<{{class}}BackendInterface *>(this->backend()))
+ backend->{{property|setter_name}}({{property}}{% if interface.tags.config.zoned %}, zone(){% endif %});
+ else
+ emit {{property}}Changed(d->m_{{property}});
+}
+{% endif %}
+
+{% endfor %}
+
+{%- for operation in interface.operations %}
+/*!
+ \qmlmethod {{interface|qml_type}}::{{operation}}({{operation.parameters|map('parameter_type')|join(', ')}})
+{{ utils.format_comments(operation.comment) }}
+*/
+/*!
+{{ utils.format_comments(operation.comment) }}
+*/
+{{operation|return_type}} {{class}}::{{operation}}({{operation.parameters|map('parameter_type')|join(', ')}}){% if operation.const %} const{% endif %}
+
+{
+ 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_type_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 %}
+{% for signal in interface.signals %}
+{% if module.tags.config.disablePrivateIVI %}{% set Connect = 'QObject::connect' %}
+{% else %}{% set Connect = 'QObjectPrivate::connect' %}{% endif %}
+ {{Connect}}(backend, &{{class}}BackendInterface::{{signal}},
+ d, &{{class}}Private::on{{signal|upperfirst}});
+{% endfor %}
+
+ backend->initialize();
+}
+
+/*! \internal */
+void {{class}}::clearServiceObject()
+{
+ auto d = {{class}}Private::get(this);
+ d->clearToDefaults();
+{% if interface.tags.config.zoned %}
+ QIviAbstractZonedFeature::clearServiceObject();
+{% endif %}
+}
+
+{% if not interface.tags.config.zoned %}
+/*! \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/tools/ivigenerator/templates_frontend/interface.h.tpl b/src/tools/ivigenerator/templates_frontend/interface.h.tpl
new file mode 100644
index 0000000..f5c9d84
--- /dev/null
+++ b/src/tools/ivigenerator/templates_frontend/interface.h.tpl
@@ -0,0 +1,132 @@
+{#
+# 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_{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|getter_name}}{% if not property.readonly and not property.const %} WRITE {{property|setter_name}}{% endif %} NOTIFY {{property}}Changed)
+{% endfor %}
+ Q_CLASSINFO("IviPropertyDomains", "{{ interface.properties|json_domain|replace("\"", "\\\"") }}")
+{% if interface.module.tags.config.validation_info %}
+ Q_CLASSINFO("IviJson", "{{ module|jsonify|replace("\"", "\\\"")|replace("\n", " \\\n") }}")
+{% endif %}
+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|getter_name}}() const;
+{% endfor %}
+
+public Q_SLOTS:
+{% for operation in interface.operations %}
+ {{operation|return_type}} {{operation}}({{operation.parameters|map('parameter_type')|join(', ')}}){% if operation.const %} const{% endif %};
+{% endfor %}
+{% for property in interface.properties %}
+{% if not property.readonly and not property.const %}
+ void {{property|setter_name}}({{property|parameter_type}});
+{% endif %}
+{% 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/tools/ivigenerator/templates_frontend/interface_p.h.tpl b/src/tools/ivigenerator/templates_frontend/interface_p.h.tpl
new file mode 100644
index 0000000..6372e17
--- /dev/null
+++ b/src/tools/ivigenerator/templates_frontend/interface_p.h.tpl
@@ -0,0 +1,131 @@
+{#
+# 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 %}
+{% for signal in interface.signals %}
+{% if interface.tags.config.zoned %}
+ void on{{signal|upperfirst}}({{signal.parameters|map('parameter_type')|join(', ')}}, const QString &zone);
+{% else %}
+ void on{{signal|upperfirst}}({{signal.parameters|map('parameter_type')|join(', ')}});
+{% endif %}
+{% endfor %}
+
+{% if not module.tags.config.disablePrivateIVI %}
+ bool notify(const QByteArray &propertyName, const QVariant &value) override;
+
+ {{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/tools/ivigenerator/templates_frontend/module.cpp.tpl b/src/tools/ivigenerator/templates_frontend/module.cpp.tpl
new file mode 100644
index 0000000..2a2d7b9
--- /dev/null
+++ b/src/tools/ivigenerator/templates_frontend/module.cpp.tpl
@@ -0,0 +1,145 @@
+{#
+# 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 "{{class|lower}}factory.h"
+{% for interface in module.interfaces %}
+#include "{{interface|lower}}.h"
+{% endfor %}
+#include <QQmlEngine>
+#include <QDebug>
+#include <QDataStream>
+
+QT_BEGIN_NAMESPACE
+
+/*! \internal */
+QObject* {{class|lower}}_singletontype_provider(QQmlEngine*, QJSEngine*)
+{
+ return new {{class}}Factory();
+}
+
+/*!
+ \class {{class}}
+ \inmodule {{module}}
+
+ \brief The {{class}} class holds all the enums defined in the {{module}} module.
+*/
+
+{% for enum in module.enums %}
+/*!
+ \enum {{class}}::{{enum}}
+ {{ utils.format_comments(enum.comment) }}
+
+{% for member in enum.members %}
+ \value {{member}}
+ {{ utils.format_comments(member.comment) }}
+{% endfor %}
+*/
+{% endfor %}
+{{class}}::{{class}}(QObject *parent)
+ : QObject(parent)
+{
+}
+
+{% for enum in module.enums %}
+{{class}}::{{enum}} {{class}}::to{{enum}}(quint8 v, bool *ok) {
+ if (ok) {
+ *ok = true;
+ }
+ switch (v) {
+{% for member in enum.members %}
+ case {{member.value}}: return {{member.name}};
+{% endfor %}
+ default:
+ if (ok) {
+ *ok = false;
+ }
+ return {{enum.members|first}};
+ }
+}
+
+{% endfor %}
+/*! \internal */
+void {{class}}::registerTypes()
+{
+{% for enum in module.enums %}
+ qRegisterMetaType<{{class}}::{{enum|flag_type}}>();
+ qRegisterMetaTypeStreamOperators<{{class}}::{{enum|flag_type}}>();
+{% endfor %}
+{% for struct in module.structs %}
+ qRegisterMetaType<{{struct}}>();
+ qRegisterMetaTypeStreamOperators<{{struct}}>();
+{% 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 %}
+}
+{% for enum in module.enums %}
+
+QDataStream &operator<<(QDataStream &out, {{class}}::{{enum|flag_type}} var)
+{
+ out << (quint8)var;
+ return out;
+}
+
+QDataStream &operator>>(QDataStream &in, {{class}}::{{enum|flag_type}} &var)
+{
+ bool ok;
+ quint8 val;
+ in >> val;
+ var = {{class}}::to{{enum}}(val, &ok);
+ if (!ok) {
+ qWarning() << "Received an invalid enum value for type {{class}}::{{enum|flag_type}}, value =" << var;
+ }
+ return in;
+}
+{% endfor %}
+
+QT_END_NAMESPACE
diff --git a/src/tools/ivigenerator/templates_frontend/module.h.tpl b/src/tools/ivigenerator/templates_frontend/module.h.tpl
new file mode 100644
index 0000000..7869ea5
--- /dev/null
+++ b/src/tools/ivigenerator/templates_frontend/module.h.tpl
@@ -0,0 +1,88 @@
+{#
+# 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_{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
+
+{% for struct in module.structs %}
+class {{struct}}Model;
+{% endfor %}
+
+class {{exportsymbol}} {{class}} : public QObject {
+ Q_OBJECT
+public:
+ {{class}}(QObject *parent=nullptr);
+
+{% for enum in module.enums %}
+ enum {{enum}} {
+ {% for member in enum.members %}
+ {{member.name}} = {{member.value}}, {{member.comment}}
+ {% endfor %}
+ };
+{% if enum.is_flag %}
+ Q_DECLARE_FLAGS({{enum|flag_type}}, {{enum}})
+ Q_FLAG({{enum|flag_type}})
+{% else %}
+ Q_ENUM({{enum}})
+{% endif %}
+ static {{enum}} to{{enum}}(quint8 v, bool *ok);
+{% endfor %}
+
+ static void registerTypes();
+ static void registerQmlTypes(const QString& uri, int majorVersion = 1, int minorVersion = 0);
+};
+
+{% for enum in module.enums %}
+QDataStream &operator<<(QDataStream &out, {{class}}::{{enum|flag_type}} var);
+QDataStream &operator>>(QDataStream &in, {{class}}::{{enum|flag_type}} &var);
+{% endfor %}
+
+QT_END_NAMESPACE
+
+#endif // {{oncedefine}}
diff --git a/src/tools/ivigenerator/templates_frontend/module.pri.tpl b/src/tools/ivigenerator/templates_frontend/module.pri.tpl
new file mode 100644
index 0000000..95986c7
--- /dev/null
+++ b/src/tools/ivigenerator/templates_frontend/module.pri.tpl
@@ -0,0 +1,69 @@
+{#
+# 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 %}
+{% for struct in module.structs %}
+ $$PWD/{{struct|lower}}.h \
+ $$PWD/{{struct|lower}}model.h \
+ $$PWD/{{struct|lower}}model_p.h \
+{% endfor %}
+ $$PWD/{{module.module_name|lower}}module.h \
+ $$PWD/{{module.module_name|lower}}modulefactory.h \
+ $$PWD/{{module.module_name|lower}}global.h
+
+SOURCES += \
+{% for interface in module.interfaces %}
+ $$PWD/{{interface|lower}}.cpp \
+ $$PWD/{{interface|lower}}backendinterface.cpp \
+{% endfor %}
+{% for struct in module.structs %}
+ $$PWD/{{struct|lower}}.cpp \
+ $$PWD/{{struct|lower}}model.cpp \
+{% endfor %}
+ $$PWD/{{module.module_name|lower}}module.cpp \
+ $$PWD/{{module.module_name|lower}}modulefactory.cpp
diff --git a/src/tools/ivigenerator/templates_frontend/modulefactory.cpp.tpl b/src/tools/ivigenerator/templates_frontend/modulefactory.cpp.tpl
new file mode 100644
index 0000000..be9c871
--- /dev/null
+++ b/src/tools/ivigenerator/templates_frontend/modulefactory.cpp.tpl
@@ -0,0 +1,81 @@
+{#
+# 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}ModuleFactory'.format(module.module_name) %}
+{% include 'generated_comment.cpp.tpl' %}
+{% import 'utils.tpl' as utils %}
+
+#include "{{class|lower}}.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \class {{class}}
+ \inmodule {{module}}
+
+ \brief The {{class}} class provides factory methods for all structs defined in the {{module}} module.
+*/
+{{class}}::{{class}}(QObject *parent)
+ : {{module.module_name}}Module(parent)
+{
+}
+
+{% for struct in module.structs %}
+/*!
+ \brief Generate default instance of {{struct}}.
+
+ \sa {{struct}}
+*/
+{{struct}} {{class}}::{{struct|lowerfirst}}() const
+{
+ return {{struct}}();
+}
+
+/*!
+ \brief Generate instance of {{struct}} using attributes.
+
+ \sa {{struct}}
+*/
+{{struct}} {{class}}::{{struct|lowerfirst}}({% for field in struct.fields %}{% if not loop.first %}, {% endif %}{{field|return_type}} {{field}}{% endfor %}) const
+{
+ return {{struct}}({% for field in struct.fields %}{% if not loop.first %}, {% endif %}{{field}}{% endfor %});
+}
+
+{% endfor %}
+
+QT_END_NAMESPACE
diff --git a/src/tools/ivigenerator/templates_frontend/modulefactory.h.tpl b/src/tools/ivigenerator/templates_frontend/modulefactory.h.tpl
new file mode 100644
index 0000000..eac3ac3
--- /dev/null
+++ b/src/tools/ivigenerator/templates_frontend/modulefactory.h.tpl
@@ -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
+#}
+{% set exportsymbol = 'Q_{0}_EXPORT'.format(module.module_name|upper) %}
+{% set class = '{0}ModuleFactory'.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}}module.h"
+#include <QObject>
+
+{% for struct in module.structs %}
+#include "{{struct|lower}}.h"
+{% endfor %}
+
+QT_BEGIN_NAMESPACE
+
+class {{exportsymbol}} {{class}} : public {{module.module_name}}Module {
+ Q_OBJECT
+public:
+ {{class}}(QObject *parent = nullptr);
+
+{% for struct in module.structs %}
+ Q_INVOKABLE {{struct}} {{struct|lowerfirst}}() const;
+ Q_INVOKABLE {{struct}} {{struct|lowerfirst}}({% for field in struct.fields %}{% if not loop.first %}, {% endif %}{{field|return_type}} {{field}}{% endfor %}) const;
+{% endfor %}
+};
+
+QT_END_NAMESPACE
+
+#endif // {{oncedefine}}
diff --git a/src/tools/ivigenerator/templates_frontend/struct.cpp.tpl b/src/tools/ivigenerator/templates_frontend/struct.cpp.tpl
new file mode 100644
index 0000000..ca0c7f8
--- /dev/null
+++ b/src/tools/ivigenerator/templates_frontend/struct.cpp.tpl
@@ -0,0 +1,127 @@
+{#
+# 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
+#}
+{% set class = '{0}'.format(struct) %}
+{% include 'generated_comment.cpp.tpl' %}
+{% import 'utils.tpl' as utils %}
+
+#include "{{class|lower}}.h"
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ \class {{struct}}
+ \inmodule {{module}}
+{{ utils.format_comments(struct.comment) }}
+*/
+
+{{class}}::{{class}}()
+{% for field in struct.fields %}
+ {% if loop.first %}:{% else %},{% endif %} m_{{field}}({{field|default_type_value}})
+{% endfor %}
+{
+}
+
+{{class}}::{{class}}({% for field in struct.fields %}{% if not loop.first %}, {% endif %}{{field|return_type}} {{field}}{% endfor %})
+{% for field in struct.fields %}
+ {% if loop.first %}:{% else %},{% endif %} m_{{field}}({{field}})
+{% endfor %}
+{
+}
+
+/*! \internal */
+{{class}}::~{{class}}()
+{
+}
+
+{% for field in struct.fields %}
+
+/*!
+ \property {{class}}::{{field}}
+{{ utils.format_comments(field.comment) }}
+{% if field.const %}
+ \note This property is constant and the value will not change once an instance has been created.
+{% endif %}
+*/
+{{field|return_type}} {{class}}::{{field}}() const
+{
+ return m_{{field}};
+}
+{% if not field.readonly and not field.const %}
+
+void {{class}}::set{{field|upperfirst}}({{ field|parameter_type }})
+{
+ m_{{field}} = {{field}};
+}
+{% endif %}
+
+{% endfor %}
+
+bool operator==(const {{class}} &left, const {{class}} &right) Q_DECL_NOTHROW
+{
+ return (
+{% for field in struct.fields %}
+ left.{{field}}() == right.{{field}}() {% if not loop.last %}&&{% endif %}
+
+{% endfor %}
+ );
+}
+
+bool operator!=(const {{class}} &left, const {{class}} &right) Q_DECL_NOTHROW
+{
+ return !(left == right);
+}
+
+QDataStream &operator<<(QDataStream &stream, const {{class}} &obj)
+{
+{% for field in struct.fields %}
+ stream << obj.{{field}}();
+{% endfor %}
+ return stream;
+}
+
+QDataStream &operator>>(QDataStream &stream, {{class}} &obj)
+{
+{% for field in struct.fields %}
+ stream >> obj.m_{{field}};
+{% endfor %}
+ return stream;
+}
+
+QT_END_NAMESPACE
diff --git a/src/tools/ivigenerator/templates_frontend/struct.h.tpl b/src/tools/ivigenerator/templates_frontend/struct.h.tpl
new file mode 100644
index 0000000..0438a87
--- /dev/null
+++ b/src/tools/ivigenerator/templates_frontend/struct.h.tpl
@@ -0,0 +1,92 @@
+{#
+# 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
+#}
+{% set class = '{0}'.format(struct) %}
+{% set oncedefine = '{0}_{1}_H_'.format(module.module_name|upper, class|upper) %}
+{% set exportsymbol = 'Q_{0}_EXPORT'.format(module.module_name|upper) %}
+{% include 'generated_comment.cpp.tpl' %}
+
+#ifndef {{oncedefine}}
+#define {{oncedefine}}
+
+#include "{{module.module_name|lower}}module.h"
+#include <QObject>
+#include <QDataStream>
+
+QT_BEGIN_NAMESPACE
+
+class {{exportsymbol}} {{class}}
+{
+ Q_GADGET
+{% for field in struct.fields %}
+ Q_PROPERTY({{field|return_type}} {{field}} READ {{field}}{% if not field.readonly and not field.const %} WRITE set{{field|upperfirst}}{% endif %})
+{% endfor %}
+ Q_CLASSINFO("IviPropertyDomains", "{{ struct.fields|json_domain|replace("\"", "\\\"") }}")
+public:
+ {{class}}();
+ {{class}}({% for field in struct.fields %}{% if not loop.first %}, {% endif %}{{field|return_type}} {{field}}{% endfor %});
+ ~{{class}}();
+
+{% for field in struct.fields %}
+ {{field|return_type}} {{field}}() const;
+{% if not field.readonly and not field.const %}
+ void set{{field|upperfirst}}({{field|parameter_type}});
+{% endif %}
+{% endfor %}
+
+
+private:
+{% for field in struct.fields %}
+ {{field|return_type}} m_{{field}};
+{% endfor %}
+
+ friend QDataStream &operator>>(QDataStream &stream, {{class}} &obj);
+};
+
+bool operator==(const {{class}} &left, const {{class}} &right) Q_DECL_NOTHROW;
+bool operator!=(const {{class}} &left, const {{class}} &right) Q_DECL_NOTHROW;
+
+QDataStream &operator<<(QDataStream &stream, const {{class}} &obj);
+QDataStream &operator>>(QDataStream &stream, {{class}} &obj);
+
+QT_END_NAMESPACE
+
+Q_DECLARE_METATYPE({{class}})
+
+#endif // {{oncedefine}}
diff --git a/src/tools/ivigenerator/templates_frontend/structmodel.cpp.tpl b/src/tools/ivigenerator/templates_frontend/structmodel.cpp.tpl
new file mode 100644
index 0000000..ebe170d
--- /dev/null
+++ b/src/tools/ivigenerator/templates_frontend/structmodel.cpp.tpl
@@ -0,0 +1,223 @@
+{#
+# 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
+#}
+{% set class = '{0}Model'.format(struct) %}
+{% include 'generated_comment.cpp.tpl' %}
+{% import 'utils.tpl' as utils %}
+
+#include "{{class|lower}}.h"
+#include "{{class|lower}}_p.h"
+
+QT_BEGIN_NAMESPACE
+
+/*! \internal */
+{{class}}Private::{{class}}Private()
+ : QAbstractItemModelPrivate()
+{
+}
+
+/*! \internal */
+{{class}}Private::~{{class}}Private()
+{
+}
+
+
+{{class}}::{{class}}(QObject* parent)
+ : QAbstractListModel(parent)
+{
+}
+
+/*! \internal */
+{{class}}::~{{class}}()
+{
+}
+
+QHash<int, QByteArray> {{class}}::roleNames() const
+{
+ auto res = QAbstractItemModel::roleNames();
+{% for field in struct.fields %}
+ res.insert({{field|upperfirst}}, "{{field}}");
+{% endfor %}
+ return res;
+}
+
+int {{class}}::count() const
+{
+ Q_D(const {{class}});
+
+ return d->m_data.count();
+}
+
+int {{class}}::rowCount(const QModelIndex &parent) const
+{
+ Q_D(const {{class}});
+
+ return parent.isValid() ? 0 : d->m_data.count();
+}
+
+QVariant {{class}}::data(const QModelIndex &index, int role) const
+{
+ Q_D(const {{class}});
+ if (index.row() < 0 || index.row() >= d->m_data.count())
+ return {};
+
+ const {{struct}} &data = d->m_data.at(index.row());
+ switch(role) {
+{% for field in struct.fields %}
+ case {{field|upperfirst}}: return qVariantFromValue<{{field|return_type}}>(data.{{field}}());
+{% endfor %}
+ default: break;
+ }
+
+ return {};
+}
+
+bool {{class}}::setData(const QModelIndex &index, const QVariant &value, int role)
+{
+ Q_D({{class}});
+ if (index.row() < 0 || index.row() >= d->m_data.count())
+ return false;
+ {{struct}} &data = d->m_data[index.row()];
+ switch(role) {
+{% for field in struct.fields %}
+ case {{field|upperfirst}}:
+{% if field.readonly or field.const %}
+ return false;
+{% else %}
+ data.set{{field|upperfirst}}(value.value<{{field|return_type}}>());
+ break;
+{% endif %}
+{% endfor %}
+ default: return false;
+ }
+ Q_EMIT dataChanged(index, index, QVector<int>() << role);
+ return true;
+}
+
+bool {{class}}::insertRows(int row, int count, const QModelIndex &parent)
+{
+ Q_D({{class}});
+ if (row < 0 || row >= d->m_data.size() || count < 0 || parent.isValid())
+ return false;
+ beginInsertRows(parent, row, row + count - 1);
+ d->m_data.insert(row, count, {});
+ endInsertRows();
+ Q_EMIT countChanged(d->m_data.count());
+ return true;
+}
+
+bool {{class}}::removeRows(int row, int count, const QModelIndex &parent)
+{
+ Q_D({{class}});
+ if (row < 0 || row >= d->m_data.size() || count < 0 || parent.isValid())
+ return false;
+ beginInsertRows(parent, row, row + count - 1);
+ while (count) {
+ d->m_data.remove(row);
+ --count;
+ }
+ endInsertRows();
+ Q_EMIT countChanged(d->m_data.count());
+ return true;
+}
+
+bool {{class}}::moveRows(const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild)
+{
+ Q_D({{class}});
+ if (sourceRow < 0 || sourceRow >= d->m_data.size() || count < 0 || sourceParent.isValid())
+ return false;
+ if (destinationChild < 0 || destinationChild > d->m_data.size() || destinationParent.isValid())
+ return false;
+ if (!beginMoveRows(sourceParent, sourceRow, sourceRow + count - 1, destinationParent, destinationChild))
+ return false;
+ QVector<{{struct}}> data;
+ for (int i = 0; i < count; i++) {
+ data << d->m_data.at(sourceRow);
+ d->m_data.remove(sourceRow);
+ }
+ if (destinationChild >= d->m_data.size())
+ d->m_data << data;
+ else {
+ d->m_data.insert(destinationChild, count, {});
+ for (int i = 0; i < count; i++)
+ d->m_data[destinationChild + 1] = data[i];
+ }
+ endMoveRows();
+ return true;
+}
+
+{{struct}} {{class}}::at(int index) const
+{
+ Q_D(const {{class}});
+ if (index < 0 || index >= d->m_data.count())
+ return {};
+ return d->m_data.at(index);
+}
+
+void {{class}}::append(const {{struct}}& data)
+{
+ Q_D({{class}});
+ beginInsertRows({}, d->m_data.count(), d->m_data.count());
+ d->m_data << data;
+ endInsertRows();
+ Q_EMIT countChanged(d->m_data.count());
+}
+
+{{struct}} {{class}}::append({% for field in struct.fields %}{% if not loop.first %}, {% endif %}{{field|return_type}} {{field}}{% endfor %})
+{
+ auto data = {{struct}}({% for field in struct.fields %}{% if not loop.first %}, {% endif %}{{field}}{% endfor %});
+ append(data);
+ return data;
+}
+
+void {{class}}::remove(int index)
+{
+ Q_D({{class}});
+ if (index < 0 || index >= d->m_data.count()) {
+ beginRemoveRows({}, index, index);
+ d->m_data.remove(index);
+ endRemoveRows();
+ Q_EMIT countChanged(d->m_data.count());
+ }
+}
+
+
+QT_END_NAMESPACE
+
+#include "moc_{{class|lower}}.cpp"
diff --git a/src/tools/ivigenerator/templates_frontend/structmodel.h.tpl b/src/tools/ivigenerator/templates_frontend/structmodel.h.tpl
new file mode 100644
index 0000000..8895df0
--- /dev/null
+++ b/src/tools/ivigenerator/templates_frontend/structmodel.h.tpl
@@ -0,0 +1,95 @@
+{#
+# 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
+#}
+{% set class = '{0}Model'.format(struct) %}
+{% set oncedefine = '{0}_{1}_H_'.format(module.module_name|upper, class|upper) %}
+{% set exportsymbol = 'Q_{0}_EXPORT'.format(module.module_name|upper) %}
+{% include 'generated_comment.cpp.tpl' %}
+
+#ifndef {{oncedefine}}
+#define {{oncedefine}}
+
+#include "{{struct|lower}}.h"
+#include <QAbstractListModel>
+
+QT_BEGIN_NAMESPACE
+
+class {{class}}Private;
+
+class {{exportsymbol}} {{class}} : public QAbstractListModel
+{
+ Q_OBJECT
+ Q_PROPERTY(int count READ count NOTIFY countChanged)
+public:
+ enum Roles {
+ {% for field in struct.fields %}
+ {{field|upperfirst}}{% if loop.first %} = Qt::UserRole{% endif %},
+ {% endfor %}
+ };
+ Q_ENUM(Roles);
+
+ explicit {{class}}(QObject *parent = nullptr);
+ ~{{class}}();
+
+ int count() const;
+
+ QHash<int, QByteArray> roleNames() const override;
+ int rowCount(const QModelIndex& parent) const override;
+ QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
+ bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::DisplayRole) override;
+ bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
+ bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
+ bool moveRows(const QModelIndex &sourceParent, int sourceRow, int count, const QModelIndex &destinationParent, int destinationChild) override;
+
+ Q_INVOKABLE {{struct}} at(int index) const;
+ Q_INVOKABLE void append(const {{struct}}& data);
+ Q_INVOKABLE {{struct}} append({% for field in struct.fields %}{% if not loop.first %}, {% endif %}{{field|return_type}} {{field}}{% endfor %});
+ Q_INVOKABLE void remove(int index);
+
+Q_SIGNALS:
+ void countChanged(int count);
+
+private:
+ Q_DECLARE_PRIVATE({{class}})
+};
+
+QT_END_NAMESPACE
+
+
+#endif // {{oncedefine}}
diff --git a/src/tools/ivigenerator/templates_frontend/structmodel_p.h.tpl b/src/tools/ivigenerator/templates_frontend/structmodel_p.h.tpl
new file mode 100644
index 0000000..1852e25
--- /dev/null
+++ b/src/tools/ivigenerator/templates_frontend/structmodel_p.h.tpl
@@ -0,0 +1,79 @@
+{#
+# 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}Model'.format(struct) %}
+{% 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 "{{struct|lower}}.h"
+
+#include <QtCore/private/qabstractitemmodel_p.h>
+#include <QVector>
+
+QT_BEGIN_NAMESPACE
+
+class {{class}};
+
+class {{class}}Private : public QAbstractItemModelPrivate
+{
+public:
+ {{class}}Private();
+ ~{{class}}Private();
+
+ QVector<{{struct}}> m_data;
+
+ Q_DECLARE_PUBLIC({{class}})
+};
+
+QT_END_NAMESPACE
+
+#endif // {{oncedefine}}
diff --git a/src/tools/ivigenerator/templates_frontend/utils.tpl b/src/tools/ivigenerator/templates_frontend/utils.tpl
new file mode 100644
index 0000000..e5cd338
--- /dev/null
+++ b/src/tools/ivigenerator/templates_frontend/utils.tpl
@@ -0,0 +1,9 @@
+{% macro format_comments(comments) -%}
+{% with doc = comments|parse_doc -%}
+{% if doc.brief %} \brief {{doc.brief|join(' ')| wordwrap(width=100, wrapstring='\n ')}}
+{% endif %}
+
+{% if doc.description %}
+ {{doc.description|join(' ')| wordwrap(width=100, wrapstring='\n ')}}{% endif %}
+{% endwith -%}
+{% endmacro -%}
diff --git a/src/tools/ivigenerator/templates_generation_validator.yaml b/src/tools/ivigenerator/templates_generation_validator.yaml
new file mode 100644
index 0000000..aaf598c
--- /dev/null
+++ b/src/tools/ivigenerator/templates_generation_validator.yaml
@@ -0,0 +1,19 @@
+generate_rules:
+ module_rules:
+ - dest_file: "main.cpp"
+ template_file: "main.cpp.tpl"
+ - dest_file: "main.qml"
+ template_file: "main.qml.tpl"
+ - dest_file: "qml.qrc"
+ template_file: "qml.qrc.tpl"
+ - dest_file: "{{srcBase|lower}}.pri"
+ template_file: "ui.pri.tpl"
+ - dest_file: "generationstatusitem.cpp"
+ template_file: "generationstatusitem.cpp.tpl"
+ - dest_file: "generationstatusitem.h"
+ template_file: "generationstatusitem.h.tpl"
+ - dest_file: "validationstatus.cpp"
+ template_file: "validationstatus.cpp.tpl"
+ - dest_file: "validationstatus.h"
+ template_file: "validationstatus.h.tpl"
+ interface_rules:
diff --git a/src/tools/ivigenerator/templates_generation_validator/generated_comment.cpp.tpl b/src/tools/ivigenerator/templates_generation_validator/generated_comment.cpp.tpl
new file mode 100644
index 0000000..b6c2e74
--- /dev/null
+++ b/src/tools/ivigenerator/templates_generation_validator/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/tools/ivigenerator/templates_generation_validator/generationstatusitem.cpp.tpl b/src/tools/ivigenerator/templates_generation_validator/generationstatusitem.cpp.tpl
new file mode 100644
index 0000000..624f6db
--- /dev/null
+++ b/src/tools/ivigenerator/templates_generation_validator/generationstatusitem.cpp.tpl
@@ -0,0 +1,59 @@
+{#
+# 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" %}
+#include "generationstatusitem.h"
+#include "validationstatus.h"
+{% for iface in module.interfaces %}
+#include "{{iface|lower}}.h"
+{% endfor %}
+
+
+GeneratorValidationStatus::GeneratorValidationStatus(QObject *parent)
+: QObject(parent)
+, m_errorMessage("All data has been successfully generated")
+{
+ QString error;
+{% for iface in module.interfaces %}
+ {{iface}} {{iface|lowerfirst}};
+ checkGeneration(error, {{iface|lowerfirst}});
+{% endfor %}
+ if (!error.isEmpty())
+ m_errorMessage = error;
+}
diff --git a/src/tools/ivigenerator/templates_generation_validator/generationstatusitem.h.tpl b/src/tools/ivigenerator/templates_generation_validator/generationstatusitem.h.tpl
new file mode 100644
index 0000000..160022c
--- /dev/null
+++ b/src/tools/ivigenerator/templates_generation_validator/generationstatusitem.h.tpl
@@ -0,0 +1,56 @@
+{#
+# 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" %}
+#include <QObject>
+
+
+class GeneratorValidationStatus : public QObject {
+ Q_OBJECT
+ Q_PROPERTY(QString errorMessage READ errorMessage NOTIFY errorMessageChanged)
+public:
+ explicit GeneratorValidationStatus(QObject *parent = nullptr);
+ ~GeneratorValidationStatus() = default;
+
+ QString errorMessage() const { return m_errorMessage;}
+Q_SIGNALS:
+ void errorMessageChanged(const QString &errorMessage);
+private:
+ QString m_errorMessage;
+};
diff --git a/src/tools/ivigenerator/templates_generation_validator/main.cpp.tpl b/src/tools/ivigenerator/templates_generation_validator/main.cpp.tpl
new file mode 100644
index 0000000..9d12223
--- /dev/null
+++ b/src/tools/ivigenerator/templates_generation_validator/main.cpp.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" %}
+
+#include <QGuiApplication>
+#include <QQmlApplicationEngine>
+#include "generationstatusitem.h"
+#include "validationstatus.h"
+
+#include <{{module.module_name|lower}}module.h>
+{% for iface in module.interfaces %}
+#include "{{iface|lower}}.h"
+{% endfor %}
+
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+
+ QString error;
+{% for iface in module.interfaces %}
+ {{iface|upperfirst}} {{iface|lowerfirst}};
+ checkGeneration(error, {{iface|lowerfirst}});
+{% endfor %}
+
+
+ qmlRegisterType<GeneratorValidationStatus>("org.example.Example", 1, 0, "ValidationStatus");
+ {{module.module_name}}Module::registerTypes();
+{#% for iface in module.interfaces %#}
+ {{module.module_name}}Module::registerQmlTypes(QLatin1String("{{module.module_name}}"), 1, 0);
+{#% endfor %#}
+ QQmlApplicationEngine engine;
+ engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
+
+ return app.exec();
+}
diff --git a/src/tools/ivigenerator/templates_generation_validator/main.qml.tpl b/src/tools/ivigenerator/templates_generation_validator/main.qml.tpl
new file mode 100644
index 0000000..031fdcd
--- /dev/null
+++ b/src/tools/ivigenerator/templates_generation_validator/main.qml.tpl
@@ -0,0 +1,99 @@
+{#
+# 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 QtQuick 2.7
+import QtQuick.Window 2.2
+import QtQuick.Controls 2.1
+import org.example.Example 1.0
+import {{module.module_name}} 1.0
+
+Window {
+ visible: true
+ width: 640
+ height: 480
+ title: qsTr("QtIVI {{module.module_name}}")
+
+ ValidationStatus {
+ id: validationStatus
+ }
+
+ Column {
+ anchors.fill: parent
+ anchors.margins: 5
+
+ Text {
+ text: validationStatus.errorMessage
+ }
+
+{% for iface in module.interfaces %}
+ {{iface|qml_type}} {
+ id: {{iface|lowerfirst}}
+ }
+
+ Text {
+ text: "{{iface}}"
+ }
+
+ ToolSeparator {
+ orientation: Qt.Horizontal
+ }
+
+{% for property in iface.properties %}
+ Text {
+ text: "{{property|upperfirst}}: " + {{iface|lowerfirst}}.{{property}}
+ }
+{% endfor %}
+
+{% for signal in iface.signals %}
+ Connections {
+ target: {{iface|lowerfirst}}
+ on{{signal|upperfirst}}: {
+ print("{{signal}}")
+{% for parameter in signal.parameters %}
+ print({{parameter}})
+{% endfor %}
+ }
+ }
+{% endfor %}
+
+{% endfor %}
+ }
+}
diff --git a/src/tools/ivigenerator/templates_generation_validator/qml.qrc.tpl b/src/tools/ivigenerator/templates_generation_validator/qml.qrc.tpl
new file mode 100644
index 0000000..ea4cd6a
--- /dev/null
+++ b/src/tools/ivigenerator/templates_generation_validator/qml.qrc.tpl
@@ -0,0 +1,44 @@
+{#
+# 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
+#}
+<RCC>
+ <qresource prefix="/">
+ <file>main.qml</file>
+ </qresource>
+</RCC>
diff --git a/src/tools/ivigenerator/templates_generation_validator/ui.pri.tpl b/src/tools/ivigenerator/templates_generation_validator/ui.pri.tpl
new file mode 100644
index 0000000..d8a2a71
--- /dev/null
+++ b/src/tools/ivigenerator/templates_generation_validator/ui.pri.tpl
@@ -0,0 +1,15 @@
+#############################################################################
+## This is an auto-generated file.
+## Do not edit! All changes made to it will be lost.
+#############################################################################
+
+SOURCES += \
+ $$PWD/main.cpp \
+ $$PWD/validationstatus.cpp \
+ $$PWD/generationstatusitem.cpp
+
+HEADERS += \
+ $$PWD/validationstatus.h \
+ $$PWD/generationstatusitem.h
+
+RESOURCES += $$PWD/qml.qrc
diff --git a/src/tools/ivigenerator/templates_generation_validator/validationstatus.cpp.tpl b/src/tools/ivigenerator/templates_generation_validator/validationstatus.cpp.tpl
new file mode 100644
index 0000000..dcf908c
--- /dev/null
+++ b/src/tools/ivigenerator/templates_generation_validator/validationstatus.cpp.tpl
@@ -0,0 +1,193 @@
+{#
+# 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" %}
+
+#include "validationstatus.h"
+
+#include <QJsonDocument>
+#include <QJsonObject>
+#include <QJsonArray>
+#include <QDebug>
+#include <QObject>
+#include <QMetaProperty>
+
+QString idlToQtTypeName(const QString& idlTypeName)
+{
+ QString result = idlTypeName;
+ if (idlTypeName == QLatin1String("string"))
+ result = "QString";
+ return result;
+}
+
+bool checkProperty(const QMetaProperty& metaProp, const QJsonValue& jValProp, QString& errorMessage)
+{
+ bool result = true;
+ QJsonObject jObjProp = jValProp.toObject();
+ if (metaProp.name() != jObjProp[QLatin1String("name")].toString())
+ return false;
+ // Anyway it should be readable
+ if (!metaProp.isReadable()) {
+ errorMessage += QString("Property %1 is not readable\n").arg(metaProp.name());
+ return false;
+ }
+ // Writable only if not readonly
+ if (metaProp.isWritable() && jObjProp[QLatin1String("readonly")].toBool()) {
+ errorMessage += QString("Property %1 is writable whereas it's defined as read-only\n").arg(metaProp.name());
+ return false;
+ }
+ // Check the property type as well
+ QString metaTypeName = metaProp.typeName();
+ QString propTypeName = idlToQtTypeName(jObjProp[QLatin1String("type")].toObject()[QLatin1String("name")].toString());
+ if (metaTypeName != propTypeName)
+ return false;
+ return result;
+}
+
+bool checkMethod(const QMetaMethod& metaOp, const QJsonValue& jValOp, QString& errorMessage)
+{
+ QJsonObject jObjOp = jValOp.toObject();
+ if (metaOp.name() != jObjOp[QLatin1String("name")].toString())
+ return false;
+
+ // Check the method parameter types and return type as well
+ QString metaReturnType = metaOp.typeName();
+ QString opReturnType = jObjOp[QLatin1String("type")].toObject()[QLatin1String("name")].toString();
+ opReturnType = idlToQtTypeName(opReturnType);
+ if (metaReturnType != opReturnType) {
+ return false;
+ }
+ QJsonValue jValParams = jObjOp[QLatin1String("parameters")];
+ Q_ASSERT(jValParams.isNull() || jValParams.isArray());
+ QJsonArray jArrParams = jValParams.toArray();
+ if (jArrParams.size() != metaOp.parameterCount()) {
+ errorMessage += QString("Amount of parameters in method %1 differs from its IDL definition (%2 vs %3)\n")
+ .arg(metaOp.name().data())
+ .arg(metaOp.parameterCount())
+ .arg(jArrParams.size());
+ return false;
+ }
+
+ for (int i = 0; i < metaOp.parameterCount(); ++i) {
+ QString metaParamType = jArrParams[i].toObject()[QLatin1String("type")].toObject()[QLatin1String("name")].toString();
+ metaParamType = idlToQtTypeName(metaParamType);
+ QString genParamType = metaOp.parameterTypes().at(i);
+ if (genParamType != metaParamType) {
+ errorMessage += QString("Method %1: %2-th parameter type differs from IDL definition (%3 vs %4)\n")
+ .arg(metaOp.name().data())
+ .arg(i)
+ .arg(genParamType)
+ .arg(metaParamType);
+ return false;
+ }
+ }
+ return true;
+}
+
+bool checkGeneration(QString& errorMessage, QObject& obj)
+{
+ bool result = true;
+ auto* metaObj = obj.metaObject();
+ int classInfoCount = metaObj->classInfoCount();
+ QMetaClassInfo metaClassInfo;
+ const QString META_INFO_NAME = QLatin1String("IviJson");
+ for (int index = 0; index < classInfoCount; ++index) {
+ metaClassInfo = metaObj->classInfo(index);
+ if (metaClassInfo.name() == META_INFO_NAME)
+ break;
+ }
+ if (metaClassInfo.name() != META_INFO_NAME) {
+ return false;
+ }
+ QJsonObject metaDoc(QJsonDocument::fromJson(metaClassInfo.value()).object());
+ auto jVal = metaDoc[QLatin1String("interfaces")];
+ if (jVal.isNull() || !jVal.isArray()) {
+ errorMessage += QString("Interfaces list is empty in the class meta info");
+ return false;
+ }
+
+
+ QJsonArray jArrInterfaces = jVal.toArray();
+ QJsonObject jInterface;
+ for (auto jValInterface : jArrInterfaces) {
+ Q_ASSERT(jValInterface.isObject());
+ if (jValInterface.toObject()[QLatin1String("name")] == QLatin1String(metaObj->className())) {
+ jInterface = jValInterface.toObject();
+ break;
+ }
+ }
+ if (jInterface.empty()) {
+ errorMessage += QString("Interface %1 is not implemented!\n").arg(metaObj->className());
+ return false;
+ }
+
+ // Check the properties
+ QJsonValue jValProps = jInterface[QLatin1String("properties")];
+ auto jArrProps = jValProps.toArray();
+ for (auto jValProp : jArrProps) {
+ auto propName = jValProp.toObject()[QLatin1String("name")].toString();
+ int propIdx = metaObj->indexOfProperty(propName.toLatin1().data());
+ if (propIdx == -1) {
+ errorMessage += QString("Property %1 has been not generated by the generator!\n").arg(propName);
+ result = false;
+ } else {
+ result &= checkProperty(metaObj->property(propIdx), jValProp, errorMessage);
+ }
+ }
+
+ // Check the methods
+ QJsonValue jValOps = jInterface[QLatin1String("operations")];
+ auto jArrOps = jValOps.toArray();
+ for (auto jValOp : jArrOps) {
+ bool opFound = false;
+ QString opName = jValOp.toObject()[QLatin1String("name")].toString();
+ for (int i = 0; i < metaObj->methodCount(); ++i) {
+ if (metaObj->method(i).name() == opName) {
+ opFound = true;
+ result &= checkMethod(metaObj->method(i), jValOp, errorMessage);
+ }
+ }
+ if (!opFound) {
+ errorMessage += QString("Method %1 has been not generated by the generator!").arg(opName);
+ result = false;
+ }
+ }
+
+ return result;
+}
diff --git a/src/tools/ivigenerator/templates_generation_validator/validationstatus.h.tpl b/src/tools/ivigenerator/templates_generation_validator/validationstatus.h.tpl
new file mode 100644
index 0000000..e080c56
--- /dev/null
+++ b/src/tools/ivigenerator/templates_generation_validator/validationstatus.h.tpl
@@ -0,0 +1,50 @@
+{#
+# 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" %}
+
+#ifndef VALIDATIONSTATUS_H_
+#define VALIDATIONSTATUS_H_
+
+#include <QObject>
+#include <QString>
+
+bool checkGeneration(QString& errorMessage, QObject& obj);
+
+#endif // VALIDATIONSTATUS_H_
diff --git a/src/tools/vehiclefunctions-controller/vehiclefunctions-controller.pro b/src/tools/vehiclefunctions-controller/vehiclefunctions-controller.pro
new file mode 100644
index 0000000..08a1545
--- /dev/null
+++ b/src/tools/vehiclefunctions-controller/vehiclefunctions-controller.pro
@@ -0,0 +1,10 @@
+TARGET = ivivehiclefunctions-controller
+TEMPLATE = app
+CONFIG += ivigenerator
+
+QT += core quick
+
+load(qt_tool)
+
+QFACE_FORMAT = control_panel
+QFACE_SOURCES = ../../ivivehiclefunctions/ivivehiclefunctions.qface
diff --git a/sync.profile b/sync.profile
index c150e63..dd46ea2 100644
--- a/sync.profile
+++ b/sync.profile
@@ -1,6 +1,6 @@
%modules = ( # path to module name map
"QtIviCore" => "$basedir/src/ivicore",
- "QtIviVehicleFunctions" => "$basedir/src/ivivehiclefunctions",
+ "QtIviVehicleFunctions" => "$basedir/src/ivivehiclefunctions;$out_basedir/src/ivivehiclefunctions",
"QtIviMedia" => "$basedir/src/ivimedia",
"QtGeniviExtras" => "$basedir/src/geniviextras",
);
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
index 561f32b..bf3f50d 100644
--- a/tests/auto/auto.pro
+++ b/tests/auto/auto.pro
@@ -1,5 +1,5 @@
TEMPLATE = subdirs
qtHaveModule(ivicore): SUBDIRS += core
-qtHaveModule(ivivehiclefunctions): SUBDIRS += vehiclefunctions
+#qtHaveModule(ivivehiclefunctions): SUBDIRS += vehiclefunctions
qtHaveModule(geniviextras): SUBDIRS += dlt
diff --git a/tests/auto/core/core.pro b/tests/auto/core/core.pro
index 6cefc23..dcd6bee 100644
--- a/tests/auto/core/core.pro
+++ b/tests/auto/core/core.pro
@@ -6,3 +6,6 @@ SUBDIRS = servicemanagertest \
qiviabstractfeature \
queryparser \
qivisearchandbrowsemodel \
+
+QT_FOR_CONFIG += ivicore
+qtConfig(ivigenerator): SUBDIRS += ivigenerator
diff --git a/tests/auto/core/ivigenerator/autotest.sh b/tests/auto/core/ivigenerator/autotest.sh
new file mode 100755
index 0000000..9d92ae7
--- /dev/null
+++ b/tests/auto/core/ivigenerator/autotest.sh
@@ -0,0 +1,157 @@
+#!/bin/bash -e
+
+# 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
+
+# A die helper function
+# $1: The exit message
+# $2: The exit code
+die() {
+ echo "${1}"
+ exit ${2}
+}
+
+checkFileCount() {
+ if [ "$#" -eq 3 ]; then
+ FILECOUNT=$(find "." -type f -name "${3}" | wc -l)
+ else
+ FILECOUNT=$(find "." -type f | wc -l)
+ fi
+ echo "${1} generated: " ${FILECOUNT}
+ test ${FILECOUNT} -eq ${2} || die "Not a correct number of files (${2} expected)" 1
+}
+
+QFACE_INIT_SCRIPT="src/tools/ivigenerator/qtivi_qface_virtualenv/bin/activate"
+# Load virtualenv where qface is installed to
+if [ -f $QFACE_INIT_SCRIPT ]; then
+ . $QFACE_INIT_SCRIPT
+else
+ echo "Warning: Can't find qface virtualenv activate script: $QFACE_INIT_SCRIPT"
+fi
+
+WORKDIR=$(dirname $0)
+GENERATOR=${WORKDIR}/../../../../src/tools/ivigenerator/generate.py
+TEST_FILES=(org.example.echo) # org.example.echo.noprivate)
+test -x ${GENERATOR} || die "${GENERATOR} does not exists or can't be executed" 1
+for idlfile in "${TEST_FILES[@]}"
+do
+ echo "Testing '$idlfile' ================"
+ idldir=$(echo $idlfile | tr . -)
+ out_dir=${WORKDIR}/projects/${idldir}
+ /bin/rm -rf ${out_dir}/frontend/*.{h,cpp,pri}
+ /bin/rm -rf ${out_dir}/backend_simulator/*.{h,cpp,pri}
+ ${GENERATOR} --format=frontend --validation_info=True ${WORKDIR}/${idlfile}.qface ${out_dir}/frontend || die "Generator failed" 1
+ ${GENERATOR} --format=backend_simulator ${WORKDIR}/${idlfile}.qface ${out_dir}/backend_simulator || die "Generator for backend failed" 1
+ ${GENERATOR} --format=generation_validator ${WORKDIR}/${idlfile}.qface ${out_dir}/ui || die "Generator for validator failed" 1
+ test -d build/${idldir} && /bin/rm -rf build/${idldir}
+ test -d build/${idldir} && die "Cannot remove existing build folder" 1
+ mkdir -p build/${idldir} || die "Cannot create build folder" 1
+ pushd build/${idldir}
+ project_dir=../../projects/${idldir}
+ qmake ${project_dir}/${idldir}-project.pro || die "Failed to run qmake" 1
+ make || die "Failed to build" 1
+if [[ "$OSTYPE" == "linux-gnu" ]]; then
+ OLD_LD_PATH=$LD_LIBRARY_PATH
+ export LD_LIBRARY_PATH=./out:$LD_LIBRARY_PATH
+ #./out/ui || die "Test failed"
+ export LD_LIBRARY_PATH=${OLD_LD_PATH}
+
+elif [[ "$OSTYPE" == "darwin"* ]]; then
+ OLD_DYLD_PATH=$DYLD_LIBRARY_PATH
+ export DYLD_LIBRARY_PATH=./out:$DYLD_LIBRARY_PATH
+ #./out/ui.app/Contents/MacOS/ui || die "Test failed"
+ export DYLD_LIBRARY_PATH=${OLD_DYLD_PATH}
+fi
+
+ popd
+ echo "Done '$idlfile' ================"
+done
+
+for idlfile in "${TEST_FILES[@]}"
+do
+ echo "Testing '$idlfile' backend_simulator ================"
+ idldir=$(echo $idlfile | tr . -)
+ bdir=${WORKDIR}/projects/${idldir}/backend_simulator
+ /bin/rm -rf ${bdir}/*.{h,cpp,pri}
+ mkdir -p ${bdir}
+
+ ${GENERATOR} --format=backend_simulator ${WORKDIR}/${idlfile}.qface ${bdir} || die "Generator failed" 1
+
+ pushd ${bdir}
+ checkFileCount "Total files" 9
+ checkFileCount "Plugins" 2 "*plugin.*"
+ checkFileCount "Backends" 4 "*backend.*"
+ popd
+
+ echo "Done '$idlfile' ================"
+done
+
+# Test control panel generation
+for idlfile in "${TEST_FILES[@]}"
+do
+ echo "Testing '$idlfile' backend_simulator ================"
+ idldir=$(echo $idlfile | tr . -)
+ bdir=${WORKDIR}/projects/${idldir}/control_panel
+ /bin/rm -rf ${bdir}/*.{h,cpp,pri}
+ mkdir -p ${bdir}
+
+ ${GENERATOR} --format=control_panel ${WORKDIR}/${idlfile}.qface ${bdir} || die "Generator failed" 1
+ test -d build/${idldir} && /bin/rm -rf build/${idldir}
+ test -d build/${idldir} && die "Cannot remove existing build folder" 1
+ mkdir -p build/${idldir} || die "Cannot create build folder" 1
+ pushd build/${idldir}
+ project_dir=../../projects/${idldir}/control_panel
+ qmake ${project_dir}/control_panel.pro || die "Failed to run qmake" 1
+ make || die "Failed to build" 1
+if [[ "$OSTYPE" == "linux-gnu" ]]; then
+ OLD_LD_PATH=$LD_LIBRARY_PATH
+ export LD_LIBRARY_PATH=./out:$LD_LIBRARY_PATH
+ ./out/control_panel || die "Test failed"
+ export LD_LIBRARY_PATH=${OLD_LD_PATH}
+
+elif [[ "$OSTYPE" == "darwin"* ]]; then
+ OLD_DYLD_PATH=$DYLD_LIBRARY_PATH
+ export DYLD_LIBRARY_PATH=./out:$DYLD_LIBRARY_PATH
+ ./out/control_panel.app/Contents/MacOS/control_panel || die "Test failed"
+ export DYLD_LIBRARY_PATH=${OLD_DYLD_PATH}
+fi
+ popd
+
+ echo "Done '$idlfile' ================"
+done
+
+die "All OK" 0
diff --git a/tests/auto/core/ivigenerator/ivigenerator.pro b/tests/auto/core/ivigenerator/ivigenerator.pro
new file mode 100644
index 0000000..dfc1c66
--- /dev/null
+++ b/tests/auto/core/ivigenerator/ivigenerator.pro
@@ -0,0 +1,7 @@
+TEMPLATE = subdirs
+
+SUBDIRS = projects
+
+OTHER_FILES = org.example.echo.qface \
+ org.example.echo.yaml \
+ org.example.echo.noprivate.qface
diff --git a/tests/auto/core/ivigenerator/org.example.echo.noprivate.qface b/tests/auto/core/ivigenerator/org.example.echo.noprivate.qface
new file mode 100644
index 0000000..33878dd
--- /dev/null
+++ b/tests/auto/core/ivigenerator/org.example.echo.noprivate.qface
@@ -0,0 +1,53 @@
+/**
+ * module
+ */
+@config: {"disablePrivateIVI": true}
+module org.example.echo.noprivate 1.0
+
+/**
+ * @brief the brief
+ * @description the description
+ * continues {@link http://qt.io}
+ * @deprecated
+ * @see org.example.echo.Echo
+ * @see org.example
+ * @see http://qt.io
+ * @anything hello
+ */
+@config: {"id": "org.foo.id.1.0"}
+interface Echo {
+ /**
+ * @brief brief message
+ * @details long message
+ *
+ * @param msg the message
+ * @return the echo
+ */
+ readonly string lastMessage;
+ int intValue;
+ string stringValue;
+
+ string echo(string msg);
+ string id();
+
+ signal valueChanged(int value);
+}
+
+@config: {"id": "org.foo.idz.1.0", "zoned": true}
+interface EchoZoned {
+ /**
+ * @brief brief message
+ * @details long message
+ *
+ * @param msg the message
+ * @return the echo
+ */
+ readonly string lastMessage;
+ int intValue;
+ string stringValue;
+
+ string echo(string msg);
+ string id();
+
+ signal valueChanged(int value);
+}
diff --git a/tests/auto/core/ivigenerator/org.example.echo.qface b/tests/auto/core/ivigenerator/org.example.echo.qface
new file mode 100644
index 0000000..f9db973
--- /dev/null
+++ b/tests/auto/core/ivigenerator/org.example.echo.qface
@@ -0,0 +1,101 @@
+/**
+ * module
+ */
+@config: { interfaceBuilder: "echoInterfaceBuilder" }
+module org.example.echo 1.0
+
+/**
+ * @brief the brief
+ * @description the description
+ * continues {@link http://qt.io}
+ * @deprecated
+ * @see org.example.echo.Echo
+ * @see org.example
+ * @see http://qt.io
+ * @anything hello
+ */
+@config: {id: "org.foo.id.1.0", qml_class_name: "UiEcho"}
+interface Echo {
+ /**
+ * @brief brief message
+ * @details long message
+ *
+ * @param msg the message
+ * @return the echo
+ */
+ readonly string lastMessage;
+ int intValue;
+ @config_simulator: {minimum: 10.}
+ real floatValue1;
+ @config_simulator: {maximum: 10.}
+ real floatValue2;
+ string stringValue;
+ model<Contact> contactList;
+ WeekDay weekDay;
+
+ string echo(string msg);
+ string id() const;
+}
+
+@config: {id: "org.foo.idz.1.0", zoned: true}
+interface EchoZoned {
+ /**
+ * @brief brief message
+ * @details long message
+ *
+ * @param msg the message
+ * @return the echo
+ */
+ readonly string lastMessage;
+ int intValue;
+ @config_simulator: {domain: ["one", "two", "three"]}
+ string stringValue;
+ string unsupportedValue;
+ bool zonedValue;
+ bool valueWithDefault;
+ @config: { getter_name: "isEchoEnabled" }
+ bool echoEnabled;
+ AirflowDirection airflowDirection;
+ @config_simulator: {minimum: 10., maximum: 15.}
+ int rangedValue;
+ int rangedValueWithDefault;
+
+ string echo(string msg);
+ string id();
+}
+
+/**
+ * @brief Control where the airflow goes
+ */
+flag AirflowDirection {
+ /**
+ * @brief Airflow to the windshield
+ */
+ Windshield = 1,
+ /**
+ * @brief Airflow to the dashboard
+ */
+ Dashboard = 2,
+ /**
+ * @brief Airflow to the floor
+ */
+ Floor = 4
+}
+
+@config: { type: "DaysOfTheWeek" }
+flag WeekDay {
+ Monday = 1,
+ Tuesday = 2,
+ Wednesday = 3,
+ Thursday = 4,
+ Friday = 5
+}
+
+/**
+ * The contact information
+ */
+struct Contact {
+ string name;
+ int age;
+ bool isMarried;
+}
diff --git a/tests/auto/core/ivigenerator/org.example.echo.yaml b/tests/auto/core/ivigenerator/org.example.echo.yaml
new file mode 100644
index 0000000..7ae5701
--- /dev/null
+++ b/tests/auto/core/ivigenerator/org.example.echo.yaml
@@ -0,0 +1,42 @@
+org.example.echo.EchoZoned:
+ config_simulator:
+ zones: { left : FrontLeft, right : FrontRight, rear: Rear }
+
+org.example.echo.EchoZoned#stringValue:
+ config_simulator:
+ default: "two"
+
+org.example.echo.EchoZoned#intValue:
+ config_simulator:
+ default: 11
+ range: [10, 33]
+
+org.example.echo.EchoZoned#zonedValue:
+ config_simulator:
+ default: true
+ zoned: true
+
+org.example.echo.EchoZoned#valueWithDefault:
+ config_simulator:
+ default: true
+
+org.example.echo.EchoZoned#unsupportedValue:
+ config_simulator:
+ unsupported: true
+
+org.example.echo.EchoZoned#rangedValue:
+ config_simulator:
+ range_high: 50
+ range_low: 0
+
+org.example.echo.EchoZoned#rangedValueWithDefault:
+ config_simulator:
+ default_value: 42
+ range_high: 150
+ range_low: 0
+
+org.example.echo.Echo#intValue:
+ config_simulator:
+ default_value: 61
+ range_high: 150
+ range_low: 0
diff --git a/tests/auto/core/ivigenerator/projects/org-example-echo-noprivate/backend_simulator/backend_simulator.pro b/tests/auto/core/ivigenerator/projects/org-example-echo-noprivate/backend_simulator/backend_simulator.pro
new file mode 100644
index 0000000..ac43530
--- /dev/null
+++ b/tests/auto/core/ivigenerator/projects/org-example-echo-noprivate/backend_simulator/backend_simulator.pro
@@ -0,0 +1,16 @@
+TEMPLATE=lib
+TARGET = $$qtLibraryTarget(echo_noprivate_simulator)
+LIBS += -L$$OUT_PWD/.. -l$$qtLibraryTarget(echo_noprivate_frontend)
+DESTDIR = ../qtivi
+
+CONFIG += warn_off ivigenerator plugin
+
+INCLUDEPATH += $$OUT_PWD/../frontend
+PLUGIN_TYPE = qtivi
+PLUGIN_EXTENDS = qtivi
+PLUGIN_CLASS_NAME = QIviServiceInterface
+
+QT += core ivicore
+
+QFACE_FORMAT = backend_simulator
+QFACE_SOURCES = ../../../org.example.echo.noprivate.qface
diff --git a/tests/auto/core/ivigenerator/projects/org-example-echo-noprivate/control_panel/control_panel.pro b/tests/auto/core/ivigenerator/projects/org-example-echo-noprivate/control_panel/control_panel.pro
new file mode 100644
index 0000000..029b372
--- /dev/null
+++ b/tests/auto/core/ivigenerator/projects/org-example-echo-noprivate/control_panel/control_panel.pro
@@ -0,0 +1,10 @@
+TEMPLATE=app
+TARGET= echo_noprivate_control_panel
+DESTDIR = ../
+
+CONFIG += ivigenerator
+
+QT += ivicore ivicore-private qml quick
+
+QFACE_FORMAT = control_panel
+QFACE_SOURCES = ../../../org.example.echo.noprivate.qface
diff --git a/tests/auto/core/ivigenerator/projects/org-example-echo-noprivate/frontend/frontend.pro b/tests/auto/core/ivigenerator/projects/org-example-echo-noprivate/frontend/frontend.pro
new file mode 100644
index 0000000..0902433
--- /dev/null
+++ b/tests/auto/core/ivigenerator/projects/org-example-echo-noprivate/frontend/frontend.pro
@@ -0,0 +1,12 @@
+TEMPLATE=lib
+TARGET= $$qtLibraryTarget(echo_noprivate_frontend)
+DESTDIR = ../
+
+CONFIG += ivigenerator
+
+QT += ivicore ivicore-private qml quick
+
+DEFINES += QT_BUILD_NOPRIVATE_LIB
+
+QFACE_SOURCES = ../../../org.example.echo.noprivate.qface
+
diff --git a/tests/auto/core/ivigenerator/projects/org-example-echo-noprivate/org-example-echo-noprivate.pro b/tests/auto/core/ivigenerator/projects/org-example-echo-noprivate/org-example-echo-noprivate.pro
new file mode 100644
index 0000000..8922ad6
--- /dev/null
+++ b/tests/auto/core/ivigenerator/projects/org-example-echo-noprivate/org-example-echo-noprivate.pro
@@ -0,0 +1,14 @@
+TEMPLATE = subdirs
+
+QT_FOR_CONFIG += ivicore
+
+SUBDIRS = frontend \
+ backend_simulator \
+ validator
+
+qtConfig(simulator) {
+ SUBDIRS += control_panel
+}
+
+backend_simulator.depends = frontend
+validator.depends = frontend
diff --git a/tests/auto/core/ivigenerator/projects/org-example-echo-noprivate/validator/validator.pro b/tests/auto/core/ivigenerator/projects/org-example-echo-noprivate/validator/validator.pro
new file mode 100644
index 0000000..5cdce3e
--- /dev/null
+++ b/tests/auto/core/ivigenerator/projects/org-example-echo-noprivate/validator/validator.pro
@@ -0,0 +1,15 @@
+TEMPLATE=app
+TARGET = validator-check
+LIBS += -L$$OUT_PWD/.. -l$$qtLibraryTarget(echo_noprivate_frontend)
+
+DESTDIR = ..
+
+CONFIG += c++11 ivigenerator
+CONFIG -= app_bundle
+
+INCLUDEPATH += $$OUT_PWD/../frontend
+
+QT += qml quick core ivicore
+
+QFACE_FORMAT = generation_validator
+QFACE_SOURCES = ../../../org.example.echo.noprivate.qface
diff --git a/tests/auto/core/ivigenerator/projects/org-example-echo/backend_simulator/backend_simulator.cpp b/tests/auto/core/ivigenerator/projects/org-example-echo/backend_simulator/backend_simulator.cpp
new file mode 100644
index 0000000..c0a381b
--- /dev/null
+++ b/tests/auto/core/ivigenerator/projects/org-example-echo/backend_simulator/backend_simulator.cpp
@@ -0,0 +1,15 @@
+#include "echobackend.h"
+#include "echozonedbackend.h"
+#include "echoplugin.h"
+
+QT_BEGIN_NAMESPACE
+
+extern QVector<QIviFeatureInterface *> echoInterfaceBuilder(echoPlugin *plugin)
+{
+ QVector<QIviFeatureInterface *> res;
+ res << new EchoBackend(plugin);
+ res << new EchoZonedBackend(plugin);
+ return res;
+}
+
+QT_END_NAMESPACE
diff --git a/tests/auto/core/ivigenerator/projects/org-example-echo/backend_simulator/backend_simulator.pro b/tests/auto/core/ivigenerator/projects/org-example-echo/backend_simulator/backend_simulator.pro
new file mode 100644
index 0000000..e1bdc6d
--- /dev/null
+++ b/tests/auto/core/ivigenerator/projects/org-example-echo/backend_simulator/backend_simulator.pro
@@ -0,0 +1,18 @@
+TEMPLATE=lib
+TARGET = $$qtLibraryTarget(echo_simulator)
+LIBS += -L$$OUT_PWD/.. -l$$qtLibraryTarget(echo_frontend)
+DESTDIR = ../qtivi
+
+CONFIG += warn_off ivigenerator plugin
+
+INCLUDEPATH += $$OUT_PWD/../frontend
+PLUGIN_TYPE = qtivi
+PLUGIN_EXTENDS = qtivi
+PLUGIN_CLASS_NAME = QIviServiceInterface
+
+QT += core ivicore
+
+QFACE_FORMAT = backend_simulator
+QFACE_SOURCES = ../../../org.example.echo.qface
+
+SOURCES += backend_simulator.cpp
diff --git a/tests/auto/core/ivigenerator/projects/org-example-echo/frontend/frontend.pro b/tests/auto/core/ivigenerator/projects/org-example-echo/frontend/frontend.pro
new file mode 100644
index 0000000..fdecab8
--- /dev/null
+++ b/tests/auto/core/ivigenerator/projects/org-example-echo/frontend/frontend.pro
@@ -0,0 +1,12 @@
+TEMPLATE=lib
+TARGET= $$qtLibraryTarget(echo_frontend)
+DESTDIR = ../
+
+CONFIG += ivigenerator
+
+QT += ivicore ivicore-private qml quick
+
+DEFINES += QT_BUILD_ECHO_LIB
+
+QFACE_SOURCES = ../../../org.example.echo.qface
+
diff --git a/tests/auto/core/ivigenerator/projects/org-example-echo/org-example-echo.pro b/tests/auto/core/ivigenerator/projects/org-example-echo/org-example-echo.pro
new file mode 100644
index 0000000..7083d85
--- /dev/null
+++ b/tests/auto/core/ivigenerator/projects/org-example-echo/org-example-echo.pro
@@ -0,0 +1,8 @@
+TEMPLATE = subdirs
+
+SUBDIRS = frontend \
+ backend_simulator \
+ validator \
+
+backend_simulator.depends = frontend
+validator.depends = frontend
diff --git a/tests/auto/core/ivigenerator/projects/org-example-echo/validator/validator.pro b/tests/auto/core/ivigenerator/projects/org-example-echo/validator/validator.pro
new file mode 100644
index 0000000..52ed4d3
--- /dev/null
+++ b/tests/auto/core/ivigenerator/projects/org-example-echo/validator/validator.pro
@@ -0,0 +1,15 @@
+TEMPLATE=app
+TARGET = validator-check
+LIBS += -L$$OUT_PWD/.. -l$$qtLibraryTarget(echo_frontend)
+
+DESTDIR = ..
+
+CONFIG += c++11 ivigenerator
+CONFIG -= app_bundle
+
+INCLUDEPATH += $$OUT_PWD/../frontend
+
+QT += qml quick core ivicore
+
+QFACE_FORMAT = generation_validator
+QFACE_SOURCES = ../../../org.example.echo.qface
diff --git a/tests/auto/core/ivigenerator/projects/projects.pro b/tests/auto/core/ivigenerator/projects/projects.pro
new file mode 100644
index 0000000..986a841
--- /dev/null
+++ b/tests/auto/core/ivigenerator/projects/projects.pro
@@ -0,0 +1,4 @@
+TEMPLATE = subdirs
+
+SUBDIRS = org-example-echo \
+ org-example-echo-noprivate
diff --git a/tests/auto/core/qiviabstractfeature/qivifeaturetester.h b/tests/auto/core/qiviabstractfeature/qivifeaturetester.h
index 9242337..320c6ec 100644
--- a/tests/auto/core/qiviabstractfeature/qivifeaturetester.h
+++ b/tests/auto/core/qiviabstractfeature/qivifeaturetester.h
@@ -42,30 +42,33 @@ class QIviFeatureTester : public QObject
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 QIviFeatureTester(QIviAbstractFeature *feature, QObject *parent = Q_NULLPTR)
+ explicit QIviFeatureTester(QIviAbstractFeature *feature, QObject *parent = nullptr)
: QObject(parent)
, m_feature(feature)
- , m_featureListModel(0)
+ , m_featureListModel(nullptr)
{
connect(m_feature, &QIviAbstractFeature::discoveryModeChanged, this, &QIviFeatureTester::discoveryModeChanged);
connect(m_feature, &QIviAbstractFeature::discoveryResultChanged, this, &QIviFeatureTester::discoveryResultChanged);
connect(m_feature, &QIviAbstractFeature::serviceObjectChanged, this, &QIviFeatureTester::serviceObjectChanged);
connect(m_feature, &QIviAbstractFeature::isValidChanged, this, &QIviFeatureTester::isValidChanged);
+ connect(m_feature, &QIviAbstractFeature::isInitializedChanged, this, &QIviFeatureTester::isInitializedChanged);
connect(m_feature, &QIviAbstractFeature::errorChanged, this, &QIviFeatureTester::errorChanged);
}
- explicit QIviFeatureTester(QIviAbstractFeatureListModel *featureModel, QObject *parent = Q_NULLPTR)
+ explicit QIviFeatureTester(QIviAbstractFeatureListModel *featureModel, QObject *parent = nullptr)
: QObject(parent)
- , m_feature(0)
+ , m_feature(nullptr)
, m_featureListModel(featureModel)
{
connect(m_featureListModel, &QIviAbstractFeatureListModel::discoveryModeChanged, this, &QIviFeatureTester::discoveryModeChanged);
connect(m_featureListModel, &QIviAbstractFeatureListModel::discoveryResultChanged, this, &QIviFeatureTester::discoveryResultChanged);
connect(m_featureListModel, &QIviAbstractFeatureListModel::serviceObjectChanged, this, &QIviFeatureTester::serviceObjectChanged);
connect(m_featureListModel, &QIviAbstractFeatureListModel::isValidChanged, this, &QIviFeatureTester::isValidChanged);
+ connect(m_featureListModel, &QIviAbstractFeatureListModel::isInitializedChanged, this, &QIviFeatureTester::isInitializedChanged);
connect(m_featureListModel, &QIviAbstractFeatureListModel::errorChanged, this, &QIviFeatureTester::errorChanged);
}
@@ -89,6 +92,11 @@ public:
return m_feature ? m_feature->isValid() : m_featureListModel->isValid();
}
+ bool isInitialized() const
+ {
+ return m_feature ? m_feature->isInitialized() : m_featureListModel->isInitialized();
+ }
+
QIviAbstractFeature::Error error() const
{
return m_feature ? m_feature->error() : m_featureListModel->error();
@@ -104,7 +112,6 @@ public:
return m_feature ? m_feature->errorText() : m_featureListModel->errorText();
}
-
public Q_SLOTS:
bool setServiceObject(QIviServiceObject *so)
{
@@ -124,6 +131,7 @@ 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);
private:
diff --git a/tests/auto/core/qiviabstractfeature/tst_qiviabstractfeature.cpp b/tests/auto/core/qiviabstractfeature/tst_qiviabstractfeature.cpp
index 93380dd..a97df09 100644
--- a/tests/auto/core/qiviabstractfeature/tst_qiviabstractfeature.cpp
+++ b/tests/auto/core/qiviabstractfeature/tst_qiviabstractfeature.cpp
@@ -40,16 +40,16 @@
int acceptCounter = 100;
-class TestFeatureInterface : public QObject
+class TestFeatureInterface : public QIviFeatureInterface
{
Q_OBJECT
public:
- TestFeatureInterface(QObject *parent = 0)
- : QObject(parent)
+ explicit TestFeatureInterface(QObject *parent = nullptr)
+ : QIviFeatureInterface(parent)
{}
- virtual ~TestFeatureInterface() {}
+ ~TestFeatureInterface() {}
Q_SIGNALS:
void errorChanged(QIviAbstractFeature::Error error, const QString &message = QString());
@@ -60,7 +60,7 @@ class TestFeature : public QIviAbstractFeature
Q_OBJECT
public:
- TestFeature(bool testBaseFunctions = false, QObject *parent = 0)
+ TestFeature(bool testBaseFunctions = false, QObject *parent = nullptr)
: QIviAbstractFeature("testFeature", parent)
, m_testBaseFunctions(testBaseFunctions)
{}
@@ -87,6 +87,8 @@ public:
return;
TestFeatureInterface* testInterface = qobject_cast<TestFeatureInterface*>(serviceObject->interfaceInstance(interfaceName()));
connect(testInterface, &TestFeatureInterface::errorChanged, this, &TestFeature::onErrorChanged);
+
+ QIviAbstractFeature::connectToServiceObject(serviceObject);
}
virtual void disconnectFromServiceObject(QIviServiceObject*)
@@ -107,7 +109,7 @@ class TestFeatureListModel : public QIviAbstractFeatureListModel
Q_OBJECT
public:
- TestFeatureListModel(bool testBaseFunctions = false, QObject *parent = 0)
+ TestFeatureListModel(bool testBaseFunctions = false, QObject *parent = nullptr)
: QIviAbstractFeatureListModel("testFeature", parent)
, m_testBaseFunctions(testBaseFunctions)
{}
@@ -134,6 +136,8 @@ public:
return;
TestFeatureInterface* testInterface = qobject_cast<TestFeatureInterface*>(serviceObject->interfaceInstance(interfaceName()));
connect(testInterface, &TestFeatureInterface::errorChanged, this, &TestFeatureListModel::onErrorChanged);
+
+ QIviAbstractFeatureListModel::connectToServiceObject(serviceObject);
}
virtual void disconnectFromServiceObject(QIviServiceObject*)
@@ -167,10 +171,15 @@ class TestFeatureBackend : public TestFeatureInterface
Q_OBJECT
public:
- TestFeatureBackend(QObject *parent = 0)
+ TestFeatureBackend(QObject *parent = nullptr)
: TestFeatureInterface(parent)
{}
+ void initialize() override
+ {
+ emit initializationDone();
+ }
+
void emitError(QIviAbstractFeature::Error error, const QString &message)
{
emit errorChanged(error, message);
@@ -183,7 +192,7 @@ class TestBackend : public QObject, QIviServiceInterface
Q_INTERFACES(QIviServiceInterface)
public:
- TestBackend(QObject *parent = 0)
+ TestBackend(QObject *parent = nullptr)
: QObject(parent)
, m_testBackend(new TestFeatureBackend(this))
{}
@@ -193,7 +202,7 @@ public:
return QStringList(QString("testFeature"));
}
- QObject* interfaceInstance(const QString& interface) const
+ QIviFeatureInterface* interfaceInstance(const QString& interface) const
{
if (interface == "testFeature")
return m_testBackend;
@@ -263,6 +272,7 @@ void BaseTest::testAutoDiscoveryFailure()
QIviAbstractFeature::DiscoveryResult result = f->startAutoDiscovery();
QVERIFY(!f->serviceObject());
QVERIFY(!f->isValid());
+ QVERIFY(!f->isInitialized());
QCOMPARE(result, QIviAbstractFeature::ErrorWhileLoading);
QTest::ignoreMessage(QtWarningMsg, "There is no production backend implementing \"testFeature\" .");
@@ -271,6 +281,7 @@ void BaseTest::testAutoDiscoveryFailure()
result = f->startAutoDiscovery();
QVERIFY(!f->serviceObject());
QVERIFY(!f->isValid());
+ QVERIFY(!f->isInitialized());
QCOMPARE(result, QIviAbstractFeature::ErrorWhileLoading);
TestBackend* backend1 = new TestBackend();
@@ -289,7 +300,7 @@ void BaseTest::testAutoDiscoveryFailure()
f->setServiceObject(list.at(0));
result = f->startAutoDiscovery();
QCOMPARE(result, QIviAbstractFeature::NoResult);
- f->setServiceObject(0);
+ f->setServiceObject(nullptr);
TestBackend* backend2 = new TestBackend();
m_manager->registerService(backend2, backend2->interfaces());
@@ -332,6 +343,7 @@ void BaseTest::testAutoDiscoveryWithMultipleBackends()
QIviAbstractFeature::DiscoveryResult res = f->startAutoDiscovery();
QVERIFY(f->serviceObject());
QVERIFY(f->isValid());
+ QVERIFY(f->isInitialized());
QCOMPARE(res, result);
}
@@ -371,6 +383,7 @@ void BaseTest::testAutoDiscovery()
QVERIFY(!f->isValid());
f->setDiscoveryMode(mode);
QSignalSpy validSpy(f, &QIviFeatureTester::isValidChanged);
+ QSignalSpy initializedSpy(f, &QIviFeatureTester::isInitializedChanged);
if (!registerProduction)
QTest::ignoreMessage(QtWarningMsg, "There is no production backend implementing \"testFeature\" .");
QIviAbstractFeature::DiscoveryResult res = f->startAutoDiscovery();
@@ -381,6 +394,9 @@ void BaseTest::testAutoDiscovery()
QCOMPARE(validSpy.at(0).at(0).toBool(), true);
QCOMPARE(res, result);
QCOMPARE(f->discoveryResult(), result);
+ QVERIFY(f->isInitialized());
+ QCOMPARE(initializedSpy.count(), 1);
+ QCOMPARE(initializedSpy.at(0).at(0).toBool(), true);
}
void BaseTest::testAutoDiscovery_qml()
@@ -499,7 +515,7 @@ void BaseTest::testResetServiceObject()
serviceObjectChangedSpy.clear();
//Reset the ServiceObject of the Feature and verify that the feature doesn't have a connection to the ServiceObject anymore
- f->setServiceObject(0);
+ f->setServiceObject(nullptr);
m_manager->unloadAllBackends();
QCOMPARE(soDestroyedSpy.count(), 1);
diff --git a/tests/auto/core/qiviproperty/tst_qiviproperty.cpp b/tests/auto/core/qiviproperty/tst_qiviproperty.cpp
index 9de5d24..d73e2c3 100644
--- a/tests/auto/core/qiviproperty/tst_qiviproperty.cpp
+++ b/tests/auto/core/qiviproperty/tst_qiviproperty.cpp
@@ -86,7 +86,7 @@ public:
QIVIPROPERTY(TestObject::TestFlags, flagsAttribute)
public:
- TestObject(QObject *parent = Q_NULLPTR)
+ TestObject(QObject *parent = nullptr)
: QObject(parent)
, m_intAttributeProperty(QIviPropertyFactory<int>::create(this,
&TestObject::intAttribute,
diff --git a/tests/auto/core/qivisearchandbrowsemodel/tst_qivisearchandbrowsemodel.cpp b/tests/auto/core/qivisearchandbrowsemodel/tst_qivisearchandbrowsemodel.cpp
index 8e70a79..b19e947 100644
--- a/tests/auto/core/qivisearchandbrowsemodel/tst_qivisearchandbrowsemodel.cpp
+++ b/tests/auto/core/qivisearchandbrowsemodel/tst_qivisearchandbrowsemodel.cpp
@@ -39,6 +39,7 @@
class TestBackend : public QIviSearchAndBrowseModelInterface
{
+ Q_OBJECT
public:
@@ -105,7 +106,12 @@ public:
return list;
}
- virtual void fetchData(const QUuid &identifier, const QString &type, QIviAbstractQueryTerm *term, const QList<QIviOrderTerm> &orderTerms, int start, int count) Q_DECL_OVERRIDE
+ void initialize() override
+ {
+ emit initializationDone();
+ }
+
+ virtual void fetchData(const QUuid &identifier, const QString &type, QIviAbstractQueryTerm *term, const QList<QIviOrderTerm> &orderTerms, int start, int count) override
{
emit supportedCapabilitiesChanged(identifier, m_caps);
@@ -200,13 +206,13 @@ public:
emit dataFetched(identifier, requestedItems, start, start + count < list.count());
}
- virtual bool canGoBack(const QUuid &identifier, const QString &type) Q_DECL_OVERRIDE
+ virtual bool canGoBack(const QUuid &identifier, const QString &type) override
{
Q_UNUSED(identifier)
return (type == "levelTwo" || type == "levelThree");
}
- virtual QString goBack(const QUuid &identifier, const QString &type) Q_DECL_OVERRIDE
+ virtual QString goBack(const QUuid &identifier, const QString &type) override
{
Q_UNUSED(identifier)
@@ -218,7 +224,7 @@ public:
return "levelOne";
}
- virtual bool canGoForward(const QUuid &identifier, const QString &type, const QString &itemId) Q_DECL_OVERRIDE
+ virtual bool canGoForward(const QUuid &identifier, const QString &type, const QString &itemId) override
{
Q_UNUSED(identifier)
if (itemId.endsWith("0"))
@@ -227,7 +233,7 @@ public:
return (type == "levelOne" || type == "levelTwo");
}
- virtual QString goForward(const QUuid &identifier, const QString &type, const QString &itemId) Q_DECL_OVERRIDE
+ virtual QString goForward(const QUuid &identifier, const QString &type, const QString &itemId) override
{
Q_UNUSED(identifier)
Q_UNUSED(itemId)
@@ -240,7 +246,7 @@ public:
return "levelOne";
}
- virtual void insert(const QUuid &identifier, const QString &type, int index, const QIviSearchAndBrowseModelItem *item) Q_DECL_OVERRIDE
+ virtual void insert(const QUuid &identifier, const QString &type, int index, const QIviSearchAndBrowseModelItem *item) override
{
QList<QIviSearchAndBrowseModelItem> list = m_lists.value(type);
@@ -252,7 +258,7 @@ public:
emit dataChanged(identifier, variantList, index, 0);
}
- virtual void remove(const QUuid &identifier, const QString &type, int index) Q_DECL_OVERRIDE
+ virtual void remove(const QUuid &identifier, const QString &type, int index) override
{
QList<QIviSearchAndBrowseModelItem> list = m_lists.value(type);
@@ -262,7 +268,7 @@ public:
emit dataChanged(identifier, QVariantList(), index, 1);
}
- virtual void move(const QUuid &identifier, const QString &type, int currentIndex, int newIndex) Q_DECL_OVERRIDE
+ virtual void move(const QUuid &identifier, const QString &type, int currentIndex, int newIndex) override
{
QList<QIviSearchAndBrowseModelItem> list = m_lists.value(type);
@@ -279,7 +285,7 @@ public:
emit dataChanged(identifier, variantLIst, min, max - min + 1);
}
- virtual int indexOf(const QUuid &identifier, const QString &type, const QIviSearchAndBrowseModelItem *item) Q_DECL_OVERRIDE
+ virtual int indexOf(const QUuid &identifier, const QString &type, const QIviSearchAndBrowseModelItem *item) override
{
static int callID = 0;
QList<QIviSearchAndBrowseModelItem> list = m_lists.value(type);
@@ -296,9 +302,10 @@ private:
class TestServiceObject : public QIviServiceObject
{
+ Q_OBJECT
public:
- explicit TestServiceObject(QObject *parent = 0) :
+ explicit TestServiceObject(QObject *parent = nullptr) :
QIviServiceObject(parent)
{
m_backend = new TestBackend;
@@ -306,7 +313,7 @@ public:
}
QStringList interfaces() const { return m_interfaces; }
- QObject *interfaceInstance(const QString &interface) const
+ QIviFeatureInterface *interfaceInstance(const QString &interface) const
{
if (interface == QIviSearchAndBrowseModel_iid)
return testBackend();
@@ -428,7 +435,7 @@ void tst_QIviSearchAndBrowseModel::testClearServiceObject()
//QVERIFY(model.loadingType() != defaultModel.loadingType());
QVERIFY(model.rowCount() != defaultModel.rowCount());
- QVERIFY(model.setServiceObject(0));
+ QVERIFY(model.setServiceObject(nullptr));
QVERIFY(model.chunkSize() == defaultModel.chunkSize());
QVERIFY(model.contentType() == defaultModel.contentType());
diff --git a/tests/auto/core/servicemanagertest/simple_plugin/simpleplugin.h b/tests/auto/core/servicemanagertest/simple_plugin/simpleplugin.h
index 64e654c..e62968d 100644
--- a/tests/auto/core/servicemanagertest/simple_plugin/simpleplugin.h
+++ b/tests/auto/core/servicemanagertest/simple_plugin/simpleplugin.h
@@ -40,14 +40,14 @@ class SimplePlugin : public QObject, public QIviServiceInterface
Q_INTERFACES(QIviServiceInterface)
Q_PLUGIN_METADATA(IID QIviServiceInterface_iid FILE "simple_plugin.json")
public:
- SimplePlugin();
- virtual ~SimplePlugin() {}
+ explicit SimplePlugin();
+ ~SimplePlugin() {}
QStringList interfaces() const {
return QStringList() << "simple_plugin";
}
- QObject *interfaceInstance(const QString &interface) const {
+ QIviFeatureInterface *interfaceInstance(const QString &interface) const {
Q_UNUSED(interface)
return 0;
}
diff --git a/tests/auto/core/servicemanagertest/tst_servicemanagertest.cpp b/tests/auto/core/servicemanagertest/tst_servicemanagertest.cpp
index 8c8ef6b..458755d 100644
--- a/tests/auto/core/servicemanagertest/tst_servicemanagertest.cpp
+++ b/tests/auto/core/servicemanagertest/tst_servicemanagertest.cpp
@@ -48,11 +48,11 @@ public:
return m_serviceObjects.keys();
}
- QObject *interfaceInstance(const QString &interface) const {
+ QIviFeatureInterface *interfaceInstance(const QString &interface) const {
return m_serviceObjects.value(interface);
}
- void addServiceObject(const QString &interface, QObject *serviceObject) {
+ void addServiceObject(const QString &interface, QIviFeatureInterface *serviceObject) {
if (!serviceObject->parent())
serviceObject->setParent(this);
@@ -60,7 +60,20 @@ public:
}
private:
- QMap<QString, QObject *> m_serviceObjects;
+ QMap<QString, QIviFeatureInterface *> m_serviceObjects;
+};
+
+class TestInterface : public QIviFeatureInterface
+{
+ Q_OBJECT
+public:
+ TestInterface(QObject *parent)
+ : QIviFeatureInterface(parent)
+ {}
+
+ void initialize() override
+ {
+ }
};
class ServiceManagerTest : public QObject
@@ -132,17 +145,17 @@ do { \
} while (0)
/*
- * Test the hasInterface method
- */
+ Test the hasInterface method
+*/
void ServiceManagerTest::testHasInterface()
{
- QCOMPARE(manager->hasInterface("Foo"), false);
+ QCOMPARE(manager->hasInterface("Foo"), false);
- MockServiceBackend *backend0 = new MockServiceBackend(manager);
- bool regResult = manager->registerService(backend0, QStringList() << "Foo" << "Bar");
- QCOMPARE(regResult, true);
- QCOMPARE(manager->hasInterface("Foo"), true);
- QCOMPARE(manager->hasInterface("Bar"), true);
+ MockServiceBackend *backend0 = new MockServiceBackend(manager);
+ bool regResult = manager->registerService(backend0, QStringList() << "Foo" << "Bar");
+ QCOMPARE(regResult, true);
+ QCOMPARE(manager->hasInterface("Foo"), true);
+ QCOMPARE(manager->hasInterface("Bar"), true);
}
void ServiceManagerTest::testFindServiceObjectsReturnInValidInstance()
@@ -168,7 +181,7 @@ void ServiceManagerTest::testFindServiceObjects()
type = QIviServiceManager::SimulationBackend;
bool regResult = manager->registerService(backend, QStringList() << "TestInterface", type);
QCOMPARE(regResult, true);
- QObject *testObject = new QObject();
+ QIviFeatureInterface *testObject = new TestInterface(backend);
backend->addServiceObject("TestInterface", testObject);
QList<QIviServiceObject*> list = manager->findServiceByInterface("TestInterface", searchFlags);
@@ -179,9 +192,9 @@ void ServiceManagerTest::testFindServiceObjects()
}
/*
- * Test that the registerService method returns false if the user tries
- * to register a service with an empty list of interfaces.
- */
+ Test that the registerService method returns false if the user tries
+ to register a service with an empty list of interfaces.
+*/
void ServiceManagerTest::testRegisterWithNoInterfaces()
{
MockServiceBackend *backend = new MockServiceBackend(manager);
@@ -190,9 +203,9 @@ void ServiceManagerTest::testRegisterWithNoInterfaces()
}
/*
- * Test that the registerService method returns false if the user tries
- * to register a service which doesn't implement the ServiceBackendInterface.
- */
+ Test that the registerService method returns false if the user tries
+ to register a service which doesn't implement the ServiceBackendInterface.
+*/
void ServiceManagerTest::testRegisterNonServiceBackendInterfaceObject()
{
QObject *anyObject = new QObject(manager);
@@ -202,8 +215,8 @@ void ServiceManagerTest::testRegisterNonServiceBackendInterfaceObject()
}
/*
- * Test typical QAbstractListModel behavior
- */
+ Test typical QAbstractListModel behavior
+*/
void ServiceManagerTest::testManagerListModel()
{
QSignalSpy managerModelSpy(manager, SIGNAL(rowsInserted(QModelIndex,int,int)));
@@ -248,7 +261,7 @@ void ServiceManagerTest::pluginLoaderTest()
QList<QIviServiceObject *> services = manager->findServiceByInterface("simple_plugin");
QCOMPARE(services.count(), 1);
//Because we unloaded the backend and created a new instance of it we expect to get a different id for the ServiceObject as in initTestCase()
- QCOMPARE(m_simplePluginID, services.at(0)->id());
+ QVERIFY(m_simplePluginID != services.at(0)->id());
QVERIFY(manager->hasInterface("wrong_plugin"));
diff --git a/tests/auto/core/servicemanagertest/wrong_plugin/wrongplugin.h b/tests/auto/core/servicemanagertest/wrong_plugin/wrongplugin.h
index 2ef469e..58154c9 100644
--- a/tests/auto/core/servicemanagertest/wrong_plugin/wrongplugin.h
+++ b/tests/auto/core/servicemanagertest/wrong_plugin/wrongplugin.h
@@ -40,8 +40,8 @@ class WrongPlugin : public QObject
//Q_INTERFACES(QIviServiceInterface)
Q_PLUGIN_METADATA(IID QIviServiceInterface_iid FILE "wrong_plugin.json")
public:
- WrongPlugin();
- virtual ~WrongPlugin() {}
+ explicit WrongPlugin();
+ ~WrongPlugin() {}
QStringList interfaces() const {
return QStringList() << "wrong_plugin";
diff --git a/tests/auto/core/servicemanagertest/wrongmetadata_plugin/wrongmetadataplugin.h b/tests/auto/core/servicemanagertest/wrongmetadata_plugin/wrongmetadataplugin.h
index 7e06a96..b5dbdd2 100644
--- a/tests/auto/core/servicemanagertest/wrongmetadata_plugin/wrongmetadataplugin.h
+++ b/tests/auto/core/servicemanagertest/wrongmetadata_plugin/wrongmetadataplugin.h
@@ -39,14 +39,14 @@ class WrongMetadataPlugin : public QObject, public QIviServiceInterface
Q_OBJECT
Q_INTERFACES(QIviServiceInterface)
public:
- WrongMetadataPlugin();
- virtual ~WrongMetadataPlugin() {}
+ explicit WrongMetadataPlugin();
+ ~WrongMetadataPlugin() {}
QStringList interfaces() const {
return QStringList() << "wrongmetadata";
}
- QObject *interfaceInstance(const QString &interface) const {
+ QIviFeatureInterface *interfaceInstance(const QString &interface) const {
Q_UNUSED(interface)
return 0;
}
diff --git a/tests/auto/dlt/tst_dlt.cpp b/tests/auto/dlt/tst_dlt.cpp
index 8b8090b..0ec84e0 100644
--- a/tests/auto/dlt/tst_dlt.cpp
+++ b/tests/auto/dlt/tst_dlt.cpp
@@ -139,7 +139,7 @@ void QDltTest::testLogging()
registration->registerCategory(&TEST1(), "TES1", "Test Category One");
QString msg = QLatin1Literal("TEST");
- QString expectedMsg = QString("%1: \"%2\"").arg(TEST1().categoryName()).arg(msg);
+ QString expectedMsg = QString("%1: \"%2\"").arg(TEST1().categoryName(), msg);
qWarning(TEST1) << msg;
diff --git a/tests/auto/vehiclefunctions/climatecontroltest/tst_climatecontroltest.cpp b/tests/auto/vehiclefunctions/climatecontroltest/tst_climatecontroltest.cpp
index 3f63d22..c2942e8 100644
--- a/tests/auto/vehiclefunctions/climatecontroltest/tst_climatecontroltest.cpp
+++ b/tests/auto/vehiclefunctions/climatecontroltest/tst_climatecontroltest.cpp
@@ -37,6 +37,8 @@
class ClimateControlTestBackend : public QIviClimateControlBackendInterface
{
+ Q_OBJECT
+
public:
ClimateControlTestBackend()
: QIviClimateControlBackendInterface()
@@ -85,12 +87,12 @@ public:
m_zones << "Dummy"; // to test unavailable attributes
}
- QStringList availableZones() const Q_DECL_OVERRIDE
+ QStringList availableZones() const override
{
return m_zones;
}
- void initializeAttributes() Q_DECL_OVERRIDE
+ void initialize() override
{
emit airflowDirectionsChanged(m_airflowDirections);
emit airflowDirectionsAttributeChanged(m_airflowDirectionsAttribute);
@@ -131,7 +133,7 @@ public:
}
}
- void setTargetTemperature(int t, const QString &z) Q_DECL_OVERRIDE
+ void setTargetTemperature(int t, const QString &z) override
{
if (!m_zoneTargetTemperature.contains(z)) {
qWarning() << "Trying to set ClimateControl::targetTemperature in an unsupported zone.";
@@ -155,7 +157,7 @@ public:
}
}
- void setSeatCooler(int t, const QString &z) Q_DECL_OVERRIDE
+ void setSeatCooler(int t, const QString &z) override
{
if (!m_zoneSeatCooler.contains(z)) {
qWarning() << "Trying to set ClimateControl::seatCooler in an unsupported zone.";
@@ -179,7 +181,7 @@ public:
}
}
- void setSeatHeater(int t, const QString &z) Q_DECL_OVERRIDE
+ void setSeatHeater(int t, const QString &z) override
{
if (!m_zoneSeatHeater.contains(z)) {
qWarning() << "Trying to set ClimateControl::seatHeater in an unsupported zone.";
@@ -203,7 +205,7 @@ public:
}
}
- void setAirflowDirections(QIviClimateControl::AirflowDirections ad, const QString &z) Q_DECL_OVERRIDE
+ void setAirflowDirections(QIviClimateControl::AirflowDirections ad, const QString &z) override
{
Q_UNUSED(z)
if (m_airflowDirections != ad) {
@@ -221,7 +223,7 @@ public:
}
}
- void setAirConditioningEnabled(bool e, const QString &z) Q_DECL_OVERRIDE
+ void setAirConditioningEnabled(bool e, const QString &z) override
{
Q_UNUSED(z)
if (m_airConditioningEnabled != e) {
@@ -239,7 +241,7 @@ public:
}
}
- void setHeaterEnabled(bool e, const QString &z) Q_DECL_OVERRIDE
+ void setHeaterEnabled(bool e, const QString &z) override
{
Q_UNUSED(z)
if (m_heaterEnabled != e) {
@@ -257,7 +259,7 @@ public:
}
}
- void setSteeringWheelHeater(int t, const QString &z) Q_DECL_OVERRIDE
+ void setSteeringWheelHeater(int t, const QString &z) override
{
if (!m_zoneSteeringWheelHeater.contains(z))
return;
@@ -279,7 +281,7 @@ public:
}
}
- void setFanSpeedLevel(int fsl, const QString &z) Q_DECL_OVERRIDE
+ void setFanSpeedLevel(int fsl, const QString &z) override
{
if (!m_zoneFanSpeedLevel.contains(z))
return;
@@ -324,7 +326,7 @@ public:
}
}
- void setZoneSynchronizationEnabled(bool zoneSynchronization, const QString &z) Q_DECL_OVERRIDE
+ void setZoneSynchronizationEnabled(bool zoneSynchronization, const QString &z) override
{
Q_UNUSED(z)
if (m_zoneSynchronizationEnabled != zoneSynchronization) {
@@ -342,7 +344,7 @@ public:
}
}
- void setDefrostEnabled(bool defrost, const QString &z) Q_DECL_OVERRIDE
+ void setDefrostEnabled(bool defrost, const QString &z) override
{
Q_UNUSED(z)
if (m_defrostEnabled != defrost) {
@@ -360,7 +362,7 @@ public:
}
}
- void setRecirculationMode(QIviClimateControl::RecirculationMode recirculationMode, const QString &z) Q_DECL_OVERRIDE
+ void setRecirculationMode(QIviClimateControl::RecirculationMode recirculationMode, const QString &z) override
{
Q_UNUSED(z)
if (m_recirculationMode != recirculationMode) {
@@ -396,7 +398,7 @@ public:
}
}
- void setRecirculationSensitivityLevel(int recirculationSensitivityLevel, const QString &z) Q_DECL_OVERRIDE
+ void setRecirculationSensitivityLevel(int recirculationSensitivityLevel, const QString &z) override
{
Q_UNUSED(z)
@@ -420,7 +422,7 @@ public:
}
}
- void setClimateMode(QIviClimateControl::ClimateMode climateMode, const QString &z) Q_DECL_OVERRIDE
+ void setClimateMode(QIviClimateControl::ClimateMode climateMode, const QString &z) override
{
Q_UNUSED(z)
if (m_climateMode != climateMode) {
@@ -438,7 +440,7 @@ public:
}
}
- void setAutomaticClimateFanIntensityLevel(int automaticClimateFanIntensityLevel, const QString &z) Q_DECL_OVERRIDE
+ void setAutomaticClimateFanIntensityLevel(int automaticClimateFanIntensityLevel, const QString &z) override
{
Q_UNUSED(z)
@@ -506,10 +508,12 @@ Q_DECLARE_METATYPE(ClimateControlTestDataInt)
typedef QIviPropertyTestData<QIviClimateControl, ClimateControlTestBackend, bool> ClimateControlTestDataBool;
Q_DECLARE_METATYPE(ClimateControlTestDataBool)
-class ClimateControlTestServiceObject : public QIviServiceObject {
+class ClimateControlTestServiceObject : public QIviServiceObject
+{
+ Q_OBJECT
public:
- explicit ClimateControlTestServiceObject(QObject *parent=0) :
+ explicit ClimateControlTestServiceObject(QObject *parent = nullptr) :
QIviServiceObject(parent), m_name(QLatin1String(""))
{
m_backend = new ClimateControlTestBackend;
@@ -518,7 +522,7 @@ public:
QString name() const { return m_name; }
QStringList interfaces() const { return m_interfaces; }
- QObject *interfaceInstance(const QString& interface) const
+ QIviFeatureInterface *interfaceInstance(const QString& interface) const
{
if (interface == QIviClimateControl_iid)
return testBackend();
@@ -537,23 +541,39 @@ private:
ClimateControlTestBackend *m_backend;
};
-class ClimateControlInvalidServiceObject : public QIviServiceObject {
+class InvalidInterface : public QIviFeatureInterface
+{
+ Q_OBJECT
+public:
+ InvalidInterface(QObject *parent)
+ : QIviFeatureInterface(parent)
+ {}
+
+ void initialize() override
+ {
+ emit initializationDone();
+ }
+};
+
+class ClimateControlInvalidServiceObject : public QIviServiceObject
+{
+ Q_OBJECT
public:
- explicit ClimateControlInvalidServiceObject(QObject *parent=0) :
- QIviServiceObject(parent), m_name(QLatin1String("")), m_dummyBackend(new QObject(this))
+ explicit ClimateControlInvalidServiceObject(QObject *parent = nullptr) :
+ QIviServiceObject(parent), m_name(QLatin1String("")), m_dummyBackend(new InvalidInterface(this))
{
m_interfaces << QIviClimateControl_iid;
}
QString name() const { return m_name; }
QStringList interfaces() const { return m_interfaces; }
- QObject *interfaceInstance(const QString& ) const { return m_dummyBackend; }
+ QIviFeatureInterface *interfaceInstance(const QString& ) const { return m_dummyBackend; }
private:
QString m_name;
QStringList m_interfaces;
- QObject *m_dummyBackend;
+ QIviFeatureInterface *m_dummyBackend;
};
class ClimateControlTest : public QObject
diff --git a/tests/auto/vehiclefunctions/windowcontroltest/tst_windowcontroltest.cpp b/tests/auto/vehiclefunctions/windowcontroltest/tst_windowcontroltest.cpp
index bffccfc..3d74cef 100644
--- a/tests/auto/vehiclefunctions/windowcontroltest/tst_windowcontroltest.cpp
+++ b/tests/auto/vehiclefunctions/windowcontroltest/tst_windowcontroltest.cpp
@@ -36,6 +36,8 @@
class WindowControlTestBackend : public QIviWindowControlBackendInterface
{
+ Q_OBJECT
+
public:
WindowControlTestBackend()
: QIviWindowControlBackendInterface()
@@ -57,12 +59,12 @@ public:
m_zoneMap.insert("Rear", zone);
}
- QStringList availableZones() const Q_DECL_OVERRIDE
+ QStringList availableZones() const override
{
return m_zoneMap.keys();
}
- void initializeAttributes() Q_DECL_OVERRIDE
+ void initialize() override
{
const QStringList zones = availableZones();
//zones.removeLast(); // Do not init zone "Dummy"
@@ -82,7 +84,7 @@ public:
public:
- void setHeaterMode(QIviWindowControl::HeaterMode value, const QString &zone) Q_DECL_OVERRIDE
+ void setHeaterMode(QIviWindowControl::HeaterMode value, const QString &zone) override
{
if (!m_zoneMap.contains(zone))
return;
@@ -126,7 +128,7 @@ public:
}
}
- void setBlindMode(QIviWindowControl::BlindMode value, const QString &zone) Q_DECL_OVERRIDE
+ void setBlindMode(QIviWindowControl::BlindMode value, const QString &zone) override
{
if (!m_zoneMap.contains(zone))
return;
@@ -194,12 +196,12 @@ public:
}
//TODO add an autotest for this
- void open(const QString &zone)
+ void open(const QString &zone) override
{
Q_UNUSED(zone)
}
- void close(const QString &zone)
+ void close(const QString &zone) override
{
Q_UNUSED(zone)
}
@@ -226,10 +228,12 @@ private:
typedef QIviPropertyTestData<QIviWindowControl, WindowControlTestBackend, QIviWindowControl::State> WindowControlTestDataState;
Q_DECLARE_METATYPE(WindowControlTestDataState)
-class WindowControlTestServiceObject : public QIviServiceObject {
+class WindowControlTestServiceObject : public QIviServiceObject
+{
+ Q_OBJECT
public:
- explicit WindowControlTestServiceObject(QObject *parent=0) :
+ explicit WindowControlTestServiceObject(QObject *parent = nullptr) :
QIviServiceObject(parent), m_name(QLatin1String(""))
{
m_backend = new WindowControlTestBackend;
@@ -238,7 +242,7 @@ public:
QString name() const { return m_name; }
QStringList interfaces() const { return m_interfaces; }
- QObject *interfaceInstance(const QString& interface) const
+ QIviFeatureInterface *interfaceInstance(const QString& interface) const
{
if (interface == QIviWindowControl_iid)
return testBackend();
@@ -257,23 +261,40 @@ private:
WindowControlTestBackend *m_backend;
};
-class WindowControlInvalidServiceObject : public QIviServiceObject {
+class InvalidInterface : public QIviFeatureInterface
+{
+ Q_OBJECT
+
+public:
+ InvalidInterface(QObject *parent)
+ : QIviFeatureInterface(parent)
+ {}
+
+ void initialize() override
+ {
+ emit initializationDone();
+ }
+};
+
+class WindowControlInvalidServiceObject : public QIviServiceObject
+{
+ Q_OBJECT
public:
- explicit WindowControlInvalidServiceObject(QObject *parent=0) :
- QIviServiceObject(parent), m_name(QLatin1String("")), m_dummyBackend(new QObject(this))
+ explicit WindowControlInvalidServiceObject(QObject *parent = nullptr) :
+ QIviServiceObject(parent), m_name(QLatin1String("")), m_dummyBackend(new InvalidInterface(this))
{
m_interfaces << QIviWindowControl_iid;
}
QString name() const { return m_name; }
QStringList interfaces() const { return m_interfaces; }
- QObject *interfaceInstance(const QString& ) const { return m_dummyBackend; }
+ QIviFeatureInterface *interfaceInstance(const QString& ) const { return m_dummyBackend; }
private:
QString m_name;
QStringList m_interfaces;
- QObject *m_dummyBackend;
+ QIviFeatureInterface *m_dummyBackend;
};
class WindowControlTest : public QObject
@@ -360,7 +381,7 @@ void WindowControlTest::testClearServiceObject()
QIviWindowControl *zone = qobject_cast<QIviWindowControl*>(wc.zoneAt("FrontLeft"));
QVERIFY(zone);
QCOMPARE(zone->heaterMode(), QIviWindowControl::HeaterOn);
- wc.setServiceObject(0);
+ wc.setServiceObject(nullptr);
QVERIFY(!wc.zoneAt("FrontLeft"));
}