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-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-03-15 20:17:11 -07:00
|
|
|
anchors.fill: parent
|
2021-06-15 22:52:47 -07:00
|
|
|
radius: windowHelper.compositing ? windowRadius : 0
|
2021-07-31 12:11:02 -07:00
|
|
|
color: FishUI.Theme.darkMode ? "#595959" : "#FFFFFF"
|
2021-06-15 22:52:47 -07:00
|
|
|
opacity: windowHelper.compositing ? FishUI.Theme.darkMode ? 0.5 : 0.4 : 1
|
2021-06-02 08:59:42 -07:00
|
|
|
border.width: 0
|
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
|
|
|
|
radius: root.windowRadius
|
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)
|
|
|
|
windowRadius: root.windowRadius
|
|
|
|
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
|
|
|
|
backgroundOpacity: _background.opacity
|
2021-03-15 20:17:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
GridLayout {
|
|
|
|
id: mainLayout
|
|
|
|
anchors.fill: parent
|
|
|
|
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()
|
|
|
|
|
|
|
|
FishUI.DesktopMenu {
|
|
|
|
id: trashMenu
|
|
|
|
|
|
|
|
MenuItem {
|
|
|
|
text: qsTr("Open")
|
|
|
|
onTriggered: trash.openTrash()
|
|
|
|
}
|
|
|
|
|
|
|
|
MenuItem {
|
|
|
|
text: qsTr("Empty Trash")
|
|
|
|
onTriggered: trash.emptyTrash()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
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
|
|
|
}
|