summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzheng_wenlong <wenlong_zheng@nexty-ele.com>2018-11-21 11:05:40 +0900
committerzheng_wenlong <wenlong_zheng@nexty-ele.com>2018-11-21 11:05:40 +0900
commit5b530ac0e2ec4abe54a2c64274b36b480ed13e25 (patch)
tree21124b5c278b097c13d71b08d59816d2ccad2d96
parentca756b3f04bb2cb89e0f1f19e197dfa6a809be8d (diff)
-rw-r--r--app/CameraControl.qml35
-rw-r--r--app/app.pro2
-rw-r--r--app/main.cpp13
-rw-r--r--app/main.qml26
-rw-r--r--package/config.xml6
-rw-r--r--package/package.pro2
-rw-r--r--sample/camera_git.bb (renamed from sample/camapp_git.bb)7
7 files changed, 55 insertions, 36 deletions
diff --git a/app/CameraControl.qml b/app/CameraControl.qml
index 4e0b94d..eb9b6af 100644
--- a/app/CameraControl.qml
+++ b/app/CameraControl.qml
@@ -20,10 +20,10 @@ import QtQuick.Controls 2.0
RowLayout {
property var device
- property var listWH
+ property var ratio: 4/3
property var number: []
property var fps: ["10", "20", "30", "40", "50", "60"]
- property var resolution: listWH ? ["320*240", "640*480", "1280*720", "1920*1080"] : ["320*240"]
+ property var resolution: ["320*240", "640*480", "1280*720", "1920*1080"]
property var models: [number, fps, resolution]
property real back: 1
property bool switchstatus: true
@@ -31,7 +31,7 @@ RowLayout {
Repeater {
id: info
- model: ["No.:", "FPS:", "W*H:"]
+ model: ["No:", "FPS:", "W*H:"]
delegate: RowLayout{
Label {
id: label
@@ -107,6 +107,29 @@ RowLayout {
}
background: Image { source: "images/camera/camerainfo_bg.svg" }
+ onCurrentIndexChanged:
+ if(cameraswitch.checked && device){
+ var dNo = info.itemAt(0).children[1].currentText
+ var dFps = info.itemAt(1).children[1].currentText
+ var dRes = info.itemAt(2).children[1].currentText
+ if (index === 0){
+ dNo = number[listview.currentIndex]
+ }
+ if (index === 1){
+ dFps = fps[listview.currentIndex]
+ }
+ if (index === 2){
+ dRes = resolution[listview.currentIndex]
+ if(listview.currentIndex === 0 || listview.currentIndex === 1){
+ ratio = 4/3
+ }
+ else{
+ ratio = 16/9
+ }
+ }
+ device.stop()
+ device.start(dNo, dFps, dRes)
+ }
}
}
}
@@ -115,6 +138,12 @@ RowLayout {
enabled: switchstatus
checked: switchChecked
onCheckedChanged: {
+ if (info.itemAt(2).children[1].currentText === "320*240" || info.itemAt(2).children[1].currentText === "640*480"){
+ ratio = 4/3
+ }
+ else{
+ ratio = 16/9
+ }
if (checked && device){
device.start(info.itemAt(0).children[1].currentText, info.itemAt(1).children[1].currentText, info.itemAt(2).children[1].currentText)
}else if (!checked && device){
diff --git a/app/app.pro b/app/app.pro
index b9d7bc5..8dfa093 100644
--- a/app/app.pro
+++ b/app/app.pro
@@ -1,4 +1,4 @@
-TARGET = camapp
+TARGET = camera
QT = quickcontrols2
equals(QT_ARCH, "arm") {
diff --git a/app/main.cpp b/app/main.cpp
index 6fd928d..c92f251 100644
--- a/app/main.cpp
+++ b/app/main.cpp
@@ -37,7 +37,7 @@
int main(int argc, char *argv[])
{
- QString myname = QString("camapp");
+ QString myname = QString("camera");
QGuiApplication app(argc, argv);
app.setApplicationName(myname);
@@ -101,16 +101,7 @@ int main(int argc, char *argv[])
hs->init(port, token.c_str());
// Set the event handler for Event_TapShortcut which will activate the surface for windowmanager
hs->set_event_handler(LibHomeScreen::Event_TapShortcut, [qwm, myname](json_object *object){
- json_object *appnameJ = nullptr;
- if(json_object_object_get_ex(object, "application_name", &appnameJ))
- {
- const char *appname = json_object_get_string(appnameJ);
- if(QString::compare(myname, appname, Qt::CaseInsensitive) == 0)
- {
- qDebug("Surface %s got tapShortcut\n", appname);
- qwm->activateSurface(myname);
- }
- }
+ qwm->activateSurface(myname);
});
#endif
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
diff --git a/app/main.qml b/app/main.qml
index 9710c99..0641efe 100644
--- a/app/main.qml
+++ b/app/main.qml
@@ -26,19 +26,12 @@ ApplicationWindow {
width: 1920
height: 720
- CameraControl {
- id:cameracontrol
- listWH: true
- device: camdev_device
- width: root.width
- height:80
- }
-
Camera {
id: camdev_device
- width: root.width
- height: root.height - cameracontrol.height
- anchors.top: cameracontrol.bottom
+ anchors.horizontalCenter: parent.horizontalCenter
+ width: height * cameracontrol.ratio
+ height: root.height
+ anchors.top: parent.top
onIsrunningChanged: {
camerabg.visible = !isrunning
}
@@ -52,8 +45,17 @@ ApplicationWindow {
}
}
+ CameraControl {
+ id:cameracontrol
+ anchors.horizontalCenter: parent.horizontalCenter
+ ratio: 4/3
+ device: camdev_device
+ width: camdev_device.width
+ height:80
+ }
+
function changeVisible(visible) {
- console.log("camapp visible is " + visible)
+ console.log("camera visible is " + visible)
cameracontrol.switchChecked = visible
}
}
diff --git a/package/config.xml b/package/config.xml
index 6582fda..7be9cda 100644
--- a/package/config.xml
+++ b/package/config.xml
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
-<widget xmlns="http://www.w3.org/ns/widgets" id="camapp" version="0.1">
- <name>camapp</name>
+<widget xmlns="http://www.w3.org/ns/widgets" id="camera" version="0.1">
+ <name>camera</name>
<icon src="icon.svg"/>
- <content src="bin/camapp" type="application/vnd.agl.native"/>
+ <content src="bin/camera" type="application/vnd.agl.native"/>
<description>This is a demo application</description>
<author>TOYOTA</author>
<license>APL 2.0</license>
diff --git a/package/package.pro b/package/package.pro
index d826c11..93c356b 100644
--- a/package/package.pro
+++ b/package/package.pro
@@ -14,6 +14,6 @@ QMAKE_EXTRA_TARGETS += copy_config
PRE_TARGETDEPS += $$copy_config.target
wgt.target = package
-wgt.commands = wgtpkg-pack -f -o camapp.wgt root
+wgt.commands = wgtpkg-pack -f -o camera.wgt root
QMAKE_EXTRA_TARGETS += wgt
diff --git a/sample/camapp_git.bb b/sample/camera_git.bb
index 6dffeab..89f6e2a 100644
--- a/sample/camapp_git.bb
+++ b/sample/camera_git.bb
@@ -6,8 +6,8 @@ SECTION = "apps"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=ae6497158920d9524cf208c09cc4c984"
-SRC_URI = "git://gerrit.automotivelinux.org/gerrit/apps/als-meter-demo;protocol=https;branch=master"
-SRCREV = "9457d3ebf0fd63f63f5d8abdd570868c0298a92f"
+SRC_URI = "git://gerrit.automotivelinux.org/gerrit/apps/als-meter-demo;protocol=https;branch=sandbox/zheng_wenlong/camapp"
+SRCREV = "${AUTOREV}"
PV = "1.0+git${SRCPV}"
S = "${WORKDIR}/git"
@@ -15,7 +15,4 @@ S = "${WORKDIR}/git"
# build-time dependencies
DEPENDS += "qtquickcontrols2 opencv"
-# runtime dependencies
-RDEPENDS_${PN} += "agl-service-steering-wheel"
-
inherit qmake5 aglwgt