X-Git-Url: http://cgit.sxemacs.org/?p=harmattan%2Fcameraplus;a=blobdiff_plain;f=qml%2FImageResolutionSettings.qml;h=b968b959465ddafde6716f5598129bacabaa7b2e;hp=671dea3d40d85f59a042a4f91ff2ddf7d18d4b08;hb=695e8f4f85218b41a7f27af281fcebe8238a33b7;hpb=dc79e29f0ef698d33e84856990b9ef99404345a4 diff --git a/qml/ImageResolutionSettings.qml b/qml/ImageResolutionSettings.qml index 671dea3..b968b95 100644 --- a/qml/ImageResolutionSettings.qml +++ b/qml/ImageResolutionSettings.qml @@ -3,7 +3,7 @@ /*! * This file is part of CameraPlus. * - * Copyright (C) 2012 Mohammed Sameer + * Copyright (C) 2012-2013 Mohammed Sameer * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,58 +20,91 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -import QtQuick 1.1 -import com.nokia.meego 1.1 +import QtQuick 2.0 +import QtCamera 1.0 Column { - spacing: 10 + property Camera camera: null - SectionHeader { - text: qsTr("Aspect ratio"); - } + spacing: 10 + + property string __aspectRatio: settings.device == 1 ? + settings.secondaryImageAspectRatio : settings.primaryImageAspectRatio + property string __resolution: settings.device == 1 ? + settings.secondaryImageResolution : settings.primaryImageResolution - ButtonRow { - id: aspectRatioRow - width: parent.width - enabled: cam.idle - exclusive: false + SectionHeader { + text: qsTr("Aspect ratio") + visible: aspectRatioRow.visible + } - Repeater { - model: imageSettings.aspectRatios - delegate: Button { - text: qsTr(modelData); - checked: settings.imageAspectRatio == modelData; - onClicked: settings.imageAspectRatio = modelData; - } + CameraButtonRow { + id: aspectRatioRow + width: parent.width + enabled: camera ? camera.idle : false + exclusive: false + visible: imageSettings.aspectRatioCount > 1 + + Repeater { + model: imageSettings.aspectRatios + delegate: CameraButton { + text: qsTr(modelData) + checked: __aspectRatio == modelData + onClicked: { + if (settings.device == 1) { + settings.secondaryImageAspectRatio = modelData + } else { + settings.primaryImageAspectRatio = modelData + } } + } } + } + + SectionHeader { + text: qsTr("Resolution") + visible: resolutionsRow.visible + } - SectionHeader { - text: qsTr("Resolution"); + CameraButtonRow { + id: resolutionsRow + width: parent.width + enabled: camera ? camera.idle : false + exclusive: false + visible: imageSettings.resolutions.count > 1 + + Binding { + target: imageSettings.resolutions + property: "aspectRatio" + value: settings.primaryImageAspectRatio + when: settings.device == 0 } - ButtonRow { - id: resolutionsRow - width: parent.width - enabled: cam.idle - exclusive: false + Binding { + target: imageSettings.resolutions + property: "aspectRatio" + value: settings.secondaryImageAspectRatio + when: settings.device == 1 + } - Binding { - target: imageSettings.resolutions - property: "aspectRatio" - value: settings.imageAspectRatio - } + Repeater { + id: resolutions - Repeater { - id: resolutions - model: imageSettings.resolutions + model: imageSettings.resolutions.aspectRatio == __aspectRatio ? + imageSettings.resolutions : undefined - delegate: Button { - font.capitalization: Font.Capitalize - text: qsTr("%1 %2 Mpx").arg(resolutionName).arg(megaPixels); - checked: settings.imageResolution == resolutionName - onClicked: settings.imageResolution = resolutionName; - } + delegate: CameraButton { + capitalize: true + text: qsTr("%1 %2 Mpx").arg(resolutionName).arg(megaPixels) + checked: __resolution == resolutionName + onClicked: { + if (settings.device == 1) { + settings.secondaryImageResolution = resolutionName + } else { + settings.primaryImageResolution = resolutionName + } } + } } + } }