/*!
* This file is part of CameraPlus.
*
- * Copyright (C) 2012 Mohammed Sameer <msameer@foolab.org>
+ * Copyright (C) 2012-2013 Mohammed Sameer <msameer@foolab.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-import QtQuick 1.1
-import com.nokia.meego 1.1
-import "ImageSettingsDialog.js" as Util
+import QtQuick 2.0
+import QtCamera 1.0
Column {
- spacing: 10
+ property Camera camera: null
- SectionHeader {
- text: qsTr("Aspect ratio");
- }
+ spacing: 10
- ButtonRow {
- id: aspectRatioRow
- width: parent.width
+ SectionHeader {
+ text: qsTr("Aspect ratio")
+ visible: aspectRatioRow.visible
+ }
- exclusive: false
- onCheckedButtonChanged: {
- // This is needed to initially setup the
- // resolutions buttons
- Util.resetAspectRatio(aspectRatioRow);
- }
+ CameraButtonRow {
+ id: aspectRatioRow
+ width: parent.width
+ enabled: camera ? camera.idle : false
+ exclusive: false
+ visible: imageSettings.aspectRatioCount > 1
- Repeater {
- model: imageSettings.aspectRatios
- delegate: Button {
- property string aspect: modelData;
- text: qsTr(modelData);
- checked: settings.imageAspectRatio == modelData;
- onClicked: Util.setAspectRatio(modelData);
- }
- }
+ Repeater {
+ id: aspectRatios
+ model: imageSettings.aspectRatios
+ delegate: CameraButton {
+ width: aspectRatioRow.width / aspectRatios.count
+ text: qsTr(modelData)
+ checked: settings.imageAspectRatio == modelData
+ onClicked: settings.imageAspectRatio = modelData
+ }
}
+ }
- SectionHeader {
- text: qsTr("Resolution");
- }
+ SectionHeader {
+ text: qsTr("Resolution")
+ visible: resolutionsRow.visible
+ }
- ButtonRow {
- id: resolutionsRow
- width: parent.width
+ CameraButtonRow {
+ id: resolutionsRow
+ width: parent.width
+ enabled: camera ? camera.idle : false
+ exclusive: false
+ visible: imageSettings.resolutions.count > 1
- exclusive: false
+ Binding {
+ target: imageSettings.resolutions
+ property: "aspectRatio"
+ value: settings.imageAspectRatio
+ }
- Repeater {
- id: resolutions
- model: imageSettings.resolutions
+ Repeater {
+ id: resolutions
+ model: imageSettings.resolutions.aspectRatio == settings.imageAspectRatio ?
+ imageSettings.resolutions : undefined
- delegate: Button {
- property string resolution: resolutionName
- property string aspectRatio: resolutionAspectRatio
- font.capitalization: Font.Capitalize
- text: qsTr("%1 %2 Mpx").arg(resolutionName).arg(megaPixels);
- checked: settings.imageResolution == resolutionName
- onClicked: Util.setResolution(resolutionName);
- }
- }
+ delegate: CameraButton {
+ width: resolutionsRow.width / resolutions.count
+ capitalize: true
+ text: qsTr("%1 %2 Mpx").arg(resolutionName).arg(megaPixels)
+ checked: settings.imageResolution == resolutionName
+ onClicked: settings.imageResolution = resolutionName
+ }
}
+ }
}