From 3322e1bd0962011e32291d3cecb0b9b374f3457e Mon Sep 17 00:00:00 2001 From: rekols Date: Wed, 2 Jun 2021 13:25:04 +0800 Subject: [PATCH] Adjust desktop border & add animation --- desktop/desktopview.cpp | 13 ++++++++----- model/foldermodel.cpp | 4 ++-- qml/Desktop/main.qml | 26 +++++++++++++++++++++----- qml/FolderGridView.qml | 5 ++--- qml/FolderListView.qml | 5 ++--- qml/OptionsMenu.qml | 2 +- 6 files changed, 36 insertions(+), 19 deletions(-) diff --git a/desktop/desktopview.cpp b/desktop/desktopview.cpp index 9108df2..5743949 100644 --- a/desktop/desktopview.cpp +++ b/desktop/desktopview.cpp @@ -33,7 +33,7 @@ DesktopView::DesktopView(QQuickView *parent) : QQuickView(parent) { m_screenRect = qApp->primaryScreen()->geometry(); - m_screenAvailableRect = qApp->primaryScreen()->availableGeometry(); + m_screenAvailableRect = qApp->primaryScreen()->availableVirtualGeometry(); KWindowSystem::setType(winId(), NET::Desktop); KWindowSystem::setState(winId(), NET::KeepBelow); @@ -48,9 +48,10 @@ DesktopView::DesktopView(QQuickView *parent) onGeometryChanged(); - connect(qApp->primaryScreen(), &QScreen::virtualGeometryChanged, this, &DesktopView::onGeometryChanged, Qt::QueuedConnection); - connect(qApp->primaryScreen(), &QScreen::geometryChanged, this, &DesktopView::onGeometryChanged, Qt::QueuedConnection); - connect(qApp->primaryScreen(), &QScreen::availableGeometryChanged, this, &DesktopView::onAvailableGeometryChanged, Qt::QueuedConnection); + connect(qApp->primaryScreen(), &QScreen::virtualGeometryChanged, this, &DesktopView::onGeometryChanged); + connect(qApp->primaryScreen(), &QScreen::geometryChanged, this, &DesktopView::onGeometryChanged); + connect(qApp->primaryScreen(), &QScreen::availableGeometryChanged, this, &DesktopView::onAvailableGeometryChanged); + connect(qApp->primaryScreen(), &QScreen::virtualGeometryChanged, this, &DesktopView::onAvailableGeometryChanged); } QRect DesktopView::screenRect() @@ -72,6 +73,8 @@ void DesktopView::onGeometryChanged() void DesktopView::onAvailableGeometryChanged(const QRect &geometry) { - m_screenAvailableRect = geometry; + Q_UNUSED(geometry); + + m_screenAvailableRect = qApp->primaryScreen()->availableVirtualGeometry(); emit screenAvailableGeometryChanged(); } diff --git a/model/foldermodel.cpp b/model/foldermodel.cpp index 533025d..1801f24 100644 --- a/model/foldermodel.cpp +++ b/model/foldermodel.cpp @@ -998,8 +998,8 @@ void FolderModel::dragSelectedInternal(int x, int y) bool FolderModel::isSupportThumbnails(const QString &mimeType) const { const QStringList supportsMimetypes = {"image/bmp", "image/png", "image/gif", "image/jpeg", "image/web", - "application/pdf", "application/rtf", "application/doc", "application/odf", - "audio/mpeg", "video/mp4"}; + /*"application/pdf", "application/rtf", "application/doc", "application/odf", + "audio/mpeg", "video/mp4"*/}; if (supportsMimetypes.contains(mimeType)) return true; diff --git a/qml/Desktop/main.qml b/qml/Desktop/main.qml index 2d3ffcd..4461b8f 100644 --- a/qml/Desktop/main.qml +++ b/qml/Desktop/main.qml @@ -110,19 +110,35 @@ Item { ScrollBar.vertical.policy: ScrollBar.AlwaysOff - onIconSizeChanged: { - globalSettings.desktopIconSize = _folderView.iconSize - } + // Handle for topbar + anchors.topMargin: desktopView.screenAvailableRect.y - leftMargin: desktopView.screenAvailableRect ? desktopView.screenAvailableRect.x : 0 - topMargin: desktopView.screenAvailableRect ? desktopView.screenAvailableRect.y : 0 + leftMargin: desktopView.screenAvailableRect.x + topMargin: 0 rightMargin: desktopView.screenRect.width - (desktopView.screenAvailableRect.x + desktopView.screenAvailableRect.width) bottomMargin: desktopView.screenRect.height - (desktopView.screenAvailableRect.y + desktopView.screenAvailableRect.height) + Behavior on anchors.topMargin { + NumberAnimation { duration: 200; easing.type: Easing.Linear } + } + Behavior on leftMargin { + NumberAnimation { duration: 200; easing.type: Easing.Linear } + } + Behavior on rightMargin { + NumberAnimation { duration: 200; easing.type: Easing.Linear } + } + Behavior on bottomMargin { + NumberAnimation { duration: 200; easing.type: Easing.Linear } + } + flow: GridView.FlowTopToBottom delegate: FolderGridItem {} + onIconSizeChanged: { + globalSettings.desktopIconSize = _folderView.iconSize + } + onActiveFocusChanged: { if (!activeFocus) { _folderView.cancelRename() diff --git a/qml/FolderGridView.qml b/qml/FolderGridView.qml index 3f9f829..dc7e5d1 100644 --- a/qml/FolderGridView.qml +++ b/qml/FolderGridView.qml @@ -1,7 +1,6 @@ /* - * Copyright (C) 2021 CutefishOS Team. - * - * Author: revenmartin + * Copyright (C) 2021 revenmartin + * Copyright (C) 2014-2015 by Eike Hein * * 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 diff --git a/qml/FolderListView.qml b/qml/FolderListView.qml index 891c846..cae64ea 100644 --- a/qml/FolderListView.qml +++ b/qml/FolderListView.qml @@ -1,7 +1,6 @@ /* - * Copyright (C) 2021 CutefishOS Team. - * - * Author: revenmartin + * Copyright (C) 2021 revenmartin + * Copyright (C) 2014-2015 by Eike Hein * * 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 diff --git a/qml/OptionsMenu.qml b/qml/OptionsMenu.qml index 971bc44..313d128 100644 --- a/qml/OptionsMenu.qml +++ b/qml/OptionsMenu.qml @@ -93,7 +93,7 @@ FishUI.DesktopMenu { onTriggered: settings.viewMethod = 0 } - MenuSeparator {} + // MenuSeparator {} MenuItem { Layout.fillWidth: true