Commit 946e9dfc authored by Devin Lin's avatar Devin Lin 🎨
Browse files

homescreens/halcyon: Allow full screen to be draggable

parent 108daf50
Pipeline #194633 passed with stage
in 1 minute and 15 seconds
......@@ -17,7 +17,7 @@ import org.kde.phone.homescreen.halcyon 1.0 as Halcyon
import org.kde.kirigami 2.19 as Kirigami
MobileShell.ExtendedAbstractButton {
MouseArea {
id: delegate
property alias iconItem: icon
......@@ -51,14 +51,18 @@ MobileShell.ExtendedAbstractButton {
hoverEnabled: true
onPressAndHold: openContextMenu()
onRightClickPressed: openContextMenu()
acceptedButtons: Qt.LeftButton | Qt.RightButton
onClicked: {
// launch app
if (application.running) {
delegate.launch(0, 0, "", applicationName, applicationStorageId);
if (mouse.button === Qt.RightButton) {
openContextMenu();
} else {
delegate.launch(delegate.x + (PlasmaCore.Units.smallSpacing * 2), delegate.y + (PlasmaCore.Units.smallSpacing * 2), icon.source, applicationName, applicationStorageId);
// launch app
if (application.running) {
delegate.launch(0, 0, "", applicationName, applicationStorageId);
} else {
delegate.launch(delegate.x + (PlasmaCore.Units.smallSpacing * 2), delegate.y + (PlasmaCore.Units.smallSpacing * 2), icon.source, applicationName, applicationStorageId);
}
}
}
......@@ -81,83 +85,79 @@ MobileShell.ExtendedAbstractButton {
}
}
background: Rectangle {
Rectangle {
anchors.fill: parent
radius: height / 2
color: delegate.pressed ? Qt.rgba(255, 255, 255, 0.2) : (delegate.hovered ? Qt.rgba(255, 255, 255, 0.1) : "transparent")
color: delegate.pressed ? Qt.rgba(255, 255, 255, 0.2) : (delegate.containsMouse ? Qt.rgba(255, 255, 255, 0.1) : "transparent")
}
contentItem: Item {
implicitHeight: rowLayout.height + rowLayout.anchors.topMargin + rowLayout.anchors.bottomMargin
implicitWidth: rowLayout.width + rowLayout.anchors.rightMargin + rowLayout.anchors.leftMargin
RowLayout {
id: rowLayout
anchors {
fill: parent
leftMargin: PlasmaCore.Units.smallSpacing * 2
topMargin: PlasmaCore.Units.smallSpacing
rightMargin: PlasmaCore.Units.smallSpacing * 2
bottomMargin: PlasmaCore.Units.smallSpacing
}
spacing: 0
PlasmaCore.IconItem {
id: icon
Layout.alignment: Qt.AlignLeft
Layout.minimumWidth: Layout.minimumHeight
Layout.preferredWidth: Layout.minimumHeight
Layout.minimumHeight: parent.height
Layout.preferredHeight: Layout.minimumHeight
usesPlasmaTheme: false
source: applicationIcon
Rectangle {
anchors {
horizontalCenter: parent.horizontalCenter
bottom: parent.bottom
}
visible: application ? application.running : false
radius: width
width: PlasmaCore.Units.smallSpacing
height: width
color: PlasmaCore.Theme.highlightColor
}
layer.enabled: true
layer.effect: DropShadow {
verticalOffset: 1
radius: 4
samples: 6
color: Qt.rgba(0, 0, 0, 0.5)
RowLayout {
id: rowLayout
anchors {
fill: parent
leftMargin: PlasmaCore.Units.smallSpacing * 2
topMargin: PlasmaCore.Units.smallSpacing
rightMargin: PlasmaCore.Units.smallSpacing * 2
bottomMargin: PlasmaCore.Units.smallSpacing
}
spacing: 0
PlasmaCore.IconItem {
id: icon
Layout.alignment: Qt.AlignLeft
Layout.minimumWidth: Layout.minimumHeight
Layout.preferredWidth: Layout.minimumHeight
Layout.minimumHeight: parent.height
Layout.preferredHeight: Layout.minimumHeight
usesPlasmaTheme: false
source: applicationIcon
Rectangle {
anchors {
horizontalCenter: parent.horizontalCenter
bottom: parent.bottom
}
visible: application ? application.running : false
radius: width
width: PlasmaCore.Units.smallSpacing
height: width
color: PlasmaCore.Theme.highlightColor
}
layer.enabled: true
layer.effect: DropShadow {
verticalOffset: 1
radius: 4
samples: 6
color: Qt.rgba(0, 0, 0, 0.5)
}
}
PlasmaComponents.Label {
id: label
visible: text.length > 0
Layout.fillWidth: true
Layout.leftMargin: PlasmaCore.Units.smallSpacing * 2
Layout.rightMargin: PlasmaCore.Units.largeSpacing
wrapMode: Text.WordWrap
maximumLineCount: 1
elide: Text.ElideRight
text: applicationName
font.pointSize: PlasmaCore.Theme.defaultFont.pointSize
font.weight: Font.Bold
color: "white"
layer.enabled: true
layer.effect: DropShadow {
verticalOffset: 1
radius: 4
samples: 6
color: Qt.rgba(0, 0, 0, 0.5)
}
PlasmaComponents.Label {
id: label
visible: text.length > 0
Layout.fillWidth: true
Layout.leftMargin: PlasmaCore.Units.smallSpacing * 2
Layout.rightMargin: PlasmaCore.Units.largeSpacing
wrapMode: Text.WordWrap
maximumLineCount: 1
elide: Text.ElideRight
text: applicationName
font.pointSize: PlasmaCore.Theme.defaultFont.pointSize
font.weight: Font.Bold
color: "white"
layer.enabled: true
layer.effect: DropShadow {
verticalOffset: 1
radius: 4
samples: 6
color: Qt.rgba(0, 0, 0, 0.5)
}
}
}
......
......@@ -58,15 +58,13 @@ Item {
id: favouritesList
clip: true
interactive: root.interactive
boundsMovement: Flickable.StopAtBounds
boundsBehavior: Flickable.DragOverBounds
property real delegateHeight: PlasmaCore.Units.gridUnit * 3
anchors.fill: parent
anchors.leftMargin: Math.round(parent.width * 0.1)
anchors.rightMargin: Math.round(parent.width * 0.1)
// don't set anchors.margins since we want everywhere to be draggable
readonly property real leftMargin: Math.round(parent.width * 0.1)
readonly property real rightMargin: Math.round(parent.width * 0.1)
readonly property real delegateHeight: PlasmaCore.Units.gridUnit * 3
// search widget open gesture
property bool openingSearchWidget: false
property real oldVerticalOvershoot: verticalOvershoot
......@@ -95,6 +93,8 @@ Item {
header: MobileShell.BaseItem {
topPadding: Math.round(swipeView.height * 0.2)
bottomPadding: PlasmaCore.Units.largeSpacing
leftPadding: favouritesList.leftMargin
rightPadding: favouritesList.rightMargin
implicitWidth: favouritesList.width
background: Rectangle {
......@@ -104,10 +104,14 @@ Item {
contentItem: Clock {}
}
delegate: DrawerListDelegate {
id: delegate
width: favouritesList.width
height: visible ? favouritesList.delegateHeight : 0
delegate: MobileShell.BaseItem {
leftPadding: favouritesList.leftMargin
rightPadding: favouritesList.rightMargin
contentItem: DrawerListDelegate {
implicitWidth: favouritesList.width - favouritesList.leftMargin - favouritesList.rightMargin
implicitHeight: visible ? favouritesList.delegateHeight : 0
}
}
// open wallpaper menu when held on click
......@@ -121,8 +125,10 @@ Item {
visible: favouritesList.count == 0
opacity: 0.9
anchors.topMargin: Math.round(swipeView.height * 0.2) - (favouritesList.contentY - favouritesList.originY)
anchors.fill: parent
anchors.topMargin: Math.round(swipeView.height * 0.2) - (favouritesList.contentY - favouritesList.originY)
anchors.leftMargin: favouritesList.leftMargin
anchors.rightMargin: favouritesList.rightMargin
Kirigami.Icon {
id: icon
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment