mirror of
https://invent.kde.org/system/dolphin
synced 2024-09-12 12:54:29 +00:00
The check whether there is a cut-selection when receiving a preview consumes 12 % (!) of the runtime in addToPreviewQueue(). The check is now done only once before starting the preview generation and when the clipboard data has been changed.
svn path=/trunk/KDE/kdebase/apps/; revision=826126
This commit is contained in:
parent
1f3607bdc1
commit
4cf8450bc4
|
@ -85,6 +85,7 @@ IconManager::IconManager(QAbstractItemView* parent, DolphinSortFilterProxyModel*
|
|||
QObject(parent),
|
||||
m_showPreview(false),
|
||||
m_clearItemQueues(true),
|
||||
m_hasCutSelection(false),
|
||||
m_pendingVisiblePreviews(0),
|
||||
m_view(parent),
|
||||
m_previewTimer(0),
|
||||
|
@ -138,7 +139,6 @@ IconManager::~IconManager()
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void IconManager::setShowPreview(bool show)
|
||||
{
|
||||
if (m_showPreview != show) {
|
||||
|
@ -242,8 +242,7 @@ void IconManager::addToPreviewQueue(const KFileItem& item, const QPixmap& pixmap
|
|||
limitToSize(icon, m_view->iconSize());
|
||||
}
|
||||
|
||||
const QMimeData* mimeData = QApplication::clipboard()->mimeData();
|
||||
if (KonqMimeData::decodeIsCutSelection(mimeData) && isCutItem(item)) {
|
||||
if (m_hasCutSelection && isCutItem(item)) {
|
||||
// Remember the current icon in the cache for cut items before
|
||||
// the disabled effect is applied. This makes it possible restoring
|
||||
// the uncut version again when cutting other items.
|
||||
|
@ -394,7 +393,8 @@ bool IconManager::isCutItem(const KFileItem& item) const
|
|||
void IconManager::applyCutItemEffect()
|
||||
{
|
||||
const QMimeData* mimeData = QApplication::clipboard()->mimeData();
|
||||
if (!KonqMimeData::decodeIsCutSelection(mimeData)) {
|
||||
m_hasCutSelection = KonqMimeData::decodeIsCutSelection(mimeData);
|
||||
if (!m_hasCutSelection) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -499,6 +499,9 @@ void IconManager::startPreviewJob(const KFileItemList& items)
|
|||
return;
|
||||
}
|
||||
|
||||
const QMimeData* mimeData = QApplication::clipboard()->mimeData();
|
||||
m_hasCutSelection = KonqMimeData::decodeIsCutSelection(mimeData);
|
||||
|
||||
const QSize size = m_view->iconSize();
|
||||
KIO::PreviewJob* job = KIO::filePreview(items, 128, 128);
|
||||
connect(job, SIGNAL(gotPreview(const KFileItem&, const QPixmap&)),
|
||||
|
|
|
@ -170,6 +170,11 @@ private:
|
|||
*/
|
||||
bool m_clearItemQueues;
|
||||
|
||||
/**
|
||||
* True if a selection has been done which should cut items.
|
||||
*/
|
||||
bool m_hasCutSelection;
|
||||
|
||||
int m_pendingVisiblePreviews;
|
||||
|
||||
QAbstractItemView* m_view;
|
||||
|
|
Loading…
Reference in a new issue