Skip to content

Commit

Permalink
Merge pull request #170 from saeugetier/feature/131-automatic-return-…
Browse files Browse the repository at this point in the history
…to-front-page-when-idling-too-long-in-snapshot-mode

Feature/131 automatic return to front page when idling too long in snapshot mode
  • Loading branch information
saeugetier authored Jun 19, 2024
2 parents de4775b + 6734a6f commit 27a7218
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 2 deletions.
5 changes: 5 additions & 0 deletions qml/ApplicationFlow.qml
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ ApplicationFlowForm {
state = "collageSelection"
}

collageMenu.collageImage.onCollageImagesChanged:
{
snapshotMenu.snapshotTimeoutEnable = (count == 0)
}

galleryMenu.onExitGallery:
{
state = "collageSelection"
Expand Down
2 changes: 2 additions & 0 deletions qml/SnapshotMenu.qml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import GPIO 1.0
SnapshotMenuForm {
id: form

property bool snapshotTimeoutEnable : false

signal captured(string filename)
signal abort

Expand Down
7 changes: 7 additions & 0 deletions qml/content/CollageRenderer.qml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Item {
property int imagesLoading : 0

signal collageFull(bool full)
signal collageImagesChanged(int count)

Rectangle
{
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions src/collageimagemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -223,6 +224,7 @@ void CollageImageModel::clearImagePathes()
}

emit collageFullChanged(false);
emit countImagePathSetChanged(0);

emit dataChanged(this->index(0,0),this->index(rowCount()-1,0));
}
Expand Down Expand Up @@ -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 {
Expand Down
6 changes: 4 additions & 2 deletions src/collageimagemodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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<CollageImage*> mImages;
QUrl mBackgroundImage;
Expand Down

0 comments on commit 27a7218

Please sign in to comment.