From 90beb4a5e37b887caad1e767046a42dad0af1ab3 Mon Sep 17 00:00:00 2001 From: Elvis Angelaccio Date: Sun, 20 Nov 2016 12:21:29 +0100 Subject: Fix slow scrolling in dock panels Commit f688bcd1f1 fixed slow scrolling with xf86-input-libinput on DolphinView. However the commit also exposed a bug in the Dolphin scrolling algorithm, which was previously hidden. This resulted in slow scrolling in dock panels (Places and Folders), with both xf86-input-evdev and xf86-input-libinput drivers, as well as libinput on Wayland. KItemListContainer::updateScrollOffsetScrollBar() relied on the view's itemSize() method to compute the scrollbar's singleStep, but this QSize was invalid for the dock panels' views. We use a new itemSizeHint() method instead, which is always valid and also adapts to the current icon size set in the view. BUG: 365968 FIXED-IN: 16.12.0 REVIEW: 129409 --- src/kitemviews/private/kitemlistsizehintresolver.cpp | 13 +++++++++++++ src/kitemviews/private/kitemlistsizehintresolver.h | 2 ++ 2 files changed, 15 insertions(+) (limited to 'src/kitemviews/private') diff --git a/src/kitemviews/private/kitemlistsizehintresolver.cpp b/src/kitemviews/private/kitemlistsizehintresolver.cpp index 1d8067026..02f1865b3 100644 --- a/src/kitemviews/private/kitemlistsizehintresolver.cpp +++ b/src/kitemviews/private/kitemlistsizehintresolver.cpp @@ -25,6 +25,7 @@ KItemListSizeHintResolver::KItemListSizeHintResolver(const KItemListView* itemLi m_itemListView(itemListView), m_logicalHeightHintCache(), m_logicalWidthHint(0.0), + m_logicalHeightHint(0.0), m_needsResolving(false) { } @@ -33,6 +34,12 @@ KItemListSizeHintResolver::~KItemListSizeHintResolver() { } +QSizeF KItemListSizeHintResolver::maxSizeHint() +{ + updateCache(); + return QSizeF(m_logicalWidthHint, m_logicalHeightHint); +} + QSizeF KItemListSizeHintResolver::sizeHint(int index) { updateCache(); @@ -149,6 +156,12 @@ void KItemListSizeHintResolver::updateCache() { if (m_needsResolving) { m_itemListView->calculateItemSizeHints(m_logicalHeightHintCache, m_logicalWidthHint); + // Set logical height as the max cached height (if the cache is not empty). + if (m_logicalHeightHintCache.isEmpty()) { + m_logicalHeightHint = 0.0; + } else { + m_logicalHeightHint = *std::max_element(m_logicalHeightHintCache.begin(), m_logicalHeightHintCache.end()); + } m_needsResolving = false; } } diff --git a/src/kitemviews/private/kitemlistsizehintresolver.h b/src/kitemviews/private/kitemlistsizehintresolver.h index ff17f2de2..841e9ca10 100644 --- a/src/kitemviews/private/kitemlistsizehintresolver.h +++ b/src/kitemviews/private/kitemlistsizehintresolver.h @@ -36,6 +36,7 @@ class DOLPHIN_EXPORT KItemListSizeHintResolver public: KItemListSizeHintResolver(const KItemListView* itemListView); virtual ~KItemListSizeHintResolver(); + QSizeF maxSizeHint(); QSizeF sizeHint(int index); void itemsInserted(const KItemRangeList& itemRanges); @@ -50,6 +51,7 @@ private: const KItemListView* m_itemListView; mutable QVector m_logicalHeightHintCache; mutable qreal m_logicalWidthHint; + mutable qreal m_logicalHeightHint; bool m_needsResolving; }; -- cgit v1.3.1 From 726515cfd43e3a1af61ab624d08f509e8e5f0a9f Mon Sep 17 00:00:00 2001 From: Montel Laurent Date: Tue, 3 Jan 2017 13:17:54 +0100 Subject: Add missing Q_DECL_OVERRIDE --- src/dolphindockwidget.cpp | 4 ++-- src/kitemviews/kitemlistcontainer.cpp | 2 +- src/kitemviews/private/kfileitemmodeldirlister.h | 2 +- src/kitemviews/private/kitemlistheaderwidget.h | 16 ++++++++-------- src/kitemviews/private/kitemlistroleeditor.h | 6 +++--- src/kitemviews/private/kitemlistselectiontoggle.h | 4 ++-- src/kitemviews/private/kitemlistsmoothscroller.h | 2 +- src/panels/information/phononwidget.cpp | 2 +- src/tests/kitemlistselectionmanagertest.cpp | 4 ++-- 9 files changed, 21 insertions(+), 21 deletions(-) (limited to 'src/kitemviews/private') diff --git a/src/dolphindockwidget.cpp b/src/dolphindockwidget.cpp index 82cf91186..ccbecb0d6 100644 --- a/src/dolphindockwidget.cpp +++ b/src/dolphindockwidget.cpp @@ -38,13 +38,13 @@ public: DolphinDockTitleBar(QWidget* parent = 0) : QWidget(parent) {} virtual ~DolphinDockTitleBar() {} - virtual QSize minimumSizeHint() const + QSize minimumSizeHint() const Q_DECL_OVERRIDE { const int border = style()->pixelMetric(QStyle::PM_DockWidgetTitleBarButtonMargin); return QSize(border, border); } - virtual QSize sizeHint() const + QSize sizeHint() const Q_DECL_OVERRIDE { return minimumSizeHint(); } diff --git a/src/kitemviews/kitemlistcontainer.cpp b/src/kitemviews/kitemlistcontainer.cpp index 6a0c5756c..b4ea62fac 100644 --- a/src/kitemviews/kitemlistcontainer.cpp +++ b/src/kitemviews/kitemlistcontainer.cpp @@ -48,7 +48,7 @@ class KItemListContainerViewport : public QGraphicsView public: KItemListContainerViewport(QGraphicsScene* scene, QWidget* parent); protected: - virtual void wheelEvent(QWheelEvent* event); + void wheelEvent(QWheelEvent* event) Q_DECL_OVERRIDE; }; KItemListContainerViewport::KItemListContainerViewport(QGraphicsScene* scene, QWidget* parent) : diff --git a/src/kitemviews/private/kfileitemmodeldirlister.h b/src/kitemviews/private/kfileitemmodeldirlister.h index c2c621aed..5aa2b6303 100644 --- a/src/kitemviews/private/kfileitemmodeldirlister.h +++ b/src/kitemviews/private/kfileitemmodeldirlister.h @@ -48,7 +48,7 @@ signals: void urlIsFileError(const QUrl& url); protected: - virtual void handleError(KIO::Job* job); + void handleError(KIO::Job* job) Q_DECL_OVERRIDE; }; #endif diff --git a/src/kitemviews/private/kitemlistheaderwidget.h b/src/kitemviews/private/kitemlistheaderwidget.h index 2a80c205d..2342b4907 100644 --- a/src/kitemviews/private/kitemlistheaderwidget.h +++ b/src/kitemviews/private/kitemlistheaderwidget.h @@ -64,7 +64,7 @@ public: qreal minimumColumnWidth() const; - virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0); + void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0) Q_DECL_OVERRIDE; signals: /** @@ -104,13 +104,13 @@ signals: void sortRoleChanged(const QByteArray& current, const QByteArray& previous); protected: - virtual void mousePressEvent(QGraphicsSceneMouseEvent* event); - virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent* event); - virtual void mouseMoveEvent(QGraphicsSceneMouseEvent* event); - virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event); - virtual void hoverEnterEvent(QGraphicsSceneHoverEvent* event); - virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent* event); - virtual void hoverMoveEvent(QGraphicsSceneHoverEvent* event); + void mousePressEvent(QGraphicsSceneMouseEvent* event) Q_DECL_OVERRIDE; + void mouseReleaseEvent(QGraphicsSceneMouseEvent* event) Q_DECL_OVERRIDE; + void mouseMoveEvent(QGraphicsSceneMouseEvent* event) Q_DECL_OVERRIDE; + void mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event) Q_DECL_OVERRIDE; + void hoverEnterEvent(QGraphicsSceneHoverEvent* event) Q_DECL_OVERRIDE; + void hoverLeaveEvent(QGraphicsSceneHoverEvent* event) Q_DECL_OVERRIDE; + void hoverMoveEvent(QGraphicsSceneHoverEvent* event) Q_DECL_OVERRIDE; private slots: void slotSortRoleChanged(const QByteArray& current, const QByteArray& previous); diff --git a/src/kitemviews/private/kitemlistroleeditor.h b/src/kitemviews/private/kitemlistroleeditor.h index 3b8f96865..f889ea4f4 100644 --- a/src/kitemviews/private/kitemlistroleeditor.h +++ b/src/kitemviews/private/kitemlistroleeditor.h @@ -44,15 +44,15 @@ public: void setRole(const QByteArray& role); QByteArray role() const; - virtual bool eventFilter(QObject* watched, QEvent* event); + bool eventFilter(QObject* watched, QEvent* event) Q_DECL_OVERRIDE; signals: void roleEditingFinished(const QByteArray& role, const QVariant& value); void roleEditingCanceled(const QByteArray& role, const QVariant& value); protected: - virtual bool event(QEvent* event); - virtual void keyPressEvent(QKeyEvent* event); + bool event(QEvent* event) Q_DECL_OVERRIDE; + void keyPressEvent(QKeyEvent* event) Q_DECL_OVERRIDE; private slots: /** diff --git a/src/kitemviews/private/kitemlistselectiontoggle.h b/src/kitemviews/private/kitemlistselectiontoggle.h index d058ee988..e3f5bb63c 100644 --- a/src/kitemviews/private/kitemlistselectiontoggle.h +++ b/src/kitemviews/private/kitemlistselectiontoggle.h @@ -42,10 +42,10 @@ public: void setHovered(bool hovered); - virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0); + void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0) Q_DECL_OVERRIDE; protected: - virtual void resizeEvent(QGraphicsSceneResizeEvent* event); + void resizeEvent(QGraphicsSceneResizeEvent* event) Q_DECL_OVERRIDE; private: void updatePixmap(); diff --git a/src/kitemviews/private/kitemlistsmoothscroller.h b/src/kitemviews/private/kitemlistsmoothscroller.h index a3576a3fd..7d01a6b62 100644 --- a/src/kitemviews/private/kitemlistsmoothscroller.h +++ b/src/kitemviews/private/kitemlistsmoothscroller.h @@ -83,7 +83,7 @@ public: void handleWheelEvent(QWheelEvent* event); protected: - virtual bool eventFilter(QObject* obj, QEvent* event); + bool eventFilter(QObject* obj, QEvent* event) Q_DECL_OVERRIDE; private slots: void slotAnimationStateChanged(QAbstractAnimation::State newState, diff --git a/src/panels/information/phononwidget.cpp b/src/panels/information/phononwidget.cpp index e4885ab76..ac4a32506 100644 --- a/src/panels/information/phononwidget.cpp +++ b/src/panels/information/phononwidget.cpp @@ -52,7 +52,7 @@ class EmbeddedVideoPlayer : public Phonon::VideoWidget updateGeometry(); } - virtual QSize sizeHint() const + QSize sizeHint() const Q_DECL_OVERRIDE { return m_sizeHint.isValid() ? m_sizeHint : Phonon::VideoWidget::sizeHint(); } diff --git a/src/tests/kitemlistselectionmanagertest.cpp b/src/tests/kitemlistselectionmanagertest.cpp index 5dce57f3c..18a79bd3f 100644 --- a/src/tests/kitemlistselectionmanagertest.cpp +++ b/src/tests/kitemlistselectionmanagertest.cpp @@ -30,8 +30,8 @@ class DummyModel : public KItemModelBase public: DummyModel(); void setCount(int count); - virtual int count() const; - virtual QHash data(int index) const; + int count() const Q_DECL_OVERRIDE; + QHash data(int index) const Q_DECL_OVERRIDE; private: int m_count; -- cgit v1.3.1 From 0cad00c39aec4508688c87e520acc782b1001d1f Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Thu, 12 Jan 2017 14:23:01 +0100 Subject: Add document title to additional information Allows showing the document title of e.g. a PDF alongside the file name BUG: 321356 Differential Revision: https://phabricator.kde.org/D3972 --- src/kitemviews/kfileitemmodel.cpp | 1 + src/kitemviews/kfileitemmodel.h | 2 +- src/kitemviews/private/kbaloorolesprovider.cpp | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src/kitemviews/private') diff --git a/src/kitemviews/kfileitemmodel.cpp b/src/kitemviews/kfileitemmodel.cpp index 7b252a346..c35d164e1 100644 --- a/src/kitemviews/kfileitemmodel.cpp +++ b/src/kitemviews/kfileitemmodel.cpp @@ -2225,6 +2225,7 @@ const KFileItemModel::RoleInfoMap* KFileItemModel::rolesInfoMap(int& count) { "rating", RatingRole, I18N_NOOP2_NOSTRIP("@label", "Rating"), 0, 0, true, false }, { "tags", TagsRole, I18N_NOOP2_NOSTRIP("@label", "Tags"), 0, 0, true, false }, { "comment", CommentRole, I18N_NOOP2_NOSTRIP("@label", "Comment"), 0, 0, true, false }, + { "title", TitleRole, I18N_NOOP2_NOSTRIP("@label", "Title"), I18N_NOOP2_NOSTRIP("@label", "Document"), true, true }, { "wordCount", WordCountRole, I18N_NOOP2_NOSTRIP("@label", "Word Count"), I18N_NOOP2_NOSTRIP("@label", "Document"), true, true }, { "lineCount", LineCountRole, I18N_NOOP2_NOSTRIP("@label", "Line Count"), I18N_NOOP2_NOSTRIP("@label", "Document"), true, true }, { "imageSize", ImageSizeRole, I18N_NOOP2_NOSTRIP("@label", "Image Size"), I18N_NOOP2_NOSTRIP("@label", "Image"), true, true }, diff --git a/src/kitemviews/kfileitemmodel.h b/src/kitemviews/kfileitemmodel.h index 8a0df72b9..717afb9a7 100644 --- a/src/kitemviews/kfileitemmodel.h +++ b/src/kitemviews/kfileitemmodel.h @@ -284,7 +284,7 @@ private: GroupRole, TypeRole, DestinationRole, PathRole, // User visible roles available with Baloo: CommentRole, TagsRole, RatingRole, ImageSizeRole, OrientationRole, - WordCountRole, LineCountRole, ArtistRole, AlbumRole, DurationRole, TrackRole, + WordCountRole, TitleRole, LineCountRole, ArtistRole, AlbumRole, DurationRole, TrackRole, OriginUrlRole, // Non-visible roles: IsDirRole, IsLinkRole, IsExpandedRole, IsExpandableRole, ExpandedParentsCountRole, diff --git a/src/kitemviews/private/kbaloorolesprovider.cpp b/src/kitemviews/private/kbaloorolesprovider.cpp index e0b889e6c..9f151df92 100644 --- a/src/kitemviews/private/kbaloorolesprovider.cpp +++ b/src/kitemviews/private/kbaloorolesprovider.cpp @@ -138,6 +138,7 @@ KBalooRolesProvider::KBalooRolesProvider() : { "rating", "rating" }, { "tag", "tags" }, { "comment", "comment" }, + { "title", "title" }, { "wordCount", "wordCount" }, { "lineCount", "lineCount" }, { "width", "imageSize" }, -- cgit v1.3.1 From 2e8e30026a207d380379fb2be0e4327bf4f455e8 Mon Sep 17 00:00:00 2001 From: Marc André Wittorf Date: Sat, 21 Jan 2017 01:37:35 +0100 Subject: Fix missing audio duration in details view Enabling the 'duration' column in a folder with audio files did only show empty information. Properly initializing the QTime object fixes this. Testing Done Find a folder with audio files Make sure that Baloo has indexed this folder Open this folder in Dolphin, detail view, enable the Audio/Duration column Unpatched Dolphin does not display audio duration, patched Dolphin does Tested on Gentoo x86_64 with Qt 5.5.1, KF 5.21.0 and Arch x86_64 with Qt 5.6.0 and KF 5.21.0. REVIEW: 127799 --- src/kitemviews/private/kbaloorolesprovider.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/kitemviews/private') diff --git a/src/kitemviews/private/kbaloorolesprovider.cpp b/src/kitemviews/private/kbaloorolesprovider.cpp index e0b889e6c..2ce1f7bf6 100644 --- a/src/kitemviews/private/kbaloorolesprovider.cpp +++ b/src/kitemviews/private/kbaloorolesprovider.cpp @@ -181,7 +181,7 @@ QString KBalooRolesProvider::orientationFromValue(int value) const QString KBalooRolesProvider::durationFromValue(int value) const { - QTime duration; + QTime duration(0, 0, 0); duration = duration.addSecs(value); return duration.toString(QStringLiteral("hh:mm:ss")); } -- cgit v1.3.1