Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 12 additions & 10 deletions faststack/qml/BatchProgressDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Dialog {

property color backgroundColor: "#1e1e1e"
property color textColor: "white"
property var uiStateRef: typeof uiState !== "undefined" ? uiState : null

background: Rectangle {
color: batchProgressDialog.backgroundColor
Expand All @@ -28,9 +29,9 @@ Dialog {
Label {
id: statusLabel
text: {
if (!uiState) return ""
var current = uiState.batchAutoLevelsCurrent
var total = uiState.batchAutoLevelsTotal
if (!batchProgressDialog.uiStateRef) return ""
var current = batchProgressDialog.uiStateRef.batchAutoLevelsCurrent
var total = batchProgressDialog.uiStateRef.batchAutoLevelsTotal
return `Processing image ${current} of ${total}...`
}
color: batchProgressDialog.textColor
Expand All @@ -42,8 +43,8 @@ Dialog {
id: progressBar
width: parent.width - parent.padding * 2
from: 0
to: uiState ? uiState.batchAutoLevelsTotal : 1
value: uiState ? uiState.batchAutoLevelsCurrent : 0
to: batchProgressDialog.uiStateRef ? batchProgressDialog.uiStateRef.batchAutoLevelsTotal : 1
value: batchProgressDialog.uiStateRef ? batchProgressDialog.uiStateRef.batchAutoLevelsCurrent : 0

background: Rectangle {
implicitHeight: 12
Expand All @@ -62,17 +63,18 @@ Dialog {
}

Button {
id: cancelButton
text: "Cancel"
anchors.horizontalCenter: parent.horizontalCenter
onClicked: {
if (uiState) uiState.cancelBatchAutoLevels()
if (batchProgressDialog.uiStateRef) batchProgressDialog.uiStateRef.cancelBatchAutoLevels()
}
background: Rectangle {
color: parent.pressed ? "#555555" : (parent.hovered ? "#666666" : "#444444")
color: cancelButton.down ? "#555555" : (cancelButton.hovered ? "#666666" : "#444444")
radius: 4
}
contentItem: Text {
text: parent.text
text: cancelButton.text
color: batchProgressDialog.textColor
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
Expand All @@ -81,9 +83,9 @@ Dialog {
}

Connections {
target: uiState
target: batchProgressDialog.uiStateRef
function onBatchAutoLevelsActiveChanged() {
if (uiState && uiState.batchAutoLevelsActive) {
if (batchProgressDialog.uiStateRef && batchProgressDialog.uiStateRef.batchAutoLevelsActive) {
batchProgressDialog.open()
} else {
batchProgressDialog.close()
Expand Down
203 changes: 112 additions & 91 deletions faststack/qml/Components.qml

Large diffs are not rendered by default.

87 changes: 48 additions & 39 deletions faststack/qml/DarkenToolPanel.qml

Large diffs are not rendered by default.

36 changes: 20 additions & 16 deletions faststack/qml/DeleteBatchDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Dialog {
property int batchCount: 0
property color backgroundColor: "#1e1e1e"
property color textColor: "white"
property var controllerRef: typeof controller !== "undefined" ? controller : null

background: Rectangle {
color: deleteBatchDialog.backgroundColor
Expand All @@ -27,7 +28,7 @@ Dialog {
padding: 20

Label {
text: `You have ${batchCount} image${batchCount === 1 ? '' : 's'} selected in a batch.`
text: `You have ${deleteBatchDialog.batchCount} image${deleteBatchDialog.batchCount === 1 ? '' : 's'} selected in a batch.`
wrapMode: Text.WordWrap
width: parent.width - parent.padding * 2
color: deleteBatchDialog.textColor
Expand All @@ -47,39 +48,41 @@ Dialog {
anchors.horizontalCenter: parent.horizontalCenter

Button {
id: deleteCurrentButton
text: "Delete Current Image"
onClicked: {
deleteBatchDialog.close()
if (controller) {
controller.delete_current_image_only()
if (deleteBatchDialog.controllerRef) {
deleteBatchDialog.controllerRef.delete_current_image_only()
}
}
background: Rectangle {
color: parent.pressed ? "#555555" : (parent.hovered ? "#666666" : "#444444")
color: deleteCurrentButton.down ? "#555555" : (deleteCurrentButton.hovered ? "#666666" : "#444444")
radius: 4
}
contentItem: Text {
text: parent.text
text: deleteCurrentButton.text
color: deleteBatchDialog.textColor
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
}

Button {
text: `Delete All (${batchCount})`
id: deleteAllButton
text: `Delete All (${deleteBatchDialog.batchCount})`
onClicked: {
deleteBatchDialog.close()
if (controller) {
controller.delete_batch_images()
if (deleteBatchDialog.controllerRef) {
deleteBatchDialog.controllerRef.delete_batch_images()
}
}
background: Rectangle {
color: parent.pressed ? "#cc0000" : (parent.hovered ? "#ff0000" : "#aa0000")
color: deleteAllButton.down ? "#cc0000" : (deleteAllButton.hovered ? "#ff0000" : "#aa0000")
radius: 4
}
contentItem: Text {
text: parent.text
text: deleteAllButton.text
color: deleteBatchDialog.textColor
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
Expand All @@ -88,16 +91,17 @@ Dialog {
}

Button {
id: cancelDeleteButton
text: "Cancel"
onClicked: {
deleteBatchDialog.close()
}
background: Rectangle {
color: parent.pressed ? "#555555" : (parent.hovered ? "#666666" : "#444444")
color: cancelDeleteButton.down ? "#555555" : (cancelDeleteButton.hovered ? "#666666" : "#444444")
radius: 4
}
contentItem: Text {
text: parent.text
text: cancelDeleteButton.text
color: deleteBatchDialog.textColor
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
Expand All @@ -108,15 +112,15 @@ Dialog {

onOpened: {
// Notify Python that a dialog is open
if (controller) {
controller.dialog_opened()
if (deleteBatchDialog.controllerRef) {
deleteBatchDialog.controllerRef.dialog_opened()
}
}

onClosed: {
// Notify Python that dialog is closed
if (controller) {
controller.dialog_closed()
if (deleteBatchDialog.controllerRef) {
deleteBatchDialog.controllerRef.dialog_closed()
}
}
}
9 changes: 5 additions & 4 deletions faststack/qml/ExifDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Dialog {
// Theme properties (can be bound from Main.qml)
property color backgroundColor: "#333333"
property color textColor: "#ffffff"
property var controllerRef: typeof controller !== "undefined" ? controller : null

background: Rectangle {
color: exifDialog.backgroundColor
Expand All @@ -29,14 +30,14 @@ Dialog {
// Reset to summary view when opened
showFull = false
// Notify Python that a dialog is open
if (controller) {
controller.dialog_opened()
if (exifDialog.controllerRef) {
exifDialog.controllerRef.dialog_opened()
}
}

onClosed: {
if (controller) {
controller.dialog_closed()
if (exifDialog.controllerRef) {
exifDialog.controllerRef.dialog_closed()
}
}

Expand Down
25 changes: 13 additions & 12 deletions faststack/qml/FilterDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Dialog {
property var filterFlags: []
property color backgroundColor: "#1e1e1e"
property color textColor: "white"
property var controllerRef: typeof controller !== "undefined" ? controller : null


// Match the app's theme dynamically
Expand Down Expand Up @@ -84,47 +85,47 @@ Dialog {
checked: false
Material.foreground: filterDialog.textColor
Material.accent: "#4fc3f7"
onCheckedChanged: _collectFlags()
onCheckedChanged: filterDialog._collectFlags()
}
CheckBox {
id: cbStacked
text: "Stacked"
checked: false
Material.foreground: filterDialog.textColor
Material.accent: "#81c784"
onCheckedChanged: _collectFlags()
onCheckedChanged: filterDialog._collectFlags()
}
CheckBox {
id: cbEdited
text: "Edited"
checked: false
Material.foreground: filterDialog.textColor
Material.accent: "#ffb74d"
onCheckedChanged: _collectFlags()
onCheckedChanged: filterDialog._collectFlags()
}
CheckBox {
id: cbRestacked
text: "Restacked"
checked: false
Material.foreground: filterDialog.textColor
Material.accent: "#ce93d8"
onCheckedChanged: _collectFlags()
onCheckedChanged: filterDialog._collectFlags()
}
CheckBox {
id: cbTodo
text: "Todo"
checked: false
Material.foreground: filterDialog.textColor
Material.accent: "#64B5F6"
onCheckedChanged: _collectFlags()
onCheckedChanged: filterDialog._collectFlags()
}
CheckBox {
id: cbFavorite
text: "Favorite"
checked: false
Material.foreground: filterDialog.textColor
Material.accent: "#ffd54f"
onCheckedChanged: _collectFlags()
onCheckedChanged: filterDialog._collectFlags()
}
}

Expand Down Expand Up @@ -155,12 +156,12 @@ Dialog {

onOpened: {
// Load current filter string from controller
var current = controller && controller.get_filter_string ? controller.get_filter_string() : ""
var current = filterDialog.controllerRef && filterDialog.controllerRef.get_filter_string ? filterDialog.controllerRef.get_filter_string() : ""
filterDialog.filterString = current || ""
filterField.text = filterDialog.filterString

// Load current filter flags from controller
var currentFlags = controller && controller.get_filter_flags ? controller.get_filter_flags() : []
var currentFlags = filterDialog.controllerRef && filterDialog.controllerRef.get_filter_flags ? filterDialog.controllerRef.get_filter_flags() : []
cbUploaded.checked = currentFlags.indexOf("uploaded") >= 0
cbStacked.checked = currentFlags.indexOf("stacked") >= 0
cbEdited.checked = currentFlags.indexOf("edited") >= 0
Expand All @@ -171,15 +172,15 @@ Dialog {
filterField.forceActiveFocus()
filterField.selectAll()
// Notify Python that a dialog is open
if (controller && controller.dialog_opened) {
controller.dialog_opened()
if (filterDialog.controllerRef && filterDialog.controllerRef.dialog_opened) {
filterDialog.controllerRef.dialog_opened()
}
}

onClosed: {
// Notify Python that dialog is closed
if (controller && controller.dialog_closed) {
controller.dialog_closed()
if (filterDialog.controllerRef && filterDialog.controllerRef.dialog_closed) {
filterDialog.controllerRef.dialog_closed()
}
}
}
41 changes: 21 additions & 20 deletions faststack/qml/HistogramWindow.qml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import QtQuick
import QtQuick.Window
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15

Window {
Expand All @@ -10,38 +9,40 @@ Window {
height: 450
minimumWidth: 100
minimumHeight: 50
visible: uiState ? uiState.isHistogramVisible : false
property var uiStateRef: typeof uiState !== "undefined" ? uiState : null
property var controllerRef: typeof controller !== "undefined" ? controller : null
visible: histogramWindow.uiStateRef ? histogramWindow.uiStateRef.isHistogramVisible : false

FocusScope {
id: histogramKeyScope
anchors.fill: parent
focus: histogramWindow.visible

Keys.onPressed: function(event) {
if (event.key === Qt.Key_H && controller) {
controller.toggle_histogram()
if (event.key === Qt.Key_H && histogramWindow.controllerRef) {
histogramWindow.controllerRef.toggle_histogram()
event.accepted = true
} else if (controller) {
} else if (histogramWindow.controllerRef) {
// Forward unhandled keys (e.g. arrow keys) to controller
controller.handle_key_from_histogram(event.key, event.modifiers, event.text)
histogramWindow.controllerRef.handle_key_from_histogram(event.key, event.modifiers, event.text)
event.accepted = true
}
}
}

Connections {
target: uiState
target: histogramWindow.uiStateRef
function onCurrentImageSourceChanged() {
if (histogramWindow.visible && controller) {
controller.update_histogram()
if (histogramWindow.visible && histogramWindow.controllerRef) {
histogramWindow.controllerRef.update_histogram()
}
}
}

onVisibleChanged: {
if (visible && controller) {
if (visible && histogramWindow.controllerRef) {
histogramKeyScope.forceActiveFocus()
controller.update_histogram()
histogramWindow.controllerRef.update_histogram()
}
}

Expand All @@ -68,9 +69,9 @@ Window {
dangerColor: histogramWindow.dangerColor
textColor: histogramWindow.primaryTextColor

histogramData: uiState && uiState.histogramData ? (uiState.histogramData["r"] || []) : []
clipCount: uiState && uiState.histogramData ? (uiState.histogramData["r_clip"] || 0) : 0
preClipCount: uiState && uiState.histogramData ? (uiState.histogramData["r_preclip"] || 0) : 0
histogramData: histogramWindow.uiStateRef && histogramWindow.uiStateRef.histogramData ? (histogramWindow.uiStateRef.histogramData["r"] || []) : []
clipCount: histogramWindow.uiStateRef && histogramWindow.uiStateRef.histogramData ? (histogramWindow.uiStateRef.histogramData["r_clip"] || 0) : 0
preClipCount: histogramWindow.uiStateRef && histogramWindow.uiStateRef.histogramData ? (histogramWindow.uiStateRef.histogramData["r_preclip"] || 0) : 0
}

SingleChannelHistogram {
Expand All @@ -83,9 +84,9 @@ Window {
dangerColor: histogramWindow.dangerColor
textColor: histogramWindow.primaryTextColor

histogramData: uiState && uiState.histogramData ? (uiState.histogramData["g"] || []) : []
clipCount: uiState && uiState.histogramData ? (uiState.histogramData["g_clip"] || 0) : 0
preClipCount: uiState && uiState.histogramData ? (uiState.histogramData["g_preclip"] || 0) : 0
histogramData: histogramWindow.uiStateRef && histogramWindow.uiStateRef.histogramData ? (histogramWindow.uiStateRef.histogramData["g"] || []) : []
clipCount: histogramWindow.uiStateRef && histogramWindow.uiStateRef.histogramData ? (histogramWindow.uiStateRef.histogramData["g_clip"] || 0) : 0
preClipCount: histogramWindow.uiStateRef && histogramWindow.uiStateRef.histogramData ? (histogramWindow.uiStateRef.histogramData["g_preclip"] || 0) : 0
}

SingleChannelHistogram {
Expand All @@ -98,9 +99,9 @@ Window {
dangerColor: histogramWindow.dangerColor
textColor: histogramWindow.primaryTextColor

histogramData: uiState && uiState.histogramData ? (uiState.histogramData["b"] || []) : []
clipCount: uiState && uiState.histogramData ? (uiState.histogramData["b_clip"] || 0) : 0
preClipCount: uiState && uiState.histogramData ? (uiState.histogramData["b_preclip"] || 0) : 0
histogramData: histogramWindow.uiStateRef && histogramWindow.uiStateRef.histogramData ? (histogramWindow.uiStateRef.histogramData["b"] || []) : []
clipCount: histogramWindow.uiStateRef && histogramWindow.uiStateRef.histogramData ? (histogramWindow.uiStateRef.histogramData["b_clip"] || 0) : 0
preClipCount: histogramWindow.uiStateRef && histogramWindow.uiStateRef.histogramData ? (histogramWindow.uiStateRef.histogramData["b_preclip"] || 0) : 0
}
}
}
Loading
Loading