From: Tasuku Suzuki Date: Fri, 2 Dec 2016 02:37:58 +0000 (+0900) Subject: sample-qml: load qml from Qt resources X-Git-Tag: 3.0.0~47 X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?p=staging%2FHomeScreen.git;a=commitdiff_plain;h=346d1b3492fcbc26e7bff085b5d480fd7a627911 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 --- 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 0000000..9961cde Binary files /dev/null and b/sample-qml/dummyimports/Automotive/ClimateControl/ClimateControlItem.qmlc differ diff --git a/sample-qml/dummyimports/Automotive/ClimateControl/qmldir b/sample-qml/dummyimports/Automotive/ClimateControl/qmldir new file mode 100644 index 0000000..8a44272 --- /dev/null +++ b/sample-qml/dummyimports/Automotive/ClimateControl/qmldir @@ -0,0 +1 @@ +ClimateControlItem 1.0 ClimateControlItem.qml diff --git a/sample-qml/main.cpp b/sample-qml/main.cpp index 9238a9b..670decc 100644 --- a/sample-qml/main.cpp +++ b/sample-qml/main.cpp @@ -30,22 +30,10 @@ int main(int argc, char *argv[]) enabled = mp_libHomeScreen->renderAppToAreaAllowed(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