Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Film controls (bindings + UI)

  • Loading branch information...
commit 1bf2e50fe465dac40fe084fef6ad6f78a96f33c4 1 parent 95561be
Thomas Perl thp authored
42 ClassicPrintDeclarative.h
View
@@ -7,6 +7,7 @@
#include "ClassicPrint.h"
#include "ClassicPrintLens.h"
+#include "ClassicPrintFilm.h"
#include "ClassicPrintProcessing.h"
class ClassicPrintDeclarative : public QObject {
@@ -37,6 +38,13 @@ class ClassicPrintDeclarative : public QObject {
QObject::connect(this, SIGNAL(defocusChanged()),
this, SLOT(contentUpdated()));
+ /* Film */
+ QObject::connect(this, SIGNAL(temperatureChanged()),
+ this, SLOT(contentUpdated()));
+
+ QObject::connect(this, SIGNAL(noiseChanged()),
+ this, SLOT(contentUpdated()));
+
/* Processing */
QObject::connect(this, SIGNAL(contrastChanged()),
this, SLOT(contentUpdated()));
@@ -125,6 +133,36 @@ class ClassicPrintDeclarative : public QObject {
NOTIFY defocusChanged)
+ /* Film */
+ qreal temperature() {
+ return getClassicPrint()->getCurrentFilm()->temperature()/100.;
+ }
+
+ void setTemperature(qreal temperature) {
+ getClassicPrint()->getCurrentFilm()->setTemperature(temperature*100.);
+ emit temperatureChanged();
+ }
+
+ Q_PROPERTY(qreal temperature
+ READ temperature
+ WRITE setTemperature
+ NOTIFY temperatureChanged)
+
+ qreal noise() {
+ return getClassicPrint()->getCurrentFilm()->noise()/100.;
+ }
+
+ void setNoise(qreal noise) {
+ getClassicPrint()->getCurrentFilm()->setNoise(noise*100.);
+ emit noiseChanged();
+ }
+
+ Q_PROPERTY(qreal noise
+ READ noise
+ WRITE setNoise
+ NOTIFY noiseChanged)
+
+
/* Processing */
qreal contrast() {
@@ -221,6 +259,10 @@ class ClassicPrintDeclarative : public QObject {
void dodgeChanged();
void defocusChanged();
+ /* Film */
+ void temperatureChanged();
+ void noiseChanged();
+
/* Processing */
void contrastChanged();
void colourisationChanged();
2  classicprintqml.cpp
View
@@ -6,7 +6,7 @@
#include "ClassicPrintProvider.h"
#include "ClassicPrintDeclarative.h"
-//#define CLASSICPRINTQML_DESKTOP
+#define CLASSICPRINTQML_DESKTOP
int main(int argc, char *argv[])
{
80 classicprintqml.qml
View
@@ -101,6 +101,7 @@ PageStackWindow {
anchors.fill: parent
onClicked: {
lensPane.state = 'down';
+ filmPane.state = 'down';
processingPane.state = 'down';
}
}
@@ -206,6 +207,70 @@ PageStackWindow {
}
Rectangle {
+ id: filmPane
+
+ state: 'down'
+
+ states: [
+ State {
+ name: 'up'
+ AnchorChanges { target: filmPane; anchors.bottom: imagePage.bottom }
+ },
+ State {
+ name: 'down'
+ AnchorChanges { target: filmPane; anchors.top: imagePage.bottom }
+ }
+ ]
+
+ transitions: Transition {
+ AnchorAnimation { easing.type: Easing.OutCirc }
+ }
+
+ height: filmColumn.height + 2*20
+ color: '#a0000000'
+
+ anchors {
+ left: parent.left
+ right: parent.right
+ }
+
+ Column {
+ id: filmColumn
+ width: parent.width * .8
+
+ anchors {
+ horizontalCenter: parent.horizontalCenter
+ top: parent.top
+ topMargin: 20
+ }
+
+ Label { text: 'Temperature' }
+
+ Slider {
+ id: temperatureSlider
+ width: parent.width
+ onValueChanged: {
+ if (pressed) {
+ classicPrint.temperature = value;
+ }
+ }
+ }
+
+ Label { text: 'Noise' }
+
+ Slider {
+ id: noiseSlider
+ width: parent.width
+ onValueChanged: {
+ if (pressed) {
+ classicPrint.noise = value;
+ }
+ }
+ }
+ }
+ }
+
+ Rectangle {
id: processingPane
state: 'down'
@@ -346,6 +411,7 @@ PageStackWindow {
dodgeSlider.value = classicPrint.dodge;
defocusSwitch.checked = classicPrint.defocus;
+ filmPane.state = 'down';
processingPane.state = 'down';
lensPane.state = 'up';
}
@@ -356,6 +422,19 @@ PageStackWindow {
visible: pageStack.currentPage == imagePage
iconId: 'icon-m-toolbar-all-content-white'
anchors.horizontalCenter: parent.horizontalCenter
+ onClicked: {
+ if (filmPane.state === 'up') {
+ filmPane.state = 'down';
+ return;
+ }
+
+ temperatureSlider.value = classicPrint.temperature;
+ noiseSlider.value = classicPrint.noise;
+
+ lensPane.state = 'down';
+ processingPane.state = 'down';
+ filmPane.state = 'up';
+ }
}
ToolIcon {
@@ -378,6 +457,7 @@ PageStackWindow {
lightLeakRow.checkedButton = lightLeakRow.children[classicPrint.lightLeak];
lensPane.state = 'down';
+ filmPane.state = 'down';
processingPane.state = 'up';
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.