From 88a7794097a8490e4398abf3e36c22ecbfaea7ab Mon Sep 17 00:00:00 2001 From: Emmanuel Pescosta Date: Thu, 12 Sep 2013 13:58:29 +0200 Subject: Fix Bug 311099 - View the underscore when using Ctrl + PagDown Take the style option vertical/horizontal margin into account for the calculation of the new scroll offset. Thanks to Frank for pointing out two other problems with "Page Up/Down" and providing a better way to fix these problems. :) BUG: 311099 FIXED-IN: 4.11.2 REVIEW: 112678 --- src/kitemviews/kitemlistview.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/kitemviews/kitemlistview.cpp b/src/kitemviews/kitemlistview.cpp index 7f1526151..a66715090 100644 --- a/src/kitemviews/kitemlistview.cpp +++ b/src/kitemviews/kitemlistview.cpp @@ -504,7 +504,11 @@ void KItemListView::scrollToItem(int index) const qreal headerHeight = m_headerWidget->size().height(); viewGeometry.adjust(0, headerHeight, 0, 0); } - const QRectF currentRect = itemRect(index); + QRectF currentRect = itemRect(index); + + // Fix for Bug 311099 - View the underscore when using Ctrl + PagDown + currentRect.adjust(-m_styleOption.horizontalMargin, -m_styleOption.verticalMargin, + m_styleOption.horizontalMargin, m_styleOption.verticalMargin); if (!viewGeometry.contains(currentRect)) { qreal newOffset = scrollOffset(); -- cgit v1.3 From 53c8c76ceebf182c0d2e121d47dac65a7ad3e3de Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Thu, 12 Sep 2013 18:45:41 +0200 Subject: Remove "Copy text" statusbar contextmenu entry REVIEW: 112355 --- src/statusbar/dolphinstatusbar.cpp | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'src') diff --git a/src/statusbar/dolphinstatusbar.cpp b/src/statusbar/dolphinstatusbar.cpp index bff956642..671ef4f96 100644 --- a/src/statusbar/dolphinstatusbar.cpp +++ b/src/statusbar/dolphinstatusbar.cpp @@ -30,7 +30,6 @@ #include "statusbarspaceinfo.h" #include -#include #include #include #include @@ -261,7 +260,6 @@ void DolphinStatusBar::contextMenuEvent(QContextMenuEvent* event) KMenu menu(this); - QAction* copyAction = menu.addAction(i18nc("@action:inmenu", "Copy Text")); QAction* showZoomSliderAction = menu.addAction(i18nc("@action:inmenu", "Show Zoom Slider")); showZoomSliderAction->setCheckable(true); showZoomSliderAction->setChecked(GeneralSettings::showZoomSlider()); @@ -271,11 +269,7 @@ void DolphinStatusBar::contextMenuEvent(QContextMenuEvent* event) showSpaceInfoAction->setChecked(GeneralSettings::showSpaceInfo()); const QAction* action = menu.exec(QCursor::pos()); - if (action == copyAction) { - QMimeData* mimeData = new QMimeData(); - mimeData->setText(text()); - QApplication::clipboard()->setMimeData(mimeData); - } else if (action == showZoomSliderAction) { + if (action == showZoomSliderAction) { const bool visible = showZoomSliderAction->isChecked(); GeneralSettings::setShowZoomSlider(visible); m_zoomSlider->setVisible(visible); -- cgit v1.3 From ced472be07200666c0ad849c6a9fbb80ecefad29 Mon Sep 17 00:00:00 2001 From: Frank Reininghaus Date: Sat, 14 Sep 2013 14:52:22 +0200 Subject: Make preview loading faster when scrolling KFileItemListView notifies KFileItemModelRolesUpdater of changes of the visible index range and the icon size with a delay, to prevent that expensive operations are triggered repeatedly, and that scrolling feels sluggish because the GUI thread is blocked by icon loading. This patch ensures that the "long" delay of 300 ms is only used when the zoom level is changed, and the "short" delay if only the visible index range has changed. Thanks to Christoph Feck for helping to analyze this problem! BUG: 322093 FIXED-IN: 4.11.2 REVIEW: 112580 --- src/kitemviews/kfileitemlistview.cpp | 65 ++++++++++++++---------------------- src/kitemviews/kfileitemlistview.h | 2 -- 2 files changed, 25 insertions(+), 42 deletions(-) (limited to 'src') diff --git a/src/kitemviews/kfileitemlistview.cpp b/src/kitemviews/kfileitemlistview.cpp index 2da238d7a..1ffd5019b 100644 --- a/src/kitemviews/kfileitemlistview.cpp +++ b/src/kitemviews/kfileitemlistview.cpp @@ -37,7 +37,15 @@ // #define KFILEITEMLISTVIEW_DEBUG namespace { + // If the visible index range changes, KFileItemModelRolesUpdater is not + // informed immediatetly, but with a short delay. This ensures that scrolling + // always feels smooth and is not interrupted by icon loading (which can be + // quite expensive if a disk access is required to determine the final icon). const int ShortInterval = 50; + + // If the icon size changes, a longer delay is used. This prevents that + // the expensive re-generation of all previews is triggered repeatedly when + // chaning the zoom level. const int LongInterval = 300; } @@ -58,7 +66,7 @@ KFileItemListView::KFileItemListView(QGraphicsWidget* parent) : m_updateIconSizeTimer = new QTimer(this); m_updateIconSizeTimer->setSingleShot(true); - m_updateIconSizeTimer->setInterval(ShortInterval); + m_updateIconSizeTimer->setInterval(LongInterval); connect(m_updateIconSizeTimer, SIGNAL(timeout()), this, SLOT(updateIconSize())); setVisibleRoles(QList() << "text"); @@ -309,7 +317,6 @@ void KFileItemListView::resizeEvent(QGraphicsSceneResizeEvent* event) void KFileItemListView::slotItemsRemoved(const KItemRangeList& itemRanges) { KStandardItemListView::slotItemsRemoved(itemRanges); - updateTimersInterval(); } void KFileItemListView::slotSortRoleChanged(const QByteArray& current, const QByteArray& previous) @@ -328,7 +335,12 @@ void KFileItemListView::triggerVisibleIndexRangeUpdate() return; } m_modelRolesUpdater->setPaused(true); - m_updateVisibleIndexRangeTimer->start(); + + // If the icon size has been changed recently, wait until + // m_updateIconSizeTimer expires. + if (!m_updateIconSizeTimer->isActive()) { + m_updateVisibleIndexRangeTimer->start(); + } } void KFileItemListView::updateVisibleIndexRange() @@ -341,17 +353,7 @@ void KFileItemListView::updateVisibleIndexRange() const int count = lastVisibleIndex() - index + 1; m_modelRolesUpdater->setMaximumVisibleItems(maximumVisibleItems()); m_modelRolesUpdater->setVisibleIndexRange(index, count); - - if (m_updateIconSizeTimer->isActive()) { - // If the icon-size update is pending do an immediate update - // of the icon-size before unpausing m_modelRolesUpdater. This prevents - // an unnecessary expensive recreation of all previews afterwards. - m_updateIconSizeTimer->stop(); - m_modelRolesUpdater->setIconSize(availableIconSize()); - } - m_modelRolesUpdater->setPaused(isTransactionActive()); - updateTimersInterval(); } void KFileItemListView::triggerIconSizeUpdate() @@ -361,6 +363,11 @@ void KFileItemListView::triggerIconSizeUpdate() } m_modelRolesUpdater->setPaused(true); m_updateIconSizeTimer->start(); + + // The visible index range will be updated when m_updateIconSizeTimer expires. + // Stop m_updateVisibleIndexRangeTimer to prevent an expensive re-generation + // of all previews (note that the user might change the icon size again soon). + m_updateVisibleIndexRangeTimer->stop(); } void KFileItemListView::updateIconSize() @@ -371,35 +378,13 @@ void KFileItemListView::updateIconSize() m_modelRolesUpdater->setIconSize(availableIconSize()); - if (m_updateVisibleIndexRangeTimer->isActive()) { - // If the visibility-index-range update is pending do an immediate update - // of the range before unpausing m_modelRolesUpdater. This prevents - // an unnecessary expensive recreation of all previews afterwards. - m_updateVisibleIndexRangeTimer->stop(); - const int index = firstVisibleIndex(); - const int count = lastVisibleIndex() - index + 1; - m_modelRolesUpdater->setVisibleIndexRange(index, count); - } + // Update the visible index range (which has most likely changed after the + // icon size change) before unpausing m_modelRolesUpdater. + const int index = firstVisibleIndex(); + const int count = lastVisibleIndex() - index + 1; + m_modelRolesUpdater->setVisibleIndexRange(index, count); m_modelRolesUpdater->setPaused(isTransactionActive()); - updateTimersInterval(); -} - -void KFileItemListView::updateTimersInterval() -{ - if (!model()) { - return; - } - - // The ShortInterval is used for cases like switching the directory: If the - // model is empty and filled later the creation of the previews should be done - // as soon as possible. The LongInterval is used when the model already contains - // items and assures that operations like zooming don't result in too many temporary - // recreations of the previews. - - const int interval = (model()->count() <= 0) ? ShortInterval : LongInterval; - m_updateVisibleIndexRangeTimer->setInterval(interval); - m_updateIconSizeTimer->setInterval(interval); } void KFileItemListView::applyRolesToModel() diff --git a/src/kitemviews/kfileitemlistview.h b/src/kitemviews/kfileitemlistview.h index 49ff77318..bdc63b01b 100644 --- a/src/kitemviews/kfileitemlistview.h +++ b/src/kitemviews/kfileitemlistview.h @@ -103,8 +103,6 @@ private slots: void updateIconSize(); private: - void updateTimersInterval(); - /** * Applies the roles defined by KItemListView::visibleRoles() to the * KFileItemModel and KFileItemModelRolesUpdater. As the model does not -- cgit v1.3