Skip to content

Commit

Permalink
feat: fullscreen mode icon move/displace animation
Browse files Browse the repository at this point in the history
支持全屏启动器图标拖拽释放后的图标移动动画,并为后续移动过程中提供
动画支持进行准备。

Log:
  • Loading branch information
BLumia committed Jul 25, 2024
1 parent 7bed30b commit bed5528
Show file tree
Hide file tree
Showing 9 changed files with 744 additions and 7 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ cmake_minimum_required(VERSION 3.10)
project(dde-launchpad VERSION 0.7.0)

option(BUILD_TEST "Whether or not to build the tests" OFF)
option(CMAKE_EXPORT_COMPILE_COMMANDS "clangd support" ON)

set(CMAKE_CXX_STANDARD 17) # blurhash requires 17, otherwish we can still use 14
set(CMAKE_AUTOMOC ON)
Expand Down
9 changes: 9 additions & 0 deletions LICENSES/MIT.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
MIT License

Copyright (c) <year> <copyright holders>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1 change: 1 addition & 0 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Build-Depends:
# v-- to get systemduserunitdir from its pkg-config data
systemd,
qt6-base-dev,
qt6-base-private-dev,
qt6-svg-dev,
qt6-declarative-dev,
qt6-tools-dev,
Expand Down
28 changes: 21 additions & 7 deletions qml/FullscreenFrame.qml
Original file line number Diff line number Diff line change
Expand Up @@ -317,11 +317,18 @@ InputEventItem {

property var grids: gridViewContainer

MultipageSortFilterProxyModel {
SortProxyModel {
id: proxyModel
sourceModel: ItemArrangementProxyModel
pageId: modelData
folderId: 0
sourceModel: MultipageSortFilterProxyModel {
filterOnlyMode: true
sourceModel: ItemArrangementProxyModel
pageId: modelData
folderId: 0
}
sortRole: ItemArrangementProxyModel.IndexInPageRole
Component.onCompleted: {
proxyModel.sort(0)
}
}

MouseArea {
Expand Down Expand Up @@ -383,7 +390,13 @@ InputEventItem {
NumberAnimation { duration: 200; easing.type: Easing.OutQuad }
}
activeGridViewFocusOnTab: gridViewLoader.SwipeView.isCurrentItem
itemMove: Transition { NumberAnimation { properties: "x,y"; duration: 250 } }
itemMove: Transition {
NumberAnimation {
properties: "x,y"
duration: 200
easing.type: Easing.OutQuad
}
}
delegate: DropArea {
Keys.forwardTo: [iconItemDelegate]

Expand All @@ -405,6 +418,7 @@ InputEventItem {
op = 1
}
dropOnItem(dragId, model.desktopId, op)
proxyModel.sort(0)
}

IconItemDelegate {
Expand All @@ -428,8 +442,8 @@ InputEventItem {
let idNum = Number(idStr.replace("internal/folders/", ""))
let itemPos = mapToItem(baseLayer, x, y)
folderGridViewPopup.currentFolderId = idNum
folderGridViewPopup.startPointX = itemPos.x
folderGridViewPopup.startPointY = itemPos.y
folderGridViewPopup.startPointX = itemPos.x + width / 2
folderGridViewPopup.startPointY = itemPos.y + height / 2
folderGridViewPopup.open()
folderGridViewPopup.folderName = model.display.startsWith("internal/category/") ? getCategoryName(model.display.substring(18)) : model.display
console.log("open folder id:" + idNum)
Expand Down
5 changes: 5 additions & 0 deletions src/models/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#
# SPDX-License-Identifier: CC0-1.0

find_package(Qt6Core CONFIG REQUIRED Private)

qt_add_qml_module(
launcher-models
URI org.deepin.launchpad.models
Expand All @@ -14,6 +16,7 @@ target_sources(launcher-models PUBLIC
FILE_SET HEADERS
FILES
appsmodel.h
sortproxymodel.h
searchfilterproxymodel.h
categorizedsortproxymodel.h
favoritedproxymodel.h
Expand All @@ -29,6 +32,7 @@ target_sources(launcher-models
PRIVATE
appsmodel.cpp
appitem.cpp appitem.h
sortproxymodel.cpp
searchfilterproxymodel.cpp
categorizedsortproxymodel.cpp
favoritedproxymodel.cpp
Expand All @@ -44,6 +48,7 @@ PRIVATE
target_link_libraries(launcher-models PRIVATE
Qt::Core
Qt::Gui
Qt::CorePrivate
${DTK_NS}::Core

gio-utils
Expand Down
5 changes: 5 additions & 0 deletions src/models/multipagesortfilterproxymodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

MultipageSortFilterProxyModel::MultipageSortFilterProxyModel(QObject *parent)
: QSortFilterProxyModel(parent)
, m_filterOnlyMode(false)
{
setSortRole(ItemArrangementProxyModel::FolderIdNumberRole);
setDynamicSortFilter(true);
Expand Down Expand Up @@ -45,6 +46,10 @@ bool MultipageSortFilterProxyModel::filterAcceptsRow(int source_row, const QMode

bool MultipageSortFilterProxyModel::lessThan(const QModelIndex &source_left, const QModelIndex &source_right) const
{
if (m_filterOnlyMode) {
return QSortFilterProxyModel::lessThan(source_left, source_right);
}

if (source_left.data(ItemArrangementProxyModel::FolderIdNumberRole).toInt() < source_right.data(ItemArrangementProxyModel::FolderIdNumberRole).toInt()) {
return true;
} else if (source_left.data(ItemArrangementProxyModel::PageRole).toInt() < source_right.data(ItemArrangementProxyModel::PageRole).toInt()) {
Expand Down
3 changes: 3 additions & 0 deletions src/models/multipagesortfilterproxymodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class MultipageSortFilterProxyModel : public QSortFilterProxyModel
Q_PROPERTY(QAbstractItemModel *sourceModel READ sourceModel WRITE setModel NOTIFY sourceModelChanged)
Q_PROPERTY(int folderId MEMBER m_folderId NOTIFY onFolderIdChanged)
Q_PROPERTY(int pageId MEMBER m_pageId NOTIFY onPageIdChanged)
Q_PROPERTY(bool filterOnlyMode MEMBER m_filterOnlyMode NOTIFY onFilterOnlyModeChanged)
QML_NAMED_ELEMENT(MultipageSortFilterProxyModel)

public:
Expand All @@ -30,8 +31,10 @@ class MultipageSortFilterProxyModel : public QSortFilterProxyModel
void onFolderIdChanged(int);
void onPageIdChanged(int);
void sourceModelChanged(QObject *);
void onFilterOnlyModeChanged(bool);

private:
int m_folderId;
int m_pageId;
bool m_filterOnlyMode;
};
Loading

0 comments on commit bed5528

Please sign in to comment.