Skip to content

Commit

Permalink
screenshooter: Fix the layout
Browse files Browse the repository at this point in the history
  • Loading branch information
plfiorini committed Jun 10, 2016
1 parent fb337e0 commit 808cabd
Showing 1 changed file with 42 additions and 57 deletions.
99 changes: 42 additions & 57 deletions screenshot/qml/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ ApplicationWindow {
id: shootButton
text: qsTr("Take Screenshot")
enabled: Screenshooter.enabled
visible: captureLayout.visible
onClicked: {
window.hide();
shootTimer.start();
Expand All @@ -73,6 +74,7 @@ ApplicationWindow {
Button {
id: actionButton
text: qsTr("OK")
visible: previewLayout.visible
onClicked: {
if (saveAction.checked)
fileDialog.open();
Expand All @@ -84,32 +86,11 @@ ApplicationWindow {
visible: true

ColumnLayout {
id: mainLayout
id: captureLayout
anchors {
fill: parent
margins: FluidUi.Units.largeSpacing
}
state: "capture"
states: [
State {
name: "capture"
PropertyChanges { target: captureGroupBox; visible: true }
PropertyChanges { target: effectsGroupBox; visible: true }
PropertyChanges { target: previewLayout; visible: false }
PropertyChanges { target: shootButton; visible: true }
PropertyChanges { target: actionButton; visible: false }
},
State {
name: "preview"
PropertyChanges { target: captureGroupBox; visible: false }
PropertyChanges { target: effectsGroupBox; visible: false }
PropertyChanges { target: previewLayout; visible: true }
PropertyChanges { target: shootButton; visible: false }
PropertyChanges { target: actionButton; visible: true }
}
]

Keys.onEscapePressed: Qt.quit()

GroupBox {
id: captureGroupBox
Expand Down Expand Up @@ -207,50 +188,54 @@ ApplicationWindow {

Layout.fillWidth: true
}
}

ColumnLayout {
id: previewLayout
spacing: FluidUi.Units.smallSpacing

GroupBox {
title: qsTr("Preview")
ColumnLayout {
id: previewLayout
anchors {
fill: parent
margins: FluidUi.Units.largeSpacing
}
visible: !captureLayout.visible

Image {
id: preview
anchors.fill: parent
//width: height * (sourceSize.width / sourceSize.height)
//height: FluidUi.Units.dp(240)
fillMode: Image.Stretch
cache: false
}
Image {
property real ratio: sourceSize.width / sourceSize.height

Layout.fillWidth: true
}
id: preview
fillMode: Image.Stretch
cache: false

GroupBox {
title: qsTr("Options")
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
Layout.preferredWidth: parent.width
Layout.preferredHeight: Layout.preferredWidth / ratio
}

ColumnLayout {
spacing: FluidUi.Units.smallSpacing
GroupBox {
title: qsTr("Options")

RadioButton {
id: saveAction
text: qsTr("Save")
autoExclusive: true
checked: true
}
ColumnLayout {
spacing: FluidUi.Units.smallSpacing

RadioButton {
id: copyAction
text: qsTr("Copy to clipboard")
autoExclusive: true
checked: false
}
RadioButton {
id: saveAction
text: qsTr("Save")
autoExclusive: true
checked: true
}

Layout.fillWidth: true
Layout.fillHeight: true
RadioButton {
id: copyAction
text: qsTr("Copy to clipboard")
autoExclusive: true
checked: false
}
}

Layout.fillWidth: true
}

Item {
Layout.fillHeight: true
}
}

Expand All @@ -269,7 +254,7 @@ ApplicationWindow {
interval: 1000
onTriggered: {
preview.source = "image://screenshooter/last";
mainLayout.state = "preview";
captureLayout.visible = false;
window.show();
}
}
Expand Down

0 comments on commit 808cabd

Please sign in to comment.