Adjust desktop border & add animation

This commit is contained in:
rekols 2021-06-02 13:25:04 +08:00
parent 9bddd607d8
commit 3322e1bd09
6 changed files with 36 additions and 19 deletions

View file

@ -33,7 +33,7 @@ DesktopView::DesktopView(QQuickView *parent)
: QQuickView(parent) : QQuickView(parent)
{ {
m_screenRect = qApp->primaryScreen()->geometry(); m_screenRect = qApp->primaryScreen()->geometry();
m_screenAvailableRect = qApp->primaryScreen()->availableGeometry(); m_screenAvailableRect = qApp->primaryScreen()->availableVirtualGeometry();
KWindowSystem::setType(winId(), NET::Desktop); KWindowSystem::setType(winId(), NET::Desktop);
KWindowSystem::setState(winId(), NET::KeepBelow); KWindowSystem::setState(winId(), NET::KeepBelow);
@ -48,9 +48,10 @@ DesktopView::DesktopView(QQuickView *parent)
onGeometryChanged(); onGeometryChanged();
connect(qApp->primaryScreen(), &QScreen::virtualGeometryChanged, this, &DesktopView::onGeometryChanged, Qt::QueuedConnection); connect(qApp->primaryScreen(), &QScreen::virtualGeometryChanged, this, &DesktopView::onGeometryChanged);
connect(qApp->primaryScreen(), &QScreen::geometryChanged, this, &DesktopView::onGeometryChanged, Qt::QueuedConnection); connect(qApp->primaryScreen(), &QScreen::geometryChanged, this, &DesktopView::onGeometryChanged);
connect(qApp->primaryScreen(), &QScreen::availableGeometryChanged, this, &DesktopView::onAvailableGeometryChanged, Qt::QueuedConnection); connect(qApp->primaryScreen(), &QScreen::availableGeometryChanged, this, &DesktopView::onAvailableGeometryChanged);
connect(qApp->primaryScreen(), &QScreen::virtualGeometryChanged, this, &DesktopView::onAvailableGeometryChanged);
} }
QRect DesktopView::screenRect() QRect DesktopView::screenRect()
@ -72,6 +73,8 @@ void DesktopView::onGeometryChanged()
void DesktopView::onAvailableGeometryChanged(const QRect &geometry) void DesktopView::onAvailableGeometryChanged(const QRect &geometry)
{ {
m_screenAvailableRect = geometry; Q_UNUSED(geometry);
m_screenAvailableRect = qApp->primaryScreen()->availableVirtualGeometry();
emit screenAvailableGeometryChanged(); emit screenAvailableGeometryChanged();
} }

View file

@ -998,8 +998,8 @@ void FolderModel::dragSelectedInternal(int x, int y)
bool FolderModel::isSupportThumbnails(const QString &mimeType) const bool FolderModel::isSupportThumbnails(const QString &mimeType) const
{ {
const QStringList supportsMimetypes = {"image/bmp", "image/png", "image/gif", "image/jpeg", "image/web", const QStringList supportsMimetypes = {"image/bmp", "image/png", "image/gif", "image/jpeg", "image/web",
"application/pdf", "application/rtf", "application/doc", "application/odf", /*"application/pdf", "application/rtf", "application/doc", "application/odf",
"audio/mpeg", "video/mp4"}; "audio/mpeg", "video/mp4"*/};
if (supportsMimetypes.contains(mimeType)) if (supportsMimetypes.contains(mimeType))
return true; return true;

View file

@ -110,19 +110,35 @@ Item {
ScrollBar.vertical.policy: ScrollBar.AlwaysOff ScrollBar.vertical.policy: ScrollBar.AlwaysOff
onIconSizeChanged: { // Handle for topbar
globalSettings.desktopIconSize = _folderView.iconSize anchors.topMargin: desktopView.screenAvailableRect.y
}
leftMargin: desktopView.screenAvailableRect ? desktopView.screenAvailableRect.x : 0 leftMargin: desktopView.screenAvailableRect.x
topMargin: desktopView.screenAvailableRect ? desktopView.screenAvailableRect.y : 0 topMargin: 0
rightMargin: desktopView.screenRect.width - (desktopView.screenAvailableRect.x + desktopView.screenAvailableRect.width) rightMargin: desktopView.screenRect.width - (desktopView.screenAvailableRect.x + desktopView.screenAvailableRect.width)
bottomMargin: desktopView.screenRect.height - (desktopView.screenAvailableRect.y + desktopView.screenAvailableRect.height) 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 flow: GridView.FlowTopToBottom
delegate: FolderGridItem {} delegate: FolderGridItem {}
onIconSizeChanged: {
globalSettings.desktopIconSize = _folderView.iconSize
}
onActiveFocusChanged: { onActiveFocusChanged: {
if (!activeFocus) { if (!activeFocus) {
_folderView.cancelRename() _folderView.cancelRename()

View file

@ -1,7 +1,6 @@
/* /*
* Copyright (C) 2021 CutefishOS Team. * Copyright (C) 2021 revenmartin <revenmartin@gmail.com>
* * Copyright (C) 2014-2015 by Eike Hein <hein@kde.org>
* Author: revenmartin <revenmartin@gmail.com>
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by

View file

@ -1,7 +1,6 @@
/* /*
* Copyright (C) 2021 CutefishOS Team. * Copyright (C) 2021 revenmartin <revenmartin@gmail.com>
* * Copyright (C) 2014-2015 by Eike Hein <hein@kde.org>
* Author: revenmartin <revenmartin@gmail.com>
* *
* This program is free software: you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by

View file

@ -93,7 +93,7 @@ FishUI.DesktopMenu {
onTriggered: settings.viewMethod = 0 onTriggered: settings.viewMethod = 0
} }
MenuSeparator {} // MenuSeparator {}
MenuItem { MenuItem {
Layout.fillWidth: true Layout.fillWidth: true