Move image aspect ratio and resolution settings to its own component
authorMohammed Sameer <msameer@foolab.org>
Sun, 10 Feb 2013 22:30:30 +0000 (00:30 +0200)
committerMohammed Sameer <msameer@foolab.org>
Sun, 10 Feb 2013 22:30:30 +0000 (00:30 +0200)
qml/ImageResolutionSettings.qml [new file with mode: 0644]
qml/ImageSettingsDialog.qml
qml/qml.qrc

diff --git a/qml/ImageResolutionSettings.qml b/qml/ImageResolutionSettings.qml
new file mode 100644 (file)
index 0000000..1c0e4b4
--- /dev/null
@@ -0,0 +1,84 @@
+// -*- qml -*-
+
+/*!
+ * This file is part of CameraPlus.
+ *
+ * Copyright (C) 2012 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
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * 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
+
+Column {
+        spacing: 10
+
+        SectionHeader {
+                text: qsTr("Aspect ratio");
+        }
+
+        ButtonRow {
+                id: aspectRatioRow
+                width: parent.width
+
+                exclusive: false
+                onCheckedButtonChanged: {
+                        // This is needed to initially setup the
+                        // resolutions buttons
+                        Util.resetAspectRatio(aspectRatioRow);
+                }
+
+                Repeater {
+                        model: imageSettings.aspectRatios
+                        delegate: Button {
+                                property string aspect: modelData;
+                                text: qsTr(modelData);
+                                checked: settings.imageAspectRatio == modelData;
+                                onClicked: Util.setAspectRatio(modelData);
+                        }
+                }
+        }
+
+        SectionHeader {
+                text: qsTr("Resolution");
+        }
+
+        ButtonRow {
+                id: resolutionsRow
+                width: parent.width
+
+                exclusive: false
+
+                Repeater {
+                        id: resolutions
+                        model: imageSettings.resolutions
+
+                        // 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";
+                        }
+
+                        delegate: Button {
+                                property string resolution: resolutionName
+                                property string aspectRatio: resolutionAspectRatio
+                                text: resolutions.name(resolutionName, megaPixels);
+                                checked: settings.imageResolution == resolutionName
+                                onClicked: Util.setResolution(resolutionName);
+                        }
+                }
+        }
+}
index 7420c31..e06427b 100644 (file)
@@ -23,7 +23,6 @@
 import QtQuick 1.1
 import com.nokia.meego 1.1
 import QtCamera 1.0
-import "ImageSettingsDialog.js" as Util
 
 Dialog {
         id: dialog
@@ -70,59 +69,8 @@ Dialog {
                                         text: qsTr("Image settings");
                                 }
 
-                                SectionHeader {
-                                        text: qsTr("Aspect ratio");
-                                }
-
-                                ButtonRow {
-                                        id: aspectRatioRow
+                                ImageResolutionSettings {
                                         width: parent.width
-
-                                        exclusive: false
-                                        onCheckedButtonChanged: {
-                                                // This is needed to initially setup the
-                                                // resolutions buttons
-                                                Util.resetAspectRatio(aspectRatioRow);
-                                        }
-
-                                        Repeater {
-                                                model: imageSettings.aspectRatios
-                                                delegate: Button {
-                                                        property string aspect: modelData;
-                                                        text: qsTr(modelData);
-                                                        checked: settings.imageAspectRatio == modelData;
-                                                        onClicked: Util.setAspectRatio(modelData);
-                                                }
-                                        }
-                                }
-
-                                SectionHeader {
-                                        text: qsTr("Resolution");
-                                }
-
-                                ButtonRow {
-                                        id: resolutionsRow
-                                        width: parent.width
-
-                                        exclusive: false
-
-                                        Repeater {
-                                                id: resolutions
-                                                model: imageSettings.resolutions
-
-                                                // 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";
-                                                }
-
-                                                delegate: Button {
-                                                        property string resolution: resolutionName
-                                                        property string aspectRatio: resolutionAspectRatio
-                                                        text: resolutions.name(resolutionName, megaPixels);
-                                                        checked: settings.imageResolution == resolutionName
-                                                        onClicked: Util.setResolution(resolutionName);
-                                                }
-                                        }
                                 }
 
                                 TextSwitch {
index 048812b..0b170c5 100644 (file)
@@ -39,6 +39,7 @@
        <file>TextSwitch.qml</file>
        <file>ImageSettingsDialog.qml</file>
        <file>ImageSettingsDialog.js</file>
+       <file>ImageResolutionSettings.qml</file>
        <file>VideoSettingsDialog.qml</file>
        <file>VideoSettingsDialog.js</file>
     </qresource>