Skip to content

Commit

Permalink
feat(qml): use bigger thumbnails when possible
Browse files Browse the repository at this point in the history
  • Loading branch information
Bionus committed Apr 25, 2024
1 parent 0b96dfb commit 247f526
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/gui-qml/src/components/ResultsView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ ScrollView {

Image {
id: img
source: "image://async/" + modelData.siteUrl + "¤" + modelData.previewUrl + "¤" + modelData.previewRect
source: "image://async/" + modelData.siteUrl + "¤" + modelData.smartPreviewUrl(width, height) + "¤" + modelData.previewRect
fillMode: root.thumbnailFillMode
anchors.centerIn: parent
width: parent.width - root.thumbnailSpacing
Expand Down
13 changes: 13 additions & 0 deletions src/gui-qml/src/models/qml-image.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include "models/qml-image.h"
#include <QSettings>
#include "models/profile.h"


QString QmlImage::smartPreviewUrl(int width, int height) const
{
if (m_profile->getSettings()->value("thumbnailSmartSize", true).toBool()) {
return m_image->mediaForSize(QSize(width, height)).url.toString();
} else {
return previewUrl();
}
}
2 changes: 2 additions & 0 deletions src/gui-qml/src/models/qml-image.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ class QmlImage : public QObject
bool isVideo() const { return m_image->isVideo(); }
bool isGallery() const { return m_image->isGallery(); }

Q_INVOKABLE QString smartPreviewUrl(int width, int height) const;

public slots:
void loadTags() { m_image->loadDetails(); }

Expand Down

0 comments on commit 247f526

Please sign in to comment.