2021-05-25 04:44:02 -07:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2021 CutefishOS Team.
|
|
|
|
*
|
|
|
|
* Author: rekols <revenmartin@gmail.com>
|
|
|
|
*
|
|
|
|
* 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 3 of the License, or
|
|
|
|
* 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, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2021-03-15 20:17:11 -07:00
|
|
|
import QtQuick 2.12
|
|
|
|
import QtQuick.Controls 2.12
|
|
|
|
import QtQuick.Layouts 1.12
|
|
|
|
import QtGraphicalEffects 1.0
|
|
|
|
|
2021-03-16 03:20:04 -07:00
|
|
|
import Cutefish.Dock 1.0
|
2021-04-09 07:38:15 -07:00
|
|
|
import FishUI 1.0 as FishUI
|
2021-03-15 20:17:11 -07:00
|
|
|
|
|
|
|
Item {
|
|
|
|
id: root
|
|
|
|
visible: true
|
|
|
|
|
2021-03-24 09:14:48 -07:00
|
|
|
property bool isHorizontal: Settings.direction === DockSettings.Bottom
|
2021-04-18 06:23:47 -07:00
|
|
|
property real windowRadius: isHorizontal ? root.height * 0.3 : root.width * 0.3
|
2021-08-15 17:58:33 -07:00
|
|
|
property bool compositing: windowHelper.compositing
|
|
|
|
|
|
|
|
onCompositingChanged: {
|
|
|
|
mainWindow.updateSize()
|
|
|
|
}
|
2021-03-20 02:17:41 -07:00
|
|
|
|
2021-03-15 20:17:11 -07:00
|
|
|
DropArea {
|
|
|
|
anchors.fill: parent
|
|
|
|
enabled: true
|
|
|
|
}
|
|
|
|
|
2021-05-06 20:05:52 -07:00
|
|
|
// Background
|
|
|
|
Rectangle {
|
|
|
|
id: _background
|
2021-12-21 10:05:03 -08:00
|
|
|
|
|
|
|
property var borderColor: root.compositing ? FishUI.Theme.darkMode ? Qt.rgba(255, 255, 255, 0.3)
|
|
|
|
: Qt.rgba(0, 0, 0, 0.2) : FishUI.Theme.darkMode ? Qt.rgba(255, 255, 255, 0.15)
|
|
|
|
: Qt.rgba(0, 0, 0, 0.15)
|
|
|
|
|
2021-03-15 20:17:11 -07:00
|
|
|
anchors.fill: parent
|
2021-10-16 04:53:52 -07:00
|
|
|
radius: root.compositing && Settings.style === 0 ? windowRadius : 0
|
2021-09-20 19:43:23 -07:00
|
|
|
color: FishUI.Theme.darkMode ? "#666666" : "#E6E6E6"
|
2021-10-16 04:53:52 -07:00
|
|
|
opacity: root.compositing ? FishUI.Theme.darkMode ? 0.5 : 0.5 : 0.9
|
2021-12-21 10:05:03 -08:00
|
|
|
border.width: 1 / FishUI.Units.devicePixelRatio
|
|
|
|
border.pixelAligned: FishUI.Units.devicePixelRatio > 1 ? false : true
|
|
|
|
border.color: borderColor
|
2021-03-17 08:17:51 -07:00
|
|
|
|
2021-03-15 20:17:11 -07:00
|
|
|
Behavior on color {
|
|
|
|
ColorAnimation {
|
2021-03-17 06:33:06 -07:00
|
|
|
duration: 200
|
2021-03-17 08:17:51 -07:00
|
|
|
easing.type: Easing.Linear
|
2021-03-15 20:17:11 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-15 22:52:47 -07:00
|
|
|
FishUI.WindowHelper {
|
|
|
|
id: windowHelper
|
|
|
|
}
|
|
|
|
|
2021-05-29 09:45:15 -07:00
|
|
|
FishUI.WindowShadow {
|
|
|
|
view: mainWindow
|
|
|
|
geometry: Qt.rect(root.x, root.y, root.width, root.height)
|
|
|
|
strength: 1
|
2021-10-16 04:53:52 -07:00
|
|
|
radius: _background.radius
|
2021-05-06 20:05:52 -07:00
|
|
|
}
|
|
|
|
|
2021-04-15 10:13:45 -07:00
|
|
|
FishUI.WindowBlur {
|
|
|
|
view: mainWindow
|
|
|
|
geometry: Qt.rect(root.x, root.y, root.width, root.height)
|
2021-10-16 04:53:52 -07:00
|
|
|
windowRadius: _background.radius
|
2021-04-15 10:13:45 -07:00
|
|
|
enabled: true
|
2021-03-15 20:17:11 -07:00
|
|
|
}
|
|
|
|
|
2021-04-09 07:38:15 -07:00
|
|
|
FishUI.PopupTips {
|
2021-03-15 20:17:11 -07:00
|
|
|
id: popupTips
|
2021-07-31 12:11:02 -07:00
|
|
|
backgroundColor: _background.color
|
2021-12-30 20:44:23 -08:00
|
|
|
blurEnabled: false
|
2021-03-15 20:17:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
GridLayout {
|
|
|
|
id: mainLayout
|
|
|
|
anchors.fill: parent
|
2021-10-16 04:53:52 -07:00
|
|
|
anchors.topMargin: Settings.style === 1
|
|
|
|
&& (Settings.direction === 0 || Settings.direction === 2)
|
|
|
|
? 28 : 0
|
2021-03-15 20:17:11 -07:00
|
|
|
flow: isHorizontal ? Grid.LeftToRight : Grid.TopToBottom
|
|
|
|
columnSpacing: 0
|
|
|
|
rowSpacing: 0
|
|
|
|
|
|
|
|
ListView {
|
|
|
|
id: appItemView
|
|
|
|
orientation: isHorizontal ? Qt.Horizontal : Qt.Vertical
|
|
|
|
snapMode: ListView.SnapToItem
|
|
|
|
interactive: false
|
|
|
|
model: appModel
|
|
|
|
clip: true
|
|
|
|
|
|
|
|
Layout.fillHeight: true
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
|
|
|
delegate: AppItem {
|
|
|
|
id: appItemDelegate
|
2021-03-24 04:44:53 -07:00
|
|
|
implicitWidth: isHorizontal ? appItemView.height : appItemView.width
|
|
|
|
implicitHeight: isHorizontal ? appItemView.height : appItemView.width
|
2021-03-15 20:17:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
moveDisplaced: Transition {
|
|
|
|
NumberAnimation {
|
|
|
|
properties: "x, y"
|
|
|
|
duration: 300
|
|
|
|
easing.type: Easing.InOutQuad
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-05-06 22:36:48 -07:00
|
|
|
|
|
|
|
DockItem {
|
|
|
|
id: trashItem
|
|
|
|
implicitWidth: isHorizontal ? root.height : root.width
|
|
|
|
implicitHeight: isHorizontal ? root.height : root.width
|
|
|
|
popupText: qsTr("Trash")
|
|
|
|
enableActivateDot: false
|
|
|
|
iconName: trash.count === 0 ? "user-trash-empty" : "user-trash-full"
|
|
|
|
onClicked: trash.openTrash()
|
|
|
|
onRightClicked: trashMenu.popup()
|
|
|
|
|
2021-11-02 10:29:31 -07:00
|
|
|
dropArea.enabled: true
|
|
|
|
|
2021-12-26 01:07:57 -08:00
|
|
|
onDropped: {
|
|
|
|
if (drop.hasUrls) {
|
|
|
|
trash.moveToTrash(drop.urls)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-11-02 10:29:31 -07:00
|
|
|
Rectangle {
|
|
|
|
anchors.fill: parent
|
|
|
|
anchors.margins: FishUI.Units.smallSpacing / 2
|
|
|
|
color: "transparent"
|
|
|
|
border.color: FishUI.Theme.textColor
|
|
|
|
radius: height * 0.3
|
2021-12-26 01:07:57 -08:00
|
|
|
border.width: 1 / FishUI.Units.devicePixelRatio
|
|
|
|
border.pixelAligned: FishUI.Units.devicePixelRatio > 1 ? false : true
|
|
|
|
opacity: trashItem.dropArea.containsDrag ? 0.5 : 0
|
2021-11-02 10:29:31 -07:00
|
|
|
|
|
|
|
Behavior on opacity {
|
|
|
|
NumberAnimation {
|
|
|
|
duration: 200
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-05-06 22:36:48 -07:00
|
|
|
FishUI.DesktopMenu {
|
|
|
|
id: trashMenu
|
|
|
|
|
|
|
|
MenuItem {
|
|
|
|
text: qsTr("Open")
|
|
|
|
onTriggered: trash.openTrash()
|
|
|
|
}
|
|
|
|
|
|
|
|
MenuItem {
|
|
|
|
text: qsTr("Empty Trash")
|
|
|
|
onTriggered: trash.emptyTrash()
|
2021-12-26 01:09:37 -08:00
|
|
|
visible: trash.count !== 0
|
2021-05-06 22:36:48 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2021-03-15 20:17:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
Connections {
|
|
|
|
target: Settings
|
|
|
|
|
|
|
|
function onDirectionChanged() {
|
|
|
|
popupTips.hide()
|
|
|
|
}
|
|
|
|
}
|
2021-06-22 00:24:16 -07:00
|
|
|
|
|
|
|
Connections {
|
|
|
|
target: mainWindow
|
|
|
|
|
|
|
|
function onVisibleChanged() {
|
|
|
|
popupTips.hide()
|
|
|
|
}
|
|
|
|
}
|
2021-03-15 20:17:11 -07:00
|
|
|
}
|