From c5eccdebc0124ca110754baab370037e1d015b1e Mon Sep 17 00:00:00 2001 From: reionwong Date: Tue, 17 Aug 2021 15:58:29 +0800 Subject: [PATCH] Fix property window crash --- dialogs/filepropertiesdialog.cpp | 4 +++- qml/Dialogs/PropertiesDialog.qml | 7 +++---- qml/FolderGridItem.qml | 4 ++-- qml/FolderListItem.qml | 2 -- thumbnailer/thumbnailcache.cpp | 2 +- 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/dialogs/filepropertiesdialog.cpp b/dialogs/filepropertiesdialog.cpp index 131dc65..98f6f6c 100644 --- a/dialogs/filepropertiesdialog.cpp +++ b/dialogs/filepropertiesdialog.cpp @@ -172,7 +172,7 @@ bool FilePropertiesDialog::event(QEvent *e) void FilePropertiesDialog::init() { engine()->rootContext()->setContextProperty("main", this); - engine()->addImageProvider(QStringLiteral("icontheme"), new DesktopIconProvider()); + // engine()->addImageProvider(QStringLiteral("icontheme"), new DesktopIconProvider()); setFlag(Qt::Dialog); setTitle(tr("Properties")); @@ -225,9 +225,11 @@ void FilePropertiesDialog::init() m_isWritable = false; m_fileName = tr("%1 files").arg(m_items.count()); m_location = QFileInfo(m_items.first().localPath()).dir().path(); + m_iconName = "unknown"; emit fileNameChanged(); emit locationChanged(); + emit iconNameChanged(); } emit isWritableChanged(); diff --git a/qml/Dialogs/PropertiesDialog.qml b/qml/Dialogs/PropertiesDialog.qml index cd80ded..7002d88 100644 --- a/qml/Dialogs/PropertiesDialog.qml +++ b/qml/Dialogs/PropertiesDialog.qml @@ -65,11 +65,10 @@ Item { RowLayout { spacing: FishUI.Units.largeSpacing * 2 - Image { + FishUI.IconItem { width: 64 - height: width - sourceSize: Qt.size(width, height) - source: "image://icontheme/" + main.iconName + height: 64 + source: main.iconName } TextField { diff --git a/qml/FolderGridItem.qml b/qml/FolderGridItem.qml index 201fa61..b4214a1 100644 --- a/qml/FolderGridItem.qml +++ b/qml/FolderGridItem.qml @@ -94,7 +94,7 @@ Item { sourceSize: Qt.size(width, height) source: "image://icontheme/" + model.iconName visible: !_image.visible - smooth: false + smooth: true antialiasing: true ColorOverlay { @@ -128,7 +128,7 @@ Item { source: model.thumbnail ? model.thumbnail : "" asynchronous: true cache: false - smooth: false + smooth: true antialiasing: true // Because of the effect of OpacityMask. diff --git a/qml/FolderListItem.qml b/qml/FolderListItem.qml index 5a96050..dac5d35 100644 --- a/qml/FolderListItem.qml +++ b/qml/FolderListItem.qml @@ -86,7 +86,6 @@ Item { source: "image://icontheme/" + model.iconName visible: !_image.visible asynchronous: true - smooth: false } Image { @@ -99,7 +98,6 @@ Item { visible: _image.status === Image.Ready fillMode: Image.PreserveAspectFit asynchronous: true - smooth: false cache: false layer.enabled: true diff --git a/thumbnailer/thumbnailcache.cpp b/thumbnailer/thumbnailcache.cpp index 691ecca..d7d4c20 100644 --- a/thumbnailer/thumbnailcache.cpp +++ b/thumbnailer/thumbnailcache.cpp @@ -126,7 +126,7 @@ QString ThumbnailCache::requestThumbnail(const QString &filePath, const QSize &r md5.addData(QString::number(info.lastModified().toTime_t()).toStdString().c_str()); QString thumbnailsName = QString::fromLatin1(md5.result().toHex()) + QLatin1String(".png"); - QString thumbnailsPath = m_thumbnailsDir + thumbnailsName; + QString thumbnailsPath = m_thumbnailsDir + thumbDir + thumbnailsName; if (!QFile::exists(thumbnailsPath)) { return generateThumbnail(path, thumbnailsPath, requestedSize);