dock/qml/main.qml

129 lines
3.2 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-03-15 20:17:11 -07:00
import MeuiKit 1.0 as Meui
Item {
id: root
visible: true
property color borderColor: Meui.Theme.darkMode ? Qt.rgba(255, 255, 255, 0.1) : Qt.rgba(0, 0, 0, 0.05)
2021-03-24 09:14:48 -07:00
property bool isHorizontal: Settings.direction === DockSettings.Bottom
property real windowRadius: isHorizontal ? root.height * 0.25 : root.width * 0.25
2021-03-20 02:17:41 -07:00
2021-03-15 20:17:11 -07:00
DropArea {
anchors.fill: parent
enabled: true
}
Meui.WindowShadow {
view: mainWindow
geometry: Qt.rect(root.x, root.y, root.width, root.height)
radius: _background.radius
}
Meui.WindowBlur {
view: mainWindow
geometry: Qt.rect(root.x, root.y, root.width, root.height)
windowRadius: _background.radius
enabled: true
}
// Background
Rectangle {
id: _background
anchors.fill: parent
radius: windowRadius
color: Meui.Theme.backgroundColor
opacity: Meui.Theme.darkMode ? 0.3 : 0.5
2021-03-17 08:17:51 -07:00
Behavior on opacity {
NumberAnimation {
duration: 200
easing.type: Easing.Linear
}
}
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
}
}
}
Rectangle {
anchors.fill: parent
color: "transparent"
radius: windowRadius
visible: windowRadius
2021-03-15 20:17:11 -07:00
border.width: 1
border.color: Qt.rgba(0, 0, 0, 0.5)
antialiasing: true
smooth: true
}
Rectangle {
anchors.fill: parent
anchors.margins: 1
radius: windowRadius - 1
visible: windowRadius
2021-03-15 20:17:11 -07:00
color: "transparent"
border.width: 1
2021-03-20 02:17:41 -07:00
border.color: Qt.rgba(255, 255, 255, 0.3)
2021-03-15 20:17:11 -07:00
antialiasing: true
smooth: true
}
Meui.PopupTips {
id: popupTips
backgroundColor: Meui.Theme.backgroundColor
backgroundOpacity: Meui.Theme.darkMode ? 0.3 : 0.4
}
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()
}
}
}