/*!
* 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");
- }
-
- ButtonRow {
- id: aspectRatioRow
- width: parent.width
+ spacing: 10
- exclusive: false
- onCheckedButtonChanged: {
- // This is needed to initially setup the
- // resolutions buttons
- Util.resetAspectRatio(aspectRatioRow);
- }
+ SectionHeader {
+ text: qsTr("Aspect ratio")
+ }
- Repeater {
- model: imageSettings.aspectRatios
- delegate: Button {
- property string aspect: modelData;
- text: qsTr(modelData);
- checked: settings.imageAspectRatio == modelData;
- onClicked: Util.setAspectRatio(modelData);
- }
- }
- }
+ CameraButtonRow {
+ id: aspectRatioRow
+ width: parent.width
+ enabled: camera ? camera.idle : false
+ exclusive: false
- SectionHeader {
- text: qsTr("Resolution");
+ Repeater {
+ model: imageSettings.aspectRatios
+ delegate: CameraButton {
+ text: qsTr(modelData)
+ checked: settings.imageAspectRatio == modelData
+ onClicked: settings.imageAspectRatio = modelData
+ }
}
+ }
- ButtonRow {
- id: resolutionsRow
- width: parent.width
+ SectionHeader {
+ text: qsTr("Resolution")
+ }
- exclusive: false
+ CameraButtonRow {
+ id: resolutionsRow
+ width: parent.width
+ enabled: camera ? camera.idle : false
+ exclusive: false
- Repeater {
- id: resolutions
- model: imageSettings.resolutions
+ Binding {
+ target: imageSettings.resolutions
+ property: "aspectRatio"
+ value: settings.imageAspectRatio
+ }
- // http://stackoverflow.com/questions/1026069/capitalize-the-first-letter-of-string-in-javascript
- function name(name, mp) {
- return name.charAt(0).toUpperCase() + name.slice(1) + " " + mp + " Mpx";
- }
+ Repeater {
+ id: resolutions
+ model: imageSettings.resolutions.aspectRatio == settings.imageAspectRatio ?
+ imageSettings.resolutions : undefined
- delegate: Button {
- property string resolution: resolutionName
- property string aspectRatio: resolutionAspectRatio
- text: resolutions.name(resolutionName, megaPixels);
- checked: settings.imageResolution == resolutionName
- onClicked: Util.setResolution(resolutionName);
- }
- }
+ delegate: CameraButton {
+ font.capitalization: Font.Capitalize
+ text: qsTr("%1 %2 Mpx").arg(resolutionName).arg(megaPixels)
+ checked: settings.imageResolution == resolutionName
+ onClicked: settings.imageResolution = resolutionName
+ }
}
+ }
}