diff options
Diffstat (limited to 'src/kitemviews')
78 files changed, 1360 insertions, 1593 deletions
diff --git a/src/kitemviews/kfileitemlistview.cpp b/src/kitemviews/kfileitemlistview.cpp index 4fffbcbfd..73d6c72e9 100644 --- a/src/kitemviews/kfileitemlistview.cpp +++ b/src/kitemviews/kfileitemlistview.cpp @@ -1,21 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2011 by Peter Penz <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2011 Peter Penz <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #include "kfileitemlistview.h" diff --git a/src/kitemviews/kfileitemlistview.h b/src/kitemviews/kfileitemlistview.h index 92005c2df..43712541a 100644 --- a/src/kitemviews/kfileitemlistview.h +++ b/src/kitemviews/kfileitemlistview.h @@ -1,21 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2011 by Peter Penz <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2011 Peter Penz <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #ifndef KFILEITEMLISTVIEW_H #define KFILEITEMLISTVIEW_H diff --git a/src/kitemviews/kfileitemlistwidget.cpp b/src/kitemviews/kfileitemlistwidget.cpp index a495a4c2f..e5b0a4957 100644 --- a/src/kitemviews/kfileitemlistwidget.cpp +++ b/src/kitemviews/kfileitemlistwidget.cpp @@ -1,21 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2011 by Peter Penz <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2011 Peter Penz <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #include "kfileitemlistwidget.h" #include "kfileitemmodel.h" diff --git a/src/kitemviews/kfileitemlistwidget.h b/src/kitemviews/kfileitemlistwidget.h index 7ce415dbe..e09808024 100644 --- a/src/kitemviews/kfileitemlistwidget.h +++ b/src/kitemviews/kfileitemlistwidget.h @@ -1,21 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2011 by Peter Penz <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2011 Peter Penz <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #ifndef KFILEITEMLISTWIDGET_H #define KFILEITEMLISTWIDGET_H diff --git a/src/kitemviews/kfileitemmodel.cpp b/src/kitemviews/kfileitemmodel.cpp index ac3c33e22..28376c5d0 100644 --- a/src/kitemviews/kfileitemmodel.cpp +++ b/src/kitemviews/kfileitemmodel.cpp @@ -1,23 +1,10 @@ -/***************************************************************************** - * Copyright (C) 2011 by Peter Penz <[email protected]> * - * Copyright (C) 2013 by Frank Reininghaus <[email protected]> * - * Copyright (C) 2013 by Emmanuel Pescosta <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - *****************************************************************************/ +/* + * SPDX-FileCopyrightText: 2011 Peter Penz <[email protected]> + * SPDX-FileCopyrightText: 2013 Frank Reininghaus <[email protected]> + * SPDX-FileCopyrightText: 2013 Emmanuel Pescosta <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #include "kfileitemmodel.h" @@ -247,7 +234,7 @@ QMimeData* KFileItemModel::createMimeData(const KItemSet& indexes) const // The following code has been taken from KDirModel::mimeData() // (kdelibs/kio/kio/kdirmodel.cpp) - // Copyright (C) 2006 David Faure <[email protected]> + // SPDX-FileCopyrightText: 2006 David Faure <[email protected]> QList<QUrl> urls; QList<QUrl> mostLocalUrls; const ItemData* lastAddedItem = nullptr; diff --git a/src/kitemviews/kfileitemmodel.h b/src/kitemviews/kfileitemmodel.h index 132a76e46..844435434 100644 --- a/src/kitemviews/kfileitemmodel.h +++ b/src/kitemviews/kfileitemmodel.h @@ -1,21 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2011 by Peter Penz <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2011 Peter Penz <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #ifndef KFILEITEMMODEL_H #define KFILEITEMMODEL_H diff --git a/src/kitemviews/kfileitemmodelrolesupdater.cpp b/src/kitemviews/kfileitemmodelrolesupdater.cpp index eb2c1b646..02c55fd3e 100644 --- a/src/kitemviews/kfileitemmodelrolesupdater.cpp +++ b/src/kitemviews/kfileitemmodelrolesupdater.cpp @@ -1,21 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2011 by Peter Penz <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2011 Peter Penz <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #include "kfileitemmodelrolesupdater.h" @@ -78,6 +65,7 @@ KFileItemModelRolesUpdater::KFileItemModelRolesUpdater(KFileItemModel* model, QO m_roles(), m_resolvableRoles(), m_enabledPlugins(), + m_localFileSizePreviewLimit(0), m_pendingSortRoleItems(), m_pendingIndexes(), m_pendingPreviewItems(), @@ -85,10 +73,9 @@ KFileItemModelRolesUpdater::KFileItemModelRolesUpdater(KFileItemModel* model, QO m_recentlyChangedItemsTimer(nullptr), m_recentlyChangedItems(), m_changedItems(), - m_directoryContentsCounter(nullptr), - m_localFileSizePreviewLimit(0) + m_directoryContentsCounter(nullptr) #ifdef HAVE_BALOO - , m_balooFileMonitor(nullptr) + , m_balooFileMonitor(nullptr) #endif { Q_ASSERT(model); diff --git a/src/kitemviews/kfileitemmodelrolesupdater.h b/src/kitemviews/kfileitemmodelrolesupdater.h index b881b73e4..a71b55c2e 100644 --- a/src/kitemviews/kfileitemmodelrolesupdater.h +++ b/src/kitemviews/kfileitemmodelrolesupdater.h @@ -1,21 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2011 by Peter Penz <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2011 Peter Penz <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #ifndef KFILEITEMMODELROLESUPDATER_H #define KFILEITEMMODELROLESUPDATER_H @@ -361,5 +348,3 @@ private: }; #endif - - diff --git a/src/kitemviews/kitemlistcontainer.cpp b/src/kitemviews/kitemlistcontainer.cpp index 6279b15a9..77847bcc7 100644 --- a/src/kitemviews/kitemlistcontainer.cpp +++ b/src/kitemviews/kitemlistcontainer.cpp @@ -1,23 +1,10 @@ -/*************************************************************************** - * Copyright (C) 2011 by Peter Penz <[email protected]> * - * * - * Based on the Itemviews NG project from Trolltech Labs * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2011 Peter Penz <[email protected]> + * + * Based on the Itemviews NG project from Trolltech Labs + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #include "kitemlistcontainer.h" @@ -30,6 +17,7 @@ #include <QGraphicsScene> #include <QGraphicsView> #include <QScrollBar> +#include <QScroller> #include <QStyleOption> /** @@ -67,7 +55,8 @@ KItemListContainer::KItemListContainer(KItemListController* controller, QWidget* QAbstractScrollArea(parent), m_controller(controller), m_horizontalSmoothScroller(nullptr), - m_verticalSmoothScroller(nullptr) + m_verticalSmoothScroller(nullptr), + m_scroller(nullptr) { Q_ASSERT(controller); controller->setParent(this); @@ -89,6 +78,13 @@ KItemListContainer::KItemListContainer(KItemListController* controller, QWidget* this, &KItemListContainer::slotModelChanged); connect(controller, &KItemListController::viewChanged, this, &KItemListContainer::slotViewChanged); + + m_scroller = QScroller::scroller(viewport()); + m_scroller->grabGesture(viewport()); + connect(controller, &KItemListController::scrollerStop, + this, &KItemListContainer::stopScroller); + connect(m_scroller, &QScroller::stateChanged, + controller, &KItemListController::slotStateChanged); } KItemListContainer::~KItemListContainer() @@ -176,8 +172,8 @@ void KItemListContainer::wheelEvent(QWheelEvent* event) return; } - const bool scrollHorizontally = (event->orientation() == Qt::Horizontal) || - (event->orientation() == Qt::Vertical && !verticalScrollBar()->isVisible()); + const bool scrollHorizontally = (event->angleDelta().x() != 0) || + (event->angleDelta().y() != 0 && !verticalScrollBar()->isVisible()); KItemListSmoothScroller* smoothScroller = scrollHorizontally ? m_horizontalSmoothScroller : m_verticalSmoothScroller; @@ -338,6 +334,11 @@ void KItemListContainer::updateItemOffsetScrollBar() } } +void KItemListContainer::stopScroller() +{ + m_scroller->stop(); +} + void KItemListContainer::updateGeometries() { QRect rect = geometry(); diff --git a/src/kitemviews/kitemlistcontainer.h b/src/kitemviews/kitemlistcontainer.h index 9fcb88969..537bab142 100644 --- a/src/kitemviews/kitemlistcontainer.h +++ b/src/kitemviews/kitemlistcontainer.h @@ -1,23 +1,10 @@ -/*************************************************************************** - * Copyright (C) 2011 by Peter Penz <[email protected]> * - * * - * Based on the Itemviews NG project from Trolltech Labs * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2011 Peter Penz <[email protected]> + * + * Based on the Itemviews NG project from Trolltech Labs + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #ifndef KITEMLISTCONTAINER_H #define KITEMLISTCONTAINER_H @@ -30,6 +17,7 @@ class KItemListController; class KItemListSmoothScroller; class KItemListView; class KItemModelBase; +class QScroller; /** * @brief Provides a QWidget based scrolling view for a KItemListController. @@ -70,6 +58,7 @@ private slots: void scrollTo(qreal offset); void updateScrollOffsetScrollBar(); void updateItemOffsetScrollBar(); + void stopScroller(); private: void updateGeometries(); @@ -87,6 +76,7 @@ private: KItemListSmoothScroller* m_horizontalSmoothScroller; KItemListSmoothScroller* m_verticalSmoothScroller; + QScroller* m_scroller; }; #endif diff --git a/src/kitemviews/kitemlistcontroller.cpp b/src/kitemviews/kitemlistcontroller.cpp index 5ddf52e5f..60318047d 100644 --- a/src/kitemviews/kitemlistcontroller.cpp +++ b/src/kitemviews/kitemlistcontroller.cpp @@ -1,24 +1,11 @@ -/*************************************************************************** - * Copyright (C) 2011 by Peter Penz <[email protected]> * - * Copyright (C) 2012 by Frank Reininghaus <[email protected]> * - * * - * Based on the Itemviews NG project from Trolltech Labs * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2011 Peter Penz <[email protected]> + * SPDX-FileCopyrightText: 2012 Frank Reininghaus <[email protected]> + * + * Based on the Itemviews NG project from Trolltech Labs + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #include "kitemlistcontroller.h" @@ -26,22 +13,32 @@ #include "kitemlistview.h" #include "private/kitemlistkeyboardsearchmanager.h" #include "private/kitemlistrubberband.h" +#include "private/ktwofingerswipe.h" +#include "private/ktwofingertap.h" #include "views/draganddrophelper.h" #include <QAccessible> #include <QApplication> #include <QDrag> +#include <QGesture> #include <QGraphicsScene> #include <QGraphicsSceneEvent> #include <QGraphicsView> #include <QMimeData> #include <QTimer> +#include <QTouchEvent> KItemListController::KItemListController(KItemModelBase* model, KItemListView* view, QObject* parent) : QObject(parent), m_singleClickActivationEnforced(false), m_selectionTogglePressed(false), m_clearSelectionIfItemsAreNotDragged(false), + m_isSwipeGesture(false), + m_dragActionOrRightClick(false), + m_scrollerIsScrolling(false), + m_pinchGestureInProgress(false), + m_mousePress(false), + m_isTouchEvent(false), m_selectionBehavior(NoSelection), m_autoActivationBehavior(ActivationAndExpansion), m_mouseDoubleClickAction(ActivateItemOnly), @@ -52,6 +49,8 @@ KItemListController::KItemListController(KItemModelBase* model, KItemListView* v m_pressedIndex(-1), m_pressedMousePos(), m_autoActivationTimer(nullptr), + m_swipeGesture(Qt::CustomGesture), + m_twoFingerTapGesture(Qt::CustomGesture), m_oldSelection(), m_keyboardAnchorIndex(-1), m_keyboardAnchorPos(0) @@ -70,6 +69,14 @@ KItemListController::KItemListController(KItemModelBase* model, KItemListView* v setModel(model); setView(view); + + m_swipeGesture = QGestureRecognizer::registerRecognizer(new KTwoFingerSwipeRecognizer()); + m_twoFingerTapGesture = QGestureRecognizer::registerRecognizer(new KTwoFingerTapRecognizer()); + view->grabGesture(m_swipeGesture); + view->grabGesture(m_twoFingerTapGesture); + view->grabGesture(Qt::TapGesture); + view->grabGesture(Qt::TapAndHoldGesture); + view->grabGesture(Qt::PinchGesture); } KItemListController::~KItemListController() @@ -530,149 +537,27 @@ bool KItemListController::inputMethodEvent(QInputMethodEvent* event) bool KItemListController::mousePressEvent(QGraphicsSceneMouseEvent* event, const QTransform& transform) { + m_mousePress = true; + + if (event->source() == Qt::MouseEventSynthesizedByQt && m_isTouchEvent) { + return false; + } + if (!m_view) { return false; } m_pressedMousePos = transform.map(event->pos()); m_pressedIndex = m_view->itemAt(m_pressedMousePos); - emit mouseButtonPressed(m_pressedIndex, event->buttons()); - - if (event->buttons() & (Qt::BackButton | Qt::ForwardButton)) { - // Do not select items when clicking the back/forward buttons, see - // https://bugs.kde.org/show_bug.cgi?id=327412. - return true; - } - if (m_view->isAboveExpansionToggle(m_pressedIndex, m_pressedMousePos)) { - m_selectionManager->endAnchoredSelection(); - m_selectionManager->setCurrentItem(m_pressedIndex); - m_selectionManager->beginAnchoredSelection(m_pressedIndex); - return true; - } + const Qt::MouseButtons buttons = event->buttons(); - m_selectionTogglePressed = m_view->isAboveSelectionToggle(m_pressedIndex, m_pressedMousePos); - if (m_selectionTogglePressed) { - m_selectionManager->setSelected(m_pressedIndex, 1, KItemListSelectionManager::Toggle); - // The previous anchored selection has been finished already in - // KItemListSelectionManager::setSelected(). We can safely change - // the current item and start a new anchored selection now. - m_selectionManager->setCurrentItem(m_pressedIndex); - m_selectionManager->beginAnchoredSelection(m_pressedIndex); - return true; - } - - const bool shiftPressed = event->modifiers() & Qt::ShiftModifier; - const bool controlPressed = event->modifiers() & Qt::ControlModifier; - - // The previous selection is cleared if either - // 1. The selection mode is SingleSelection, or - // 2. the selection mode is MultiSelection, and *none* of the following conditions are met: - // a) Shift or Control are pressed. - // b) The clicked item is selected already. In that case, the user might want to: - // - start dragging multiple items, or - // - open the context menu and perform an action for all selected items. - const bool shiftOrControlPressed = shiftPressed || controlPressed; - const bool pressedItemAlreadySelected = m_pressedIndex >= 0 && m_selectionManager->isSelected(m_pressedIndex); - const bool clearSelection = m_selectionBehavior == SingleSelection || - (!shiftOrControlPressed && !pressedItemAlreadySelected); - if (clearSelection) { - m_selectionManager->clearSelection(); - } else if (pressedItemAlreadySelected && !shiftOrControlPressed && (event->buttons() & Qt::LeftButton)) { - // The user might want to start dragging multiple items, but if he clicks the item - // in order to trigger it instead, the other selected items must be deselected. - // However, we do not know yet what the user is going to do. - // -> remember that the user pressed an item which had been selected already and - // clear the selection in mouseReleaseEvent(), unless the items are dragged. - m_clearSelectionIfItemsAreNotDragged = true; - - if (m_selectionManager->selectedItems().count() == 1 && m_view->isAboveText(m_pressedIndex, m_pressedMousePos)) { - emit selectedItemTextPressed(m_pressedIndex); - } - } - - if (!shiftPressed) { - // Finish the anchored selection before the current index is changed - m_selectionManager->endAnchoredSelection(); - } - - if (event->buttons() & Qt::RightButton) { - // Stop rubber band from persisting after right-clicks - KItemListRubberBand* rubberBand = m_view->rubberBand(); - if (rubberBand->isActive()) { - disconnect(rubberBand, &KItemListRubberBand::endPositionChanged, this, &KItemListController::slotRubberBandChanged); - rubberBand->setActive(false); - m_view->setAutoScroll(false); - } - } - - if (m_pressedIndex >= 0) { - m_selectionManager->setCurrentItem(m_pressedIndex); - - switch (m_selectionBehavior) { - case NoSelection: - break; - - case SingleSelection: - m_selectionManager->setSelected(m_pressedIndex); - break; - - case MultiSelection: - if (controlPressed && !shiftPressed) { - m_selectionManager->setSelected(m_pressedIndex, 1, KItemListSelectionManager::Toggle); - m_selectionManager->beginAnchoredSelection(m_pressedIndex); - } else if (!shiftPressed || !m_selectionManager->isAnchoredSelectionActive()) { - // Select the pressed item and start a new anchored selection - m_selectionManager->setSelected(m_pressedIndex, 1, KItemListSelectionManager::Select); - m_selectionManager->beginAnchoredSelection(m_pressedIndex); - } - break; - - default: - Q_ASSERT(false); - break; - } - - if (event->buttons() & Qt::RightButton) { - emit itemContextMenuRequested(m_pressedIndex, event->screenPos()); - } - - return true; - } - - if (event->buttons() & Qt::RightButton) { - const QRectF headerBounds = m_view->headerBoundaries(); - if (headerBounds.contains(event->pos())) { - emit headerContextMenuRequested(event->screenPos()); - } else { - emit viewContextMenuRequested(event->screenPos()); - } - return true; - } - - if (m_selectionBehavior == MultiSelection) { - QPointF startPos = m_pressedMousePos; - if (m_view->scrollOrientation() == Qt::Vertical) { - startPos.ry() += m_view->scrollOffset(); - if (m_view->itemSize().width() < 0) { - // Use a special rubberband for views that have only one column and - // expand the rubberband to use the whole width of the view. - startPos.setX(0); - } - } else { - startPos.rx() += m_view->scrollOffset(); - } - - m_oldSelection = m_selectionManager->selectedItems(); - KItemListRubberBand* rubberBand = m_view->rubberBand(); - rubberBand->setStartPosition(startPos); - rubberBand->setEndPosition(startPos); - rubberBand->setActive(true); - connect(rubberBand, &KItemListRubberBand::endPositionChanged, this, &KItemListController::slotRubberBandChanged); - m_view->setAutoScroll(true); + if (!onPress(event->screenPos(), event->pos(), event->modifiers(), buttons)) { + startRubberBand(); + return false; } - return false; + return true; } bool KItemListController::mouseMoveEvent(QGraphicsSceneMouseEvent* event, const QTransform& transform) @@ -681,6 +566,14 @@ bool KItemListController::mouseMoveEvent(QGraphicsSceneMouseEvent* event, const return false; } + if (m_view->m_tapAndHoldIndicator->isActive()) { + m_view->m_tapAndHoldIndicator->setActive(false); + } + + if (event->source() == Qt::MouseEventSynthesizedByQt && !m_dragActionOrRightClick && m_isTouchEvent) { + return false; + } + if (m_pressedIndex >= 0) { // Check whether a dragging should be started if (event->buttons() & Qt::LeftButton) { @@ -696,8 +589,8 @@ bool KItemListController::mouseMoveEvent(QGraphicsSceneMouseEvent* event, const // -> the selection should not be cleared when the mouse button is released. m_clearSelectionIfItemsAreNotDragged = false; } - startDragging(); + m_mousePress = false; } } } else { @@ -733,75 +626,25 @@ bool KItemListController::mouseMoveEvent(QGraphicsSceneMouseEvent* event, const bool KItemListController::mouseReleaseEvent(QGraphicsSceneMouseEvent* event, const QTransform& transform) { + m_mousePress = false; + m_isTouchEvent = false; + if (!m_view) { return false; } - emit mouseButtonReleased(m_pressedIndex, event->buttons()); - - const bool isAboveSelectionToggle = m_view->isAboveSelectionToggle(m_pressedIndex, m_pressedMousePos); - if (isAboveSelectionToggle) { - m_selectionTogglePressed = false; - return true; + if (m_view->m_tapAndHoldIndicator->isActive()) { + m_view->m_tapAndHoldIndicator->setActive(false); } - if (!isAboveSelectionToggle && m_selectionTogglePressed) { - m_selectionManager->setSelected(m_pressedIndex, 1, KItemListSelectionManager::Toggle); - m_selectionTogglePressed = false; - return true; - } - - const bool shiftOrControlPressed = event->modifiers() & Qt::ShiftModifier || - event->modifiers() & Qt::ControlModifier; - KItemListRubberBand* rubberBand = m_view->rubberBand(); - if (rubberBand->isActive()) { - disconnect(rubberBand, &KItemListRubberBand::endPositionChanged, this, &KItemListController::slotRubberBandChanged); - rubberBand->setActive(false); - m_oldSelection.clear(); - m_view->setAutoScroll(false); + if (event->source() == Qt::MouseEventSynthesizedByQt && !rubberBand->isActive() && m_isTouchEvent) { + return false; } - const QPointF pos = transform.map(event->pos()); - const int index = m_view->itemAt(pos); - - if (index >= 0 && index == m_pressedIndex) { - // The release event is done above the same item as the press event - - if (m_clearSelectionIfItemsAreNotDragged) { - // A selected item has been clicked, but no drag operation has been started - // -> clear the rest of the selection. - m_selectionManager->clearSelection(); - m_selectionManager->setSelected(m_pressedIndex, 1, KItemListSelectionManager::Select); - m_selectionManager->beginAnchoredSelection(m_pressedIndex); - } - - if (event->button() & Qt::LeftButton) { - bool emitItemActivated = true; - if (m_view->isAboveExpansionToggle(index, pos)) { - const bool expanded = m_model->isExpanded(index); - m_model->setExpanded(index, !expanded); - - emit itemExpansionToggleClicked(index); - emitItemActivated = false; - } else if (shiftOrControlPressed) { - // The mouse click should only update the selection, not trigger the item - emitItemActivated = false; - } else if (!(m_view->style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick) || m_singleClickActivationEnforced)) { - emitItemActivated = false; - } - if (emitItemActivated) { - emit itemActivated(index); - } - } else if (event->button() & Qt::MidButton) { - emit itemMiddleClicked(index); - } - } + emit mouseButtonReleased(m_pressedIndex, event->buttons()); - m_pressedMousePos = QPointF(); - m_pressedIndex = -1; - m_clearSelectionIfItemsAreNotDragged = false; - return false; + return onRelease(transform.map(event->pos()), event->modifiers(), event->button(), false); } bool KItemListController::mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event, const QTransform& transform) @@ -1014,6 +857,9 @@ bool KItemListController::hoverLeaveEvent(QGraphicsSceneHoverEvent* event, const Q_UNUSED(event) Q_UNUSED(transform) + m_mousePress = false; + m_isTouchEvent = false; + if (!m_model || !m_view) { return false; } @@ -1041,6 +887,211 @@ bool KItemListController::resizeEvent(QGraphicsSceneResizeEvent* event, const QT return false; } +bool KItemListController::gestureEvent(QGestureEvent* event, const QTransform& transform) +{ + if (!m_view) { + return false; + } + + //you can touch on different views at the same time, but only one QWidget gets a mousePressEvent + //we use this to get the right QWidget + //the only exception is a tap gesture with state GestureStarted, we need to reset some variable + if (!m_mousePress) { + if (QGesture* tap = event->gesture(Qt::TapGesture)) { + QTapGesture* tapGesture = static_cast<QTapGesture*>(tap); + if (tapGesture->state() == Qt::GestureStarted) { + tapTriggered(tapGesture, transform); + } + } + return false; + } + + bool accepted = false; + + if (QGesture* tap = event->gesture(Qt::TapGesture)) { + tapTriggered(static_cast<QTapGesture*>(tap), transform); + accepted = true; + } + if (event->gesture(Qt::TapAndHoldGesture)) { + tapAndHoldTriggered(event, transform); + accepted = true; + } + if (event->gesture(Qt::PinchGesture)) { + pinchTriggered(event, transform); + accepted = true; + } + if (event->gesture(m_swipeGesture)) { + swipeTriggered(event, transform); + accepted = true; + } + if (event->gesture(m_twoFingerTapGesture)) { + twoFingerTapTriggered(event, transform); + accepted = true; + } + return accepted; +} + +bool KItemListController::touchBeginEvent(QTouchEvent* event, const QTransform& transform) +{ + Q_UNUSED(event) + Q_UNUSED(transform) + + m_isTouchEvent = true; + return false; +} + +void KItemListController::tapTriggered(QTapGesture* tap, const QTransform& transform) +{ + static bool scrollerWasActive = false; + + if (tap->state() == Qt::GestureStarted) { + m_dragActionOrRightClick = false; + m_isSwipeGesture = false; + m_pinchGestureInProgress = false; + scrollerWasActive = m_scrollerIsScrolling; + } + + if (tap->state() == Qt::GestureFinished) { + m_mousePress = false; + + //if at the moment of the gesture start the QScroller was active, the user made the tap + //to stop the QScroller and not to tap on an item + if (scrollerWasActive) { + return; + } + + if (m_view->m_tapAndHoldIndicator->isActive()) { + m_view->m_tapAndHoldIndicator->setActive(false); + } + + m_pressedMousePos = transform.map(tap->position()); + m_pressedIndex = m_view->itemAt(m_pressedMousePos); + + if (m_dragActionOrRightClick) { + onPress(tap->hotSpot().toPoint(), tap->position().toPoint(), Qt::NoModifier, Qt::RightButton); + onRelease(transform.map(tap->position()), Qt::NoModifier, Qt::RightButton, false); + m_dragActionOrRightClick = false; + } + else { + onPress(tap->hotSpot().toPoint(), tap->position().toPoint(), Qt::NoModifier, Qt::LeftButton); + onRelease(transform.map(tap->position()), Qt::NoModifier, Qt::LeftButton, true); + } + m_isTouchEvent = false; + } +} + +void KItemListController::tapAndHoldTriggered(QGestureEvent* event, const QTransform& transform) +{ + + //the Qt TabAndHold gesture is triggerable with a mouse click, we don't want this + if (!m_isTouchEvent) { + return; + } + + const QTapAndHoldGesture* tap = static_cast<QTapAndHoldGesture*>(event->gesture(Qt::TapAndHoldGesture)); + if (tap->state() == Qt::GestureFinished) { + //if a pinch gesture is in progress we don't want a TabAndHold gesture + if (m_pinchGestureInProgress) { + return; + } + m_pressedMousePos = transform.map(event->mapToGraphicsScene(tap->position())); + m_pressedIndex = m_view->itemAt(m_pressedMousePos); + + if (m_pressedIndex >= 0 && !m_selectionManager->isSelected(m_pressedIndex)) { + m_selectionManager->clearSelection(); + m_selectionManager->setSelected(m_pressedIndex); + } else if (m_pressedIndex == -1) { + m_selectionManager->clearSelection(); + startRubberBand(); + } + + emit scrollerStop(); + + m_view->m_tapAndHoldIndicator->setStartPosition(m_pressedMousePos); + m_view->m_tapAndHoldIndicator->setActive(true); + + m_dragActionOrRightClick = true; + } +} + +void KItemListController::pinchTriggered(QGestureEvent* event, const QTransform& transform) +{ + Q_UNUSED(transform) + + const QPinchGesture* pinch = static_cast<QPinchGesture*>(event->gesture(Qt::PinchGesture)); + const qreal sensitivityModifier = 0.2; + static qreal counter = 0; + + if (pinch->state() == Qt::GestureStarted) { + m_pinchGestureInProgress = true; + counter = 0; + } + if (pinch->state() == Qt::GestureUpdated) { + //if a swipe gesture was recognized or in progress, we don't want a pinch gesture to change the zoom + if (m_isSwipeGesture) { + return; + } + counter = counter + (pinch->scaleFactor() - 1); + if (counter >= sensitivityModifier) { + emit increaseZoom(); + counter = 0; + } else if (counter <= -sensitivityModifier) { + emit decreaseZoom(); + counter = 0; + } + } +} + +void KItemListController::swipeTriggered(QGestureEvent* event, const QTransform& transform) +{ + Q_UNUSED(transform) + + const KTwoFingerSwipe* swipe = static_cast<KTwoFingerSwipe*>(event->gesture(m_swipeGesture)); + + if (!swipe) { + return; + } + if (swipe->state() == Qt::GestureStarted) { + m_isSwipeGesture = true; + } + + if (swipe->state() == Qt::GestureCanceled) { + m_isSwipeGesture = false; + } + + if (swipe->state() == Qt::GestureFinished) { + emit scrollerStop(); + + if (swipe->swipeAngle() <= 20 || swipe->swipeAngle() >= 340) { + emit mouseButtonPressed(m_pressedIndex, Qt::BackButton); + } else if (swipe->swipeAngle() <= 200 && swipe->swipeAngle() >= 160) { + emit mouseButtonPressed(m_pressedIndex, Qt::ForwardButton); + } else if (swipe->swipeAngle() <= 110 && swipe->swipeAngle() >= 60) { + emit swipeUp(); + } + m_isSwipeGesture = true; + } +} + +void KItemListController::twoFingerTapTriggered(QGestureEvent* event, const QTransform& transform) +{ + const KTwoFingerTap* twoTap = static_cast<KTwoFingerTap*>(event->gesture(m_twoFingerTapGesture)); + + if (!twoTap) { + return; + } + + if (twoTap->state() == Qt::GestureStarted) { + m_pressedMousePos = transform.map(twoTap->pos()); + m_pressedIndex = m_view->itemAt(m_pressedMousePos); + if (m_pressedIndex >= 0) { + onPress(twoTap->screenPos().toPoint(), twoTap->pos().toPoint(), Qt::ControlModifier, Qt::LeftButton); + onRelease(transform.map(twoTap->pos()), Qt::ControlModifier, Qt::LeftButton, false); + } + + } +} + bool KItemListController::processEvent(QEvent* event, const QTransform& transform) { if (!event) { @@ -1078,6 +1129,10 @@ bool KItemListController::processEvent(QEvent* event, const QTransform& transfor return hoverLeaveEvent(static_cast<QGraphicsSceneHoverEvent*>(event), QTransform()); case QEvent::GraphicsSceneResize: return resizeEvent(static_cast<QGraphicsSceneResizeEvent*>(event), transform); + case QEvent::Gesture: + return gestureEvent(static_cast<QGestureEvent*>(event), transform); + case QEvent::TouchBegin: + return touchBeginEvent(static_cast<QTouchEvent*>(event), transform); default: break; } @@ -1358,3 +1413,225 @@ void KItemListController::updateExtendedSelectionRegion() } } +bool KItemListController::onPress(const QPoint& screenPos, const QPointF& pos, const Qt::KeyboardModifiers modifiers, const Qt::MouseButtons buttons) +{ + emit mouseButtonPressed(m_pressedIndex, buttons); + + if (buttons & (Qt::BackButton | Qt::ForwardButton)) { + // Do not select items when clicking the back/forward buttons, see + // https://bugs.kde.org/show_bug.cgi?id=327412. + return true; + } + + if (m_view->isAboveExpansionToggle(m_pressedIndex, m_pressedMousePos)) { + m_selectionManager->endAnchoredSelection(); + m_selectionManager->setCurrentItem(m_pressedIndex); + m_selectionManager->beginAnchoredSelection(m_pressedIndex); + return true; + } + + m_selectionTogglePressed = m_view->isAboveSelectionToggle(m_pressedIndex, m_pressedMousePos); + if (m_selectionTogglePressed) { + m_selectionManager->setSelected(m_pressedIndex, 1, KItemListSelectionManager::Toggle); + // The previous anchored selection has been finished already in + // KItemListSelectionManager::setSelected(). We can safely change + // the current item and start a new anchored selection now. + m_selectionManager->setCurrentItem(m_pressedIndex); + m_selectionManager->beginAnchoredSelection(m_pressedIndex); + return true; + } + + const bool shiftPressed = modifiers & Qt::ShiftModifier; + const bool controlPressed = modifiers & Qt::ControlModifier; + + // The previous selection is cleared if either + // 1. The selection mode is SingleSelection, or + // 2. the selection mode is MultiSelection, and *none* of the following conditions are met: + // a) Shift or Control are pressed. + // b) The clicked item is selected already. In that case, the user might want to: + // - start dragging multiple items, or + // - open the context menu and perform an action for all selected items. + const bool shiftOrControlPressed = shiftPressed || controlPressed; + const bool pressedItemAlreadySelected = m_pressedIndex >= 0 && m_selectionManager->isSelected(m_pressedIndex); + const bool clearSelection = m_selectionBehavior == SingleSelection || + (!shiftOrControlPressed && !pressedItemAlreadySelected); + if (clearSelection) { + m_selectionManager->clearSelection(); + } else if (pressedItemAlreadySelected && !shiftOrControlPressed && (buttons & Qt::LeftButton)) { + // The user might want to start dragging multiple items, but if he clicks the item + // in order to trigger it instead, the other selected items must be deselected. + // However, we do not know yet what the user is going to do. + // -> remember that the user pressed an item which had been selected already and + // clear the selection in mouseReleaseEvent(), unless the items are dragged. + m_clearSelectionIfItemsAreNotDragged = true; + + if (m_selectionManager->selectedItems().count() == 1 && m_view->isAboveText(m_pressedIndex, m_pressedMousePos)) { + emit selectedItemTextPressed(m_pressedIndex); + } + } + + if (!shiftPressed) { + // Finish the anchored selection before the current index is changed + m_selectionManager->endAnchoredSelection(); + } + + if (buttons & Qt::RightButton) { + // Stop rubber band from persisting after right-clicks + KItemListRubberBand* rubberBand = m_view->rubberBand(); + if (rubberBand->isActive()) { + disconnect(rubberBand, &KItemListRubberBand::endPositionChanged, this, &KItemListController::slotRubberBandChanged); + rubberBand->setActive(false); + m_view->setAutoScroll(false); + } + } + + if (m_pressedIndex >= 0) { + m_selectionManager->setCurrentItem(m_pressedIndex); + + switch (m_selectionBehavior) { + case NoSelection: + break; + + case SingleSelection: + m_selectionManager->setSelected(m_pressedIndex); + break; + + case MultiSelection: + if (controlPressed && !shiftPressed) { + m_selectionManager->setSelected(m_pressedIndex, 1, KItemListSelectionManager::Toggle); + m_selectionManager->beginAnchoredSelection(m_pressedIndex); + } else if (!shiftPressed || !m_selectionManager->isAnchoredSelectionActive()) { + // Select the pressed item and start a new anchored selection + m_selectionManager->setSelected(m_pressedIndex, 1, KItemListSelectionManager::Select); + m_selectionManager->beginAnchoredSelection(m_pressedIndex); + } + break; + + default: + Q_ASSERT(false); + break; + } + + if (buttons & Qt::RightButton) { + emit itemContextMenuRequested(m_pressedIndex, screenPos); + } + + return true; + } + + if (buttons & Qt::RightButton) { + const QRectF headerBounds = m_view->headerBoundaries(); + if (headerBounds.contains(pos)) { + emit headerContextMenuRequested(screenPos); + } else { + emit viewContextMenuRequested(screenPos); + } + return true; + } + + return false; +} + +bool KItemListController::onRelease(const QPointF& pos, const Qt::KeyboardModifiers modifiers, const Qt::MouseButtons buttons, bool touch) +{ + const bool isAboveSelectionToggle = m_view->isAboveSelectionToggle(m_pressedIndex, m_pressedMousePos); + if (isAboveSelectionToggle) { + m_selectionTogglePressed = false; + return true; + } + + if (!isAboveSelectionToggle && m_selectionTogglePressed) { + m_selectionManager->setSelected(m_pressedIndex, 1, KItemListSelectionManager::Toggle); + m_selectionTogglePressed = false; + return true; + } + + const bool shiftOrControlPressed = modifiers & Qt::ShiftModifier || + modifiers & Qt::ControlModifier; + + KItemListRubberBand* rubberBand = m_view->rubberBand(); + if (rubberBand->isActive()) { + disconnect(rubberBand, &KItemListRubberBand::endPositionChanged, this, &KItemListController::slotRubberBandChanged); + rubberBand->setActive(false); + m_oldSelection.clear(); + m_view->setAutoScroll(false); + } + + const int index = m_view->itemAt(pos); + + if (index >= 0 && index == m_pressedIndex) { + // The release event is done above the same item as the press event + + if (m_clearSelectionIfItemsAreNotDragged) { + // A selected item has been clicked, but no drag operation has been started + // -> clear the rest of the selection. + m_selectionManager->clearSelection(); + m_selectionManager->setSelected(m_pressedIndex, 1, KItemListSelectionManager::Select); + m_selectionManager->beginAnchoredSelection(m_pressedIndex); + } + + if (buttons & Qt::LeftButton) { + bool emitItemActivated = true; + if (m_view->isAboveExpansionToggle(index, pos)) { + const bool expanded = m_model->isExpanded(index); + m_model->setExpanded(index, !expanded); + + emit itemExpansionToggleClicked(index); + emitItemActivated = false; + } else if (shiftOrControlPressed) { + // The mouse click should only update the selection, not trigger the item + emitItemActivated = false; + } else if (!(m_view->style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick) || m_singleClickActivationEnforced)) { + if (touch) { + emitItemActivated = true; + } else { + emitItemActivated = false; + } + } + if (emitItemActivated) { + emit itemActivated(index); + } + } else if (buttons & Qt::MiddleButton) { + emit itemMiddleClicked(index); + } + } + + m_pressedMousePos = QPointF(); + m_pressedIndex = -1; + m_clearSelectionIfItemsAreNotDragged = false; + return false; +} + +void KItemListController::startRubberBand() +{ + if (m_selectionBehavior == MultiSelection) { + QPointF startPos = m_pressedMousePos; + if (m_view->scrollOrientation() == Qt::Vertical) { + startPos.ry() += m_view->scrollOffset(); + if (m_view->itemSize().width() < 0) { + // Use a special rubberband for views that have only one column and + // expand the rubberband to use the whole width of the view. + startPos.setX(0); + } + } else { + startPos.rx() += m_view->scrollOffset(); + } + + m_oldSelection = m_selectionManager->selectedItems(); + KItemListRubberBand* rubberBand = m_view->rubberBand(); + rubberBand->setStartPosition(startPos); + rubberBand->setEndPosition(startPos); + rubberBand->setActive(true); + connect(rubberBand, &KItemListRubberBand::endPositionChanged, this, &KItemListController::slotRubberBandChanged); + m_view->setAutoScroll(true); + } +} + +void KItemListController::slotStateChanged(QScroller::State newState) +{ + if (newState == QScroller::Scrolling) { + m_scrollerIsScrolling = true; + } else if (newState == QScroller::Inactive) { + m_scrollerIsScrolling = false; + } +} diff --git a/src/kitemviews/kitemlistcontroller.h b/src/kitemviews/kitemlistcontroller.h index 6d9b2ac6a..cdbc5b470 100644 --- a/src/kitemviews/kitemlistcontroller.h +++ b/src/kitemviews/kitemlistcontroller.h @@ -1,23 +1,10 @@ -/*************************************************************************** - * Copyright (C) 2011 by Peter Penz <[email protected]> * - * * - * Based on the Itemviews NG project from Trolltech Labs * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2011 Peter Penz <[email protected]> + * + * Based on the Itemviews NG project from Trolltech Labs + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #ifndef KITEMLISTCONTROLLER_H #define KITEMLISTCONTROLLER_H @@ -27,6 +14,7 @@ #include <QObject> #include <QPointF> +#include <QScroller> class QTimer; class KItemModelBase; @@ -34,6 +22,7 @@ class KItemListKeyboardSearchManager; class KItemListSelectionManager; class KItemListView; class KItemListWidget; +class QGestureEvent; class QGraphicsSceneHoverEvent; class QGraphicsSceneDragDropEvent; class QGraphicsSceneMouseEvent; @@ -41,7 +30,9 @@ class QGraphicsSceneResizeEvent; class QGraphicsSceneWheelEvent; class QInputMethodEvent; class QKeyEvent; +class QTapGesture; class QTransform; +class QTouchEvent; /** * @brief Controls the view, model and selection of an item-list. @@ -221,6 +212,14 @@ signals: void selectedItemTextPressed(int index); + void scrollerStop(); + void increaseZoom(); + void decreaseZoom(); + void swipeUp(); + +public slots: + void slotStateChanged(QScroller::State newState); + private slots: void slotViewScrollOffsetChanged(qreal current, qreal previous); @@ -302,11 +301,27 @@ private: bool hoverLeaveEvent(QGraphicsSceneHoverEvent* event, const QTransform& transform); bool wheelEvent(QGraphicsSceneWheelEvent* event, const QTransform& transform); bool resizeEvent(QGraphicsSceneResizeEvent* event, const QTransform& transform); + bool gestureEvent(QGestureEvent* event, const QTransform& transform); + bool touchBeginEvent(QTouchEvent* event, const QTransform& transform); + void tapTriggered(QTapGesture* tap, const QTransform& transform); + void tapAndHoldTriggered(QGestureEvent* event, const QTransform& transform); + void pinchTriggered(QGestureEvent* event, const QTransform& transform); + void swipeTriggered(QGestureEvent* event, const QTransform& transform); + void twoFingerTapTriggered(QGestureEvent* event, const QTransform& transform); + bool onPress(const QPoint& screenPos, const QPointF& pos, const Qt::KeyboardModifiers modifiers, const Qt::MouseButtons buttons); + bool onRelease(const QPointF& pos, const Qt::KeyboardModifiers modifiers, const Qt::MouseButtons buttons, bool touch); + void startRubberBand(); private: bool m_singleClickActivationEnforced; bool m_selectionTogglePressed; bool m_clearSelectionIfItemsAreNotDragged; + bool m_isSwipeGesture; + bool m_dragActionOrRightClick; + bool m_scrollerIsScrolling; + bool m_pinchGestureInProgress; + bool m_mousePress; + bool m_isTouchEvent; SelectionBehavior m_selectionBehavior; AutoActivationBehavior m_autoActivationBehavior; MouseDoubleClickAction m_mouseDoubleClickAction; @@ -319,6 +334,9 @@ private: QTimer* m_autoActivationTimer; + Qt::GestureType m_swipeGesture; + Qt::GestureType m_twoFingerTapGesture; + /** * When starting a rubberband selection during a Shift- or Control-key has been * pressed the current selection should never be deleted. To be able to restore diff --git a/src/kitemviews/kitemlistgroupheader.cpp b/src/kitemviews/kitemlistgroupheader.cpp index 0c495693c..80dd94149 100644 --- a/src/kitemviews/kitemlistgroupheader.cpp +++ b/src/kitemviews/kitemlistgroupheader.cpp @@ -1,23 +1,10 @@ -/*************************************************************************** - * Copyright (C) 2011 by Peter Penz <[email protected]> * - * * - * Based on the Itemviews NG project from Trolltech Labs * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2011 Peter Penz <[email protected]> + * + * Based on the Itemviews NG project from Trolltech Labs + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #include "kstandarditemlistgroupheader.h" diff --git a/src/kitemviews/kitemlistgroupheader.h b/src/kitemviews/kitemlistgroupheader.h index 0e5c61f74..4ba469056 100644 --- a/src/kitemviews/kitemlistgroupheader.h +++ b/src/kitemviews/kitemlistgroupheader.h @@ -1,21 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2011 by Peter Penz <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2011 Peter Penz <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #ifndef KITEMLISTGROUPHEADER_H #define KITEMLISTGROUPHEADER_H diff --git a/src/kitemviews/kitemlistheader.cpp b/src/kitemviews/kitemlistheader.cpp index a82af44e7..d0a09704e 100644 --- a/src/kitemviews/kitemlistheader.cpp +++ b/src/kitemviews/kitemlistheader.cpp @@ -1,21 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2012 by Peter Penz <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2012 Peter Penz <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #include "kitemlistheader.h" #include "kitemlistview.h" diff --git a/src/kitemviews/kitemlistheader.h b/src/kitemviews/kitemlistheader.h index 95258a592..e8cfc420a 100644 --- a/src/kitemviews/kitemlistheader.h +++ b/src/kitemviews/kitemlistheader.h @@ -1,21 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2012 by Peter Penz <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2012 Peter Penz <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #ifndef KITEMLISTHEADER_H #define KITEMLISTHEADER_H diff --git a/src/kitemviews/kitemlistselectionmanager.cpp b/src/kitemviews/kitemlistselectionmanager.cpp index 6bee19414..3cb051a23 100644 --- a/src/kitemviews/kitemlistselectionmanager.cpp +++ b/src/kitemviews/kitemlistselectionmanager.cpp @@ -1,24 +1,11 @@ -/*************************************************************************** - * Copyright (C) 2011 by Peter Penz <[email protected]> * - * Copyright (C) 2011 by Frank Reininghaus <[email protected]> * - * * - * Based on the Itemviews NG project from Trolltech Labs * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2011 Peter Penz <[email protected]> + * SPDX-FileCopyrightText: 2011 Frank Reininghaus <[email protected]> + * + * Based on the Itemviews NG project from Trolltech Labs + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #include "kitemlistselectionmanager.h" diff --git a/src/kitemviews/kitemlistselectionmanager.h b/src/kitemviews/kitemlistselectionmanager.h index 6b0435139..2be578399 100644 --- a/src/kitemviews/kitemlistselectionmanager.h +++ b/src/kitemviews/kitemlistselectionmanager.h @@ -1,23 +1,10 @@ -/*************************************************************************** - * Copyright (C) 2011 by Peter Penz <[email protected]> * - * * - * Based on the Itemviews NG project from Trolltech Labs * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2011 Peter Penz <[email protected]> + * + * Based on the Itemviews NG project from Trolltech Labs + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #ifndef KITEMLISTSELECTIONMANAGER_H #define KITEMLISTSELECTIONMANAGER_H diff --git a/src/kitemviews/kitemliststyleoption.cpp b/src/kitemviews/kitemliststyleoption.cpp index 84054aaac..6e4aaa96e 100644 --- a/src/kitemviews/kitemliststyleoption.cpp +++ b/src/kitemviews/kitemliststyleoption.cpp @@ -1,21 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2011 by Peter Penz <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2011 Peter Penz <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #include "kitemliststyleoption.h" diff --git a/src/kitemviews/kitemliststyleoption.h b/src/kitemviews/kitemliststyleoption.h index 381f4bbe5..62e462a5d 100644 --- a/src/kitemviews/kitemliststyleoption.h +++ b/src/kitemviews/kitemliststyleoption.h @@ -1,21 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2011 by Peter Penz <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2011 Peter Penz <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #ifndef KITEMLISTSTYLEOPTION_H #define KITEMLISTSTYLEOPTION_H diff --git a/src/kitemviews/kitemlistview.cpp b/src/kitemviews/kitemlistview.cpp index f00805242..4d9bf083f 100644 --- a/src/kitemviews/kitemlistview.cpp +++ b/src/kitemviews/kitemlistview.cpp @@ -1,23 +1,10 @@ -/*************************************************************************** - * Copyright (C) 2011 by Peter Penz <[email protected]> * - * * - * Based on the Itemviews NG project from Trolltech Labs * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2011 Peter Penz <[email protected]> + * + * Based on the Itemviews NG project from Trolltech Labs + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #include "kitemlistview.h" @@ -37,6 +24,7 @@ #include <QElapsedTimer> #include <QGraphicsSceneMouseEvent> #include <QGraphicsView> +#include <QPropertyAnimation> #include <QStyleOptionRubberBand> #include <QTimer> @@ -93,14 +81,17 @@ KItemListView::KItemListView(QGraphicsWidget* parent) : m_oldMaximumItemOffset(0), m_skipAutoScrollForRubberBand(false), m_rubberBand(nullptr), + m_tapAndHoldIndicator(nullptr), m_mousePos(), m_autoScrollIncrement(0), m_autoScrollTimer(nullptr), m_header(nullptr), m_headerWidget(nullptr), + m_indicatorAnimation(nullptr), m_dropIndicator() { setAcceptHoverEvents(true); + setAcceptTouchEvents(true); m_sizeHintResolver = new KItemListSizeHintResolver(this); @@ -118,6 +109,23 @@ KItemListView::KItemListView(QGraphicsWidget* parent) : m_rubberBand = new KItemListRubberBand(this); connect(m_rubberBand, &KItemListRubberBand::activationChanged, this, &KItemListView::slotRubberBandActivationChanged); + m_tapAndHoldIndicator = new KItemListRubberBand(this); + m_indicatorAnimation = new QPropertyAnimation(m_tapAndHoldIndicator, "endPosition", this); + connect(m_tapAndHoldIndicator, &KItemListRubberBand::activationChanged, this, [this](bool active) { + if (active) { + m_indicatorAnimation->setDuration(150); + m_indicatorAnimation->setStartValue(QPointF(1, 1)); + m_indicatorAnimation->setEndValue(QPointF(40, 40)); + m_indicatorAnimation->start(); + } + update(); + }); + connect(m_tapAndHoldIndicator, &KItemListRubberBand::endPositionChanged, this, [this]() { + if (m_tapAndHoldIndicator->isActive()) { + update(); + } + }); + m_headerWidget = new KItemListHeaderWidget(this); m_headerWidget->setVisible(false); @@ -671,6 +679,18 @@ void KItemListView::paint(QPainter* painter, const QStyleOptionGraphicsItem* opt style()->drawControl(QStyle::CE_RubberBand, &opt, painter); } + if (m_tapAndHoldIndicator->isActive()) { + const QPointF indicatorSize = m_tapAndHoldIndicator->endPosition(); + const QRectF rubberBandRect = QRectF(m_tapAndHoldIndicator->startPosition() - indicatorSize, + (m_tapAndHoldIndicator->startPosition()) + indicatorSize).normalized(); + QStyleOptionRubberBand opt; + initStyleOption(&opt); + opt.shape = QRubberBand::Rectangle; + opt.opaque = false; + opt.rect = rubberBandRect.toRect(); + style()->drawControl(QStyle::CE_RubberBand, &opt, painter); + } + if (!m_dropIndicator.isEmpty()) { const QRectF r = m_dropIndicator.toRect(); diff --git a/src/kitemviews/kitemlistview.h b/src/kitemviews/kitemlistview.h index 2a3b7ada2..df582aad0 100644 --- a/src/kitemviews/kitemlistview.h +++ b/src/kitemviews/kitemlistview.h @@ -1,23 +1,10 @@ -/*************************************************************************** - * Copyright (C) 2011 by Peter Penz <[email protected]> * - * * - * Based on the Itemviews NG project from Trolltech Labs * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2011 Peter Penz <[email protected]> + * + * Based on the Itemviews NG project from Trolltech Labs + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #ifndef KITEMLISTVIEW_H #define KITEMLISTVIEW_H @@ -44,6 +31,7 @@ class KItemListWidget; class KItemListWidgetInformant; class KItemListWidgetCreatorBase; class QTimer; +class QPropertyAnimation; /** * @brief Represents the view of an item-list. @@ -740,6 +728,7 @@ private: bool m_skipAutoScrollForRubberBand; KItemListRubberBand* m_rubberBand; + KItemListRubberBand* m_tapAndHoldIndicator; QPointF m_mousePos; int m_autoScrollIncrement; @@ -748,6 +737,8 @@ private: KItemListHeader* m_header; KItemListHeaderWidget* m_headerWidget; + QPropertyAnimation* m_indicatorAnimation; + // When dragging items into the view where the sort-role of the model // is empty, a visual indicator should be shown during dragging where // the dropping will happen. This indicator is specified by an index diff --git a/src/kitemviews/kitemlistviewaccessible.cpp b/src/kitemviews/kitemlistviewaccessible.cpp index 0188408a7..5f3753525 100644 --- a/src/kitemviews/kitemlistviewaccessible.cpp +++ b/src/kitemviews/kitemlistviewaccessible.cpp @@ -1,21 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2012 by Amandeep Singh <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2012 Amandeep Singh <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #ifndef QT_NO_ACCESSIBILITY diff --git a/src/kitemviews/kitemlistviewaccessible.h b/src/kitemviews/kitemlistviewaccessible.h index 3e39e2399..cdef2ccca 100644 --- a/src/kitemviews/kitemlistviewaccessible.h +++ b/src/kitemviews/kitemlistviewaccessible.h @@ -1,21 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2012 by Amandeep Singh <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2012 Amandeep Singh <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #ifndef KITEMLISTVIEWACCESSIBLE_H #define KITEMLISTVIEWACCESSIBLE_H diff --git a/src/kitemviews/kitemlistwidget.cpp b/src/kitemviews/kitemlistwidget.cpp index 42bf9ebdc..fce06a53f 100644 --- a/src/kitemviews/kitemlistwidget.cpp +++ b/src/kitemviews/kitemlistwidget.cpp @@ -1,23 +1,10 @@ -/*************************************************************************** - * Copyright (C) 2011 by Peter Penz <[email protected]> * - * * - * Based on the Itemviews NG project from Trolltech Labs * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2011 Peter Penz <[email protected]> + * + * Based on the Itemviews NG project from Trolltech Labs + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #include "kitemlistwidget.h" diff --git a/src/kitemviews/kitemlistwidget.h b/src/kitemviews/kitemlistwidget.h index 66b2da069..aad499853 100644 --- a/src/kitemviews/kitemlistwidget.h +++ b/src/kitemviews/kitemlistwidget.h @@ -1,23 +1,10 @@ -/*************************************************************************** - * Copyright (C) 2011 by Peter Penz <[email protected]> * - * * - * Based on the Itemviews NG project from Trolltech Labs * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2011 Peter Penz <[email protected]> + * + * Based on the Itemviews NG project from Trolltech Labs + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #ifndef KITEMLISTWIDGET_H #define KITEMLISTWIDGET_H diff --git a/src/kitemviews/kitemmodelbase.cpp b/src/kitemviews/kitemmodelbase.cpp index faabdbe1d..795a1a2f5 100644 --- a/src/kitemviews/kitemmodelbase.cpp +++ b/src/kitemviews/kitemmodelbase.cpp @@ -1,23 +1,10 @@ -/*************************************************************************** - * Copyright (C) 2011 by Peter Penz <[email protected]> * - * * - * Based on the Itemviews NG project from Trolltech Labs * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2011 Peter Penz <[email protected]> + * + * Based on the Itemviews NG project from Trolltech Labs + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #include "kitemmodelbase.h" diff --git a/src/kitemviews/kitemmodelbase.h b/src/kitemviews/kitemmodelbase.h index a6ba3f7c4..d68eab568 100644 --- a/src/kitemviews/kitemmodelbase.h +++ b/src/kitemviews/kitemmodelbase.h @@ -1,23 +1,10 @@ -/*************************************************************************** - * Copyright (C) 2011 by Peter Penz <[email protected]> * - * * - * Based on the Itemviews NG project from Trolltech Labs * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2011 Peter Penz <[email protected]> + * + * Based on the Itemviews NG project from Trolltech Labs + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #ifndef KITEMMODELBASE_H #define KITEMMODELBASE_H diff --git a/src/kitemviews/kitemrange.h b/src/kitemviews/kitemrange.h index f62305a39..0ea068062 100644 --- a/src/kitemviews/kitemrange.h +++ b/src/kitemviews/kitemrange.h @@ -1,24 +1,11 @@ -/*************************************************************************** - * Copyright (C) 2011 by Peter Penz <[email protected]> * - * Copyright (C) 2013 by Frank Reininghaus <[email protected]> * - * * - * Based on the Itemviews NG project from Trolltech Labs * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2011 Peter Penz <[email protected]> + * SPDX-FileCopyrightText: 2013 Frank Reininghaus <[email protected]> + * + * Based on the Itemviews NG project from Trolltech Labs + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #ifndef KITEMRANGE_H #define KITEMRANGE_H diff --git a/src/kitemviews/kitemset.cpp b/src/kitemviews/kitemset.cpp index e36829eb5..ea96efd11 100644 --- a/src/kitemviews/kitemset.cpp +++ b/src/kitemviews/kitemset.cpp @@ -1,21 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2013 by Frank Reininghaus <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2013 Frank Reininghaus <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #include "kitemset.h" diff --git a/src/kitemviews/kitemset.h b/src/kitemviews/kitemset.h index 14aa665a1..e66b47f28 100644 --- a/src/kitemviews/kitemset.h +++ b/src/kitemviews/kitemset.h @@ -1,21 +1,9 @@ -/*************************************************************************** - * Copyright (C) 2013 by Frank Reininghaus <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2013 Frank Reininghaus <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + #ifndef KITEMSET_H #define KITEMSET_H diff --git a/src/kitemviews/kstandarditem.cpp b/src/kitemviews/kstandarditem.cpp index b0673236f..39121ab31 100644 --- a/src/kitemviews/kstandarditem.cpp +++ b/src/kitemviews/kstandarditem.cpp @@ -1,21 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2012 by Peter Penz <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2012 Peter Penz <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #include "kstandarditem.h" #include "kstandarditemmodel.h" diff --git a/src/kitemviews/kstandarditem.h b/src/kitemviews/kstandarditem.h index 13e61a089..265483d50 100644 --- a/src/kitemviews/kstandarditem.h +++ b/src/kitemviews/kstandarditem.h @@ -1,21 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2012 by Peter Penz <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2012 Peter Penz <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #ifndef KSTANDARDITEM_H #define KSTANDARDITEM_H diff --git a/src/kitemviews/kstandarditemlistgroupheader.cpp b/src/kitemviews/kstandarditemlistgroupheader.cpp index 062b20e90..22eefe5ea 100644 --- a/src/kitemviews/kstandarditemlistgroupheader.cpp +++ b/src/kitemviews/kstandarditemlistgroupheader.cpp @@ -1,23 +1,10 @@ -/*************************************************************************** - * Copyright (C) 2011 by Peter Penz <[email protected]> * - * * - * Based on the Itemviews NG project from Trolltech Labs * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2011 Peter Penz <[email protected]> + * + * Based on the Itemviews NG project from Trolltech Labs + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #include "kstandarditemlistgroupheader.h" diff --git a/src/kitemviews/kstandarditemlistgroupheader.h b/src/kitemviews/kstandarditemlistgroupheader.h index c420a58b1..ff428c4ea 100644 --- a/src/kitemviews/kstandarditemlistgroupheader.h +++ b/src/kitemviews/kstandarditemlistgroupheader.h @@ -1,21 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2011 by Peter Penz <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2011 Peter Penz <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #ifndef KSTANDARDITEMLISTGROUPHEADER_H #define KSTANDARDITEMLISTGROUPHEADER_H diff --git a/src/kitemviews/kstandarditemlistview.cpp b/src/kitemviews/kstandarditemlistview.cpp index 097f681c5..bc766a5dc 100644 --- a/src/kitemviews/kstandarditemlistview.cpp +++ b/src/kitemviews/kstandarditemlistview.cpp @@ -1,21 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2012 by Peter Penz <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2012 Peter Penz <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #include "kstandarditemlistview.h" diff --git a/src/kitemviews/kstandarditemlistview.h b/src/kitemviews/kstandarditemlistview.h index cf5ce5fc1..7f0550ec3 100644 --- a/src/kitemviews/kstandarditemlistview.h +++ b/src/kitemviews/kstandarditemlistview.h @@ -1,21 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2012 by Peter Penz <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2012 Peter Penz <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #ifndef KSTANDARDITEMLISTVIEW_H #define KSTANDARDITEMLISTVIEW_H diff --git a/src/kitemviews/kstandarditemlistwidget.cpp b/src/kitemviews/kstandarditemlistwidget.cpp index 3faf786c9..3939fd237 100644 --- a/src/kitemviews/kstandarditemlistwidget.cpp +++ b/src/kitemviews/kstandarditemlistwidget.cpp @@ -1,21 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2012 by Peter Penz <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2012 Peter Penz <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #include "kstandarditemlistwidget.h" diff --git a/src/kitemviews/kstandarditemlistwidget.h b/src/kitemviews/kstandarditemlistwidget.h index e7f2de2e0..d036aae66 100644 --- a/src/kitemviews/kstandarditemlistwidget.h +++ b/src/kitemviews/kstandarditemlistwidget.h @@ -1,21 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2012 by Peter Penz <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2012 Peter Penz <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #ifndef KSTANDARDITEMLISTWIDGET_H #define KSTANDARDITEMLISTWIDGET_H diff --git a/src/kitemviews/kstandarditemmodel.cpp b/src/kitemviews/kstandarditemmodel.cpp index c40050c7e..ceadff257 100644 --- a/src/kitemviews/kstandarditemmodel.cpp +++ b/src/kitemviews/kstandarditemmodel.cpp @@ -1,21 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2012 by Peter Penz <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2012 Peter Penz <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #include "kstandarditemmodel.h" diff --git a/src/kitemviews/kstandarditemmodel.h b/src/kitemviews/kstandarditemmodel.h index 8643d2e9e..d92ec5d46 100644 --- a/src/kitemviews/kstandarditemmodel.h +++ b/src/kitemviews/kstandarditemmodel.h @@ -1,21 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2012 by Peter Penz <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2012 Peter Penz <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #ifndef KSTANDARDITEMMODEL_H #define KSTANDARDITEMMODEL_H diff --git a/src/kitemviews/private/kbaloorolesprovider.cpp b/src/kitemviews/private/kbaloorolesprovider.cpp index 0f7100faa..d45b06777 100644 --- a/src/kitemviews/private/kbaloorolesprovider.cpp +++ b/src/kitemviews/private/kbaloorolesprovider.cpp @@ -1,22 +1,9 @@ -/*************************************************************************** - * Copyright (C) 2012 by Peter Penz <[email protected]> * - * Copyright (C) 2013 by Vishesh Handa <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2012 Peter Penz <[email protected]> + * SPDX-FileCopyrightText: 2013 Vishesh Handa <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #include "kbaloorolesprovider.h" diff --git a/src/kitemviews/private/kbaloorolesprovider.h b/src/kitemviews/private/kbaloorolesprovider.h index cd5131df8..99c601e16 100644 --- a/src/kitemviews/private/kbaloorolesprovider.h +++ b/src/kitemviews/private/kbaloorolesprovider.h @@ -1,22 +1,9 @@ -/*************************************************************************** - * Copyright (C) 2012 by Peter Penz <[email protected]> * - * Copyright (C) 2013 by Vishesh Handa <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2012 Peter Penz <[email protected]> + * SPDX-FileCopyrightText: 2013 Vishesh Handa <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #ifndef KBALOO_ROLESPROVIDER_H #define KBALOO_ROLESPROVIDER_H diff --git a/src/kitemviews/private/kdirectorycontentscounter.cpp b/src/kitemviews/private/kdirectorycontentscounter.cpp index 608f9f582..df45c4173 100644 --- a/src/kitemviews/private/kdirectorycontentscounter.cpp +++ b/src/kitemviews/private/kdirectorycontentscounter.cpp @@ -1,22 +1,9 @@ -/*************************************************************************** - * Copyright (C) 2011 by Peter Penz <[email protected]> * - * Copyright (C) 2013 by Frank Reininghaus <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2011 Peter Penz <[email protected]> + * SPDX-FileCopyrightText: 2013 Frank Reininghaus <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #include "kdirectorycontentscounter.h" #include "kitemviews/kfileitemmodel.h" diff --git a/src/kitemviews/private/kdirectorycontentscounter.h b/src/kitemviews/private/kdirectorycontentscounter.h index d5baf3462..cc8616ff7 100644 --- a/src/kitemviews/private/kdirectorycontentscounter.h +++ b/src/kitemviews/private/kdirectorycontentscounter.h @@ -1,22 +1,9 @@ -/*************************************************************************** - * Copyright (C) 2011 by Peter Penz <[email protected]> * - * Copyright (C) 2013 by Frank Reininghaus <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2011 Peter Penz <[email protected]> + * SPDX-FileCopyrightText: 2013 Frank Reininghaus <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #ifndef KDIRECTORYCONTENTSCOUNTER_H #define KDIRECTORYCONTENTSCOUNTER_H diff --git a/src/kitemviews/private/kdirectorycontentscounterworker.cpp b/src/kitemviews/private/kdirectorycontentscounterworker.cpp index 1e4a0b3b4..59ff471ae 100644 --- a/src/kitemviews/private/kdirectorycontentscounterworker.cpp +++ b/src/kitemviews/private/kdirectorycontentscounterworker.cpp @@ -1,22 +1,9 @@ -/*************************************************************************** - * Copyright (C) 2011 by Peter Penz <[email protected]> * - * Copyright (C) 2013 by Frank Reininghaus <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2011 Peter Penz <[email protected]> + * SPDX-FileCopyrightText: 2013 Frank Reininghaus <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #include "kdirectorycontentscounterworker.h" diff --git a/src/kitemviews/private/kdirectorycontentscounterworker.h b/src/kitemviews/private/kdirectorycontentscounterworker.h index fac9978d5..8e6359746 100644 --- a/src/kitemviews/private/kdirectorycontentscounterworker.h +++ b/src/kitemviews/private/kdirectorycontentscounterworker.h @@ -1,21 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2013 by Frank Reininghaus <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2013 Frank Reininghaus <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #ifndef KDIRECTORYCONTENTSCOUNTERWORKER_H #define KDIRECTORYCONTENTSCOUNTERWORKER_H diff --git a/src/kitemviews/private/kfileitemclipboard.cpp b/src/kitemviews/private/kfileitemclipboard.cpp index d6cc87e1d..e1deda3dd 100644 --- a/src/kitemviews/private/kfileitemclipboard.cpp +++ b/src/kitemviews/private/kfileitemclipboard.cpp @@ -1,21 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2011 by Peter Penz <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2011 Peter Penz <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #include "kfileitemclipboard.h" diff --git a/src/kitemviews/private/kfileitemclipboard.h b/src/kitemviews/private/kfileitemclipboard.h index 9a727ab9f..7495c32dd 100644 --- a/src/kitemviews/private/kfileitemclipboard.h +++ b/src/kitemviews/private/kfileitemclipboard.h @@ -1,21 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2011 by Peter Penz <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2011 Peter Penz <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #ifndef KFILEITEMCLIPBOARD_H #define KFILEITEMCLIPBOARD_H diff --git a/src/kitemviews/private/kfileitemmodeldirlister.cpp b/src/kitemviews/private/kfileitemmodeldirlister.cpp index c690e9fdf..accd200ef 100644 --- a/src/kitemviews/private/kfileitemmodeldirlister.cpp +++ b/src/kitemviews/private/kfileitemmodeldirlister.cpp @@ -1,21 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2006-2012 by Peter Penz <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2006-2012 Peter Penz <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #include "kfileitemmodeldirlister.h" diff --git a/src/kitemviews/private/kfileitemmodeldirlister.h b/src/kitemviews/private/kfileitemmodeldirlister.h index 72466d508..c44c136b0 100644 --- a/src/kitemviews/private/kfileitemmodeldirlister.h +++ b/src/kitemviews/private/kfileitemmodeldirlister.h @@ -1,21 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2006-2012 by Peter Penz <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2006-2012 Peter Penz <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #ifndef KFILEITEMMODELDIRLISTER_H #define KFILEITEMMODELDIRLISTER_H diff --git a/src/kitemviews/private/kfileitemmodelfilter.cpp b/src/kitemviews/private/kfileitemmodelfilter.cpp index bcd875132..bb695e266 100644 --- a/src/kitemviews/private/kfileitemmodelfilter.cpp +++ b/src/kitemviews/private/kfileitemmodelfilter.cpp @@ -1,22 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2011 by Janardhan Reddy * - * <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2011 Janardhan Reddy <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #include "kfileitemmodelfilter.h" diff --git a/src/kitemviews/private/kfileitemmodelfilter.h b/src/kitemviews/private/kfileitemmodelfilter.h index b56e0ad5b..f55a8097d 100644 --- a/src/kitemviews/private/kfileitemmodelfilter.h +++ b/src/kitemviews/private/kfileitemmodelfilter.h @@ -1,22 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2011 by Janardhan Reddy * - * <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2011 Janardhan Reddy <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #ifndef KFILEITEMMODELFILTER_H #define KFILEITEMMODELFILTER_H diff --git a/src/kitemviews/private/kfileitemmodelsortalgorithm.h b/src/kitemviews/private/kfileitemmodelsortalgorithm.h index ff484a7e8..4ee6095ca 100644 --- a/src/kitemviews/private/kfileitemmodelsortalgorithm.h +++ b/src/kitemviews/private/kfileitemmodelsortalgorithm.h @@ -1,23 +1,10 @@ -/***************************************************************************** - * Copyright (C) 2012 by Peter Penz <[email protected]> * - * Copyright (C) 2012 by Emmanuel Pescosta <[email protected]> * - * Copyright (C) 2013 by Frank Reininghaus <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - *****************************************************************************/ +/* + * SPDX-FileCopyrightText: 2012 Peter Penz <[email protected]> + * SPDX-FileCopyrightText: 2012 Emmanuel Pescosta <[email protected]> + * SPDX-FileCopyrightText: 2013 Frank Reininghaus <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #ifndef KFILEITEMMODELSORTALGORITHM_H #define KFILEITEMMODELSORTALGORITHM_H @@ -31,7 +18,7 @@ * worst-case of O(n * log(n)) and to keep the number of comparisons low. * * The implementation is based on qStableSortHelper() from qalgorithms.h - * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). + * SPDX-FileCopyrightText: 2011 Nokia Corporation and/or its subsidiary(-ies). */ template <typename RandomAccessIterator, typename LessThan> @@ -40,7 +27,7 @@ static void mergeSort(RandomAccessIterator begin, const LessThan& lessThan) { // The implementation is based on qStableSortHelper() from qalgorithms.h - // Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). + // SPDX-FileCopyrightText: 2011 Nokia Corporation and/or its subsidiary(-ies). const int span = end - begin; if (span < 2) { @@ -92,7 +79,7 @@ static void parallelMergeSort(RandomAccessIterator begin, * \a begin and \a end. * * The implementation is based on qMerge() from qalgorithms.h - * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). + * SPDX-FileCopyrightText: 2011 Nokia Corporation and/or its subsidiary(-ies). */ template <typename RandomAccessIterator, typename LessThan> @@ -102,7 +89,7 @@ static void merge(RandomAccessIterator begin, const LessThan& lessThan) { // The implementation is based on qMerge() from qalgorithms.h - // Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). + // SPDX-FileCopyrightText: 2011 Nokia Corporation and/or its subsidiary(-ies). const int len1 = pivot - begin; const int len2 = end - pivot; diff --git a/src/kitemviews/private/kitemlistheaderwidget.cpp b/src/kitemviews/private/kitemlistheaderwidget.cpp index 9263a7de2..c28231e1c 100644 --- a/src/kitemviews/private/kitemlistheaderwidget.cpp +++ b/src/kitemviews/private/kitemlistheaderwidget.cpp @@ -1,21 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2011 by Peter Penz <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2011 Peter Penz <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #include "kitemlistheaderwidget.h" #include "kitemviews/kitemmodelbase.h" @@ -396,7 +383,7 @@ void KItemListHeaderWidget::paintRole(QPainter* painter, QWidget* widget) const { // The following code is based on the code from QHeaderView::paintSection(). - // Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). + // SPDX-FileCopyrightText: 2011 Nokia Corporation and/or its subsidiary(-ies). QStyleOptionHeader option; option.section = orderIndex; option.state = QStyle::State_None | QStyle::State_Raised | QStyle::State_Horizontal; diff --git a/src/kitemviews/private/kitemlistheaderwidget.h b/src/kitemviews/private/kitemlistheaderwidget.h index 350588f00..ca85f2139 100644 --- a/src/kitemviews/private/kitemlistheaderwidget.h +++ b/src/kitemviews/private/kitemlistheaderwidget.h @@ -1,21 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2011 by Peter Penz <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2011 Peter Penz <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #ifndef KITEMLISTHEADERWIDGET_H #define KITEMLISTHEADERWIDGET_H diff --git a/src/kitemviews/private/kitemlistkeyboardsearchmanager.cpp b/src/kitemviews/private/kitemlistkeyboardsearchmanager.cpp index 1fa6f7a7b..97e2b0b32 100644 --- a/src/kitemviews/private/kitemlistkeyboardsearchmanager.cpp +++ b/src/kitemviews/private/kitemlistkeyboardsearchmanager.cpp @@ -1,23 +1,10 @@ -/*************************************************************************** - * Copyright (C) 2011 by Tirtha Chatterjee <[email protected]> * - * * - * Based on the Itemviews NG project from Trolltech Labs * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2011 Tirtha Chatterjee <[email protected]> + * + * Based on the Itemviews NG project from Trolltech Labs + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #include "kitemlistkeyboardsearchmanager.h" diff --git a/src/kitemviews/private/kitemlistkeyboardsearchmanager.h b/src/kitemviews/private/kitemlistkeyboardsearchmanager.h index d0161f927..27c9a203f 100644 --- a/src/kitemviews/private/kitemlistkeyboardsearchmanager.h +++ b/src/kitemviews/private/kitemlistkeyboardsearchmanager.h @@ -1,23 +1,10 @@ -/*************************************************************************** - * Copyright (C) 2011 by Tirtha Chatterjee <[email protected]> * - * * - * Based on the Itemviews NG project from Trolltech Labs * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2011 Tirtha Chatterjee <[email protected]> + * + * Based on the Itemviews NG project from Trolltech Labs + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #ifndef KITEMLISTKEYBOARDSEARCHMANAGER_H #define KITEMLISTKEYBOARDSEARCHMANAGER_H diff --git a/src/kitemviews/private/kitemlistroleeditor.cpp b/src/kitemviews/private/kitemlistroleeditor.cpp index eb6f1de76..75fd6a0c7 100644 --- a/src/kitemviews/private/kitemlistroleeditor.cpp +++ b/src/kitemviews/private/kitemlistroleeditor.cpp @@ -1,21 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2012 by Peter Penz <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2012 Peter Penz <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #include "kitemlistroleeditor.h" diff --git a/src/kitemviews/private/kitemlistroleeditor.h b/src/kitemviews/private/kitemlistroleeditor.h index 7285d62f7..a63680624 100644 --- a/src/kitemviews/private/kitemlistroleeditor.h +++ b/src/kitemviews/private/kitemlistroleeditor.h @@ -1,21 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2012 by Peter Penz <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2012 Peter Penz <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #ifndef KITEMLISTROLEEDITOR_H #define KITEMLISTROLEEDITOR_H diff --git a/src/kitemviews/private/kitemlistrubberband.cpp b/src/kitemviews/private/kitemlistrubberband.cpp index 702873126..309a82833 100644 --- a/src/kitemviews/private/kitemlistrubberband.cpp +++ b/src/kitemviews/private/kitemlistrubberband.cpp @@ -1,21 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2011 by Peter Penz <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2011 Peter Penz <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #include "kitemlistrubberband.h" diff --git a/src/kitemviews/private/kitemlistrubberband.h b/src/kitemviews/private/kitemlistrubberband.h index 7d24857a9..7886b1e84 100644 --- a/src/kitemviews/private/kitemlistrubberband.h +++ b/src/kitemviews/private/kitemlistrubberband.h @@ -1,21 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2011 by Peter Penz <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2011 Peter Penz <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #ifndef KITEMLISTRUBBERBAND_H #define KITEMLISTRUBBERBAND_H @@ -31,6 +18,7 @@ class DOLPHIN_EXPORT KItemListRubberBand : public QObject { Q_OBJECT + Q_PROPERTY(QPointF endPosition MEMBER m_endPos READ endPosition WRITE setEndPosition) public: explicit KItemListRubberBand(QObject* parent = nullptr); diff --git a/src/kitemviews/private/kitemlistselectiontoggle.cpp b/src/kitemviews/private/kitemlistselectiontoggle.cpp index 48c6854aa..2905e2925 100644 --- a/src/kitemviews/private/kitemlistselectiontoggle.cpp +++ b/src/kitemviews/private/kitemlistselectiontoggle.cpp @@ -1,21 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2011 by Peter Penz <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2011 Peter Penz <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #include "kitemlistselectiontoggle.h" diff --git a/src/kitemviews/private/kitemlistselectiontoggle.h b/src/kitemviews/private/kitemlistselectiontoggle.h index a537a9904..0a592653e 100644 --- a/src/kitemviews/private/kitemlistselectiontoggle.h +++ b/src/kitemviews/private/kitemlistselectiontoggle.h @@ -1,22 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2011 by Peter Penz <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ - +/* + * SPDX-FileCopyrightText: 2011 Peter Penz <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #ifndef KITEMLISTSELECTIONTOGGLE_H #define KITEMLISTSELECTIONTOGGLE_H diff --git a/src/kitemviews/private/kitemlistsizehintresolver.cpp b/src/kitemviews/private/kitemlistsizehintresolver.cpp index 66784f191..7021c5296 100644 --- a/src/kitemviews/private/kitemlistsizehintresolver.cpp +++ b/src/kitemviews/private/kitemlistsizehintresolver.cpp @@ -1,21 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2011 by Peter Penz <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2011 Peter Penz <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #include "kitemlistsizehintresolver.h" #include "kitemviews/kitemlistview.h" diff --git a/src/kitemviews/private/kitemlistsizehintresolver.h b/src/kitemviews/private/kitemlistsizehintresolver.h index 96a9dd1bc..7878c8c63 100644 --- a/src/kitemviews/private/kitemlistsizehintresolver.h +++ b/src/kitemviews/private/kitemlistsizehintresolver.h @@ -1,21 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2011 by Peter Penz <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2011 Peter Penz <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #ifndef KITEMLISTSIZEHINTRESOLVER_H #define KITEMLISTSIZEHINTRESOLVER_H diff --git a/src/kitemviews/private/kitemlistsmoothscroller.cpp b/src/kitemviews/private/kitemlistsmoothscroller.cpp index cdb7f255b..6b475b5f0 100644 --- a/src/kitemviews/private/kitemlistsmoothscroller.cpp +++ b/src/kitemviews/private/kitemlistsmoothscroller.cpp @@ -1,21 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2011 by Peter Penz <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2011 Peter Penz <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #include "kitemlistsmoothscroller.h" diff --git a/src/kitemviews/private/kitemlistsmoothscroller.h b/src/kitemviews/private/kitemlistsmoothscroller.h index a5aca82e6..c0e02491e 100644 --- a/src/kitemviews/private/kitemlistsmoothscroller.h +++ b/src/kitemviews/private/kitemlistsmoothscroller.h @@ -1,21 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2011 by Peter Penz <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2011 Peter Penz <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #ifndef KITEMLISTSMOOTHSCROLLER_H #define KITEMLISTSMOOTHSCROLLER_H diff --git a/src/kitemviews/private/kitemlistviewanimation.cpp b/src/kitemviews/private/kitemlistviewanimation.cpp index ccc387529..67b9cc113 100644 --- a/src/kitemviews/private/kitemlistviewanimation.cpp +++ b/src/kitemviews/private/kitemlistviewanimation.cpp @@ -1,21 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2011 by Peter Penz <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2011 Peter Penz <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #include "kitemlistviewanimation.h" #include "kitemviews/kitemlistview.h" diff --git a/src/kitemviews/private/kitemlistviewanimation.h b/src/kitemviews/private/kitemlistviewanimation.h index f73ea7fb7..3f6772b8b 100644 --- a/src/kitemviews/private/kitemlistviewanimation.h +++ b/src/kitemviews/private/kitemlistviewanimation.h @@ -1,21 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2011 by Peter Penz <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2011 Peter Penz <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #ifndef KITEMLISTVIEWANIMATION_H #define KITEMLISTVIEWANIMATION_H diff --git a/src/kitemviews/private/kitemlistviewlayouter.cpp b/src/kitemviews/private/kitemlistviewlayouter.cpp index 56e0f338f..6de83ca87 100644 --- a/src/kitemviews/private/kitemlistviewlayouter.cpp +++ b/src/kitemviews/private/kitemlistviewlayouter.cpp @@ -1,21 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2011 by Peter Penz <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2011 Peter Penz <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #include "kitemlistviewlayouter.h" #include "dolphindebug.h" diff --git a/src/kitemviews/private/kitemlistviewlayouter.h b/src/kitemviews/private/kitemlistviewlayouter.h index 6cdce666f..d5dc6dae1 100644 --- a/src/kitemviews/private/kitemlistviewlayouter.h +++ b/src/kitemviews/private/kitemlistviewlayouter.h @@ -1,21 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2011 by Peter Penz <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2011 Peter Penz <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #ifndef KITEMLISTVIEWLAYOUTER_H #define KITEMLISTVIEWLAYOUTER_H diff --git a/src/kitemviews/private/kpixmapmodifier.cpp b/src/kitemviews/private/kpixmapmodifier.cpp index 402fccfde..5bcb3b8f5 100644 --- a/src/kitemviews/private/kpixmapmodifier.cpp +++ b/src/kitemviews/private/kpixmapmodifier.cpp @@ -2,34 +2,15 @@ /* This file is a part of the KDE project - Copyright © 2006 Zack Rusin <[email protected]> - Copyright © 2006-2007, 2008 Fredrik Höglund <[email protected]> + SPDX-FileCopyrightText: 2006 Zack Rusin <[email protected]> + SPDX-FileCopyrightText: 2006-2007, 2008 Fredrik Höglund <[email protected]> The stack blur algorithm was invented by Mario Klingemann <[email protected]> This implementation is based on the version in Anti-Grain Geometry Version 2.4, - Copyright © 2002-2005 Maxim Shemanarev (http://www.antigrain.com) + SPDX-FileCopyrightText: 2002-2005 Maxim Shemanarev (http://www.antigrain.com) - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: - - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - - THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + SPDX-License-Identifier: BSD-2-Clause */ #include "kpixmapmodifier.h" diff --git a/src/kitemviews/private/kpixmapmodifier.h b/src/kitemviews/private/kpixmapmodifier.h index 3f7747b55..d8d7f2394 100644 --- a/src/kitemviews/private/kpixmapmodifier.h +++ b/src/kitemviews/private/kpixmapmodifier.h @@ -1,21 +1,8 @@ -/*************************************************************************** - * Copyright (C) 2011 by Peter Penz <[email protected]> * - * * - * This program is free software; you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation; either version 2 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program; if not, write to the * - * Free Software Foundation, Inc., * - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - ***************************************************************************/ +/* + * SPDX-FileCopyrightText: 2011 Peter Penz <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ #ifndef KPIXMAPMODIFIER_H #define KPIXMAPMODIFIER_H diff --git a/src/kitemviews/private/ktwofingerswipe.cpp b/src/kitemviews/private/ktwofingerswipe.cpp new file mode 100644 index 000000000..6d0e18e65 --- /dev/null +++ b/src/kitemviews/private/ktwofingerswipe.cpp @@ -0,0 +1,139 @@ +/* + * SPDX-FileCopyrightText: 2020 Steffen Hartleib <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +// Self +#include "ktwofingerswipe.h" + +// Qt +#include <QTouchEvent> +#include <QLineF> + +KTwoFingerSwipeRecognizer::KTwoFingerSwipeRecognizer() : + QGestureRecognizer(), + m_touchBeginnTimestamp(0), + m_gestureAlreadyTriggered(false) +{ +} + +KTwoFingerSwipeRecognizer::~KTwoFingerSwipeRecognizer() +{ +} + +QGesture* KTwoFingerSwipeRecognizer::create(QObject*) +{ + return static_cast<QGesture*>(new KTwoFingerSwipe()); +} + +QGestureRecognizer::Result KTwoFingerSwipeRecognizer::recognize(QGesture* gesture, QObject* watched, QEvent* event) +{ + Q_UNUSED(watched) + + KTwoFingerSwipe* const kTwoFingerSwipe = static_cast<KTwoFingerSwipe*>(gesture); + const QTouchEvent* touchEvent = static_cast<const QTouchEvent*>(event); + + const int maxTimeFrameForSwipe = 90; + const int minDistanceForSwipe = 30; + + switch (event->type()) { + case QEvent::TouchBegin: { + m_touchBeginnTimestamp = touchEvent->timestamp(); + m_gestureAlreadyTriggered = false; + kTwoFingerSwipe->setHotSpot(touchEvent->touchPoints().first().startScreenPos()); + kTwoFingerSwipe->setPos(touchEvent->touchPoints().first().startPos()); + kTwoFingerSwipe->setScreenPos(touchEvent->touchPoints().first().startScreenPos()); + kTwoFingerSwipe->setScenePos(touchEvent->touchPoints().first().startScenePos()); + return MayBeGesture; + } + + case QEvent::TouchUpdate: { + const qint64 now = touchEvent->timestamp(); + const qint64 elapsedTime = now - m_touchBeginnTimestamp; + const QPointF distance = touchEvent->touchPoints().first().startPos() - touchEvent->touchPoints().first().pos(); + kTwoFingerSwipe->setHotSpot(touchEvent->touchPoints().first().startScreenPos()); + kTwoFingerSwipe->setPos(touchEvent->touchPoints().first().startPos()); + kTwoFingerSwipe->setScreenPos(touchEvent->touchPoints().first().startScreenPos()); + kTwoFingerSwipe->setScenePos(touchEvent->touchPoints().first().startScenePos()); + const QLineF ql = QLineF(touchEvent->touchPoints().first().startPos(), touchEvent->touchPoints().first().pos()); + kTwoFingerSwipe->setSwipeAngle(ql.angle()); + + if (touchEvent->touchPoints().size() > 2) { + return CancelGesture; + } + + if (touchEvent->touchPoints().size() == 2) { + if ((elapsedTime) > maxTimeFrameForSwipe) { + return CancelGesture; + } + + if (distance.manhattanLength() >= minDistanceForSwipe && + (elapsedTime) <= maxTimeFrameForSwipe && !m_gestureAlreadyTriggered) { + m_gestureAlreadyTriggered = true; + return FinishGesture; + } else if ((elapsedTime) <= maxTimeFrameForSwipe && !m_gestureAlreadyTriggered) { + return TriggerGesture; + } + } + break; + } + + default: + return Ignore; + } + return Ignore; +} + +KTwoFingerSwipe::KTwoFingerSwipe(QObject* parent) : + QGesture(parent), + m_pos(QPointF(-1, -1)), + m_screenPos(QPointF(-1, -1)), + m_scenePos(QPointF(-1, -1)), + m_swipeAngle(0.0) +{ +} + +KTwoFingerSwipe::~KTwoFingerSwipe() +{ +} + +QPointF KTwoFingerSwipe::pos() const +{ + return m_pos; +} + +void KTwoFingerSwipe::setPos(QPointF _pos) +{ + m_pos = _pos; +} + +QPointF KTwoFingerSwipe::screenPos() const +{ + return m_screenPos; +} + +void KTwoFingerSwipe::setScreenPos(QPointF _screenPos) +{ + m_screenPos = _screenPos; +} + +QPointF KTwoFingerSwipe::scenePos() const +{ + return m_scenePos; +} + +void KTwoFingerSwipe::setScenePos(QPointF _scenePos) +{ + m_scenePos = _scenePos; +} + +qreal KTwoFingerSwipe::swipeAngle() const +{ + return m_swipeAngle; +} + void KTwoFingerSwipe::setSwipeAngle(qreal _swipeAngle) +{ + m_swipeAngle = _swipeAngle; +} + diff --git a/src/kitemviews/private/ktwofingerswipe.h b/src/kitemviews/private/ktwofingerswipe.h new file mode 100644 index 000000000..27d9d75d9 --- /dev/null +++ b/src/kitemviews/private/ktwofingerswipe.h @@ -0,0 +1,54 @@ +/* + * SPDX-FileCopyrightText: 2020 Steffen Hartleib <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef KTWOFINGERSWIPE_H +#define KTWOFINGERSWIPE_H + +#include "dolphin_export.h" +// Qt +#include <QGesture> +#include <QGestureRecognizer> + +class DOLPHIN_EXPORT KTwoFingerSwipe : public QGesture +{ + Q_OBJECT + Q_PROPERTY(QPointF pos READ pos WRITE setPos) + Q_PROPERTY(QPointF screenPos READ screenPos WRITE setScreenPos) + Q_PROPERTY(QPointF scenePos READ scenePos WRITE setScenePos) + Q_PROPERTY(qreal swipeAngle READ swipeAngle WRITE setSwipeAngle) +public: + explicit KTwoFingerSwipe(QObject* parent = nullptr); + ~KTwoFingerSwipe(); + QPointF pos() const; + void setPos(QPointF pos); + QPointF screenPos() const; + void setScreenPos(QPointF screenPos); + QPointF scenePos() const; + void setScenePos(QPointF scenePos); + qreal swipeAngle() const; + void setSwipeAngle(qreal swipeAngle); +private: + QPointF m_pos; + QPointF m_screenPos; + QPointF m_scenePos; + qreal m_swipeAngle; +}; + +class DOLPHIN_EXPORT KTwoFingerSwipeRecognizer : public QGestureRecognizer +{ +public: + explicit KTwoFingerSwipeRecognizer(); + ~KTwoFingerSwipeRecognizer(); + QGesture* create(QObject*) override; + Result recognize(QGesture*, QObject*, QEvent*) override; +private: + Q_DISABLE_COPY( KTwoFingerSwipeRecognizer ) + qint64 m_touchBeginnTimestamp; + bool m_gestureAlreadyTriggered; +}; + +#endif /* KTWOFINGERSWIPE_H */ + diff --git a/src/kitemviews/private/ktwofingertap.cpp b/src/kitemviews/private/ktwofingertap.cpp new file mode 100644 index 000000000..edd9d1d35 --- /dev/null +++ b/src/kitemviews/private/ktwofingertap.cpp @@ -0,0 +1,122 @@ +/* + * SPDX-FileCopyrightText: 2020 Steffen Hartleib <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +// Self +#include "ktwofingertap.h" + +// Qt +#include <QTouchEvent> +#include <QApplication> +#include <QGraphicsWidget> + +KTwoFingerTapRecognizer::KTwoFingerTapRecognizer() : + QGestureRecognizer(), + m_gestureTriggered(false) +{ +} + +KTwoFingerTapRecognizer::~KTwoFingerTapRecognizer() +{ +} + +QGesture* KTwoFingerTapRecognizer::create(QObject*) +{ + return static_cast<QGesture*>(new KTwoFingerTap()); +} + +QGestureRecognizer::Result KTwoFingerTapRecognizer::recognize(QGesture* gesture, QObject* watched, QEvent* event) +{ + if (qobject_cast<QGraphicsWidget*>(watched)) { + return Ignore; + } + + KTwoFingerTap* const kTwoFingerTap = static_cast<KTwoFingerTap*>(gesture); + const QTouchEvent* touchEvent = static_cast<const QTouchEvent*>(event); + + switch (event->type()) { + case QEvent::TouchBegin: { + kTwoFingerTap->setHotSpot(touchEvent->touchPoints().first().startScreenPos()); + kTwoFingerTap->setPos(touchEvent->touchPoints().first().startPos()); + kTwoFingerTap->setScreenPos(touchEvent->touchPoints().first().startScreenPos()); + kTwoFingerTap->setScenePos(touchEvent->touchPoints().first().startScenePos()); + m_gestureTriggered = false; + return MayBeGesture; + } + + case QEvent::TouchUpdate: { + + if (touchEvent->touchPoints().size() > 2) { + m_gestureTriggered = false; + return CancelGesture; + } + + if (touchEvent->touchPoints().size() == 2) { + if ((touchEvent->touchPoints().first().startPos() - touchEvent->touchPoints().first().pos()).manhattanLength() >= QApplication::startDragDistance()) { + m_gestureTriggered = false; + return CancelGesture; + } + if ((touchEvent->touchPoints().at(1).startPos() - touchEvent->touchPoints().at(1).pos()).manhattanLength() >= QApplication::startDragDistance()) { + m_gestureTriggered = false; + return CancelGesture; + } + if (touchEvent->touchPointStates() & Qt::TouchPointPressed) { + m_gestureTriggered = true; + } + if (touchEvent->touchPointStates() & Qt::TouchPointReleased && m_gestureTriggered) { + m_gestureTriggered = false; + return FinishGesture; + } + } + break; + } + + default: + return Ignore; + } + return Ignore; +} + +KTwoFingerTap::KTwoFingerTap(QObject* parent) : + QGesture(parent), + m_pos(QPointF(-1, -1)), + m_screenPos(QPointF(-1, -1)), + m_scenePos(QPointF(-1, -1)) +{ +} + +KTwoFingerTap::~KTwoFingerTap() +{ +} + +QPointF KTwoFingerTap::pos() const +{ + return m_pos; +} + +void KTwoFingerTap::setPos(QPointF _pos) +{ + m_pos = _pos; +} + +QPointF KTwoFingerTap::screenPos() const +{ + return m_screenPos; +} + +void KTwoFingerTap::setScreenPos(QPointF _screenPos) +{ + m_screenPos = _screenPos; +} + +QPointF KTwoFingerTap::scenePos() const +{ + return m_scenePos; +} + +void KTwoFingerTap::setScenePos(QPointF _scenePos) +{ + m_scenePos = _scenePos; +} diff --git a/src/kitemviews/private/ktwofingertap.h b/src/kitemviews/private/ktwofingertap.h new file mode 100644 index 000000000..614df2424 --- /dev/null +++ b/src/kitemviews/private/ktwofingertap.h @@ -0,0 +1,48 @@ +/* + * SPDX-FileCopyrightText: 2020 Steffen Hartleib <[email protected]> + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#ifndef KTWOFINGERTAP_H +#define KTWOFINGERTAP_H + +#include <dolphin_export.h> +// Qt +#include <QGesture> +#include <QGestureRecognizer> + +class DOLPHIN_EXPORT KTwoFingerTap : public QGesture +{ + Q_OBJECT + Q_PROPERTY(QPointF pos READ pos WRITE setPos) + Q_PROPERTY(QPointF screenPos READ screenPos WRITE setScreenPos) + Q_PROPERTY(QPointF scenePos READ scenePos WRITE setScenePos) +public: + explicit KTwoFingerTap(QObject* parent = nullptr); + ~KTwoFingerTap(); + QPointF pos() const; + void setPos(QPointF pos); + QPointF screenPos() const; + void setScreenPos(QPointF screenPos); + QPointF scenePos() const; + void setScenePos(QPointF scenePos); +private: + QPointF m_pos; + QPointF m_screenPos; + QPointF m_scenePos; +}; + +class DOLPHIN_EXPORT KTwoFingerTapRecognizer : public QGestureRecognizer +{ +public: + explicit KTwoFingerTapRecognizer(); + ~KTwoFingerTapRecognizer(); + QGesture* create(QObject*) override; + Result recognize(QGesture*, QObject*, QEvent*) override; +private: + Q_DISABLE_COPY(KTwoFingerTapRecognizer) + bool m_gestureTriggered; +}; + +#endif /* KTWOFINGERTAP_H */ |
