forked from Shinonome/dots-hyprland
pomodoro: rename more for consistency
This commit is contained in:
@@ -50,6 +50,11 @@ Singleton {
|
||||
property bool running: false
|
||||
property int start: 0
|
||||
}
|
||||
property JsonObject stopwatch: JsonObject {
|
||||
property bool running: false
|
||||
property int start: 0
|
||||
property list<var> laps: []
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ Item {
|
||||
implicitHeight: 35
|
||||
implicitWidth: 90
|
||||
|
||||
onClicked: Pomodoro.pomodoroReset()
|
||||
onClicked: Pomodoro.resetPomodoro()
|
||||
enabled: (Pomodoro.pomodoroSecondsLeft < Pomodoro.focusTime)
|
||||
|
||||
font.pixelSize: Appearance.font.pixelSize.larger
|
||||
@@ -95,82 +95,101 @@ Item {
|
||||
}
|
||||
|
||||
// The SpinBoxes for adjusting duration
|
||||
GridLayout {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
columns: 2
|
||||
uniformCellWidths: true
|
||||
columnSpacing: 20
|
||||
rowSpacing: 4
|
||||
// GridLayout {
|
||||
// Layout.alignment: Qt.AlignHCenter
|
||||
// columns: 2
|
||||
// uniformCellWidths: true
|
||||
// columnSpacing: 20
|
||||
// rowSpacing: 4
|
||||
|
||||
StyledText {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
text: Translation.tr("Focus")
|
||||
}
|
||||
// StyledText {
|
||||
// Layout.alignment: Qt.AlignHCenter
|
||||
// text: Translation.tr("Focus")
|
||||
// }
|
||||
|
||||
StyledText {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
text: Translation.tr("Break")
|
||||
}
|
||||
// StyledText {
|
||||
// Layout.alignment: Qt.AlignHCenter
|
||||
// text: Translation.tr("Break")
|
||||
// }
|
||||
|
||||
ConfigSpinBox {
|
||||
id: focusSpinBox
|
||||
spacing: 0
|
||||
Layout.leftMargin: 0
|
||||
Layout.rightMargin: 0
|
||||
value: Config.options.time.pomodoro.focus / 60
|
||||
onValueChanged: {
|
||||
Config.options.time.pomodoro.focus = value * 60
|
||||
if (Pomodoro.isPomodoroReset) { // Special case for Pomodoro in Reset state
|
||||
Pomodoro.pomodoroSecondsLeft = Pomodoro.focusTime
|
||||
Pomodoro.timeLeft = Pomodoro.focusTime
|
||||
}
|
||||
}
|
||||
}
|
||||
// ConfigSpinBox {
|
||||
// id: focusSpinBox
|
||||
// spacing: 0
|
||||
// Layout.leftMargin: 0
|
||||
// Layout.rightMargin: 0
|
||||
// from: 0
|
||||
// to: 120
|
||||
// Connections {
|
||||
// target: Config
|
||||
// function onReadyChanged() {
|
||||
// focusSpinBox.valueChanged()
|
||||
// }
|
||||
// }
|
||||
// value: {
|
||||
// console.log("New focus time: " + (Config.options.time.pomodoro.focus / 60))
|
||||
// return Config.options.time.pomodoro.focus / 60
|
||||
// }
|
||||
// onValueChanged: {
|
||||
// console.log("New focus time is " + value + " minutes, Config is ready:", Config.ready)
|
||||
// if (!Config.ready) return;
|
||||
// console.log("Setting focus time to " + value + " minutes")
|
||||
// Config.options.time.pomodoro.focus = value * 60
|
||||
// if (Pomodoro.isPomodoroReset) { // Special case for Pomodoro in Reset state
|
||||
// Pomodoro.pomodoroSecondsLeft = Pomodoro.focusTime
|
||||
// Pomodoro.timeLeft = Pomodoro.focusTime
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
ConfigSpinBox {
|
||||
id: breakSpinBox
|
||||
spacing: 0
|
||||
Layout.leftMargin: 0
|
||||
Layout.rightMargin: 0
|
||||
value: Config.options.time.pomodoro.breakTime / 60
|
||||
onValueChanged: {
|
||||
Config.options.time.pomodoro.breakTime = value * 60
|
||||
}
|
||||
}
|
||||
// ConfigSpinBox {
|
||||
// id: breakSpinBox
|
||||
// value: Config.options.time.pomodoro.breakTime / 60
|
||||
// spacing: 0
|
||||
// from: 0
|
||||
// to: 120
|
||||
// Layout.leftMargin: 0
|
||||
// Layout.rightMargin: 0
|
||||
// onValueChanged: {
|
||||
// Config.options.time.pomodoro.breakTime = value * 60
|
||||
// }
|
||||
// }
|
||||
|
||||
StyledText {
|
||||
Layout.topMargin: 6
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
text: Translation.tr("Cycle")
|
||||
}
|
||||
StyledText {
|
||||
Layout.topMargin: 6
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
text: Translation.tr("Long break")
|
||||
}
|
||||
// StyledText {
|
||||
// Layout.topMargin: 6
|
||||
// Layout.alignment: Qt.AlignHCenter
|
||||
// text: Translation.tr("Cycle")
|
||||
// }
|
||||
// StyledText {
|
||||
// Layout.topMargin: 6
|
||||
// Layout.alignment: Qt.AlignHCenter
|
||||
// text: Translation.tr("Long break")
|
||||
// }
|
||||
|
||||
ConfigSpinBox {
|
||||
id: cycleSpinBox
|
||||
spacing: 0
|
||||
from: 1
|
||||
Layout.leftMargin: 0
|
||||
Layout.rightMargin: 0
|
||||
value: Config.options.time.pomodoro.cycle
|
||||
onValueChanged: {
|
||||
Config.options.time.pomodoro.cycle = value
|
||||
}
|
||||
}
|
||||
// ConfigSpinBox {
|
||||
// id: cycleSpinBox
|
||||
// value: Config.options.time.pomodoro.cycle
|
||||
// spacing: 0
|
||||
// from: 1
|
||||
// to: 20
|
||||
// Layout.leftMargin: 0
|
||||
// Layout.rightMargin: 0
|
||||
// onValueChanged: {
|
||||
// Config.options.time.pomodoro.cycle = value
|
||||
// }
|
||||
// }
|
||||
|
||||
ConfigSpinBox {
|
||||
id: longBreakSpinBox
|
||||
spacing: 0
|
||||
Layout.leftMargin: 0
|
||||
Layout.rightMargin: 0
|
||||
value: Config.options.time.pomodoro.longBreak / 60
|
||||
onValueChanged: {
|
||||
Config.options.time.pomodoro.longBreak = value * 60
|
||||
}
|
||||
}
|
||||
}
|
||||
// ConfigSpinBox {
|
||||
// id: longBreakSpinBox
|
||||
// spacing: 0
|
||||
// Layout.leftMargin: 0
|
||||
// Layout.rightMargin: 0
|
||||
// value: Config.options.time.pomodoro.longBreak / 60
|
||||
// from: 0
|
||||
// to: 120
|
||||
// onValueChanged: {
|
||||
// Config.options.time.pomodoro.longBreak = value * 60
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,7 @@ Item {
|
||||
} else if (event.key === Qt.Key_R) {
|
||||
// Reset with R key
|
||||
if (currentTab === 0) {
|
||||
Pomodoro.pomodoroReset()
|
||||
Pomodoro.resetPomodoro()
|
||||
} else {
|
||||
Pomodoro.stopwatchReset()
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ Item {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
spacing: 0
|
||||
StyledText {
|
||||
Layout.preferredWidth: elapsedIndicator.width * 0.6 // Prevent shakiness
|
||||
// Layout.preferredWidth: elapsedIndicator.width * 0.6 // Prevent shakiness
|
||||
font.pixelSize: 40
|
||||
color: Appearance.m3colors.m3onSurface
|
||||
text: {
|
||||
@@ -100,12 +100,12 @@ Item {
|
||||
id: lapsList
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
spacing: lapsListItemSpacing
|
||||
spacing: 4
|
||||
clip: true
|
||||
popin: true
|
||||
|
||||
model: ScriptModel {
|
||||
values: Pomodoro.stopwatchLaps
|
||||
values: Pomodoro.stopwatchLaps.map((v, i, arr) => arr[arr.length - 1 - i])
|
||||
}
|
||||
|
||||
delegate: Rectangle {
|
||||
@@ -139,11 +139,11 @@ Item {
|
||||
StyledText {
|
||||
font.pixelSize: Appearance.font.pixelSize.small
|
||||
text: {
|
||||
let lapTime = lapItem.modelData
|
||||
let _10ms = (Math.floor(lapTime) % 100).toString().padStart(2, '0')
|
||||
let totalSeconds = Math.floor(lapTime) / 100
|
||||
let minutes = Math.floor(totalSeconds / 60).toString().padStart(2, '0')
|
||||
let seconds = Math.floor(totalSeconds % 60).toString().padStart(2, '0')
|
||||
const lapTime = lapItem.modelData
|
||||
const _10ms = (Math.floor(lapTime) % 100).toString().padStart(2, '0')
|
||||
const totalSeconds = Math.floor(lapTime) / 100
|
||||
const minutes = Math.floor(totalSeconds / 60).toString().padStart(2, '0')
|
||||
const seconds = Math.floor(totalSeconds % 60).toString().padStart(2, '0')
|
||||
return `${minutes}:${seconds}.${_10ms}`
|
||||
}
|
||||
}
|
||||
@@ -154,12 +154,13 @@ Item {
|
||||
font.pixelSize: Appearance.font.pixelSize.smaller
|
||||
color: Appearance.colors.colPrimary
|
||||
text: {
|
||||
let lastTime = (lapItem.index != Pomodoro.stopwatchLaps.length - 1) ? Pomodoro.stopwatchLaps[lapItem.index + 1] : 0
|
||||
let lapTime = lapItem.modelData - lastTime
|
||||
let _10ms = (Math.floor(lapTime) % 100).toString().padStart(2, '0')
|
||||
let totalSeconds = Math.floor(lapTime) / 100
|
||||
let minutes = Math.floor(totalSeconds / 60).toString().padStart(2, '0')
|
||||
let seconds = Math.floor(totalSeconds % 60).toString().padStart(2, '0')
|
||||
const originalIndex = Pomodoro.stopwatchLaps.length - lapItem.index - 1
|
||||
const lastTime = originalIndex > 0 ? Pomodoro.stopwatchLaps[originalIndex - 1] : 0
|
||||
const lapTime = lapItem.modelData - lastTime
|
||||
const _10ms = (Math.floor(lapTime) % 100).toString().padStart(2, '0')
|
||||
const totalSeconds = Math.floor(lapTime) / 100
|
||||
const minutes = Math.floor(totalSeconds / 60).toString().padStart(2, '0')
|
||||
const seconds = Math.floor(totalSeconds % 60).toString().padStart(2, '0')
|
||||
return `+${minutes == "00" ? "" : minutes + ":"}${seconds}.${_10ms}`
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user