From 753c35e2003b96175ccb40b9dfb709d20b620c72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antti=20H=C3=B6ltt=C3=A4?= Date: Thu, 26 Apr 2018 13:02:59 +0200 Subject: Change the example walkthroughs to include code from files Use qdoc \snippet instead of hard coded snippets in the QtIvi core example walkthroughs Task-number: AUTOSUITE-278 Change-Id: Icd966aeb53805d7b0009db490d5c462c22d75bf8 Reviewed-by: Dominik Holland --- .../backend_simulator/backend_simulator.pro | 18 ++++++++++-------- examples/ivicore/qface-ivi-climate/demo/main.qml | 3 +++ .../ivicore/qface-ivi-climate/frontend/frontend.pro | 10 +++++----- .../qface-ivi-remote/backend_qtro/backend_qtro.pro | 18 ++++++++++-------- examples/ivicore/qface-ivi-remote/demo/main.qml | 7 ++++++- .../ivicore/qface-ivi-remote/example-ivi-remote.qface | 5 ++++- .../ivicore/qface-ivi-remote/frontend/frontend.pro | 10 +++++----- examples/ivicore/qface-ivi-remote/server_qtro/main.cpp | 3 ++- .../qface-ivi-remote/server_qtro/processingservice.cpp | 3 ++- .../qface-ivi-remote/server_qtro/processingservice.h | 4 ++-- .../qface-ivi-remote/server_qtro/server_qtro.pro | 7 ++++--- 11 files changed, 53 insertions(+), 35 deletions(-) (limited to 'examples') diff --git a/examples/ivicore/qface-ivi-climate/backend_simulator/backend_simulator.pro b/examples/ivicore/qface-ivi-climate/backend_simulator/backend_simulator.pro index 4f13532..53dd135 100644 --- a/examples/ivicore/qface-ivi-climate/backend_simulator/backend_simulator.pro +++ b/examples/ivicore/qface-ivi-climate/backend_simulator/backend_simulator.pro @@ -1,25 +1,27 @@ TEMPLATE=lib TARGET = $$qtLibraryTarget(example_ivi_climate) -CONFIG += ivigenerator plugin macos: CONFIG += debug_and_release build_all QT_FOR_CONFIG += ivicore !qtConfig(ivigenerator): error("No ivigenerator available") LIBS += -L$$OUT_PWD/../ -l$$qtLibraryTarget(QtIviClimateExample) +#! [0] DESTDIR = ../qtivi - +#! [0] CONFIG += warn_off +#! [1] INCLUDEPATH += $$OUT_PWD/../frontend -PLUGIN_TYPE = qtivi -PLUGIN_EXTENDS = qtivi -PLUGIN_CLASS_NAME = ClimatePlugin - +#! [1] QT += core ivicore - +#! [2] +CONFIG += ivigenerator plugin QFACE_FORMAT = backend_simulator QFACE_SOURCES = ../example-ivi-climate.qface - +PLUGIN_TYPE = qtivi +PLUGIN_EXTENDS = qtivi +PLUGIN_CLASS_NAME = ClimatePlugin +#! [2] CONFIG += install_ok # Do not cargo-cult this! target.path = $$[QT_INSTALL_EXAMPLES]/ivicore/qface-ivi-climate/qtivi/ INSTALLS += target diff --git a/examples/ivicore/qface-ivi-climate/demo/main.qml b/examples/ivicore/qface-ivi-climate/demo/main.qml index 6d6b543..6dab041 100644 --- a/examples/ivicore/qface-ivi-climate/demo/main.qml +++ b/examples/ivicore/qface-ivi-climate/demo/main.qml @@ -52,9 +52,11 @@ import QtQuick 2.7 import QtQuick.Window 2.2 +//! [0] import IviClimate 1.0 Window { + visible: true width: 640 height: 480 @@ -71,6 +73,7 @@ Window { Text { text: "Air Conditioning: " + climateCtrl.airConditioning } +//! [0] Text { text: "Heater: " + climateCtrl.heater } diff --git a/examples/ivicore/qface-ivi-climate/frontend/frontend.pro b/examples/ivicore/qface-ivi-climate/frontend/frontend.pro index 7ebda2f..fb07a8a 100644 --- a/examples/ivicore/qface-ivi-climate/frontend/frontend.pro +++ b/examples/ivicore/qface-ivi-climate/frontend/frontend.pro @@ -1,18 +1,18 @@ TARGET = $$qtLibraryTarget(QtIviClimateExample) TEMPLATE = lib -CONFIG += ivigenerator DESTDIR = .. macos: CONFIG += debug_and_release build_all - +#! [0] QT_FOR_CONFIG += ivicore !qtConfig(ivigenerator): error("No ivigenerator available") - +#! [0] QT += ivicore ivicore-private qml quick DEFINES += QT_BUILD_CLIMATE_LIB - +#! [1] +CONFIG += ivigenerator QFACE_SOURCES = ../example-ivi-climate.qface - +#! [1] CONFIG += install_ok # Do not cargo-cult this! target.path = $$[QT_INSTALL_EXAMPLES]/ivicore/qface-ivi-climate INSTALLS += target diff --git a/examples/ivicore/qface-ivi-remote/backend_qtro/backend_qtro.pro b/examples/ivicore/qface-ivi-remote/backend_qtro/backend_qtro.pro index 6b7f191..5d790d6 100644 --- a/examples/ivicore/qface-ivi-remote/backend_qtro/backend_qtro.pro +++ b/examples/ivicore/qface-ivi-remote/backend_qtro/backend_qtro.pro @@ -1,25 +1,27 @@ TEMPLATE=lib TARGET = $$qtLibraryTarget(example_ivi_remote) -CONFIG += ivigenerator plugin macos: CONFIG += debug_and_release build_all QT_FOR_CONFIG += ivicore !qtConfig(ivigenerator): error("No ivigenerator available") LIBS += -L$$OUT_PWD/../ -l$$qtLibraryTarget(QtIviRemoteExample) +#! [0] DESTDIR = ../qtivi - +#! [0] CONFIG += warn_off +#! [1] INCLUDEPATH += $$OUT_PWD/../frontend -PLUGIN_TYPE = qtivi -PLUGIN_EXTENDS = qtivi -PLUGIN_CLASS_NAME = RemoteClientPlugin - +#! [1] QT += core ivicore - +#! [2] +CONFIG += ivigenerator plugin QFACE_FORMAT = backend_qtro QFACE_SOURCES = ../example-ivi-remote.qface - +PLUGIN_TYPE = qtivi +PLUGIN_EXTENDS = qtivi +PLUGIN_CLASS_NAME = RemoteClientPlugin +#! [2] CONFIG += install_ok # Do not cargo-cult this! target.path = $$[QT_INSTALL_EXAMPLES]/ivicore/qface-ivi-remote/qtivi/ INSTALLS += target diff --git a/examples/ivicore/qface-ivi-remote/demo/main.qml b/examples/ivicore/qface-ivi-remote/demo/main.qml index a5c6c80..e19f26f 100644 --- a/examples/ivicore/qface-ivi-remote/demo/main.qml +++ b/examples/ivicore/qface-ivi-remote/demo/main.qml @@ -53,6 +53,7 @@ import QtQuick 2.7 import QtQuick.Controls 2.3 import QtQuick.Window 2.2 +//! [0] import IviRemote 1.0 Window { @@ -64,12 +65,14 @@ Window { UiProcessingService { id: processingService } +//! [0] Column { anchors.fill: parent anchors.margins: 10 Row { + //! [1] Button { text: "Process" @@ -81,6 +84,7 @@ Window { resultLabel.text = "failed" } ) } + //! [1] TextField { placeholderText: "text to process" id: inputField @@ -91,7 +95,7 @@ Window { Text { text: "Processing result: " } Text { id: resultLabel } } - + //! [2] Row { Text { text: "Last message: " } Text { @@ -99,5 +103,6 @@ Window { text: processingService.lastMessage } } + //! [2] } } diff --git a/examples/ivicore/qface-ivi-remote/example-ivi-remote.qface b/examples/ivicore/qface-ivi-remote/example-ivi-remote.qface index 444163e..af45423 100644 --- a/examples/ivicore/qface-ivi-remote/example-ivi-remote.qface +++ b/examples/ivicore/qface-ivi-remote/example-ivi-remote.qface @@ -1,12 +1,14 @@ /** * Test module */ +//! [0] module Example.IVI.Remote 1.0; - +//! [0] /** * The ProcessingService provides a QML interface to a service doing * all sorts of heavy processing */ +//! [1] @config: { id: "example.qtivi.ProcessingService/1.0", qml_type: "UiProcessingService" } interface ProcessingService { @@ -14,3 +16,4 @@ interface ProcessingService { int process(string data); } +//! [1] diff --git a/examples/ivicore/qface-ivi-remote/frontend/frontend.pro b/examples/ivicore/qface-ivi-remote/frontend/frontend.pro index 9259b86..20e5207 100644 --- a/examples/ivicore/qface-ivi-remote/frontend/frontend.pro +++ b/examples/ivicore/qface-ivi-remote/frontend/frontend.pro @@ -1,18 +1,18 @@ TARGET = $$qtLibraryTarget(QtIviRemoteExample) TEMPLATE = lib -CONFIG += ivigenerator DESTDIR = .. macos: CONFIG += debug_and_release build_all - +#! [0] QT_FOR_CONFIG += ivicore !qtConfig(ivigenerator): error("No ivigenerator available") - +#! [0] QT += ivicore ivicore-private qml quick DEFINES += QT_BUILD_REMOTE_LIB - +#! [1] +CONFIG += ivigenerator QFACE_SOURCES = ../example-ivi-remote.qface - +#! [1] CONFIG += install_ok # Do not cargo-cult this! target.path = $$[QT_INSTALL_EXAMPLES]/ivicore/qface-ivi-remote INSTALLS += target diff --git a/examples/ivicore/qface-ivi-remote/server_qtro/main.cpp b/examples/ivicore/qface-ivi-remote/server_qtro/main.cpp index 9eb73d4..2c917ab 100644 --- a/examples/ivicore/qface-ivi-remote/server_qtro/main.cpp +++ b/examples/ivicore/qface-ivi-remote/server_qtro/main.cpp @@ -49,7 +49,7 @@ ** SPDX-License-Identifier: BSD-3-Clause ** ****************************************************************************/ - +//! [0] #include #include "processingservice.h" @@ -64,3 +64,4 @@ int main(int argc, char *argv[]) return app.exec(); } +//! [0] diff --git a/examples/ivicore/qface-ivi-remote/server_qtro/processingservice.cpp b/examples/ivicore/qface-ivi-remote/server_qtro/processingservice.cpp index a3f154c..e554ef8 100644 --- a/examples/ivicore/qface-ivi-remote/server_qtro/processingservice.cpp +++ b/examples/ivicore/qface-ivi-remote/server_qtro/processingservice.cpp @@ -51,7 +51,7 @@ ****************************************************************************/ #include "processingservice.h" - +//! [0] ProcessingService::ProcessingService() { setLastMessage("Service online."); @@ -62,3 +62,4 @@ int ProcessingService::process(const QString & data) setLastMessage(QStringLiteral("Processed data \'%1\'").arg(data)); return data.length(); } +//! [0] diff --git a/examples/ivicore/qface-ivi-remote/server_qtro/processingservice.h b/examples/ivicore/qface-ivi-remote/server_qtro/processingservice.h index c7ef6b8..8c7f6b2 100644 --- a/examples/ivicore/qface-ivi-remote/server_qtro/processingservice.h +++ b/examples/ivicore/qface-ivi-remote/server_qtro/processingservice.h @@ -52,7 +52,7 @@ #ifndef PROCESSINGSERVICE_H #define PROCESSINGSERVICE_H - +//! [0] #include "rep_processingservice_source.h" class ProcessingService : public ProcessingServiceSimpleSource @@ -62,5 +62,5 @@ public: int process(const QString & data) override; }; - +//! [0] #endif // PROCESSINGSERVICE_H diff --git a/examples/ivicore/qface-ivi-remote/server_qtro/server_qtro.pro b/examples/ivicore/qface-ivi-remote/server_qtro/server_qtro.pro index 145872e..69b7e62 100644 --- a/examples/ivicore/qface-ivi-remote/server_qtro/server_qtro.pro +++ b/examples/ivicore/qface-ivi-remote/server_qtro/server_qtro.pro @@ -1,8 +1,9 @@ TARGET = qface-ivi-remote-server +#! [0] TEMPLATE = app - QT -= gui CONFIG += c++11 ivigenerator +#! [0] CONFIG -= app_bundle DESTDIR = ../ @@ -13,10 +14,10 @@ SOURCES += main.cpp \ processingservice.cpp QMAKE_RPATHDIR += $ORIGIN - +#! [1] QFACE_FORMAT = server_qtro QFACE_SOURCES = ../example-ivi-remote.qface - +#! [1] # Additional import path used to resolve QML modules in Qt Creator's code model QML_IMPORT_PATH = -- cgit v1.2.1