From 341a09fafd5b817d999832e4650435153611f85f Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Wed, 16 Nov 2016 00:14:47 +0100 Subject: GIT_SILENT Upgrade KDE Applications version to 17.03.70. --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 8b76a08fb..2d5c1c045 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,8 +3,8 @@ cmake_minimum_required(VERSION 2.8.12) project(Dolphin) # KDE Application Version, managed by release script -set (KDE_APPLICATIONS_VERSION_MAJOR "16") -set (KDE_APPLICATIONS_VERSION_MINOR "11") +set (KDE_APPLICATIONS_VERSION_MAJOR "17") +set (KDE_APPLICATIONS_VERSION_MINOR "03") set (KDE_APPLICATIONS_VERSION_MICRO "70") set (KDE_APPLICATIONS_VERSION "${KDE_APPLICATIONS_VERSION_MAJOR}.${KDE_APPLICATIONS_VERSION_MINOR}.${KDE_APPLICATIONS_VERSION_MICRO}") -- cgit v1.3 From 73a6bf4e10dc5d49b5752a9bd23fc332075da244 Mon Sep 17 00:00:00 2001 From: Spencer Brown Date: Sat, 3 Dec 2016 15:58:39 +0100 Subject: Fix 5 clazy warnings This bumps the minimum Qt version to 5.5 (because of Q_ENUM usage). REVIEW: 129604 --- CMakeLists.txt | 2 +- src/kitemviews/kitemlistcontroller.h | 2 +- src/tests/kfileitemmodeltest.cpp | 6 +++--- src/tests/kitemsettest.cpp | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 2d5c1c045..814c00ff2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ set (KDE_APPLICATIONS_VERSION_MINOR "03") set (KDE_APPLICATIONS_VERSION_MICRO "70") set (KDE_APPLICATIONS_VERSION "${KDE_APPLICATIONS_VERSION_MAJOR}.${KDE_APPLICATIONS_VERSION_MINOR}.${KDE_APPLICATIONS_VERSION_MICRO}") -set(QT_MIN_VERSION "5.4.0") +set(QT_MIN_VERSION "5.5.0") set(KF5_MIN_VERSION "5.21.0") set(ECM_MIN_VERSION "1.6.0") diff --git a/src/kitemviews/kitemlistcontroller.h b/src/kitemviews/kitemlistcontroller.h index b8a93edac..5e5e6b7c3 100644 --- a/src/kitemviews/kitemlistcontroller.h +++ b/src/kitemviews/kitemlistcontroller.h @@ -59,7 +59,6 @@ class QTransform; class DOLPHIN_EXPORT KItemListController : public QObject { Q_OBJECT - Q_ENUMS(SelectionBehavior) Q_PROPERTY(KItemModelBase* model READ model WRITE setModel) Q_PROPERTY(KItemListView *view READ view WRITE setView) Q_PROPERTY(SelectionBehavior selectionBehavior READ selectionBehavior WRITE setSelectionBehavior) @@ -72,6 +71,7 @@ public: SingleSelection, MultiSelection }; + Q_ENUM(SelectionBehavior) enum AutoActivationBehavior { ActivationAndExpansion, diff --git a/src/tests/kfileitemmodeltest.cpp b/src/tests/kfileitemmodeltest.cpp index 6c45e114b..ac15693b6 100644 --- a/src/tests/kfileitemmodeltest.cpp +++ b/src/tests/kfileitemmodeltest.cpp @@ -154,9 +154,9 @@ void KFileItemModelTest::testDefaultSortRole() QVERIFY(itemsInsertedSpy.wait()); QCOMPARE(m_model->count(), 3); - QCOMPARE(m_model->data(0)["text"].toString(), QString("a.txt")); - QCOMPARE(m_model->data(1)["text"].toString(), QString("b.txt")); - QCOMPARE(m_model->data(2)["text"].toString(), QString("c.txt")); + QCOMPARE(m_model->data(0).value("text").toString(), QString("a.txt")); + QCOMPARE(m_model->data(1).value("text").toString(), QString("b.txt")); + QCOMPARE(m_model->data(2).value("text").toString(), QString("c.txt")); } void KFileItemModelTest::testDefaultGroupedSorting() diff --git a/src/tests/kitemsettest.cpp b/src/tests/kitemsettest.cpp index 0d14e20fa..f559475a6 100644 --- a/src/tests/kitemsettest.cpp +++ b/src/tests/kitemsettest.cpp @@ -72,14 +72,14 @@ QVector KItemRangeList2QVector(const KItemRangeList& itemRanges) static QSet KItemSet2QSet(const KItemSet& itemSet) { QSet result; - foreach (int i, itemSet) { + for (int i : itemSet) { result.insert(i); } // Check that the conversion was successful. Q_ASSERT(itemSet.count() == result.count()); - foreach (int i, itemSet) { + for (int i : itemSet) { Q_ASSERT(result.contains(i)); } @@ -239,7 +239,7 @@ void KItemSetTest::testIterators() QCOMPARE(testQVector, itemsQVector); testQVector.clear(); - foreach (int i, itemSet) { + for (int i : itemSet) { testQVector.append(i); } QCOMPARE(testQVector, itemsQVector); -- cgit v1.3 From 230fe13d1fccf8c2ab09c0873c1cc4c733cfc3b4 Mon Sep 17 00:00:00 2001 From: Elvis Angelaccio Date: Sun, 5 Feb 2017 22:53:50 +0100 Subject: Port tooltips to KToolTipWidget Use the new KToolTipWidget class (introduced by kwidgetsaddons 5.30) as backend of ToolTipManager. FileMetaDataToolTip becomes a simple widget used as content of the tooltip. It is now possible to actually use the metadata widget shown inside the tooltips. Tooltips are now functional on Wayland as well. More information about KToolTipWidget in https://git.reviewboard.kde.org/r/129648/ BUG: 352276 BUG: 371223 FIXED-IN: 17.04.0 Closes T4980 Differential Revision: D4449 --- CMakeLists.txt | 2 +- src/views/dolphinview.cpp | 2 +- src/views/tooltips/filemetadatatooltip.cpp | 19 ------- src/views/tooltips/filemetadatatooltip.h | 8 +-- src/views/tooltips/tooltipmanager.cpp | 84 ++++-------------------------- src/views/tooltips/tooltipmanager.h | 10 +++- 6 files changed, 23 insertions(+), 102 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index 814c00ff2..e3494f5a8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,7 +9,7 @@ set (KDE_APPLICATIONS_VERSION_MICRO "70") set (KDE_APPLICATIONS_VERSION "${KDE_APPLICATIONS_VERSION_MAJOR}.${KDE_APPLICATIONS_VERSION_MINOR}.${KDE_APPLICATIONS_VERSION_MICRO}") set(QT_MIN_VERSION "5.5.0") -set(KF5_MIN_VERSION "5.21.0") +set(KF5_MIN_VERSION "5.30.0") set(ECM_MIN_VERSION "1.6.0") # ECM setup diff --git a/src/views/dolphinview.cpp b/src/views/dolphinview.cpp index f5ba63d1e..bfed3e847 100644 --- a/src/views/dolphinview.cpp +++ b/src/views/dolphinview.cpp @@ -1021,7 +1021,7 @@ void DolphinView::slotItemHovered(int index) const QPoint pos = m_container->mapToGlobal(itemRect.topLeft().toPoint()); itemRect.moveTo(pos); - m_toolTipManager->showToolTip(item, itemRect); + m_toolTipManager->showToolTip(item, itemRect, nativeParentWidget()->windowHandle()); } emit requestItemInfo(item); diff --git a/src/views/tooltips/filemetadatatooltip.cpp b/src/views/tooltips/filemetadatatooltip.cpp index 0d58717d4..2fbba8b9c 100644 --- a/src/views/tooltips/filemetadatatooltip.cpp +++ b/src/views/tooltips/filemetadatatooltip.cpp @@ -47,9 +47,6 @@ FileMetaDataToolTip::FileMetaDataToolTip(QWidget* parent) : m_name(0), m_fileMetaDataWidget(0) { - setAttribute(Qt::WA_TranslucentBackground); - setWindowFlags(Qt::ToolTip | Qt::FramelessWindowHint | Qt::NoDropShadowWindowHint); - // Create widget for file preview m_preview = new QLabel(this); m_preview->setAlignment(Qt::AlignTop); @@ -161,19 +158,3 @@ KFileItemList FileMetaDataToolTip::items() const return m_fileMetaDataWidget->items(); } -void FileMetaDataToolTip::paintEvent(QPaintEvent* event) -{ - QStylePainter painter(this); - QStyleOptionFrame option; - option.init(this); - painter.drawPrimitive(QStyle::PE_PanelTipLabel, option); - painter.end(); - - QWidget::paintEvent(event); -} - -void FileMetaDataToolTip::showEvent(QShowEvent *) -{ - KWindowEffects::enableBlurBehind(winId(), true, mask()); -} - diff --git a/src/views/tooltips/filemetadatatooltip.h b/src/views/tooltips/filemetadatatooltip.h index 379b025c8..1738e386c 100644 --- a/src/views/tooltips/filemetadatatooltip.h +++ b/src/views/tooltips/filemetadatatooltip.h @@ -37,8 +37,8 @@ namespace Baloo { #endif /** - * @brief Tooltip, that shows the meta information and a preview of one - * or more files. + * @brief Widget that shows the meta information and a preview of one + * or more files inside a KToolTipWidget. */ class FileMetaDataToolTip : public QWidget { @@ -69,10 +69,6 @@ signals: */ void metaDataRequestFinished(const KFileItemList& items); -protected: - virtual void paintEvent(QPaintEvent* event) Q_DECL_OVERRIDE; - virtual void showEvent(QShowEvent *) Q_DECL_OVERRIDE; - private: QLabel* m_preview; QLabel* m_name; diff --git a/src/views/tooltips/tooltipmanager.cpp b/src/views/tooltips/tooltipmanager.cpp index 404d6801c..d19e98c81 100644 --- a/src/views/tooltips/tooltipmanager.cpp +++ b/src/views/tooltips/tooltipmanager.cpp @@ -24,18 +24,22 @@ #include #include #include +#include #include #include #include #include #include +#include ToolTipManager::ToolTipManager(QWidget* parent) : QObject(parent), m_showToolTipTimer(0), m_contentRetrievalTimer(0), + m_transientParent(0), m_fileMetaDataToolTip(0), + m_tooltipWidget(new KToolTipWidget()), m_toolTipRequested(false), m_metaDataRequested(false), m_appliedWaitCursor(false), @@ -62,11 +66,9 @@ ToolTipManager::ToolTipManager(QWidget* parent) : ToolTipManager::~ToolTipManager() { - delete m_fileMetaDataToolTip; - m_fileMetaDataToolTip = 0; } -void ToolTipManager::showToolTip(const KFileItem& item, const QRectF& itemRect) +void ToolTipManager::showToolTip(const KFileItem& item, const QRectF& itemRect, QWindow *transientParent) { hideToolTip(); @@ -75,10 +77,12 @@ void ToolTipManager::showToolTip(const KFileItem& item, const QRectF& itemRect) m_itemRect.adjust(-m_margin, -m_margin, m_margin, m_margin); m_item = item; + m_transientParent = transientParent; + // Only start the retrieving of the content, when the mouse has been over this // item for 200 milliseconds. This prevents a lot of useless preview jobs and // meta data retrieval, when passing rapidly over a lot of items. - Q_ASSERT(!m_fileMetaDataToolTip); + delete m_fileMetaDataToolTip; m_fileMetaDataToolTip = new FileMetaDataToolTip(); connect(m_fileMetaDataToolTip, &FileMetaDataToolTip::metaDataRequestFinished, this, &ToolTipManager::slotMetaDataRequestFinished); @@ -100,14 +104,7 @@ void ToolTipManager::hideToolTip() m_metaDataRequested = false; m_showToolTipTimer->stop(); m_contentRetrievalTimer->stop(); - - if (m_fileMetaDataToolTip) { - m_fileMetaDataToolTip->hide(); - // Do not delete the tool tip immediately to prevent crashes when - // QCoreApplication tries to deliver an 'Enter' event to it, see bug 310579. - m_fileMetaDataToolTip->deleteLater(); - m_fileMetaDataToolTip = 0; - } + m_tooltipWidget->hideLater(); } void ToolTipManager::startContentRetrieval() @@ -200,68 +197,9 @@ void ToolTipManager::showToolTip() return; } - const QRect screen = QApplication::desktop()->screenGeometry(QCursor::pos()); - - // Restrict tooltip size to current screen size when needed. - // Because layout controlling widget doesn't respect widget's maximumSize property - // (correct me if I'm wrong), we need to let layout do its work, then manually change - // geometry if resulting widget doesn't fit the screen. - - // Step #1 - make sizeHint return calculated tooltip size - m_fileMetaDataToolTip->layout()->setSizeConstraint(QLayout::SetFixedSize); + // Adjust the size to get a proper sizeHint() m_fileMetaDataToolTip->adjustSize(); - QSize size = m_fileMetaDataToolTip->sizeHint(); - - // Step #2 - correct tooltip size when needed - if (size.width() > screen.width()) { - size.setWidth(screen.width()); - } - if (size.height() > screen.height()) { - size.setHeight(screen.height()); - } - - // m_itemRect defines the area of the item, where the tooltip should be - // shown. Per default the tooltip is shown centered at the bottom. - // It must be assured that: - // - the content is fully visible - // - the content is not drawn inside m_itemRect - const bool hasRoomToLeft = (m_itemRect.left() - size.width() - m_margin >= screen.left()); - const bool hasRoomToRight = (m_itemRect.right() + size.width() + m_margin <= screen.right()); - const bool hasRoomAbove = (m_itemRect.top() - size.height() - m_margin >= screen.top()); - const bool hasRoomBelow = (m_itemRect.bottom() + size.height() + m_margin <= screen.bottom()); - if (!hasRoomAbove && !hasRoomBelow && !hasRoomToLeft && !hasRoomToRight) { - return; - } - - int x, y; - if (hasRoomBelow || hasRoomAbove) { - x = qMax(screen.left(), m_itemRect.center().x() - size.width() / 2); - if (x + size.width() >= screen.right()) { - x = screen.right() - size.width() + 1; - } - if (hasRoomBelow) { - y = m_itemRect.bottom() + m_margin; - } else { - y = m_itemRect.top() - size.height() - m_margin; - } - } else { - Q_ASSERT(hasRoomToLeft || hasRoomToRight); - if (hasRoomToRight) { - x = m_itemRect.right() + m_margin; - } else { - x = m_itemRect.left() - size.width() - m_margin; - } - // Put the tooltip at the bottom of the screen. The x-coordinate has already - // been adjusted, so that no overlapping with m_itemRect occurs. - y = screen.bottom() - size.height() + 1; - } - - // Step #3 - Alter tooltip geometry - m_fileMetaDataToolTip->setFixedSize(size); - m_fileMetaDataToolTip->layout()->setSizeConstraint(QLayout::SetNoConstraint); - m_fileMetaDataToolTip->move(QPoint(x, y)); - m_fileMetaDataToolTip->show(); - + m_tooltipWidget->showBelow(m_itemRect, m_fileMetaDataToolTip, m_transientParent); m_toolTipRequested = false; } diff --git a/src/views/tooltips/tooltipmanager.h b/src/views/tooltips/tooltipmanager.h index f6d8b8f26..58fe68763 100644 --- a/src/views/tooltips/tooltipmanager.h +++ b/src/views/tooltips/tooltipmanager.h @@ -26,7 +26,9 @@ #include class FileMetaDataToolTip; +class KToolTipWidget; class QTimer; +class QWindow; /** * @brief Manages the tooltips for an item view. @@ -47,9 +49,9 @@ public: * Triggers the showing of the tooltip for the item \p item * where the item has the maximum boundaries of \p itemRect. * The tooltip manager takes care that the tooltip is shown - * slightly delayed. + * slightly delayed and with a proper \p transientParent. */ - void showToolTip(const KFileItem& item, const QRectF& itemRect); + void showToolTip(const KFileItem& item, const QRectF& itemRect, QWindow *transientParent); /** * Hides the currently shown tooltip. @@ -72,7 +74,11 @@ private: /// the tooltip content like preview and meta data gets started. QTimer* m_contentRetrievalTimer; + /// Transient parent of the tooltip, mandatory on Wayland. + QWindow* m_transientParent; + FileMetaDataToolTip* m_fileMetaDataToolTip; + QScopedPointer m_tooltipWidget; bool m_toolTipRequested; bool m_metaDataRequested; -- cgit v1.3 From 62b7f9228a4dd06c6ece81df3dbfe07b077dcb7e Mon Sep 17 00:00:00 2001 From: Elvis Angelaccio Date: Mon, 6 Feb 2017 00:07:58 +0100 Subject: Drop no longer used dependency KWindowSystem is no longer used since commit 230fe13d1f. It was only pulled for `KWindowEffects::enableBlurBehind()`, which is now in plasma-integration (triggered by KToolTipWidget). --- CMakeLists.txt | 1 - src/CMakeLists.txt | 1 - 2 files changed, 2 deletions(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index e3494f5a8..ad75d9ebe 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,7 +63,6 @@ find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS IconThemes Completion TextWidgets - WindowSystem Notifications Crash ) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 62d11584e..87300d60c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -145,7 +145,6 @@ target_link_libraries( KF5::KIOFileWidgets KF5::Completion KF5::TextWidgets - KF5::WindowSystem KF5::ConfigCore KF5::NewStuff KF5::Parts -- cgit v1.3