dock/qml/main.qml

141 lines
3.4 KiB
QML
Raw Normal View History

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-05-06 20:05:52 -07:00
radius: windowRadius
2021-04-15 10:13:45 -07:00
color: FishUI.Theme.backgroundColor
2021-05-06 20:05:52 -07:00
opacity: FishUI.Theme.darkMode ? 0.3 : 0.4
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-05-06 20:05:52 -07:00
Rectangle {
anchors.fill: parent
color: "transparent"
radius: windowRadius
border.width: 1
border.color: Qt.rgba(0, 0, 0, 0.3)
antialiasing: true
smooth: true
}
Rectangle {
anchors.fill: parent
anchors.margins: 1
radius: windowRadius - 1
color: "transparent"
border.width: 1
border.color: Qt.rgba(255, 255, 255, 0.1)
antialiasing: true
smooth: true
}
// DockBackground {
// anchors.fill: parent
// radius: root.windowRadius
// opacity: FishUI.Theme.darkMode ? 0.3 : 0.4
// color: FishUI.Theme.backgroundColor
// Behavior on opacity {
// NumberAnimation {
// duration: 200
// easing.type: Easing.Linear
// }
// }
// Behavior on color {
// ColorAnimation {
// duration: 200
// easing.type: Easing.Linear
// }
// }
// }
2021-04-18 06:23:47 -07:00
FishUI.WindowShadow {
view: mainWindow
geometry: Qt.rect(root.x, root.y, root.width, root.height)
strength: 1
radius: root.windowRadius
}
2021-03-15 20:17:11 -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-04-09 07:38:15 -07:00
backgroundColor: FishUI.Theme.backgroundColor
backgroundOpacity: FishUI.Theme.darkMode ? 0.3 : 0.4
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
}
}
}
}
Connections {
target: Settings
function onDirectionChanged() {
popupTips.hide()
}
}
}