mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-26 14:23:09 +00:00
The old UI was very confusing to use, I changed it so that: - Dialogs are used for the time and date picker, with user confirmation for changes - Tumblers are not used for the time picker, use the time picker component from kclock - Removed seconds selector (since it was always wrong) - Fixed the time zone selector (it didn't work before) - Properly support 24 hour time in the time picker Fixes https://invent.kde.org/plasma/plasma-mobile/-/issues/286
74 lines
1.9 KiB
QML
74 lines
1.9 KiB
QML
/*
|
|
SPDX-FileCopyrightText: 2011 Marco Martin <mart@kde.org>
|
|
|
|
SPDX-License-Identifier: LGPL-2.0-or-later
|
|
*/
|
|
|
|
import QtQuick 2.7
|
|
import org.kde.kirigami 2.4 as Kirigami
|
|
|
|
|
|
Item {
|
|
id: root
|
|
|
|
property alias model: spinnerView.model
|
|
property alias currentIndex: spinnerView.currentIndex
|
|
property alias delegate: spinnerView.delegate
|
|
property alias moving: spinnerView.moving
|
|
property int selectedIndex: -1
|
|
property int fontSize: 14
|
|
|
|
width: placeHolder.width*1.3
|
|
height: placeHolder.height*3
|
|
|
|
Text {
|
|
id: placeHolder
|
|
visible: false
|
|
font.pointSize: root.fontSize
|
|
text: "00"
|
|
}
|
|
|
|
PathView {
|
|
id: spinnerView
|
|
anchors.fill: parent
|
|
model: 60
|
|
clip: true
|
|
pathItemCount: 5
|
|
dragMargin: 800
|
|
preferredHighlightBegin: 0.5
|
|
preferredHighlightEnd: 0.5
|
|
delegate: Text {
|
|
horizontalAlignment: Text.AlignHCenter
|
|
width: spinnerView.width
|
|
property int ownIndex: index
|
|
text: index < 10 ? "0"+index : index
|
|
color: Kirigami.Theme.textColor
|
|
font.pointSize: root.fontSize
|
|
}
|
|
|
|
onMovingChanged: {
|
|
userConfiguring = true
|
|
if (!moving) {
|
|
userConfiguringTimer.restart()
|
|
selectedIndex = childAt(width/2, height/2).ownIndex
|
|
}
|
|
}
|
|
|
|
path: Path {
|
|
startX: spinnerView.width/2
|
|
startY: spinnerView.height + 1.5*placeHolder.height
|
|
PathAttribute { name: "itemOpacity"; value: 0 }
|
|
PathLine {
|
|
x: spinnerView.width/2
|
|
y: spinnerView.height/2
|
|
}
|
|
PathAttribute { name: "itemOpacity"; value: 1 }
|
|
PathLine {
|
|
x: spinnerView.width/2
|
|
y: -1.5*placeHolder.height
|
|
}
|
|
PathAttribute { name: "itemOpacity"; value: 0 }
|
|
}
|
|
}
|
|
}
|
|
|