Merge lp:~sergiusens/camera-app/click into lp:camera-app

Proposed by Sergio Schvezov
Status: Merged
Approved by: Gustavo Pichorim Boiko
Approved revision: 194
Merged at revision: 201
Proposed branch: lp:~sergiusens/camera-app/click
Merge into: lp:camera-app
Diff against target: 282 lines (+119/-16)
11 files modified
CMakeLists.txt (+20/-3)
CameraApp/CMakeLists.txt (+9/-8)
README.click (+15/-0)
camera-app.desktop.in (+1/-1)
cameraapplication.cpp (+6/-1)
click/CMakeLists.txt (+10/-0)
click/camera-apparmor.json (+7/-0)
click/manifest.json.in (+21/-0)
config.h.in (+20/-1)
tests/autopilot/CMakeLists.txt (+2/-1)
tests/autopilot/camera_app/tests/__init__.py (+8/-1)
To merge this branch: bzr merge lp:~sergiusens/camera-app/click
Reviewer Review Type Date Requested Status
Gustavo Pichorim Boiko (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+187800@code.launchpad.net

Commit message

Click build support

Description of the change

Still requires a security policy for user metrics input, but aside from that is ok.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Gustavo Pichorim Boiko (boiko) wrote :

201 + static bool click = (QString("@CLICK_MODE@") != QString("off"));

This is not reliable: cmake accepts also uppercase ON/OFF, and also lower and upper case true/false as arguments for enabling/disabling the arguments.

For instance, if I don't set CLICK_MODE to anything, the value will already be different:
static bool click = (QString("OFF") != QString("off"))

Can you set the value of another variable in CMakeLists.txt to some value depending on whether CLICK_MODE is enabled or disabled?

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
lp:~sergiusens/camera-app/click updated
192. By Sergio Schvezov

use a fixed tag for config.h

193. By Sergio Schvezov

Adding a hack to detect if installed and default to click/confined.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Gustavo Pichorim Boiko (boiko) wrote :

106 +pkcon install-local com.ubuntu.notes_*.click

It should probably read com.ubuntu.camera_

review: Needs Fixing
lp:~sergiusens/camera-app/click updated
194. By Sergio Schvezov

Copy paste typo fix

Revision history for this message
Gustavo Pichorim Boiko (boiko) wrote :

Looks good now!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2013-09-23 12:40:33 +0000
+++ CMakeLists.txt 2013-09-26 21:51:29 +0000
@@ -15,7 +15,23 @@
15# Standard install paths15# Standard install paths
16include(GNUInstallDirs)16include(GNUInstallDirs)
1717
18set(CAMERA_APP_DIR ${CMAKE_INSTALL_DATADIR}/camera-app)18option(INSTALL_TESTS "Install the tests on make install" on)
19option(CLICK_MODE "Installs to a contained location" off)
20
21if(CLICK_MODE)
22 set(CAMERA_APP camera)
23 set(CMAKE_INSTALL_PREFIX /)
24 set(CAMERA_APP_DIR /)
25 set(CMAKE_INSTALL_BINDIR /)
26 set(PLUGIN_BASE lib/${CMAKE_LIBRARY_ARCHITECTURE})
27 set(PLUGIN_DIR ${PLUGIN_BASE}/CameraApp)
28 set(DESKTOP_EXEC "./${CAMERA_APP}")
29 set(CLICK_TAG click)
30else(CLICK_MODE)
31 set(CAMERA_APP camera-app)
32 set(CAMERA_APP_DIR ${CMAKE_INSTALL_DATADIR}/${CAMERA_APP})
33 set(DESKTOP_EXEC ${CAMERA_APP})
34endif(CLICK_MODE)
1935
20configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h @ONLY)36configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h @ONLY)
2137
@@ -27,8 +43,6 @@
27 ${Qt5Multimedia_INCLUDE_DIRS}43 ${Qt5Multimedia_INCLUDE_DIRS}
28 )44 )
2945
30set(CAMERA_APP camera-app)
31
32set(camera_app_HDRS46set(camera_app_HDRS
33 cameraapplication.h)47 cameraapplication.h)
3448
@@ -74,6 +88,8 @@
74file(STRINGS ${DESKTOP_FILE}.in DESKTOP_FILE_CONTENTS)88file(STRINGS ${DESKTOP_FILE}.in DESKTOP_FILE_CONTENTS)
75foreach(LINE ${DESKTOP_FILE_CONTENTS})89foreach(LINE ${DESKTOP_FILE_CONTENTS})
76 string(REGEX REPLACE "tr\\\(\"(.*)\"\\\)" "\\1" LINE "${LINE}")90 string(REGEX REPLACE "tr\\\(\"(.*)\"\\\)" "\\1" LINE "${LINE}")
91 string(REGEX REPLACE "\@DESKTOP_EXEC\@"
92 "${DESKTOP_EXEC}" LINE "${LINE}")
77 file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_FILE} "${LINE}\n")93 file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/${DESKTOP_FILE} "${LINE}\n")
78endforeach(LINE)94endforeach(LINE)
7995
@@ -82,6 +98,7 @@
82 )98 )
8399
84add_subdirectory(CameraApp)100add_subdirectory(CameraApp)
101add_subdirectory(click)
85102
86file(GLOB_RECURSE I18N_SRC_FILES103file(GLOB_RECURSE I18N_SRC_FILES
87 RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}104 RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
88105
=== modified file 'CameraApp/CMakeLists.txt'
--- CameraApp/CMakeLists.txt 2013-01-18 16:09:32 +0000
+++ CameraApp/CMakeLists.txt 2013-09-26 21:51:29 +0000
@@ -20,18 +20,19 @@
2020
2121
22# Qt5's cmake does not export QT_IMPORTS_DIR, lets query qmake on our own for now22# Qt5's cmake does not export QT_IMPORTS_DIR, lets query qmake on our own for now
23if(NOT CLICK_MODE)
23get_target_property(QMAKE_EXECUTABLE Qt5::qmake LOCATION) 24get_target_property(QMAKE_EXECUTABLE Qt5::qmake LOCATION)
24function(QUERY_QMAKE VAR RESULT) 25 function(QUERY_QMAKE VAR RESULT)
25 exec_program(${QMAKE_EXECUTABLE} ARGS "-query ${VAR}" RETURN_VALUE return_code OUTPUT_VARIABLE output ) 26 exec_program(${QMAKE_EXECUTABLE} ARGS "-query ${VAR}" RETURN_VALUE return_code OUTPUT_VARIABLE output )
26 if(NOT return_code) 27 if(NOT return_code)
27 file(TO_CMAKE_PATH "${output}" output) 28 file(TO_CMAKE_PATH "${output}" output)
28 set(${RESULT} ${output} PARENT_SCOPE) 29 set(${RESULT} ${output} PARENT_SCOPE)
29 endif(NOT return_code) 30 endif(NOT return_code)
30endfunction(QUERY_QMAKE) 31endfunction(QUERY_QMAKE)
31query_qmake(QT_INSTALL_QML QT_IMPORTS_DIR)32query_qmake(QT_INSTALL_QML QT_IMPORTS_DIR)
32
33
34set(PLUGIN_DIR ${QT_IMPORTS_DIR}/CameraApp)33set(PLUGIN_DIR ${QT_IMPORTS_DIR}/CameraApp)
34endif(NOT CLICK_MODE)
35
35install(TARGETS camera-qml DESTINATION ${PLUGIN_DIR})36install(TARGETS camera-qml DESTINATION ${PLUGIN_DIR})
36install(FILES qmldir DESTINATION ${PLUGIN_DIR})37install(FILES qmldir DESTINATION ${PLUGIN_DIR})
3738
3839
=== added file 'README.click'
--- README.click 1970-01-01 00:00:00 +0000
+++ README.click 2013-09-26 21:51:29 +0000
@@ -0,0 +1,15 @@
1Building for click
2==================
3
4To build for a click package configure cmake as:
5
6mkdir build
7cd build
8cmake [path_to_this_location] -DINSTALL_TESTS=off -DCLICK_MODE=on \
9 -DBZR_REVNO=$(cd [path_to_this_location]; bzr revno)
10make DESTDIR=package install
11click build package
12
13This package can be installed by running:
14
15pkcon install-local com.ubuntu.camera_*.click
016
=== modified file 'camera-app.desktop.in'
--- camera-app.desktop.in 2013-06-11 16:05:35 +0000
+++ camera-app.desktop.in 2013-09-26 21:51:29 +0000
@@ -3,7 +3,7 @@
3Name=tr("Camera")3Name=tr("Camera")
4GenericName=camera-app4GenericName=camera-app
5Comment=tr("Camera application")5Comment=tr("Camera application")
6Exec=camera-app --fullscreen %u6Exec=@DESKTOP_EXEC@ --fullscreen %u
7Terminal=false7Terminal=false
8Icon=camera-app8Icon=camera-app
9#MimeType=x-scheme-handler/contact;x-scheme-handler/call9#MimeType=x-scheme-handler/contact;x-scheme-handler/call
1010
=== modified file 'cameraapplication.cpp'
--- cameraapplication.cpp 2013-09-23 12:40:33 +0000
+++ cameraapplication.cpp 2013-09-26 21:51:29 +0000
@@ -76,8 +76,13 @@
76 m_view->setTitle("Camera");76 m_view->setTitle("Camera");
77 m_view->rootContext()->setContextProperty("application", this);77 m_view->rootContext()->setContextProperty("application", this);
78 m_view->engine()->setBaseUrl(QUrl::fromLocalFile(cameraAppDirectory()));78 m_view->engine()->setBaseUrl(QUrl::fromLocalFile(cameraAppDirectory()));
79 if (isClick()) {
80 m_view->engine()->addImportPath(cameraAppImportDirectory());
81 qDebug() << "Import path added" << cameraAppImportDirectory();
82 }
83 qDebug() << "Camera app directory" << cameraAppDirectory();
79 QObject::connect(m_view->engine(), SIGNAL(quit()), this, SLOT(quit()));84 QObject::connect(m_view->engine(), SIGNAL(quit()), this, SLOT(quit()));
80 m_view->setSource(QUrl::fromLocalFile("camera-app.qml"));85 m_view->setSource(QUrl::fromLocalFile(sourceQml()));
81 if (arguments().contains(QLatin1String("--fullscreen"))) m_view->showFullScreen();86 if (arguments().contains(QLatin1String("--fullscreen"))) m_view->showFullScreen();
82 else m_view->show();87 else m_view->show();
8388
8489
=== added directory 'click'
=== added file 'click/CMakeLists.txt'
--- click/CMakeLists.txt 1970-01-01 00:00:00 +0000
+++ click/CMakeLists.txt 2013-09-26 21:51:29 +0000
@@ -0,0 +1,10 @@
1if(CLICK_MODE)
2 if(NOT BZR_REVNO)
3 set(BZR_REVNO "latest")
4 endif(NOT BZR_REVNO)
5 configure_file(manifest.json.in ${CMAKE_CURRENT_BINARY_DIR}/manifest.json)
6 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/manifest.json
7 DESTINATION ${CMAKE_INSTALL_PREFIX})
8 install(FILES camera-apparmor.json
9 DESTINATION ${CMAKE_INSTALL_PREFIX})
10endif(CLICK_MODE)
011
=== added file 'click/camera-apparmor.json'
--- click/camera-apparmor.json 1970-01-01 00:00:00 +0000
+++ click/camera-apparmor.json 2013-09-26 21:51:29 +0000
@@ -0,0 +1,7 @@
1{
2 "policy_groups": ["picture_files",
3 "camera",
4 "audio"
5 ],
6 "policy_version": 1.0
7}
08
=== added file 'click/manifest.json.in'
--- click/manifest.json.in 1970-01-01 00:00:00 +0000
+++ click/manifest.json.in 2013-09-26 21:51:29 +0000
@@ -0,0 +1,21 @@
1{
2 "description":
3 "An application to take pictures and videos with the device cameras",
4 "framework": "ubuntu-sdk-13.10",
5 "architecture": "armhf",
6 "hooks": {
7 "camera": {
8 "apparmor": "camera-apparmor.json",
9 "desktop": "@CMAKE_INSTALL_DATADIR@/applications/@DESKTOP_FILE@"
10 }
11 },
12 "icon": "camera-app",
13 "maintainer": "Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>",
14 "name": "com.ubuntu.camera",
15 "title": "Camera",
16 "version": "2.9.1",
17 "x-source": {
18 "vcs-bzr": "lp:camera-app",
19 "vcs-bzr-revno": "@BZR_REVNO@"
20 }
21}
022
=== modified file 'config.h.in'
--- config.h.in 2012-10-30 15:48:34 +0000
+++ config.h.in 2013-09-26 21:51:29 +0000
@@ -21,6 +21,11 @@
21#include <QtCore/QCoreApplication>21#include <QtCore/QCoreApplication>
22#include <QtCore/QDir>22#include <QtCore/QDir>
2323
24inline bool isClick() {
25 static bool click = (QString("@CLICK_TAG@") == QString("click"));
26 return click;
27}
28
24inline bool isRunningInstalled() {29inline bool isRunningInstalled() {
25 static bool installed = (QCoreApplication::applicationDirPath() ==30 static bool installed = (QCoreApplication::applicationDirPath() ==
26 QDir(("@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@")).canonicalPath());31 QDir(("@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@")).canonicalPath());
@@ -28,10 +33,24 @@
28}33}
2934
30inline QString cameraAppDirectory() {35inline QString cameraAppDirectory() {
31 if (isRunningInstalled()) {36 if (isClick()) {
37 return QDir::currentPath();
38 } else if (isRunningInstalled()) {
32 return QString("@CMAKE_INSTALL_PREFIX@/@CAMERA_APP_DIR@/");39 return QString("@CMAKE_INSTALL_PREFIX@/@CAMERA_APP_DIR@/");
33 } else {40 } else {
34 return QString("@CMAKE_SOURCE_DIR@/");41 return QString("@CMAKE_SOURCE_DIR@/");
35 }42 }
36}43}
3744
45inline QString cameraAppImportDirectory() {
46 return QDir::currentPath() + "/@PLUGIN_BASE@";
47}
48
49inline QString sourceQml() {
50 static QString qmlFile("camera-app.qml");
51 if (isClick()) {
52 return QDir::currentPath() + "/" + qmlFile;
53 } else {
54 return qmlFile;
55 }
56}
3857
=== modified file 'tests/autopilot/CMakeLists.txt'
--- tests/autopilot/CMakeLists.txt 2013-01-08 13:44:38 +0000
+++ tests/autopilot/CMakeLists.txt 2013-09-26 21:51:29 +0000
@@ -3,7 +3,8 @@
3execute_process(COMMAND python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"3execute_process(COMMAND python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"
4 OUTPUT_VARIABLE PYTHON_PACKAGE_DIR OUTPUT_STRIP_TRAILING_WHITESPACE)4 OUTPUT_VARIABLE PYTHON_PACKAGE_DIR OUTPUT_STRIP_TRAILING_WHITESPACE)
55
6if(INSTALL_TESTS)
6install(DIRECTORY ${AUTOPILOT_DIR}7install(DIRECTORY ${AUTOPILOT_DIR}
7 DESTINATION ${PYTHON_PACKAGE_DIR}8 DESTINATION ${PYTHON_PACKAGE_DIR}
8 )9 )
910endif(INSTALL_TESTS)
1011
=== modified file 'tests/autopilot/camera_app/tests/__init__.py'
--- tests/autopilot/camera_app/tests/__init__.py 2013-05-25 07:16:22 +0000
+++ tests/autopilot/camera_app/tests/__init__.py 2013-09-26 21:51:29 +0000
@@ -33,14 +33,17 @@
33 ('with touch', dict(input_device_class=Touch))]33 ('with touch', dict(input_device_class=Touch))]
3434
35 local_location = "../../camera-app"35 local_location = "../../camera-app"
36 deb_location = '/usr/bin/camera-app'
3637
37 def setUp(self):38 def setUp(self):
38 self.pointing_device = Pointer(self.input_device_class.create())39 self.pointing_device = Pointer(self.input_device_class.create())
39 super(CameraAppTestCase, self).setUp()40 super(CameraAppTestCase, self).setUp()
40 if os.path.exists(self.local_location):41 if os.path.exists(self.local_location):
41 self.launch_test_local()42 self.launch_test_local()
42 else:43 elif os.path.exists(self.deb_location):
43 self.launch_test_installed()44 self.launch_test_installed()
45 else:
46 self.launch_click_installed()
4447
45 def launch_test_local(self):48 def launch_test_local(self):
46 self.app = self.launch_test_application(49 self.app = self.launch_test_application(
@@ -57,6 +60,10 @@
57 "--desktop_file_hint=/usr/share/applications/camera-app.desktop",60 "--desktop_file_hint=/usr/share/applications/camera-app.desktop",
58 app_type='qt')61 app_type='qt')
5962
63 def launch_click_installed(self):
64 self.app = self.launch_click_package(
65 "com.ubuntu.camera")
66
60 def get_center(self, object_proxy):67 def get_center(self, object_proxy):
61 x, y, w, h = object_proxy.globalRect68 x, y, w, h = object_proxy.globalRect
62 return [x + (w / 2), y + (h / 2)]69 return [x + (w / 2), y + (h / 2)]

Subscribers

People subscribed via source and target branches