Commit db42961a authored by Eike Hein's avatar Eike Hein

Improve preview thumbnail quality

Summary:
This patch does two things:

* Instead of giving the KAbstractViewAdapter the actual icon size,
  we overprovision by giving it the size times two. This is because
  while we're deriving the grid view cell size from the icon size
  setting, it's not the actual size the thumbnails will be displayed
  at. Our IconItem is sized to almost fill the cell, and for image
  sources with non-square aspect ratios IconItem doesn't scale to
  the next icon size.

* We set IconItem to do smooth scaling.

While this results in lovely visual fidelity, I the performance
impact is a concern. We're requesting twice as large thumbnails
now, and we're doing more scaling work. However, thumbnail
generation is async and doesn't slow down listing. There's also
the possibility IconItem::smooth could have general performance
impact unless things are smart enough not to scale when not
necessary, which is hopefully the case.

BUG:376848

Reviewers: #plasma

Subscribers: plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D10223
parent f1e14424
......@@ -285,6 +285,8 @@ Item {
animated: false
usesPlasmaTheme: false
smooth: true
source: model.decoration
overlays: model.overlays
}
......
......@@ -1169,7 +1169,7 @@ FocusScope {
adapterView: gridView
adapterModel: positioner
adapterIconSize: gridView.iconSize;
adapterIconSize: gridView.iconSize * 2
adapterVisibleArea: Qt.rect(gridView.contentX, gridView.contentY, gridView.contentWidth, gridView.contentHeight)
Component.onCompleted: {
......
......@@ -1892,6 +1892,7 @@ void FolderModel::moveSelectedToTrash()
const QList<QUrl> urls = selectedUrls();
KIO::JobUiDelegate uiDelegate;
if (uiDelegate.askDeleteConfirmation(urls, KIO::JobUiDelegate::Trash, KIO::JobUiDelegate::DefaultConfirmation)) {
KIO::Job* job = KIO::trash(urls);
job->uiDelegate()->setAutoErrorHandlingEnabled(true);
......@@ -1907,6 +1908,7 @@ void FolderModel::deleteSelected()
const QList<QUrl> urls = selectedUrls();
KIO::JobUiDelegate uiDelegate;
if (uiDelegate.askDeleteConfirmation(urls, KIO::JobUiDelegate::Delete, KIO::JobUiDelegate::DefaultConfirmation)) {
KIO::Job* job = KIO::del(urls);
job->uiDelegate()->setAutoErrorHandlingEnabled(true);
......@@ -1939,6 +1941,7 @@ void FolderModel::emptyTrashBin()
{
KIO::JobUiDelegate uiDelegate;
uiDelegate.setWindow(QApplication::desktop());
if (uiDelegate.askDeleteConfirmation(QList<QUrl>(), KIO::JobUiDelegate::EmptyTrash, KIO::JobUiDelegate::DefaultConfirmation)) {
KIO::Job* job = KIO::emptyTrash();
job->uiDelegate()->setAutoErrorHandlingEnabled(true);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment