mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
homescreens/halcyon: Allow full screen to be draggable
This commit is contained in:
parent
108daf50db
commit
946e9dfc62
2 changed files with 93 additions and 87 deletions
|
|
@ -17,7 +17,7 @@ import org.kde.phone.homescreen.halcyon 1.0 as Halcyon
|
||||||
|
|
||||||
import org.kde.kirigami 2.19 as Kirigami
|
import org.kde.kirigami 2.19 as Kirigami
|
||||||
|
|
||||||
MobileShell.ExtendedAbstractButton {
|
MouseArea {
|
||||||
id: delegate
|
id: delegate
|
||||||
|
|
||||||
property alias iconItem: icon
|
property alias iconItem: icon
|
||||||
|
|
@ -51,14 +51,18 @@ MobileShell.ExtendedAbstractButton {
|
||||||
|
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
onPressAndHold: openContextMenu()
|
onPressAndHold: openContextMenu()
|
||||||
onRightClickPressed: openContextMenu()
|
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
// launch app
|
if (mouse.button === Qt.RightButton) {
|
||||||
if (application.running) {
|
openContextMenu();
|
||||||
delegate.launch(0, 0, "", applicationName, applicationStorageId);
|
|
||||||
} else {
|
} 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
|
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 {
|
RowLayout {
|
||||||
implicitHeight: rowLayout.height + rowLayout.anchors.topMargin + rowLayout.anchors.bottomMargin
|
id: rowLayout
|
||||||
implicitWidth: rowLayout.width + rowLayout.anchors.rightMargin + rowLayout.anchors.leftMargin
|
anchors {
|
||||||
|
fill: parent
|
||||||
RowLayout {
|
leftMargin: PlasmaCore.Units.smallSpacing * 2
|
||||||
id: rowLayout
|
topMargin: PlasmaCore.Units.smallSpacing
|
||||||
anchors {
|
rightMargin: PlasmaCore.Units.smallSpacing * 2
|
||||||
fill: parent
|
bottomMargin: PlasmaCore.Units.smallSpacing
|
||||||
leftMargin: PlasmaCore.Units.smallSpacing * 2
|
}
|
||||||
topMargin: PlasmaCore.Units.smallSpacing
|
spacing: 0
|
||||||
rightMargin: PlasmaCore.Units.smallSpacing * 2
|
|
||||||
bottomMargin: PlasmaCore.Units.smallSpacing
|
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
|
||||||
}
|
}
|
||||||
spacing: 0
|
|
||||||
|
layer.enabled: true
|
||||||
PlasmaCore.IconItem {
|
layer.effect: DropShadow {
|
||||||
id: icon
|
verticalOffset: 1
|
||||||
|
radius: 4
|
||||||
Layout.alignment: Qt.AlignLeft
|
samples: 6
|
||||||
Layout.minimumWidth: Layout.minimumHeight
|
color: Qt.rgba(0, 0, 0, 0.5)
|
||||||
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 {
|
PlasmaComponents.Label {
|
||||||
id: label
|
id: label
|
||||||
visible: text.length > 0
|
visible: text.length > 0
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.leftMargin: PlasmaCore.Units.smallSpacing * 2
|
Layout.leftMargin: PlasmaCore.Units.smallSpacing * 2
|
||||||
Layout.rightMargin: PlasmaCore.Units.largeSpacing
|
Layout.rightMargin: PlasmaCore.Units.largeSpacing
|
||||||
wrapMode: Text.WordWrap
|
wrapMode: Text.WordWrap
|
||||||
maximumLineCount: 1
|
maximumLineCount: 1
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
|
|
||||||
text: applicationName
|
text: applicationName
|
||||||
|
|
||||||
font.pointSize: PlasmaCore.Theme.defaultFont.pointSize
|
font.pointSize: PlasmaCore.Theme.defaultFont.pointSize
|
||||||
font.weight: Font.Bold
|
font.weight: Font.Bold
|
||||||
color: "white"
|
color: "white"
|
||||||
|
|
||||||
layer.enabled: true
|
layer.enabled: true
|
||||||
layer.effect: DropShadow {
|
layer.effect: DropShadow {
|
||||||
verticalOffset: 1
|
verticalOffset: 1
|
||||||
radius: 4
|
radius: 4
|
||||||
samples: 6
|
samples: 6
|
||||||
color: Qt.rgba(0, 0, 0, 0.5)
|
color: Qt.rgba(0, 0, 0, 0.5)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -58,15 +58,13 @@ Item {
|
||||||
id: favouritesList
|
id: favouritesList
|
||||||
clip: true
|
clip: true
|
||||||
interactive: root.interactive
|
interactive: root.interactive
|
||||||
boundsMovement: Flickable.StopAtBounds
|
|
||||||
boundsBehavior: Flickable.DragOverBounds
|
|
||||||
|
|
||||||
property real delegateHeight: PlasmaCore.Units.gridUnit * 3
|
|
||||||
|
|
||||||
anchors.fill: parent
|
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
|
// search widget open gesture
|
||||||
property bool openingSearchWidget: false
|
property bool openingSearchWidget: false
|
||||||
property real oldVerticalOvershoot: verticalOvershoot
|
property real oldVerticalOvershoot: verticalOvershoot
|
||||||
|
|
@ -95,6 +93,8 @@ Item {
|
||||||
header: MobileShell.BaseItem {
|
header: MobileShell.BaseItem {
|
||||||
topPadding: Math.round(swipeView.height * 0.2)
|
topPadding: Math.round(swipeView.height * 0.2)
|
||||||
bottomPadding: PlasmaCore.Units.largeSpacing
|
bottomPadding: PlasmaCore.Units.largeSpacing
|
||||||
|
leftPadding: favouritesList.leftMargin
|
||||||
|
rightPadding: favouritesList.rightMargin
|
||||||
implicitWidth: favouritesList.width
|
implicitWidth: favouritesList.width
|
||||||
|
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
|
|
@ -104,10 +104,14 @@ Item {
|
||||||
contentItem: Clock {}
|
contentItem: Clock {}
|
||||||
}
|
}
|
||||||
|
|
||||||
delegate: DrawerListDelegate {
|
delegate: MobileShell.BaseItem {
|
||||||
id: delegate
|
leftPadding: favouritesList.leftMargin
|
||||||
width: favouritesList.width
|
rightPadding: favouritesList.rightMargin
|
||||||
height: visible ? favouritesList.delegateHeight : 0
|
|
||||||
|
contentItem: DrawerListDelegate {
|
||||||
|
implicitWidth: favouritesList.width - favouritesList.leftMargin - favouritesList.rightMargin
|
||||||
|
implicitHeight: visible ? favouritesList.delegateHeight : 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// open wallpaper menu when held on click
|
// open wallpaper menu when held on click
|
||||||
|
|
@ -121,8 +125,10 @@ Item {
|
||||||
visible: favouritesList.count == 0
|
visible: favouritesList.count == 0
|
||||||
opacity: 0.9
|
opacity: 0.9
|
||||||
|
|
||||||
anchors.topMargin: Math.round(swipeView.height * 0.2) - (favouritesList.contentY - favouritesList.originY)
|
|
||||||
anchors.fill: parent
|
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 {
|
Kirigami.Icon {
|
||||||
id: icon
|
id: icon
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue