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)
{
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();
}

View file

@ -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;

View file

@ -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()

View file

@ -1,7 +1,6 @@
/*
* Copyright (C) 2021 CutefishOS Team.
*
* Author: revenmartin <revenmartin@gmail.com>
* Copyright (C) 2021 revenmartin <revenmartin@gmail.com>
* Copyright (C) 2014-2015 by Eike Hein <hein@kde.org>
*
* 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

View file

@ -1,7 +1,6 @@
/*
* Copyright (C) 2021 CutefishOS Team.
*
* Author: revenmartin <revenmartin@gmail.com>
* Copyright (C) 2021 revenmartin <revenmartin@gmail.com>
* Copyright (C) 2014-2015 by Eike Hein <hein@kde.org>
*
* 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

View file

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