X-Git-Url: http://cgit.sxemacs.org/?a=blobdiff_plain;f=qml%2FCameraToolBar.qml;h=f75a78961e4a6728868170e1c58a243c85aa983e;hb=177128d83939d5d290e0a8ba381606fd6b380bea;hp=a797988bb20f7375cac3710af3d0d956851e7969;hpb=3423bd2565dc32f1a8910a99e1d26a6e977a3f63;p=harmattan%2Fcameraplus diff --git a/qml/CameraToolBar.qml b/qml/CameraToolBar.qml index a797988..f75a789 100644 --- a/qml/CameraToolBar.qml +++ b/qml/CameraToolBar.qml @@ -20,110 +20,108 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -import QtQuick 1.1 -import com.nokia.meego 1.1 +@IMPORT_QT_QUICK@ import "CameraToolBar.js" as Layout Rectangle { - id: tools - property bool expanded: false - property list items - property int targetWidth: parent.width - (2 * anchors.leftMargin) - property alias menuWidth: menu.width - property bool manualBack: false - signal clicked + id: tools + property bool expanded: false + property list items + property int targetWidth: parent.width - (2 * anchors.leftMargin) + property alias menuWidth: menu.width + property bool manualBack: false + property bool hideBack: false + signal clicked - height: menu.height - width: expanded ? targetWidth : menu.width - color: expanded ? "black" : width == menu.width ? "transparent" : "black" - border.color: expanded ? "gray" : width == menu.width ? "transparent" : "gray" - radius: 20 + height: menu.height + width: expanded ? targetWidth : menu.width + color: expanded ? "black" : width == menu.width ? "transparent" : "black" + border.color: expanded ? "gray" : width == menu.width ? "transparent" : "gray" + radius: 20 - Behavior on width { - PropertyAnimation { duration: 100; } - } - - ToolIcon { - property bool __isMenu: true - id: menu - anchors.verticalCenter: parent.verticalCenter - iconSource: "image://theme/icon-m-toolbar-back-white" - onClicked: { - if (tools.manualBack) { - tools.clicked(); - return; - } + Behavior on width { + PropertyAnimation { duration: 100 } + } - if (!expanded) { - expanded = true; - } - else if (Layout.stack.length == 1) { - expanded = false; - } - else { - Layout.pop(); - } - } + CameraToolIcon { + property bool __isMenu: true + visible: !parent.hideBack + id: menu + anchors.verticalCenter: parent.verticalCenter + iconSource: "image://theme/icon-m-toolbar-back-white" + onClicked: { + if (tools.manualBack) { + tools.clicked() + return + } - anchors.left: parent.left - rotation: 180 + if (!expanded) { + expanded = true + } else if (Layout.stack.length == 1) { + expanded = false + } else { + Layout.pop() + } } - onExpandedChanged: { - if (tools.expanded) { - tools.push(tools.items); - } - else { - tools.pop(); - } + anchors.left: parent.left + rotation: 180 + } + + onExpandedChanged: { + if (tools.expanded) { + tools.push(tools.items) + } else { + tools.pop() } + } - onWidthChanged: Layout.layout(); - onTargetWidthChanged: Layout.layout(); + onWidthChanged: Layout.layout() + onTargetWidthChanged: Layout.layout() - function push(items) { - return Layout.push(items); - } + function push(items) { + return Layout.push(items) + } - function pop() { - return Layout.pop(); - } + function pop() { + return Layout.pop() + } - state: "collapsed" - states: [ + state: "collapsed" + states: [ State { - name: "expanded" - when: tools.expanded + name: "expanded" + when: tools.expanded }, State { - name: "collapsed" - when: !tools.expanded + name: "collapsed" + when: !tools.expanded } - ] + ] - transitions: [ + transitions: [ Transition { - from: "expanded" - to: "collapsed" + from: "expanded" + to: "collapsed" - PropertyAnimation { - property: "rotation" - target: menu - from: 0 - to: 180 - duration: 500 - } + PropertyAnimation { + property: "rotation" + target: menu + from: 0 + to: 180 + duration: 500 + } }, Transition { - from: "collapsed" - to: "expanded" - PropertyAnimation { - property: "rotation" - target: menu - from: 180 - to: 360 - duration: 500 - } + from: "collapsed" + to: "expanded" + PropertyAnimation { + property: "rotation" + target: menu + from: 180 + to: 360 + duration: 500 + } } - ] + ] }