From 896d397cb4c88deb70a34d0e757d635c3dcd4c91 Mon Sep 17 00:00:00 2001 From: Mohammed Sameer Date: Wed, 26 Dec 2012 04:54:07 +0200 Subject: [PATCH] Added a floating toolbar to be used instead of the top left buttons. We also use it to change settings affecting capture (ev, wb, cf, ...) Also offers quick access to flash and video torch Reworked the UI to use that toolbar and moved items around --- qml/CameraSettings.qml | 5 +- qml/CameraToolBar.js | 92 +++++++++++++++++++++++ qml/CameraToolBar.qml | 128 +++++++++++++++++++++++++++++++ qml/CheckButton.qml | 13 +--- qml/FlashButton.qml | 33 +++----- qml/IconButton.qml | 73 ------------------ qml/ImageColorFilterButton.qml | 80 ++++++++++++++++++++ qml/ImageColorFilterPage.qml | 129 -------------------------------- qml/ImageEvCompButton.qml | 41 ++++++---- qml/ImagePage.qml | 78 ++++++++++--------- qml/ImageSceneButton.qml | 39 ++++------ qml/ImageSettingsPage.qml | 29 +------ qml/ImageWhiteBalanceButton.qml | 74 ++++++++++++++++++ qml/ImageWhiteBalancePage.qml | 119 ----------------------------- qml/Indicator.qml | 1 - qml/RecordingPage.qml | 95 +++++++++++++++++++---- qml/Selector.qml | 74 ------------------ qml/VideoColorFilterButton.qml | 81 ++++++++++++++++++++ qml/VideoColorFilterPage.qml | 129 -------------------------------- qml/VideoEvCompButton.qml | 41 ++++++---- qml/VideoPage.qml | 79 +++++++++---------- qml/VideoSceneButton.qml | 40 +++------- qml/VideoSettingsPage.qml | 22 ------ qml/VideoTorchButton.qml | 6 +- qml/VideoWhiteBalanceButton.qml | 74 ++++++++++++++++++ qml/VideoWhiteBalancePage.qml | 119 ----------------------------- qml/data.js | 8 +- src/settings.cpp | 13 ++++ src/settings.h | 6 ++ 29 files changed, 807 insertions(+), 914 deletions(-) create mode 100644 qml/CameraToolBar.js create mode 100644 qml/CameraToolBar.qml delete mode 100644 qml/IconButton.qml create mode 100644 qml/ImageColorFilterButton.qml delete mode 100644 qml/ImageColorFilterPage.qml create mode 100644 qml/ImageWhiteBalanceButton.qml delete mode 100644 qml/ImageWhiteBalancePage.qml delete mode 100644 qml/Selector.qml create mode 100644 qml/VideoColorFilterButton.qml delete mode 100644 qml/VideoColorFilterPage.qml create mode 100644 qml/VideoWhiteBalanceButton.qml delete mode 100644 qml/VideoWhiteBalancePage.qml diff --git a/qml/CameraSettings.qml b/qml/CameraSettings.qml index 8f0f874..886764c 100644 --- a/qml/CameraSettings.qml +++ b/qml/CameraSettings.qml @@ -26,12 +26,13 @@ import com.nokia.meego 1.1 Column { id: col spacing: 10 + width: parent.width Label { font.pixelSize: 36 text: qsTr("Camera settings"); } - +/* SectionHeader { text: qsTr("Show captured content"); } @@ -63,7 +64,7 @@ Column { onClicked: settings.postCaptureTimeout = -1; } } - +*/ SectionHeader { text: qsTr("Creator name"); } diff --git a/qml/CameraToolBar.js b/qml/CameraToolBar.js new file mode 100644 index 0000000..fba19e3 --- /dev/null +++ b/qml/CameraToolBar.js @@ -0,0 +1,92 @@ +// -*- js -*- + +/*! + * This file is part of CameraPlus. + * + * Copyright (C) 2012 Mohammed Sameer + * + * 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 + */ + +var stack = new Array(); + +function push(items) { + if (stack.length >= 1) { + hide(stack[stack.length - 1]); + } + + stack.push(items); + + layout(); +} + +function pop() { + var items = stack[stack.length - 1]; + hide(items); + stack.pop(); + layout(); +} + +function hide(items) { + var len = items.length; + + for (var x = 0; x < len; x++) { + var item = items[x]; + item.visible = false; + } +} + +function show(items) { + var len = items.length; + + var width = 0; + for (var x = 0; x < len; x++) { + width += items[x].width; + } + + var spacing = (tools.width - width - tools.menuWidth) / len; + + for (var x = 0; x < len; x++) { + var child = items[x]; + + if (x != 0) { + var prev = items[x - 1]; + child.x = prev.x + prev.width + spacing; + } + else { + child.x = spacing + 80; + } + + child.parent = tools; + child.visible = true; + child.y = 0; + } +} + +function layout() { + if (stack.length == 0) { + return; + } + + var items = stack[stack.length - 1]; + var len = items.length; + + if (!tools.expanded) { + hide(items); + } + else if (tools.width == tools.targetWidth) { + show(items); + } +} diff --git a/qml/CameraToolBar.qml b/qml/CameraToolBar.qml new file mode 100644 index 0000000..b82e825 --- /dev/null +++ b/qml/CameraToolBar.qml @@ -0,0 +1,128 @@ +// -*- qml -*- + +/*! + * This file is part of CameraPlus. + * + * Copyright (C) 2012 Mohammed Sameer + * + * 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 "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 + + 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 (!expanded) { + expanded = true; + } + else if (Layout.stack.length == 1) { + expanded = false; + } + else { + Layout.pop(); + } + } + + anchors.left: parent.left + rotation: 180 + } + + onExpandedChanged: { + if (tools.expanded) { + tools.push(tools.items); + } + else { + tools.pop(); + } + } + + onWidthChanged: Layout.layout(); + onTargetWidthChanged: Layout.layout(); + + Component.onCompleted: { + if (tools.expanded) { + tools.push(tools.items); + } + } + + function push(items) { + return Layout.push(items); + } + + function pop() { + return Layout.pop(); + } + + state: "collapsed" + states: [ + State { + name: "expanded" + when: tools.expanded + }, + State { + name: "collapsed" + when: !tools.expanded + } + ] + + transitions: [ + Transition { + from: "expanded" + to: "collapsed" + + 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 + } + } + ] +} diff --git a/qml/CheckButton.qml b/qml/CheckButton.qml index 1fba1b4..08bc01c 100644 --- a/qml/CheckButton.qml +++ b/qml/CheckButton.qml @@ -23,21 +23,12 @@ import QtQuick 1.1 import com.nokia.meego 1.1 -Button { +ToolIcon { id: button property string normalIcon: "" property string checkedIcon: "" property int value: -1 - property bool doClose: true property int savedValue: -1 - width: visible ? 56 : 0 - height: visible ? 56 : 0 - iconSource: !visible ? "" : savedValue == value ? checkedIcon : normalIcon - - onClicked: { - if (doClose) { - close(); - } - } + iconSource: savedValue == value ? checkedIcon : normalIcon } diff --git a/qml/FlashButton.qml b/qml/FlashButton.qml index 32ca39d..cabaf46 100644 --- a/qml/FlashButton.qml +++ b/qml/FlashButton.qml @@ -25,54 +25,43 @@ import com.nokia.meego 1.1 import QtCamera 1.0 import "data.js" as Data -Selector { +ToolIcon { id: button iconSource: "image://theme/" + Data.flashIcon(settings.imageFlashMode) - title: qsTr("Flash mode"); - - widget: Row { - id: row - height: button.checked ? 64 : 0 - width: button.checked ? (children.length * height) + (children.length - 1) * spacing : 0 - spacing: 10 - - Behavior on width { - // TODO: seems animation is not working - PropertyAnimation { duration: 250; } - } - + property list items: [ + Label { + height: parent ? parent.height : 0 + text: qsTr("Flash"); + verticalAlignment: Text.AlignVCenter + }, CheckButton { normalIcon: "image://theme/" + Data.flashIcon(value) checkedIcon: "image://theme/" + Data.flashPressedIcon(value) onClicked: settings.imageFlashMode = value; value: Flash.Auto savedValue: settings.imageFlashMode - } - + }, CheckButton { normalIcon: "image://theme/" + Data.flashIcon(value) checkedIcon: "image://theme/" + Data.flashPressedIcon(value) onClicked: settings.imageFlashMode = value; value: Flash.On savedValue: settings.imageFlashMode - } - + }, CheckButton { normalIcon: "image://theme/" + Data.flashIcon(value) checkedIcon: "image://theme/" + Data.flashPressedIcon(value) onClicked: settings.imageFlashMode = value; value: Flash.Off savedValue: settings.imageFlashMode - } - + }, CheckButton { normalIcon: "image://theme/" + Data.flashIcon(value) checkedIcon: "image://theme/" + Data.flashPressedIcon(value) onClicked: settings.imageFlashMode = value; value: Flash.RedEye savedValue: settings.imageFlashMode - } - } + }] } diff --git a/qml/IconButton.qml b/qml/IconButton.qml deleted file mode 100644 index be5a9d5..0000000 --- a/qml/IconButton.qml +++ /dev/null @@ -1,73 +0,0 @@ -// -*- qml -*- - -/*! - * This file is part of CameraPlus. - * - * Copyright (C) 2012 Mohammed Sameer - * - * 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 - -Item { - id: root - width: Math.max(150, Math.max(label.width, icon.width) + 20); - height: 120 - - property string normalIcon: "" - property string checkedIcon: "" - property int value: -1 - property int savedValue: -1 - - property alias iconSource: icon.source - property alias text: label.text - - signal clicked - - MouseArea { - anchors.fill: parent - onClicked: root.clicked(); - } - - Image { - id: icon - - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right - anchors.topMargin: 10 - anchors.leftMargin: 10 - anchors.rightMargin: 10 - source: root.value == root.savedValue ? checkedIcon : normalIcon - fillMode: Image.PreserveAspectFit - } - - Label { - id: label - anchors.left: parent.left - anchors.right: parent.right - anchors.bottom: parent.bottom - anchors.top: icon.bottom - anchors.bottomMargin: 10 - anchors.leftMargin: 10 - anchors.rightMargin: 10 - anchors.topMargin: 10 - horizontalAlignment: Text.AlignHCenter - wrapMode: Text.NoWrap - font.pixelSize: 22 - } -} diff --git a/qml/ImageColorFilterButton.qml b/qml/ImageColorFilterButton.qml new file mode 100644 index 0000000..8e2f6f3 --- /dev/null +++ b/qml/ImageColorFilterButton.qml @@ -0,0 +1,80 @@ +// -*- qml -*- + +/*! + * This file is part of CameraPlus. + * + * Copyright (C) 2012 Mohammed Sameer + * + * 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 QtCamera 1.0 +import "data.js" as Data + +ToolIcon { + id: button + iconSource: "image://theme/" + Data.cfIcon(settings.imageColorFilter); + + property list items: [ + Label { + height: parent ? parent.height : 0 + text: qsTr("Filter"); + verticalAlignment: Text.AlignVCenter + }, + CheckButton { + normalIcon: "image://theme/" + Data.cfIcon(value); + checkedIcon: "image://theme/" + Data.cfSelectedIcon(value); + value: ColorTone.Normal + savedValue: settings.imageColorFilter + onClicked: settings.imageColorFilter = value; + }, + CheckButton { + normalIcon: "image://theme/" + Data.cfIcon(value); + checkedIcon: "image://theme/" + Data.cfSelectedIcon(value); + value: ColorTone.GrayScale + savedValue: settings.imageColorFilter + onClicked: settings.imageColorFilter = value; + }, + CheckButton { + normalIcon: "image://theme/" + Data.cfIcon(value); + checkedIcon: "image://theme/" + Data.cfSelectedIcon(value); + value: ColorTone.Sepia + savedValue: settings.imageColorFilter + onClicked: settings.imageColorFilter = value; + }, + CheckButton { + normalIcon: "image://theme/" + Data.cfIcon(value); + checkedIcon: "image://theme/" + Data.cfSelectedIcon(value); + value: ColorTone.Vivid + savedValue: settings.imageColorFilter + onClicked: settings.imageColorFilter = value; + }, + CheckButton { + normalIcon: "image://theme/" + Data.cfIcon(value); + checkedIcon: "image://theme/" + Data.cfSelectedIcon(value); + value: ColorTone.Negative + savedValue: settings.imageColorFilter + onClicked: settings.imageColorFilter = value; + }, + CheckButton { + normalIcon: "image://theme/" + Data.cfIcon(value); + checkedIcon: "image://theme/" + Data.cfSelectedIcon(value); + value: ColorTone.Solarize + savedValue: settings.imageColorFilter + onClicked: settings.imageColorFilter = value; + }] +} diff --git a/qml/ImageColorFilterPage.qml b/qml/ImageColorFilterPage.qml deleted file mode 100644 index cbfac10..0000000 --- a/qml/ImageColorFilterPage.qml +++ /dev/null @@ -1,129 +0,0 @@ -// -*- qml -*- - -/*! - * This file is part of CameraPlus. - * - * Copyright (C) 2012 Mohammed Sameer - * - * 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 QtCamera 1.0 -import CameraPlus 1.0 -import "data.js" as Data - -CameraPage { - id: page - - controlsVisible: false - policyMode: CameraResources.Image - needsPipeline: true - - Rectangle { - color: "black" - width: parent.width - height: row.height + title.height + 30 - anchors.bottom: toolBar.top - opacity: 0.5 - - SectionHeader { - id: title - anchors.top: parent.top - anchors.topMargin: 10 - text: qsTr("Color filter"); - } - - Row { - id: row - anchors.left: parent.left - anchors.right: parent.right - anchors.leftMargin: 20 - anchors.rightMargin: 20 - anchors.top: title.bottom - anchors.topMargin: 10 - - IconButton { - width: parent.width / 6 - normalIcon: "image://theme/" + Data.cfIcon(value); - checkedIcon: "image://theme/" + Data.cfSelectedIcon(value); - value: ColorTone.Normal - savedValue: settings.imageColorFilter - onClicked: settings.imageColorFilter = value; - text: Data.cfName(value); - } - - IconButton { - width: parent.width / 6 - normalIcon: "image://theme/" + Data.cfIcon(value); - checkedIcon: "image://theme/" + Data.cfSelectedIcon(value); - value: ColorTone.GrayScale - savedValue: settings.imageColorFilter - onClicked: settings.imageColorFilter = value; - text: Data.cfName(value); - } - - IconButton { - width: parent.width / 6 - normalIcon: "image://theme/" + Data.cfIcon(value); - checkedIcon: "image://theme/" + Data.cfSelectedIcon(value); - value: ColorTone.Sepia - savedValue: settings.imageColorFilter - onClicked: settings.imageColorFilter = value; - text: Data.cfName(value); - } - - IconButton { - width: parent.width / 6 - normalIcon: "image://theme/" + Data.cfIcon(value); - checkedIcon: "image://theme/" + Data.cfSelectedIcon(value); - value: ColorTone.Vivid - savedValue: settings.imageColorFilter - onClicked: settings.imageColorFilter = value; - text: Data.cfName(value); - } - - IconButton { - width: parent.width / 6 - normalIcon: "image://theme/" + Data.cfIcon(value); - checkedIcon: "image://theme/" + Data.cfSelectedIcon(value); - value: ColorTone.Negative - savedValue: settings.imageColorFilter - onClicked: settings.imageColorFilter = value; - text: Data.cfName(value); - } - - IconButton { - width: parent.width / 6 - normalIcon: "image://theme/" + Data.cfIcon(value); - checkedIcon: "image://theme/" + Data.cfSelectedIcon(value); - value: ColorTone.Solarize - savedValue: settings.imageColorFilter - onClicked: settings.imageColorFilter = value; - text: Data.cfName(value); - } - } - } - - ToolBar { - id: toolBar - anchors.bottom: parent.bottom - tools: ToolBarLayout { - id: layout - ToolIcon { iconId: "icon-m-toolbar-back"; onClicked: pageStack.pop(); } - } - } -} diff --git a/qml/ImageEvCompButton.qml b/qml/ImageEvCompButton.qml index 0f8989f..9450e02 100644 --- a/qml/ImageEvCompButton.qml +++ b/qml/ImageEvCompButton.qml @@ -24,25 +24,34 @@ import QtQuick 1.1 import com.nokia.meego 1.1 import QtCamera 1.0 -Selector { +ToolIcon { id: button iconSource: settings.imageEvComp == 0 ? "image://theme/icon-m-camera-manual-exposure" : "" - text: settings.imageEvComp == 0 ? "" : settings.imageEvComp.toFixed(1); - font.pixelSize: 19 - timerConstraints: slider.pressed - title: qsTr("Exposure compensation"); - - widget: Slider { - id: slider - width: 500 - orientation: Qt.Horizontal - minimumValue: cam.evComp.minimum - maximumValue: cam.evComp.maximum - value: settings.imageEvComp - stepSize: 0.1 - onValueChanged: settings.imageEvComp = value.toFixed(1); - Component.onCompleted: { slider.value = settings.imageEvComp.toFixed(1); } + Label { + anchors.fill: parent + verticalAlignment: Text.AlignVCenter + visible: settings.imageEvComp != 0 + text: settings.imageEvComp == 0 ? "" : settings.imageEvComp.toFixed(1); } + + property list items: [ + Label { + height: parent ? parent.height : 0 + text: qsTr("EV"); + verticalAlignment: Text.AlignVCenter + }, + Slider { + id: slider + width: 500 + orientation: Qt.Horizontal + minimumValue: cam.evComp.minimum + maximumValue: cam.evComp.maximum + value: settings.imageEvComp + valueIndicatorVisible: true + stepSize: 0.1 + onValueChanged: settings.imageEvComp = value.toFixed(1); + Component.onCompleted: { slider.value = settings.imageEvComp.toFixed(1); } + }] } diff --git a/qml/ImagePage.qml b/qml/ImagePage.qml index 39e76d8..5fa8783 100644 --- a/qml/ImagePage.qml +++ b/qml/ImagePage.qml @@ -112,51 +112,20 @@ CameraPage { onSaved: mountProtector.unlock(); } - FlashButton { - id: flash - visible: controlsVisible + Rectangle { + id: indicators anchors.top: parent.top - anchors.left: parent.left anchors.topMargin: 20 - anchors.leftMargin: 20 - } - - ImageSceneButton { - id: scene - visible: controlsVisible - anchors.top: flash.bottom - anchors.left: parent.left - anchors.topMargin: 10 - anchors.leftMargin: 20 - } - - ImageEvCompButton { - id: evComp - visible: controlsVisible - anchors.top: scene.bottom - anchors.left: parent.left - anchors.topMargin: 10 - anchors.leftMargin: 20 - } - - MouseArea { - id: indicators - anchors.bottom: parent.bottom - anchors.bottomMargin: 20 anchors.left: parent.left anchors.leftMargin: 20 width: 48 height: col.height - onClicked: openFile("ImageSettingsPage.qml"); + color: "black" + border.color: "gray" + radius: 20 + opacity: 0.5 visible: controlsVisible - BorderImage { - id: image - anchors.fill: parent - smooth: true - source: indicators.pressed ? "image://theme/meegotouch-camera-settings-indicators-background-pressed" : "image://theme/meegotouch-camera-settings-indicators-background" - } - Column { id: col width: parent.width @@ -217,4 +186,39 @@ CameraPage { onClicked: openFile("PostCapturePage.qml"); visible: controlsVisible } + + CameraToolBar { + id: toolBar + anchors.bottom: parent.bottom + anchors.bottomMargin: 20 + anchors.left: parent.left + anchors.leftMargin: 20 + opacity: 0.5 + targetWidth: parent.width - (anchors.leftMargin * 2) - (66 * 1.5) + visible: controlsVisible + expanded: settings.showToolBar + onExpandedChanged: settings.showToolBar = expanded; + + items: [ + FlashButton { + onClicked: toolBar.push(items); + }, + ImageSceneButton { + onClicked: toolBar.push(items); + }, + ImageEvCompButton { + onClicked: toolBar.push(items); + }, + ImageWhiteBalanceButton { + onClicked: toolBar.push(items); + }, + ImageColorFilterButton { + onClicked: toolBar.push(items); + }, + ToolIcon { + iconSource: "image://theme/icon-m-toolbar-view-menu-white" + onClicked: openFile("ImageSettingsPage.qml"); + } + ] + } } diff --git a/qml/ImageSceneButton.qml b/qml/ImageSceneButton.qml index 59ba290..f41fc32 100644 --- a/qml/ImageSceneButton.qml +++ b/qml/ImageSceneButton.qml @@ -25,70 +25,57 @@ import com.nokia.meego 1.1 import QtCamera 1.0 import "data.js" as Data -Selector { +ToolIcon { id: button iconSource: "image://theme/" + Data.ismIcon(settings.imageSceneMode); - title: qsTr("Scene mode"); - - widget: Row { - id: row - height: button.checked ? 64 : 0 - width: button.checked ? (children.length * height) + (children.length - 1) * spacing : 0 - spacing: 10 - - Behavior on width { - // TODO: seems animation is not working - PropertyAnimation { duration: 250; } - } - + property list items: [ + Label { + height: parent ? parent.height : 0 + text: qsTr("Scene"); + verticalAlignment: Text.AlignVCenter + }, CheckButton { normalIcon: "image://theme/" + Data.ismIcon(value); checkedIcon: "image://theme/" + Data.ismSelectedIcon(value); savedValue: settings.imageSceneMode onClicked: settings.imageSceneMode = value; value: Scene.Auto - } - + }, CheckButton { normalIcon: "image://theme/" + Data.ismIcon(value); checkedIcon: "image://theme/" + Data.ismSelectedIcon(value); savedValue: settings.imageSceneMode onClicked: settings.imageSceneMode = value; value: Scene.Closeup - } - + }, CheckButton { normalIcon: "image://theme/" + Data.ismIcon(value); checkedIcon: "image://theme/" + Data.ismSelectedIcon(value); savedValue: settings.imageSceneMode onClicked: settings.imageSceneMode = value; value: Scene.Landscape - } - + }, CheckButton { normalIcon: "image://theme/" + Data.ismIcon(value); checkedIcon: "image://theme/" + Data.ismSelectedIcon(value); savedValue: settings.imageSceneMode onClicked: settings.imageSceneMode = value; value: Scene.Portrait - } - + }, CheckButton { normalIcon: "image://theme/" + Data.ismIcon(value); checkedIcon: "image://theme/" + Data.ismSelectedIcon(value); savedValue: settings.imageSceneMode onClicked: settings.imageSceneMode = value; value: Scene.Night - } - + }, CheckButton { normalIcon: "image://theme/" + Data.ismIcon(value); checkedIcon: "image://theme/" + Data.ismSelectedIcon(value); savedValue: settings.imageSceneMode onClicked: settings.imageSceneMode = value; value: Scene.Sport - } - } + }] } diff --git a/qml/ImageSettingsPage.qml b/qml/ImageSettingsPage.qml index 3678f24..1c3b472 100644 --- a/qml/ImageSettingsPage.qml +++ b/qml/ImageSettingsPage.qml @@ -57,7 +57,7 @@ CameraPage { font.pixelSize: 36 text: qsTr("Image settings"); } - +/* SectionHeader { text: qsTr("Capture mode"); } @@ -69,29 +69,8 @@ CameraPage { Button { text: qsTr("Self timer"); } Button { text: qsTr("Fast capture"); } } - - Row { - width: parent.width - - ListItem { - id: wb - width: parent.width / 2 - title: qsTr("White balance"); - subtitle: Data.wbName(settings.imageWhiteBalance); - iconId: Data.wbSelectedIcon(settings.imageWhiteBalance); - onClicked: openFile("ImageWhiteBalancePage.qml"); - } - - ListItem { - id: cf - width: parent.width / 2 - title: qsTr("Color filter"); - subtitle: Data.cfName(settings.imageColorFilter); - iconId: Data.cfSelectedIcon(settings.imageColorFilter); - onClicked: openFile("ImageColorFilterPage.qml"); - } - } - +*/ +/* SectionHeader { text: qsTr("Self timer"); } @@ -102,7 +81,7 @@ CameraPage { Button { text: qsTr("2 seconds"); } Button { text: qsTr("10 seconds"); } } - +*/ SectionHeader { text: qsTr("Light sensitivity"); } diff --git a/qml/ImageWhiteBalanceButton.qml b/qml/ImageWhiteBalanceButton.qml new file mode 100644 index 0000000..ef023ef --- /dev/null +++ b/qml/ImageWhiteBalanceButton.qml @@ -0,0 +1,74 @@ +// -*- qml -*- + +/*! + * This file is part of CameraPlus. + * + * Copyright (C) 2012 Mohammed Sameer + * + * 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 QtCamera 1.0 +import "data.js" as Data + +ToolIcon { + id: button + + iconSource: "image://theme/" + Data.wbIcon(settings.imageWhiteBalance); + + property list items: [ + Label { + height: parent ? parent.height : 0 + text: qsTr("WB"); + verticalAlignment: Text.AlignVCenter + }, + CheckButton { + normalIcon: "image://theme/" + Data.wbIcon(value); + checkedIcon: "image://theme/" + Data.wbSelectedIcon(value); + onClicked: settings.imageWhiteBalance = value; + value: WhiteBalance.Auto + savedValue: settings.imageWhiteBalance + }, + CheckButton { + normalIcon: "image://theme/" + Data.wbIcon(value); + checkedIcon: "image://theme/" + Data.wbSelectedIcon(value); + onClicked: settings.imageWhiteBalance = value; + value: WhiteBalance.Sunset + savedValue: settings.imageWhiteBalance + }, + CheckButton { + normalIcon: "image://theme/" + Data.wbIcon(value); + checkedIcon: "image://theme/" + Data.wbSelectedIcon(value); + onClicked: settings.imageWhiteBalance = value; + value: WhiteBalance.Cloudy + savedValue: settings.imageWhiteBalance + }, + CheckButton { + normalIcon: "image://theme/" + Data.wbIcon(value); + checkedIcon: "image://theme/" + Data.wbSelectedIcon(value); + onClicked: settings.imageWhiteBalance = value; + value: WhiteBalance.Flourescent + savedValue: settings.imageWhiteBalance + }, + CheckButton { + normalIcon: "image://theme/" + Data.wbIcon(value); + checkedIcon: "image://theme/" + Data.wbSelectedIcon(value); + onClicked: settings.imageWhiteBalance = value; + value: WhiteBalance.Tungsten + savedValue: settings.imageWhiteBalance + }] +} diff --git a/qml/ImageWhiteBalancePage.qml b/qml/ImageWhiteBalancePage.qml deleted file mode 100644 index 4c85e2b..0000000 --- a/qml/ImageWhiteBalancePage.qml +++ /dev/null @@ -1,119 +0,0 @@ -// -*- qml -*- - -/*! - * This file is part of CameraPlus. - * - * Copyright (C) 2012 Mohammed Sameer - * - * 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 QtCamera 1.0 -import CameraPlus 1.0 -import "data.js" as Data - -CameraPage { - id: page - - controlsVisible: false - policyMode: CameraResources.Image - needsPipeline: true - - Rectangle { - color: "black" - width: parent.width - height: row.height + title.height + 30 - anchors.bottom: toolBar.top - opacity: 0.5 - - SectionHeader { - id: title - anchors.top: parent.top - anchors.topMargin: 10 - text: qsTr("White balance"); - } - - Row { - id: row - anchors.left: parent.left - anchors.right: parent.right - anchors.leftMargin: 20 - anchors.rightMargin: 20 - anchors.top: title.bottom - anchors.topMargin: 10 - - IconButton { - width: parent.width / 5 - normalIcon: "image://theme/" + Data.wbIcon(value); - checkedIcon: "image://theme/" + Data.wbSelectedIcon(value); - value: WhiteBalance.Auto - savedValue: settings.imageWhiteBalance - onClicked: settings.imageWhiteBalance = value; - text: Data.wbName(value); - } - - IconButton { - width: parent.width / 5 - normalIcon: "image://theme/" + Data.wbIcon(value); - checkedIcon: "image://theme/" + Data.wbSelectedIcon(value); - value: WhiteBalance.Sunset - savedValue: settings.imageWhiteBalance - onClicked: settings.imageWhiteBalance = value; - text: Data.wbName(value); - } - - IconButton { - width: parent.width / 5 - normalIcon: "image://theme/" + Data.wbIcon(value); - checkedIcon: "image://theme/" + Data.wbSelectedIcon(value); - value: WhiteBalance.Cloudy - savedValue: settings.imageWhiteBalance - onClicked: settings.imageWhiteBalance = value; - text: Data.wbName(value); - } - - IconButton { - width: parent.width / 5 - normalIcon: "image://theme/" + Data.wbIcon(value); - checkedIcon: "image://theme/" + Data.wbSelectedIcon(value); - value: WhiteBalance.Flourescent - savedValue: settings.imageWhiteBalance - onClicked: settings.imageWhiteBalance = value; - text: Data.wbName(value); - } - - IconButton { - width: parent.width / 5 - normalIcon: "image://theme/" + Data.wbIcon(value); - checkedIcon: "image://theme/" + Data.wbSelectedIcon(value); - value: WhiteBalance.Tungsten - savedValue: settings.imageWhiteBalance - onClicked: settings.imageWhiteBalance = value; - text: Data.wbName(value); - } - } - } - - ToolBar { - id: toolBar - anchors.bottom: parent.bottom - tools: ToolBarLayout { - id: layout - ToolIcon { iconId: "icon-m-toolbar-back"; onClicked: pageStack.pop(); } - } - } -} diff --git a/qml/Indicator.qml b/qml/Indicator.qml index b2be78c..beeae91 100644 --- a/qml/Indicator.qml +++ b/qml/Indicator.qml @@ -30,6 +30,5 @@ Image { anchors.topMargin: 5 anchors.bottomMargin: 5 - width: parent.width - 10 height: width } diff --git a/qml/RecordingPage.qml b/qml/RecordingPage.qml index bb0fc1f..a214840 100644 --- a/qml/RecordingPage.qml +++ b/qml/RecordingPage.qml @@ -131,30 +131,63 @@ CameraPage { camera: cam } - VideoTorchButton { - id: torch - camera: cam - visible: controlsVisible + Rectangle { anchors.top: parent.top - anchors.left: parent.left anchors.topMargin: 20 + anchors.left: parent.left anchors.leftMargin: 20 + width: 48 + height: col.height + color: "black" + border.color: "gray" + radius: 20 opacity: 0.5 - } - - VideoEvCompButton { - id: evComp visible: controlsVisible - anchors.top: torch.bottom - anchors.left: parent.left - anchors.topMargin: 10 - anchors.leftMargin: 20 + + Column { + id: col + width: parent.width + spacing: 5 + + Indicator { + id: resolutionIndicator + source: "image://theme/" + Data.videoIcon(settings.videoResolution); + } + + Indicator { + id: wbIndicator + source: visible ? "image://theme/" + Data.wbIcon(settings.videoWhiteBalance) + "-screen" : "" + visible: settings.videoWhiteBalance != WhiteBalance.Auto + } + + Indicator { + id: cfIndicator + source: "image://theme/" + Data.cfIcon(settings.videoColorFilter) + "-screen" + visible: settings.videoColorFilter != ColorTone.Normal + } + + Indicator { + id: gpsIndicator + visible: settings.useGps + source: "image://theme/icon-m-camera-location" + + PropertyAnimation on opacity { + easing.type: Easing.OutSine + loops: Animation.Infinite + from: 0.2 + to: 1.0 + duration: 1000 + running: settings.useGps && !positionSource.position.longitudeValid + alwaysRunToEnd: true + } + } + } } Rectangle { - anchors.left: parent.left anchors.bottom: parent.bottom - anchors.leftMargin: 20 + anchors.right: parent.right + anchors.rightMargin: 20 anchors.bottomMargin: 20 visible: controlsVisible @@ -216,4 +249,36 @@ CameraPage { anchors.leftMargin: 5 } } + + CameraToolBar { + id: toolBar + anchors.bottom: parent.bottom + anchors.bottomMargin: 20 + anchors.left: parent.left + anchors.leftMargin: 20 + opacity: 0.5 + targetWidth: parent.width - (anchors.leftMargin * 2) - (66 * 1.5) + visible: controlsVisible + expanded: settings.showToolBar + onExpandedChanged: settings.showToolBar = expanded; + + items: [ + VideoTorchButton { + camera: cam + }, + VideoEvCompButton { + onClicked: toolBar.push(items); + }, + VideoWhiteBalanceButton { + onClicked: toolBar.push(items); + }, + VideoColorFilterButton { + onClicked: toolBar.push(items); + }, + ToolIcon { + iconSource: "image://theme/icon-m-toolbar-view-menu-white" + onClicked: openFile("VideoSettingsPage.qml"); + } + ] + } } diff --git a/qml/Selector.qml b/qml/Selector.qml deleted file mode 100644 index 4b8912b..0000000 --- a/qml/Selector.qml +++ /dev/null @@ -1,74 +0,0 @@ -// -*- qml -*- - -/*! - * This file is part of CameraPlus. - * - * Copyright (C) 2012 Mohammed Sameer - * - * 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 QtCamera 1.0 - -Button { - id: button - width: 56 - height: 56 - - opacity: 0.5 - - property alias widget: __widget.children - property bool timerConstraints: false - property alias title: label.text - - checkable: true - - function close() { - button.checked = false; - } - - Timer { - interval: 2000 - running: mouse.enabled && !button.timerConstraints - repeat: false - onTriggered: button.close(); - } - - MouseArea { - id: mouse - parent: button.parent - anchors.fill: parent - enabled: button.checked - onClicked: button.close(); - - Label { - id: label - y: button.y - x: button.x + button.width + 20 - visible: button.checked - } - - Item { - id: __widget - anchors.top: label.bottom - anchors.topMargin: 10 -// y: button.y - x: button.x + button.width + 20 - visible: button.checked - } - } -} diff --git a/qml/VideoColorFilterButton.qml b/qml/VideoColorFilterButton.qml new file mode 100644 index 0000000..4d26b56 --- /dev/null +++ b/qml/VideoColorFilterButton.qml @@ -0,0 +1,81 @@ +// -*- qml -*- + +/*! + * This file is part of CameraPlus. + * + * Copyright (C) 2012 Mohammed Sameer + * + * 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 QtCamera 1.0 +import "data.js" as Data + +ToolIcon { + id: button + + iconSource: "image://theme/" + Data.cfIcon(settings.videoColorFilter); + + property list items: [ + Label { + height: parent ? parent.height : 0 + text: qsTr("Filter"); + verticalAlignment: Text.AlignVCenter + }, + CheckButton { + normalIcon: "image://theme/" + Data.cfIcon(value); + checkedIcon: "image://theme/" + Data.cfSelectedIcon(value); + value: ColorTone.Normal + savedValue: settings.videoColorFilter + onClicked: settings.videoColorFilter = value; + }, + CheckButton { + normalIcon: "image://theme/" + Data.cfIcon(value); + checkedIcon: "image://theme/" + Data.cfSelectedIcon(value); + value: ColorTone.GrayScale + savedValue: settings.videoColorFilter + onClicked: settings.videoColorFilter = value; + }, + CheckButton { + normalIcon: "image://theme/" + Data.cfIcon(value); + checkedIcon: "image://theme/" + Data.cfSelectedIcon(value); + value: ColorTone.Sepia + savedValue: settings.videoColorFilter + onClicked: settings.videoColorFilter = value; + }, + CheckButton { + normalIcon: "image://theme/" + Data.cfIcon(value); + checkedIcon: "image://theme/" + Data.cfSelectedIcon(value); + value: ColorTone.Vivid + savedValue: settings.videoColorFilter + onClicked: settings.videoColorFilter = value; + }, + CheckButton { + normalIcon: "image://theme/" + Data.cfIcon(value); + checkedIcon: "image://theme/" + Data.cfSelectedIcon(value); + value: ColorTone.Negative + savedValue: settings.videoColorFilter + onClicked: settings.videoColorFilter = value; + }, + CheckButton { + normalIcon: "image://theme/" + Data.cfIcon(value); + checkedIcon: "image://theme/" + Data.cfSelectedIcon(value); + value: ColorTone.Solarize + savedValue: settings.videoColorFilter + onClicked: settings.videoColorFilter = value; + }] +} diff --git a/qml/VideoColorFilterPage.qml b/qml/VideoColorFilterPage.qml deleted file mode 100644 index 0618bb8..0000000 --- a/qml/VideoColorFilterPage.qml +++ /dev/null @@ -1,129 +0,0 @@ -// -*- qml -*- - -/*! - * This file is part of CameraPlus. - * - * Copyright (C) 2012 Mohammed Sameer - * - * 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 QtCamera 1.0 -import CameraPlus 1.0 -import "data.js" as Data - -CameraPage { - id: page - - controlsVisible: false - policyMode: CameraResources.Video - needsPipeline: true - - Rectangle { - color: "black" - width: parent.width - height: row.height + title.height + 30 - anchors.bottom: toolBar.top - opacity: 0.5 - - SectionHeader { - id: title - anchors.top: parent.top - anchors.topMargin: 10 - text: qsTr("Color filter"); - } - - Row { - id: row - anchors.left: parent.left - anchors.right: parent.right - anchors.leftMargin: 20 - anchors.rightMargin: 20 - anchors.top: title.bottom - anchors.topMargin: 10 - - IconButton { - width: parent.width / 6 - normalIcon: "image://theme/" + Data.cfIcon(value); - checkedIcon: "image://theme/" + Data.cfSelectedIcon(value); - value: ColorTone.Normal - savedValue: settings.videoColorFilter - onClicked: settings.videoColorFilter = value; - text: Data.cfName(value); - } - - IconButton { - width: parent.width / 6 - normalIcon: "image://theme/" + Data.cfIcon(value); - checkedIcon: "image://theme/" + Data.cfSelectedIcon(value); - value: ColorTone.GrayScale - savedValue: settings.videoColorFilter - onClicked: settings.videoColorFilter = value; - text: Data.cfName(value); - } - - IconButton { - width: parent.width / 6 - normalIcon: "image://theme/" + Data.cfIcon(value); - checkedIcon: "image://theme/" + Data.cfSelectedIcon(value); - value: ColorTone.Sepia - savedValue: settings.videoColorFilter - onClicked: settings.videoColorFilter = value; - text: Data.cfName(value); - } - - IconButton { - width: parent.width / 6 - normalIcon: "image://theme/" + Data.cfIcon(value); - checkedIcon: "image://theme/" + Data.cfSelectedIcon(value); - value: ColorTone.Vivid - savedValue: settings.videoColorFilter - onClicked: settings.videoColorFilter = value; - text: Data.cfName(value); - } - - IconButton { - width: parent.width / 6 - normalIcon: "image://theme/" + Data.cfIcon(value); - checkedIcon: "image://theme/" + Data.cfSelectedIcon(value); - value: ColorTone.Negative - savedValue: settings.videoColorFilter - onClicked: settings.videoColorFilter = value; - text: Data.cfName(value); - } - - IconButton { - width: parent.width / 6 - normalIcon: "image://theme/" + Data.cfIcon(value); - checkedIcon: "image://theme/" + Data.cfSelectedIcon(value); - value: ColorTone.Solarize - savedValue: settings.videoColorFilter - onClicked: settings.videoColorFilter = value; - text: Data.cfName(value); - } - } - } - - ToolBar { - id: toolBar - anchors.bottom: parent.bottom - tools: ToolBarLayout { - id: layout - ToolIcon { iconId: "icon-m-toolbar-back"; onClicked: pageStack.pop(); } - } - } -} diff --git a/qml/VideoEvCompButton.qml b/qml/VideoEvCompButton.qml index da14141..a00710b 100644 --- a/qml/VideoEvCompButton.qml +++ b/qml/VideoEvCompButton.qml @@ -24,25 +24,34 @@ import QtQuick 1.1 import com.nokia.meego 1.1 import QtCamera 1.0 -Selector { +ToolIcon { id: button iconSource: settings.videoEvComp == 0 ? "image://theme/icon-m-camera-manual-exposure" : "" - text: settings.videoEvComp == 0 ? "" : settings.videoEvComp.toFixed(1); - font.pixelSize: 19 - timerConstraints: slider.pressed - title: qsTr("Exposure compensation"); - - widget: Slider { - id: slider - width: 500 - orientation: Qt.Horizontal - minimumValue: cam.evComp.minimum - maximumValue: cam.evComp.maximum - value: settings.videoEvComp - stepSize: 0.1 - onValueChanged: settings.videoEvComp = value.toFixed(1); - Component.onCompleted: { slider.value = settings.videoEvComp.toFixed(1); } + Label { + anchors.fill: parent + verticalAlignment: Text.AlignVCenter + visible: settings.videoEvComp != 0 + text: settings.videoEvComp == 0 ? "" : settings.videoEvComp.toFixed(1); } + + property list items: [ + Label { + height: parent ? parent.height : 0 + text: qsTr("EV"); + verticalAlignment: Text.AlignVCenter + }, + Slider { + id: slider + width: 500 + orientation: Qt.Horizontal + minimumValue: cam.evComp.minimum + maximumValue: cam.evComp.maximum + value: settings.videoEvComp + valueIndicatorVisible: true + stepSize: 0.1 + onValueChanged: settings.videoEvComp = value.toFixed(1); + Component.onCompleted: { slider.value = settings.videoEvComp.toFixed(1); } + }] } diff --git a/qml/VideoPage.qml b/qml/VideoPage.qml index ed112c6..5b1c96d 100644 --- a/qml/VideoPage.qml +++ b/qml/VideoPage.qml @@ -76,53 +76,19 @@ CameraPage { } } - VideoTorchButton { - id: torch - camera: cam - visible: controlsVisible + Rectangle { anchors.top: parent.top - anchors.left: parent.left anchors.topMargin: 20 - anchors.leftMargin: 20 - opacity: 0.5 - } - - VideoSceneButton { - id: scene - visible: controlsVisible - anchors.top: torch.bottom - anchors.left: parent.left - anchors.topMargin: 10 - anchors.leftMargin: 20 - } - - VideoEvCompButton { - id: evComp - visible: controlsVisible - anchors.top: scene.bottom - anchors.left: parent.left - anchors.topMargin: 10 - anchors.leftMargin: 20 - } - - MouseArea { - id: indicators - anchors.bottom: parent.bottom - anchors.bottomMargin: 20 anchors.left: parent.left anchors.leftMargin: 20 width: 48 height: col.height - onClicked: openFile("VideoSettingsPage.qml"); + color: "black" + border.color: "gray" + radius: 20 + opacity: 0.5 visible: controlsVisible - BorderImage { - id: image - anchors.fill: parent - smooth: true - source: indicators.pressed ? "image://theme/meegotouch-camera-settings-indicators-background-pressed" : "image://theme/meegotouch-camera-settings-indicators-background" - } - Column { id: col width: parent.width @@ -177,4 +143,39 @@ CameraPage { onClicked: openFile("PostCapturePage.qml"); visible: controlsVisible } + + CameraToolBar { + id: toolBar + anchors.bottom: parent.bottom + anchors.bottomMargin: 20 + anchors.left: parent.left + anchors.leftMargin: 20 + opacity: 0.5 + targetWidth: parent.width - (anchors.leftMargin * 2) - (66 * 1.5) + visible: controlsVisible + expanded: settings.showToolBar + onExpandedChanged: settings.showToolBar = expanded; + + items: [ + VideoTorchButton { + camera: cam + }, + VideoSceneButton { + onClicked: toolBar.push(items); + }, + VideoEvCompButton { + onClicked: toolBar.push(items); + }, + VideoWhiteBalanceButton { + onClicked: toolBar.push(items); + }, + VideoColorFilterButton { + onClicked: toolBar.push(items); + }, + ToolIcon { + iconSource: "image://theme/icon-m-toolbar-view-menu-white" + onClicked: openFile("VideoSettingsPage.qml"); + } + ] + } } diff --git a/qml/VideoSceneButton.qml b/qml/VideoSceneButton.qml index 3e5d1d7..a96819e 100644 --- a/qml/VideoSceneButton.qml +++ b/qml/VideoSceneButton.qml @@ -25,48 +25,28 @@ import com.nokia.meego 1.1 import QtCamera 1.0 import "data.js" as Data -Selector { +ToolIcon { id: button - iconSource: sceneIcon(settings.videoSceneMode); - - title: qsTr("Scene mode"); - - function sceneIcon(val) { - var x = row.children.length; - var i = 0; - for (i = 0; i < x; i++) { - if (row.children[i].value == val) { - return row.children[i].normalIcon; - } - } - } - - widget: Row { - id: row - height: button.checked ? 64 : 0 - width: button.checked ? (children.length * height) + (children.length - 1) * spacing : 0 - spacing: 10 - - Behavior on width { - // TODO: seems animation is not working - PropertyAnimation { duration: 250; } - } - + iconSource: "image://theme/" + Data.vsmIcon(settings.videoSceneMode); + property list items: [ + Label { + height: parent ? parent.height : 0 + text: qsTr("Scene"); + verticalAlignment: Text.AlignVCenter + }, CheckButton { normalIcon: "image://theme/" + Data.vsmIcon(value); checkedIcon: "image://theme/" + Data.vsmSelectedIcon(value); savedValue: settings.videoSceneMode onClicked: settings.videoSceneMode = value; value: Scene.Auto - } - + }, CheckButton { normalIcon: "image://theme/" + Data.vsmIcon(value); checkedIcon: "image://theme/" + Data.vsmSelectedIcon(value); savedValue: settings.videoSceneMode onClicked: settings.videoSceneMode = value; value: Scene.Night - } - } + }] } diff --git a/qml/VideoSettingsPage.qml b/qml/VideoSettingsPage.qml index 72c82f6..7fdb402 100644 --- a/qml/VideoSettingsPage.qml +++ b/qml/VideoSettingsPage.qml @@ -58,28 +58,6 @@ CameraPage { text: qsTr("Video settings"); } - Row { - width: parent.width - - ListItem { - id: wb - width: parent.width / 2 - title: qsTr("White balance"); - subtitle: Data.wbName(settings.videoWhiteBalance); - iconId: Data.wbSelectedIcon(settings.videoWhiteBalance); - onClicked: openFile("VideoWhiteBalancePage.qml"); - } - - ListItem { - id: cf - width: parent.width / 2 - title: qsTr("Color filter"); - subtitle: Data.cfName(settings.videoColorFilter); - iconId: Data.cfSelectedIcon(settings.videoColorFilter); - onClicked: openFile("VideoColorFilterPage.qml"); - } - } - SectionHeader { text: qsTr("Resolution"); } diff --git a/qml/VideoTorchButton.qml b/qml/VideoTorchButton.qml index 3e820a6..7958d7d 100644 --- a/qml/VideoTorchButton.qml +++ b/qml/VideoTorchButton.qml @@ -24,12 +24,8 @@ import QtQuick 1.1 import com.nokia.meego 1.1 import QtCamera 1.0 -Button { +ToolIcon { id: button - width: 56 - height: 56 - opacity: 0.5 - property Camera camera: null iconSource: settings.videoTorchOn ? "image://theme/icon-m-camera-torch-on" : "image://theme/icon-m-camera-torch-off" diff --git a/qml/VideoWhiteBalanceButton.qml b/qml/VideoWhiteBalanceButton.qml new file mode 100644 index 0000000..5e10720 --- /dev/null +++ b/qml/VideoWhiteBalanceButton.qml @@ -0,0 +1,74 @@ +// -*- qml -*- + +/*! + * This file is part of CameraPlus. + * + * Copyright (C) 2012 Mohammed Sameer + * + * 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 QtCamera 1.0 +import "data.js" as Data + +ToolIcon { + id: button + + iconSource: "image://theme/" + Data.wbIcon(settings.videoWhiteBalance); + + property list items: [ + Label { + height: parent ? parent.height : 0 + text: qsTr("WB"); + verticalAlignment: Text.AlignVCenter + }, + CheckButton { + normalIcon: "image://theme/" + Data.wbIcon(value); + checkedIcon: "image://theme/" + Data.wbSelectedIcon(value); + value: WhiteBalance.Auto + savedValue: settings.videoWhiteBalance + onClicked: settings.videoWhiteBalance = value; + }, + CheckButton { + normalIcon: "image://theme/" + Data.wbIcon(value); + checkedIcon: "image://theme/" + Data.wbSelectedIcon(value); + value: WhiteBalance.Sunset + savedValue: settings.videoWhiteBalance + onClicked: settings.videoWhiteBalance = value; + }, + CheckButton { + normalIcon: "image://theme/" + Data.wbIcon(value); + checkedIcon: "image://theme/" + Data.wbSelectedIcon(value); + value: WhiteBalance.Cloudy + savedValue: settings.videoWhiteBalance + onClicked: settings.videoWhiteBalance = value; + }, + CheckButton { + normalIcon: "image://theme/" + Data.wbIcon(value); + checkedIcon: "image://theme/" + Data.wbSelectedIcon(value); + value: WhiteBalance.Flourescent + savedValue: settings.videoWhiteBalance + onClicked: settings.videoWhiteBalance = value; + }, + CheckButton { + normalIcon: "image://theme/" + Data.wbIcon(value); + checkedIcon: "image://theme/" + Data.wbSelectedIcon(value); + value: WhiteBalance.Tungsten + savedValue: settings.videoWhiteBalance + onClicked: settings.videoWhiteBalance = value; + }] +} diff --git a/qml/VideoWhiteBalancePage.qml b/qml/VideoWhiteBalancePage.qml deleted file mode 100644 index 54b1e68..0000000 --- a/qml/VideoWhiteBalancePage.qml +++ /dev/null @@ -1,119 +0,0 @@ -// -*- qml -*- - -/*! - * This file is part of CameraPlus. - * - * Copyright (C) 2012 Mohammed Sameer - * - * 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 QtCamera 1.0 -import CameraPlus 1.0 -import "data.js" as Data - -CameraPage { - id: page - - controlsVisible: false - policyMode: CameraResources.Video - needsPipeline: true - - Rectangle { - color: "black" - width: parent.width - height: row.height + title.height + 30 - anchors.bottom: toolBar.top - opacity: 0.5 - - SectionHeader { - id: title - anchors.top: parent.top - anchors.topMargin: 10 - text: qsTr("White balance"); - } - - Row { - id: row - anchors.left: parent.left - anchors.right: parent.right - anchors.leftMargin: 20 - anchors.rightMargin: 20 - anchors.top: title.bottom - anchors.topMargin: 10 - - IconButton { - width: parent.width / 5 - normalIcon: "image://theme/" + Data.wbIcon(value); - checkedIcon: "image://theme/" + Data.wbSelectedIcon(value); - value: WhiteBalance.Auto - savedValue: settings.videoWhiteBalance - onClicked: settings.videoWhiteBalance = value; - text: Data.wbName(value); - } - - IconButton { - width: parent.width / 5 - normalIcon: "image://theme/" + Data.wbIcon(value); - checkedIcon: "image://theme/" + Data.wbSelectedIcon(value); - value: WhiteBalance.Sunset - savedValue: settings.videoWhiteBalance - onClicked: settings.videoWhiteBalance = value; - text: Data.wbName(value); - } - - IconButton { - width: parent.width / 5 - normalIcon: "image://theme/" + Data.wbIcon(value); - checkedIcon: "image://theme/" + Data.wbSelectedIcon(value); - value: WhiteBalance.Cloudy - savedValue: settings.videoWhiteBalance - onClicked: settings.videoWhiteBalance = value; - text: Data.wbName(value); - } - - IconButton { - width: parent.width / 5 - normalIcon: "image://theme/" + Data.wbIcon(value); - checkedIcon: "image://theme/" + Data.wbSelectedIcon(value); - value: WhiteBalance.Flourescent - savedValue: settings.videoWhiteBalance - onClicked: settings.videoWhiteBalance = value; - text: Data.wbName(value); - } - - IconButton { - width: parent.width / 5 - normalIcon: "image://theme/" + Data.wbIcon(value); - checkedIcon: "image://theme/" + Data.wbSelectedIcon(value); - value: WhiteBalance.Tungsten - savedValue: settings.videoWhiteBalance - onClicked: settings.videoWhiteBalance = value; - text: Data.wbName(value); - } - } - } - - ToolBar { - id: toolBar - anchors.bottom: parent.bottom - tools: ToolBarLayout { - id: layout - ToolIcon { iconId: "icon-m-toolbar-back"; onClicked: pageStack.pop(); } - } - } -} diff --git a/qml/data.js b/qml/data.js index 125341d..441eb15 100644 --- a/qml/data.js +++ b/qml/data.js @@ -78,10 +78,10 @@ var __vsm = [ ]; var __flash = [ - [Flash.Auto,"icon-m-camera-flash-auto-pressed", "icon-m-camera-flash-auto"], - [Flash.On, "icon-m-camera-flash-always-pressed", "icon-m-camera-flash-always"], - [Flash.Off, "icon-m-camera-flash-off-pressed", "icon-m-camera-flash-off"], - [Flash.RedEye, "icon-m-camera-flash-red-eye-pressed", "icon-m-camera-flash-red-eye"] + [Flash.Auto,"icon-m-camera-flash-auto-selected", "icon-m-camera-flash-auto"], + [Flash.On, "icon-m-camera-flash-always-selected", "icon-m-camera-flash-always"], + [Flash.Off, "icon-m-camera-flash-off-selected", "icon-m-camera-flash-off"], + [Flash.RedEye, "icon-m-camera-flash-red-eye-selected", "icon-m-camera-flash-red-eye"] ]; // ISO diff --git a/src/settings.cpp b/src/settings.cpp index 2cf7b03..37aaf15 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -39,6 +39,7 @@ #define DEFAULT_VIDEO_RESOLUTION "high" #define DEFAULT_SOUND_ENABLED true #define DEFAULT_VIDEO_TORCH_ON false +#define DEFAULT_SHOW_TOOL_BAR false Settings::Settings(QObject *parent) : QObject(parent), @@ -296,3 +297,15 @@ void Settings::setVideoTorchOn(bool on) { emit videoTorchOnChanged(); } } + +bool Settings::isToolBarShown() const { + return m_settings->value("camera/showToolBar", DEFAULT_SHOW_TOOL_BAR).toBool(); +} + +void Settings::setToolBarShown(bool shown) { + if (isToolBarShown() != shown) { + m_settings->setValue("camera/showToolBar", shown); + + emit toolBarShownChanged(); + } +} diff --git a/src/settings.h b/src/settings.h index 4ccafc0..defcfe9 100644 --- a/src/settings.h +++ b/src/settings.h @@ -57,6 +57,8 @@ class Settings : public QObject { Q_PROPERTY(bool soundEnabled READ isSoundEnabled WRITE setSoundEnabled NOTIFY soundEnabledChanged); Q_PROPERTY(bool videoTorchOn READ isVideoTorchOn WRITE setVideoTorchOn NOTIFY videoTorchOnChanged); + Q_PROPERTY(bool showToolBar READ isToolBarShown WRITE setToolBarShown NOTIFY toolBarShownChanged); + public: Settings(QObject *parent = 0); ~Settings(); @@ -124,6 +126,9 @@ public: bool isVideoTorchOn() const; void setVideoTorchOn(bool on); + bool isToolBarShown() const; + void setToolBarShown(bool shown); + signals: void modeChanged(); void creatorNameChanged(); @@ -146,6 +151,7 @@ signals: void videoResolutionChanged(); void soundEnabledChanged(); void videoTorchOnChanged(); + void toolBarShownChanged(); private: QSettings *m_settings; -- 2.25.1