[Merge] lp:~fboucault/camera-app/faster_startup into lp:camera-app
Ugo Riboni
ugo.riboni at canonical.com
Wed Aug 27 17:10:42 UTC 2014
Review: Approve
Code is ok and everything works as expected.
Diff comments:
> === modified file 'CircleButton.qml'
> --- CircleButton.qml 2014-06-26 12:37:19 +0000
> +++ CircleButton.qml 2014-08-27 00:46:10 +0000
> @@ -34,6 +34,8 @@
> opacity: button.pressed ? 0.7 : 0.3
> sourceSize.width: width
> sourceSize.height: height
> + cache: true
> + asynchronous: true
> }
>
> Icon {
>
> === modified file 'FocusRing.qml'
> --- FocusRing.qml 2014-06-26 11:47:01 +0000
> +++ FocusRing.qml 2014-08-27 00:46:10 +0000
> @@ -32,6 +32,8 @@
> width: units.gu(11)
> height: units.gu(11)
> source: "assets/focus_ring.png"
> + asynchronous: true
> + cache: false
Why not cache this too ?
>
> opacity: 0.0
> Behavior on opacity { UbuntuNumberAnimation {} }
>
> === added file 'GalleryViewLoader.qml'
> --- GalleryViewLoader.qml 1970-01-01 00:00:00 +0000
> +++ GalleryViewLoader.qml 2014-08-27 00:46:10 +0000
> @@ -0,0 +1,38 @@
> +/*
> + * Copyright 2014 Canonical Ltd.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; version 3.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program. If not, see <http://www.gnu.org/licenses/>.
> + */
> +
> +import QtQuick 2.2
> +
> +Loader {
> + id: loader
> +
> + signal exit
> + property bool inView
> + property bool touchAcquired: loader.item ? loader.item.touchAcquired : false
> +
> + function showLastPhotoTaken() {
> + loader.item.showLastPhotoTaken();
> + }
> +
> + asynchronous: true
> +
> + Component.onCompleted: {
> + loader.setSource("GalleryView.qml", { "inView": Qt.binding(function() { return loader.inView }) });
> + }
> + onLoaded: {
> + loader.item.exit.connect(exit);
> + }
> +}
>
> === added file 'OptionsOverlay.qml'
> --- OptionsOverlay.qml 1970-01-01 00:00:00 +0000
> +++ OptionsOverlay.qml 2014-08-27 00:46:10 +0000
> @@ -0,0 +1,116 @@
> +/*
> + * Copyright 2014 Canonical Ltd.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; version 3.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program. If not, see <http://www.gnu.org/licenses/>.
> + */
> +
> +import QtQuick 2.2
> +import Ubuntu.Components 1.1
> +
> +Item {
> + id: optionsOverlay
> +
> + property list<ListModel> options
> +
> + function closeValueSelector() {
> + optionValueSelector.hide();
> + }
> +
> + height: optionsGrid.height
> +
> + Grid {
> + id: optionsGrid
> + anchors {
> + horizontalCenter: parent.horizontalCenter
> + }
> +
> + columns: 3
> + columnSpacing: units.gu(9.5)
> + rowSpacing: units.gu(9.5)
> +
> + Repeater {
> + model: optionsOverlay.options
> + delegate: OptionButton {
> + id: optionButton
> + model: modelData
> + onClicked: optionValueSelector.toggle(model, optionButton)
> + }
> + }
> + }
> +
> + Column {
> + id: optionValueSelector
> + objectName: "optionValueSelector"
> + anchors {
> + bottom: optionsGrid.top
> + bottomMargin: units.gu(2)
> + }
> + width: units.gu(12)
> +
> + function toggle(model, callerButton) {
> + if (optionValueSelectorVisible && optionsRepeater.model === model) {
> + hide();
> + } else {
> + show(model, callerButton);
> + }
> + }
> +
> + function show(model, callerButton) {
> + alignWith(callerButton);
> + optionsRepeater.model = model;
> + optionValueSelectorVisible = true;
> + }
> +
> + function hide() {
> + optionValueSelectorVisible = false;
> + }
> +
> + function alignWith(item) {
> + // horizontally center optionValueSelector with the center of item
> + // if there is enough space to do so, that is as long as optionValueSelector
> + // does not get cropped by the edge of the screen
> + var itemX = parent.mapFromItem(item, 0, 0).x;
> + var centeredX = itemX + item.width / 2.0 - width / 2.0;
> + var margin = units.gu(1);
> +
> + if (centeredX < margin) {
> + x = itemX;
> + } else if (centeredX + width > item.parent.width - margin) {
> + x = itemX + item.width - width;
> + } else {
> + x = centeredX;
> + }
> + }
> +
> + visible: opacity !== 0.0
> + onVisibleChanged: if (!visible) optionsRepeater.model = null;
> + opacity: optionValueSelectorVisible ? 1.0 : 0.0
> + Behavior on opacity {UbuntuNumberAnimation {duration: UbuntuAnimation.FastDuration}}
> +
> + Repeater {
> + id: optionsRepeater
> +
> + delegate: OptionValueButton {
> + anchors {
> + right: optionValueSelector.right
> + left: optionValueSelector.left
> + }
> + label: model.label
> + iconName: model.icon
> + selected: optionsRepeater.model.selectedIndex == index
> + isLast: index === optionsRepeater.count - 1
> + onClicked: settings[optionsRepeater.model.settingsProperty] = optionsRepeater.model.get(index).value
> + }
> + }
> + }
> +}
>
> === modified file 'ShootButton.qml'
> --- ShootButton.qml 2014-07-02 15:43:31 +0000
> +++ ShootButton.qml 2014-08-27 00:46:10 +0000
> @@ -34,6 +34,7 @@
> Image {
> id: icon
> anchors.centerIn: parent
> + cache: false
> }
>
> states: [
>
> === modified file 'Snapshot.qml'
> --- Snapshot.qml 2014-08-01 15:28:56 +0000
> +++ Snapshot.qml 2014-08-27 00:46:10 +0000
> @@ -45,6 +45,7 @@
> rotation: snapshotRoot.orientation * -1
>
> asynchronous: true
> + cache: false
> fillMode: Image.PreserveAspectFit
> smooth: false
> width: deviceDefaultIsPortrait ? geometry.height : geometry.width
> @@ -62,6 +63,8 @@
> x: (container.width - (rotated ? snapshot.height : snapshot.width)) / 2 - width
> source: "assets/shadow.png"
> fillMode: Image.Stretch
> + asynchronous: true
> + cache: false
> }
> }
>
>
> === modified file 'StopWatch.qml'
> --- StopWatch.qml 2014-07-02 15:43:31 +0000
> +++ StopWatch.qml 2014-08-27 00:46:10 +0000
> @@ -40,6 +40,8 @@
> anchors.fill: parent
> source: "assets/ubuntu_shape.sci"
> opacity: 0.3
> + asynchronous: true
> + cache: false
> }
>
> Row {
>
> === modified file 'ThinSliderStyle.qml'
> --- ThinSliderStyle.qml 2014-06-09 11:47:32 +0000
> +++ ThinSliderStyle.qml 2014-08-27 00:46:10 +0000
> @@ -57,6 +57,8 @@
> }
> source: backgroundImage
> height: sourceSize.height
> + asynchronous: true
> + cache: false
> }
>
> Image {
> @@ -69,5 +71,7 @@
> height: thumbHeight
> anchors.verticalCenter: backgroundShape.verticalCenter
> source: thumbImage
> + asynchronous: true
> + cache: false
> }
> }
>
> === modified file 'ViewFinderExportConfirmation.qml'
> --- ViewFinderExportConfirmation.qml 2014-08-05 15:51:25 +0000
> +++ ViewFinderExportConfirmation.qml 2014-08-27 00:46:10 +0000
> @@ -41,54 +41,62 @@
>
> visible: false
>
> - CircleButton {
> - id: retryButton
> - objectName: "retryButton"
> -
> - anchors {
> - right: validateButton.left
> - rightMargin: units.gu(7.5)
> - bottom: parent.bottom
> - bottomMargin: units.gu(6)
> - }
> -
> - iconName: "reload"
> - onClicked: hide()
> - }
> -
> - CircleButton {
> - id: validateButton
> - objectName: "validateButton"
> -
> - width: units.gu(8)
> - anchors {
> - bottom: parent.bottom
> - bottomMargin: units.gu(5)
> - horizontalCenter: parent.horizontalCenter
> - }
> -
> - iconName: "ok"
> - onClicked: {
> - hide();
> - main.exportContent([mediaPath]);
> - }
> - }
> -
> - CircleButton {
> - id: cancelButton
> - objectName: "cancelButton"
> -
> - anchors {
> - left: validateButton.right
> - leftMargin: units.gu(7.5)
> - bottom: parent.bottom
> - bottomMargin: units.gu(6)
> - }
> -
> - iconName: "close"
> - onClicked: {
> - hide();
> - main.cancelExport();
> + Loader {
> + anchors.fill: parent
> + asynchronous: true
> + sourceComponent: Component {
> + Item {
> + CircleButton {
> + id: retryButton
> + objectName: "retryButton"
> +
> + anchors {
> + right: validateButton.left
> + rightMargin: units.gu(7.5)
> + bottom: parent.bottom
> + bottomMargin: units.gu(6)
> + }
> +
> + iconName: "reload"
> + onClicked: viewFinderExportConfirmation.hide()
> + }
> +
> + CircleButton {
> + id: validateButton
> + objectName: "validateButton"
> +
> + width: units.gu(8)
> + anchors {
> + bottom: parent.bottom
> + bottomMargin: units.gu(5)
> + horizontalCenter: parent.horizontalCenter
> + }
> +
> + iconName: "ok"
> + onClicked: {
> + viewFinderExportConfirmation.hide();
> + main.exportContent([mediaPath]);
> + }
> + }
> +
> + CircleButton {
> + id: cancelButton
> + objectName: "cancelButton"
> +
> + anchors {
> + left: validateButton.right
> + leftMargin: units.gu(7.5)
> + bottom: parent.bottom
> + bottomMargin: units.gu(6)
> + }
> +
> + iconName: "close"
> + onClicked: {
> + viewFinderExportConfirmation.hide();
> + main.cancelExport();
> + }
> + }
> + }
> }
> }
> }
>
> === modified file 'ViewFinderOverlay.qml'
> --- ViewFinderOverlay.qml 2014-08-01 14:54:56 +0000
> +++ ViewFinderOverlay.qml 2014-08-27 00:46:10 +0000
> @@ -91,7 +91,7 @@
> bottom: parent.bottom
> }
> height: units.gu(9)
> - onOpenedChanged: optionValueSelector.hide()
> + onOpenedChanged: optionsOverlayLoader.item.closeValueSelector()
>
> property real progress: (bottomEdge.height - bottomEdge.position) / bottomEdge.height
> property list<ListModel> options: [
> @@ -225,6 +225,7 @@
> sourceSize.width: width
> sourceSize.height: height
> cache: false
> + asynchronous: true
> visible: indicators.visibleChildren.length > 1
> }
>
> @@ -499,99 +500,17 @@
> }
> }
>
> - Item {
> - id: options
> -
> + Loader {
> + id: optionsOverlayLoader
> anchors {
> left: parent.left
> right: parent.right
> top: controls.bottom
> }
> - height: optionsGrid.height
> -
> - Grid {
> - id: optionsGrid
> - anchors {
> - horizontalCenter: parent.horizontalCenter
> - }
> -
> - columns: 3
> - columnSpacing: units.gu(9.5)
> - rowSpacing: units.gu(9.5)
> -
> - Repeater {
> - model: bottomEdge.options
> - delegate: OptionButton {
> - id: optionButton
> - model: modelData
> - onClicked: optionValueSelector.toggle(model, optionButton)
> - }
> - }
> - }
> -
> - Column {
> - id: optionValueSelector
> - objectName: "optionValueSelector"
> - anchors {
> - bottom: optionsGrid.top
> - bottomMargin: units.gu(2)
> - }
> - width: units.gu(12)
> -
> - function toggle(model, callerButton) {
> - if (optionValueSelectorVisible && optionsRepeater.model === model) {
> - hide();
> - } else {
> - show(model, callerButton);
> - }
> - }
> -
> - function show(model, callerButton) {
> - alignWith(callerButton);
> - optionsRepeater.model = model;
> - optionValueSelectorVisible = true;
> - }
> -
> - function hide() {
> - optionValueSelectorVisible = false;
> - }
> -
> - function alignWith(item) {
> - // horizontally center optionValueSelector with the center of item
> - // if there is enough space to do so, that is as long as optionValueSelector
> - // does not get cropped by the edge of the screen
> - var itemX = parent.mapFromItem(item, 0, 0).x;
> - var centeredX = itemX + item.width / 2.0 - width / 2.0;
> - var margin = units.gu(1);
> -
> - if (centeredX < margin) {
> - x = itemX;
> - } else if (centeredX + width > item.parent.width - margin) {
> - x = itemX + item.width - width;
> - } else {
> - x = centeredX;
> - }
> - }
> -
> - visible: opacity !== 0.0
> - onVisibleChanged: if (!visible) optionsRepeater.model = null;
> - opacity: optionValueSelectorVisible ? 1.0 : 0.0
> - Behavior on opacity {UbuntuNumberAnimation {duration: UbuntuAnimation.FastDuration}}
> -
> - Repeater {
> - id: optionsRepeater
> -
> - delegate: OptionValueButton {
> - anchors {
> - right: optionValueSelector.right
> - left: optionValueSelector.left
> - }
> - label: model.label
> - iconName: model.icon
> - selected: optionsRepeater.model.selectedIndex == index
> - isLast: index === optionsRepeater.count - 1
> - onClicked: settings[optionsRepeater.model.settingsProperty] = optionsRepeater.model.get(index).value
> - }
> + asynchronous: true
> + sourceComponent: Component {
> + OptionsOverlay {
> + options: bottomEdge.options
> }
> }
> }
>
> === added file 'ViewFinderOverlayLoader.qml'
> --- ViewFinderOverlayLoader.qml 1970-01-01 00:00:00 +0000
> +++ ViewFinderOverlayLoader.qml 2014-08-27 00:46:10 +0000
> @@ -0,0 +1,34 @@
> +/*
> + * Copyright 2014 Canonical Ltd.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License as published by
> + * the Free Software Foundation; version 3.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program. If not, see <http://www.gnu.org/licenses/>.
> + */
> +
> +import QtQuick 2.2
> +
> +Loader {
> + id: loader
> +
> + property var camera
> + property bool touchAcquired: loader.item ? loader.item.touchAcquired : false
> + property real revealProgress: loader.item ? loader.item.revealProgress : 0
> +
> + function showFocusRing(x, y) {
> + loader.item.showFocusRing(x, y);
> + }
> +
> + asynchronous: true
> + Component.onCompleted: {
> + loader.setSource("ViewFinderOverlay.qml", { "camera": loader.camera });
> + }
> +}
>
> === modified file 'ViewFinderView.qml'
> --- ViewFinderView.qml 2014-08-01 15:28:56 +0000
> +++ ViewFinderView.qml 2014-08-27 00:46:10 +0000
> @@ -274,12 +274,12 @@
> visible: radius !== 0
> }
>
> - ViewFinderOverlay {
> + ViewFinderOverlayLoader {
> id: viewFinderOverlay
>
> anchors.fill: parent
> camera: camera
> - opacity: overlayVisible ? 1.0 : 0.0
> + opacity: status == Loader.Ready && overlayVisible ? 1.0 : 0.0
> Behavior on opacity {UbuntuNumberAnimation {duration: UbuntuAnimation.SnapDuration}}
> }
>
>
> === modified file 'ZoomControl.qml'
> --- ZoomControl.qml 2014-06-09 11:47:32 +0000
> +++ ZoomControl.qml 2014-08-27 00:46:10 +0000
> @@ -51,6 +51,8 @@
> verticalCenter: parent.verticalCenter
> }
> source: "assets/zoom_minus.png"
> + asynchronous: true
> + cache: false
> }
>
> Slider {
> @@ -73,6 +75,8 @@
> verticalCenter: parent.verticalCenter
> }
> source: "assets/zoom_plus.png"
> + asynchronous: true
> + cache: false
> }
> }
>
>
> === modified file 'camera-app.qml'
> --- camera-app.qml 2014-08-11 17:20:01 +0000
> +++ camera-app.qml 2014-08-27 00:46:10 +0000
> @@ -156,7 +156,7 @@
> onVideoShot: galleryView.showLastPhotoTaken();
> }
>
> - GalleryView {
> + GalleryViewLoader {
> id: galleryView
> width: viewSwitcher.width
> height: viewSwitcher.height
>
> === modified file 'main.cpp'
> --- main.cpp 2014-07-29 18:08:21 +0000
> +++ main.cpp 2014-08-27 00:46:10 +0000
> @@ -19,6 +19,7 @@
>
> // Qt
> #include <QGuiApplication>
> +#include <QtQml/QQmlDebuggingEnabler>
>
> // local
> #include "cameraapplication.h"
> @@ -26,6 +27,8 @@
>
> #include <QDebug>
>
> +static QQmlDebuggingEnabler debuggingEnabler(false);
> +
> int main(int argc, char** argv)
> {
> QGuiApplication::setApplicationName("camera");
>
--
https://code.launchpad.net/~fboucault/camera-app/faster_startup/+merge/232340
Your team Ubuntu Phablet Team is subscribed to branch lp:camera-app.
More information about the Ubuntu-reviews
mailing list