From 346d1b3492fcbc26e7bff085b5d480fd7a627911 Mon Sep 17 00:00:00 2001 From: Tasuku Suzuki Date: Fri, 2 Dec 2016 11:37:58 +0900 Subject: [PATCH] sample-qml: load qml from Qt resources embed every assets in the binary and load its contents from there Change-Id: If0ca9342f82ab3ac8badf6bd75755a24001d2da7 Signed-off-by: Tasuku Suzuki --- .../ClimateControl/ClimateControlItem.qml | 13 +++ .../ClimateControl/ClimateControlItem.qmlc | Bin 0 -> 1389 bytes .../dummyimports/Automotive/ClimateControl/qmldir | 1 + sample-qml/main.cpp | 18 +--- sample-qml/qml.qrc | 96 +++++++++++++++++++++ 5 files changed, 113 insertions(+), 15 deletions(-) create mode 100644 sample-qml/dummyimports/Automotive/ClimateControl/ClimateControlItem.qml create mode 100644 sample-qml/dummyimports/Automotive/ClimateControl/ClimateControlItem.qmlc create mode 100644 sample-qml/dummyimports/Automotive/ClimateControl/qmldir diff --git a/sample-qml/dummyimports/Automotive/ClimateControl/ClimateControlItem.qml b/sample-qml/dummyimports/Automotive/ClimateControl/ClimateControlItem.qml new file mode 100644 index 0000000..2688db6 --- /dev/null +++ b/sample-qml/dummyimports/Automotive/ClimateControl/ClimateControlItem.qml @@ -0,0 +1,13 @@ +import QtQuick 2.0 + +QtObject { + property int zone: 0 + property int fanSpeedLevel: 0 + property int targetTemperature: 0 + property bool airConditioning: false + property bool heater: false + property int seatHeater: 0 + property int seatCooler: 0 + property bool airCirculation: false + property int steeringWheelHeater: 0 +} diff --git a/sample-qml/dummyimports/Automotive/ClimateControl/ClimateControlItem.qmlc b/sample-qml/dummyimports/Automotive/ClimateControl/ClimateControlItem.qmlc new file mode 100644 index 0000000000000000000000000000000000000000..9961cdec5a1c350f7089faf82c1396168b52bc82 GIT binary patch literal 1389 zcmaKsOKVe66ovOqn`fg|qyq;+6~vLIl`7)MqF{xBih@o`N#Cu_qw%IxM}qhR1QlnB z1HpmdM9`T~oGD1D;6zYRaiV{qNd4A6xf)V*hjq@~kF)l^>m*rP9-5pg$K{M+xwNgW zejL3VnN`wenYF#IKL6bK{$&0BgKzI1ZET}tJ6N0e_4vi|zCHbo-YT={B=mX z;E{EKguC0$S$CVC#z%)g`3$~<(ivG6Kg*u@Is6=c!k5Qa-^4HA7uxE3@O#?w#g_l~ z1WBxD{ZY~CDV+^c`GYS#HV}c7`gEQvaIRpVBF)s9%ahBK)BK&BIXH9nEb=dfUyT>} zk|me56DjG^$(ex@jZ)IEGnXcpw%%0GDpAA>(Y!zEwi|xcZ%MreKR}w|K5zt#fm`4% zcnV&Fub_`+`x#~|4CI7*r}Gwrrp?==T?uXcZWKRj6SiQ}WMa=~-s@JgDlwV9=rdNv zzhHG@(>7(Jtjl1L+)faaZ`dr6*e~>=AGQG-w4-*ArxNNnsjApDW|Ge88Mmspb}gayqE`kzgZ43Jq}TtmXW-RD shir*ecP-luR_qw_jDsPj5`WA`3XOv*GtQ$y)pK>P3jYfWUgrenderAppToAreaAllowed(appcategory, FULLSCREEN); if(enabled) { - QString target(getenv("AFM_APP_INSTALL_DIR")); - qDebug("AFM_APP_INSTALL_DIR is " + target.toLatin1()); + engine.addImportPath(QStringLiteral(":/imports")); + engine.addImportPath(QStringLiteral(":/dummyimports")); - if(NULL == target) - { - target = "."; - } - - QString load_path; - load_path = target + "/imports"; - engine.addImportPath(load_path); - load_path = target + "/dummyimports"; - engine.addImportPath(load_path); - load_path = target + "/main.qml"; - - engine.load(QUrl(load_path)); + engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); std::vector surfaceIdList; int pid = getpid(); diff --git a/sample-qml/qml.qrc b/sample-qml/qml.qrc index 680a07e..52e2f08 100644 --- a/sample-qml/qml.qrc +++ b/sample-qml/qml.qrc @@ -18,5 +18,101 @@ dummyimports/radio/qmldir dummyimports/com/pelagicore/qmldevinfo/qmldir dummyimports/amb/qmldir + apps/HVAC/models/HVACModel.qml + apps/HVAC/models/qmldir + apps/HVAC/models/TemperatureModel.qml + imports/system/App.qml + imports/system/System.qml + imports/components/AwesomeIcon.qml + imports/components/Box.qml + imports/components/BoxButton.qml + imports/components/BoxHeading.qml + imports/components/Button.qml + imports/components/DateTime.qml + imports/components/HexGrid.qml + imports/components/HexSwitch.qml + imports/components/InsetShadow.qml + imports/components/InShadow.qml + imports/components/Label.qml + imports/components/NumberPad.qml + imports/components/OutShadow.qml + imports/components/Switch.qml + imports/radio/Radio.qml + imports/utils/Marker.qml + imports/utils/Style.qml + imports/vehicle/ClimateModel.qml + imports/vehicle/FuelModel.qml + imports/vehicle/PositionModel.qml + imports/vehicle/SpeedModel.qml + imports/vehicle/TemperatureModel.qml + dummyimports/amb/AutomotivePropertyItem.qml + dummyimports/com/pelagicore/qmldevinfo/DevInfo.qml + dummyimports/radio/Radio.qml + dummyimports/Automotive/ClimateControl/ClimateControlItem.qml + dummyimports/Automotive/ClimateControl/ClimateControlItem.qmlc + dummyimports/Automotive/ClimateControl/qmldir + apps/HVAC/images/defrost_front_off.png + apps/HVAC/images/defrost_front_on.png + apps/HVAC/images/defrost_max_off.png + apps/HVAC/images/defrost_max_on.png + apps/HVAC/images/defrost_rear_off.png + apps/HVAC/images/defrost_rear_on.png + apps/HVAC/images/fan_bar_off.png + apps/HVAC/images/fan_bar_on.png + apps/HVAC/images/fan_control_ac_off.png + apps/HVAC/images/fan_control_ac_on.png + apps/HVAC/images/fan_control_auto_off.png + apps/HVAC/images/fan_control_auto_on.png + apps/HVAC/images/fan_control_circ_off.png + apps/HVAC/images/fan_control_circ_on.png + apps/HVAC/images/fan_dir_down_off.png + apps/HVAC/images/fan_dir_down_on.png + apps/HVAC/images/fan_dir_right_off.png + apps/HVAC/images/fan_dir_right_on.png + apps/HVAC/images/fan_dir_up_off.png + apps/HVAC/images/fan_dir_up_on.png + apps/HVAC/images/fan_icon_off.png + apps/HVAC/images/hazard_blink.png + apps/HVAC/images/hazard_off.png + apps/HVAC/images/hazard_on.png + apps/HVAC/images/left_heat_seat_off.png + apps/HVAC/images/left_heat_seat_on.png + apps/HVAC/images/right_heat_seat_off.png + apps/HVAC/images/right_heat_seat_on.png + apps/HVAC/images/separator.png + apps/HVAC/images/defrost_front_off.svg + apps/HVAC/images/defrost_front_on.svg + apps/HVAC/images/defrost_max_off.svg + apps/HVAC/images/defrost_max_on.svg + apps/HVAC/images/defrost_rear_off.svg + apps/HVAC/images/defrost_rear_on.svg + apps/HVAC/images/drag_knob.svg + apps/HVAC/images/fan_bar_on.svg + apps/HVAC/images/fan_control_ac_off.svg + apps/HVAC/images/fan_control_ac_on.svg + apps/HVAC/images/fan_control_auto_off.svg + apps/HVAC/images/fan_control_auto_on.svg + apps/HVAC/images/fan_control_circ_off.svg + apps/HVAC/images/fan_control_circ_on.svg + apps/HVAC/images/fan_dir_down_off.svg + apps/HVAC/images/fan_dir_down_on.svg + apps/HVAC/images/fan_dir_right_off.svg + apps/HVAC/images/fan_dir_right_on.svg + apps/HVAC/images/fan_dir_up_off.svg + apps/HVAC/images/fan_dir_up_on.svg + apps/HVAC/images/hazard_blink.svg + apps/HVAC/images/hazard_off.svg + apps/HVAC/images/hazard_on.svg + apps/HVAC/images/left_heat_seat_off.svg + apps/HVAC/images/left_heat_seat_on.svg + apps/HVAC/images/left_number_bg.svg + apps/HVAC/images/left_number_cover.svg + apps/HVAC/images/right_heat_seat_off.svg + apps/HVAC/images/right_heat_seat_on.svg + apps/HVAC/images/right_number_bg.svg + apps/HVAC/images/right_number_cover.svg + apps/HVAC/images/static_parts_bg.svg + apps/HVAC/images/temp_bar_on_left.svg + apps/HVAC/images/temp_bar_on_right.svg -- 2.16.6