Reworked CameraButton to get rid of meego bits
authorMohammed Sameer <msameer@foolab.org>
Sun, 15 Sep 2013 15:52:13 +0000 (18:52 +0300)
committerMohammed Sameer <msameer@foolab.org>
Sun, 15 Sep 2013 15:52:13 +0000 (18:52 +0300)
qml/ImageResolutionSettings.qml
qml/VideoResolutionSettings.qml
qml/harmattan/CameraButton.qml

index 3f8b5c0..6cb05b1 100644 (file)
@@ -44,6 +44,7 @@ Column {
             id: aspectRatios
             model: imageSettings.aspectRatios
             delegate: CameraButton {
             id: aspectRatios
             model: imageSettings.aspectRatios
             delegate: CameraButton {
+                width: aspectRatioRow.width / aspectRatios.count
                 text: qsTr(modelData)
                 checked: settings.imageAspectRatio == modelData
                 onClicked: settings.imageAspectRatio = modelData
                 text: qsTr(modelData)
                 checked: settings.imageAspectRatio == modelData
                 onClicked: settings.imageAspectRatio = modelData
@@ -75,6 +76,7 @@ Column {
                 imageSettings.resolutions : undefined
 
             delegate: CameraButton {
                 imageSettings.resolutions : undefined
 
             delegate: CameraButton {
+                width: resolutionsRow.width / resolutions.count
                 capitalize: true
                 text: qsTr("%1 %2 Mpx").arg(resolutionName).arg(megaPixels)
                 checked: settings.imageResolution == resolutionName
                 capitalize: true
                 text: qsTr("%1 %2 Mpx").arg(resolutionName).arg(megaPixels)
                 checked: settings.imageResolution == resolutionName
index c105c55..432bd61 100644 (file)
@@ -35,6 +35,7 @@ Column {
     }
 
     CameraButtonRow {
     }
 
     CameraButtonRow {
+        id: resoultionsRow
         width: parent.width
         enabled: camera ? camera.idle : false
         exclusive: false
         width: parent.width
         enabled: camera ? camera.idle : false
         exclusive: false
@@ -45,6 +46,7 @@ Column {
             model: videoSettings.resolutions
 
             delegate: CameraButton {
             model: videoSettings.resolutions
 
             delegate: CameraButton {
+                width: resoultionsRow.width / resolutions.count
                 capitalize: true
                 text: qsTr("%1 %2").arg(resolutionName).arg(resolution)
                 checked: settings.videoResolution == resolutionName
                 capitalize: true
                 text: qsTr("%1 %2").arg(resolutionName).arg(resolution)
                 checked: settings.videoResolution == resolutionName
index 115a90a..3cc7c9c 100644 (file)
  */
 
 import QtQuick 1.1
  */
 
 import QtQuick 1.1
-import com.nokia.meego 1.1
 
 
-Button {
+Item {
+    id: button
     property bool capitalize
     property bool capitalize
-    font.capitalization: capitalize ? Font.Capitalize : Font.MixedCase
+    width: platformStyle.buttonWidth
+    height: platformStyle.buttonHeight
+
+    signal clicked
+    property bool checked
+    property bool checkable
+    property alias text: label.text
+    property alias pressed: mouse.pressed
+    property alias enabled: mouse.enabled
+    property CameraButtonStyle platformStyle: CameraButtonStyle {}
+
+    MouseArea {
+        id: mouse
+        anchors.fill: parent
+        onClicked: parent.clicked()
+    }
+
+    BorderImage {
+        id: background
+        anchors.fill: parent
+        border { left: button.platformStyle.backgroundMarginLeft; top: button.platformStyle.backgroundMarginTop;
+                 right: button.platformStyle.backgroundMarginRight; bottom: button.platformStyle.backgroundMarginBottom }
+
+        source: !enabled ?
+                  (checked ? button.platformStyle.checkedDisabledBackground : button.platformStyle.disabledBackground) :
+                  pressed ?
+                      button.platformStyle.pressedBackground :
+                  checked ?
+                      button.platformStyle.checkedBackground :
+                      button.platformStyle.background;
+    }
+
+    CameraLabel {
+        id: label
+        anchors.verticalCenter: parent.verticalCenter
+        anchors.right: parent.right
+        anchors.rightMargin: 10
+        anchors.left: parent.left
+        anchors.leftMargin: 10
+        horizontalAlignment: Text.AlignHCenter
+        font.bold: true
+        font.capitalization: parent.capitalize ? Font.Capitalize : Font.MixedCase
+        color: !enabled ? button.platformStyle.disabledTextColor :
+               pressed ? button.platformStyle.pressedTextColor :
+               checked ? button.platformStyle.checkedTextColor :
+                         button.platformStyle.textColor;
+        elide: Text.ElideRight
+    }
 }
 }