| 1 |
/* |
| 2 |
* Copyright (C) 2014 Canonical Ltd. |
| 3 |
* |
| 4 |
* This program is free software: you can redistribute it and/or modify |
| 5 |
* it under the terms of the GNU General Public License version 3 as |
| 6 |
* published by the Free Software Foundation. |
| 7 |
* |
| 8 |
* This program is distributed in the hope that it will be useful, |
| 9 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 |
* GNU General Public License for more details. |
| 12 |
* |
| 13 |
* You should have received a copy of the GNU General Public License |
| 14 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 |
*/ |
| 16 |
|
| 17 |
import QtQuick 2.9 |
| 18 |
import Lomiri.Components |
| 19 |
import Lomiri.Components.Extras 0.2 |
| 20 |
|
| 21 |
// When the photo editor uses a proper PageStack this will switch back to being |
| 22 |
// an Item as it will not need to cover what is below it. |
| 23 |
Rectangle { |
| 24 |
id: adjuster |
| 25 |
color:"black" |
| 26 |
|
| 27 |
property alias exposure: exposureSelector.value |
| 28 |
property bool enabled |
| 29 |
|
| 30 |
signal confirm() |
| 31 |
signal cancel() |
| 32 |
|
| 33 |
Image { |
| 34 |
id: targetImage |
| 35 |
anchors.fill: parent |
| 36 |
fillMode: Image.PreserveAspectFit |
| 37 |
asynchronous: true |
| 38 |
cache: false |
| 39 |
sourceSize { |
| 40 |
width: targetImage.width |
| 41 |
height: targetImage.height |
| 42 |
} |
| 43 |
} |
| 44 |
|
| 45 |
Column { |
| 46 |
anchors.left: parent.left |
| 47 |
anchors.right: parent.right |
| 48 |
anchors.bottom: parent.bottom |
| 49 |
anchors.margins: units.gu(2) |
| 50 |
spacing: units.gu(2) |
| 51 |
|
| 52 |
Slider { |
| 53 |
id: exposureSelector |
| 54 |
live: false |
| 55 |
minimumValue: -1.0 |
| 56 |
maximumValue: +1.0 |
| 57 |
value: 0.0 |
| 58 |
enabled: adjuster.enabled |
| 59 |
|
| 60 |
anchors.left: parent.left |
| 61 |
anchors.right: parent.right |
| 62 |
height: units.gu(2) |
| 63 |
|
| 64 |
function formatValue(value) { |
| 65 |
return (Math.round(value * 100) / 100).toString() |
| 66 |
} |
| 67 |
} |
| 68 |
Row { |
| 69 |
anchors.horizontalCenter: parent.horizontalCenter |
| 70 |
spacing: units.gu(2) |
| 71 |
Button { |
| 72 |
text: i18n.dtr("lomiri-ui-extras", "Cancel") |
| 73 |
enabled: adjuster.enabled |
| 74 |
onTriggered: { |
| 75 |
targetImage.source = ""; |
| 76 |
cancel(); |
| 77 |
} |
| 78 |
} |
| 79 |
Button { |
| 80 |
text: i18n.dtr("lomiri-ui-extras", "Done") |
| 81 |
color: theme.palette.normal.positive |
| 82 |
enabled: adjuster.enabled |
| 83 |
onTriggered: { |
| 84 |
targetImage.source = ""; |
| 85 |
confirm(); |
| 86 |
} |
| 87 |
} |
| 88 |
} |
| 89 |
} |
| 90 |
|
| 91 |
function start(target) { |
| 92 |
targetImage.source = target; |
| 93 |
exposure = 0.0; |
| 94 |
opacity = 1.0; |
| 95 |
} |
| 96 |
|
| 97 |
function reload() { |
| 98 |
var path = targetImage.source; |
| 99 |
targetImage.asynchronous = false; |
| 100 |
targetImage.source = ""; |
| 101 |
targetImage.asynchronous = true; |
| 102 |
targetImage.source = path; |
| 103 |
} |
| 104 |
} |