From 6734a6ff7cd0e3a04c77b16b0a89b6882098e793 Mon Sep 17 00:00:00 2001 From: Timm Date: Wed, 19 Jun 2024 21:57:29 +0200 Subject: [PATCH] add poperty to enable timeout timer --- qml/ApplicationFlow.qml | 5 +++++ qml/SnapshotMenu.qml | 2 ++ qml/content/CollageRenderer.qml | 7 +++++++ src/collageimagemodel.cpp | 3 +++ src/collageimagemodel.h | 6 ++++-- 5 files changed, 21 insertions(+), 2 deletions(-) diff --git a/qml/ApplicationFlow.qml b/qml/ApplicationFlow.qml index a2b349f..2975865 100644 --- a/qml/ApplicationFlow.qml +++ b/qml/ApplicationFlow.qml @@ -84,6 +84,11 @@ ApplicationFlowForm { state = "collageSelection" } + collageMenu.collageImage.onCollageImagesChanged: + { + snapshotMenu.snapshotTimeoutEnable = (count == 0) + } + galleryMenu.onExitGallery: { state = "collageSelection" diff --git a/qml/SnapshotMenu.qml b/qml/SnapshotMenu.qml index 1cae643..a9d19a6 100644 --- a/qml/SnapshotMenu.qml +++ b/qml/SnapshotMenu.qml @@ -4,6 +4,8 @@ import GPIO 1.0 SnapshotMenuForm { id: form + property bool snapshotTimeoutEnable : false + signal captured(string filename) signal abort diff --git a/qml/content/CollageRenderer.qml b/qml/content/CollageRenderer.qml index eb73b4f..8ee1e41 100644 --- a/qml/content/CollageRenderer.qml +++ b/qml/content/CollageRenderer.qml @@ -11,6 +11,7 @@ Item { property int imagesLoading : 0 signal collageFull(bool full) + signal collageImagesChanged(int count) Rectangle { @@ -133,6 +134,12 @@ Item { collageFull(full) console.log("Collage Full Changed to " + Boolean(full).toString()); } + + onCountImagePathSetChanged: + { + collageImagesChanged(count) + console.log("Images in model set: " + Number(count).toString()); + } } function saveImage(filename, size) diff --git a/src/collageimagemodel.cpp b/src/collageimagemodel.cpp index 0d70ce6..e473e78 100644 --- a/src/collageimagemodel.cpp +++ b/src/collageimagemodel.cpp @@ -204,6 +204,7 @@ bool CollageImageModel::addImagePath(QUrl source, QString effect) } QModelIndex ii = index(i,0); emit dataChanged(ii, ii); + emit countImagePathSetChanged(countImagePathSet()); if(collageFull()) { emit collageFullChanged(true); @@ -223,6 +224,7 @@ void CollageImageModel::clearImagePathes() } emit collageFullChanged(false); + emit countImagePathSetChanged(0); emit dataChanged(this->index(0,0),this->index(rowCount()-1,0)); } @@ -258,6 +260,7 @@ bool CollageImageModel::clearImagePath(int index) } #endif emit dataChanged(this->index(0,0),this->index(rowCount()-1,0)); + emit countImagePathSetChanged(countImagePathSet()); return true; } else { diff --git a/src/collageimagemodel.h b/src/collageimagemodel.h index c353779..633355f 100644 --- a/src/collageimagemodel.h +++ b/src/collageimagemodel.h @@ -55,9 +55,9 @@ class CollageImageModel : public QAbstractListModel, public ModelParser Q_OBJECT Q_PROPERTY(QUrl backgroundImage READ backgroundImage) Q_PROPERTY(QUrl foregroundImage READ foregroundImage) - Q_PROPERTY(int countImagePathSet READ countImagePathSet) + Q_PROPERTY(int countImagePathSet READ countImagePathSet NOTIFY countImagePathSet) Q_PROPERTY(bool collageFull READ collageFull NOTIFY collageFullChanged) - Q_PROPERTY(QSize collagePixelSize READ collagePixelSize) + Q_PROPERTY(QSize collagePixelSize READ collagePixelSize NOTIFY collagePixelSizeChanged) public: enum ImageRoles { ImagePathRole = Qt::UserRole + 1, @@ -87,6 +87,8 @@ class CollageImageModel : public QAbstractListModel, public ModelParser int countImagePathSet() const; signals: void collageFullChanged(bool full); + void countImagePathSetChanged(int count); + void collagePixelSizeChanged(QSize size); protected: QList mImages; QUrl mBackgroundImage;