Skip to content

Commit

Permalink
fix text flow and layout
Browse files Browse the repository at this point in the history
  • Loading branch information
AIIX committed Mar 9, 2021
1 parent 02c305d commit 7bbe7c9
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions ui/timer.qml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Mycroft.Delegate {
property var removeTimer: sessionData.remove_timer
property bool cancelAllTimers: false
property var previousTimer

function calculateCellHeight(count){
horizontalMode && count > 1 ? height / 2 : height || !horizontalMode && count > 1 ? height / 4 : height
if(horizontalMode && count > 1) {
Expand All @@ -42,13 +42,13 @@ Mycroft.Delegate {
previousTimer = sessionData.timer_data
}
}

onCancelAllTimersChanged: {
if(sessionData.cancelAllTimers){
timerModel.clear()
}
}

onRemoveTimerChanged: {
if(removeTimer != ""){
for (var i = 0; i < timerModel.count; i++) {
Expand All @@ -65,21 +65,21 @@ Mycroft.Delegate {
model: ListModel {
id: timerModel
}

delegate: Rectangle {
width: view.cellWidth
height: view.cellHeight
color: "transparent"
property var time_remaining_current
property var time_duration_current
property var time_remaining_negative: 0

Component.onCompleted: {
time_remaining_current = model.time_remaining
time_duration_current = model.timer_duration
countdownTimer.start()
}

Timer {
id: countdownTimer
interval: 1000
Expand Down Expand Up @@ -131,7 +131,7 @@ Mycroft.Delegate {
}
}
}

Rectangle {
id: timerBackground
width: view.cellWidth - Kirigami.Units.gridUnit
Expand All @@ -151,11 +151,11 @@ Mycroft.Delegate {
layer.effect: OpacityMask {
maskSource: timerBackground
}

Component.onCompleted: {
color = model.timer_color
}

Rectangle {
id: progressbar
height: parent.height * 0.1
Expand All @@ -176,7 +176,7 @@ Mycroft.Delegate {
horizontalAlignment: Text.AlignHCenter
width: timerBackground.width - (Kirigami.Units.largeSpacing + Kirigami.Units.smallSpacing)
height: parent.height * 0.35
font.pixelSize: contentWidth > (parent.width * 0.8) ? timerName.height * 0.4 : timerName.height * 0.6
font.pixelSize: parent.width * 0.15
font.weight: Font.Bold
maximumLineCount: 2
wrapMode: Text.WrapAnywhere
Expand All @@ -190,20 +190,20 @@ Mycroft.Delegate {
Label {
id: timeRemaining
anchors.horizontalCenter: timerBackground.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
anchors.top: timerName.bottom
horizontalAlignment: Text.AlignHCenter
width: timerBackground.width - Kirigami.Units.largeSpacing
color: "white"
font.family: "Noto Sans"
font.pixelSize: contentWidth > timerBackground.width ? parent.height * 0.15 : parent.height * 0.25
font.pixelSize: parent.width * 0.20
font.weight: Font.Bold

/* Flash the time remaining when the timer expires for a visual cue */
SequentialAnimation on opacity {
id: expireAnimation
running: false
loops: Animation.Infinite

onRunningChanged: {
if(running){
triggerGuiEvent("skill.mycrofttimer.expiredtimer", {"index": model.timer_index, "name": model.timer_name, "duration": model.timer_duration, "ordinal": model.timer_ordinal, "announced": model.timer_announced})
Expand Down

0 comments on commit 7bbe7c9

Please sign in to comment.