Skip to content

Commit

Permalink
HEY, LOOK MA, I MADE IT! The bullets paginator is done and with progr…
Browse files Browse the repository at this point in the history
…ess feature.

The old progressbar is gonegit stash apply stash@{0}!
  • Loading branch information
NathanPB committed Nov 2, 2019
1 parent 18799c2 commit aed6892
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 57 deletions.
54 changes: 51 additions & 3 deletions plasma5-genial/contents/ui/BulletsDelegate.qml
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
import QtQuick 2.12

Rectangle {
id: root

property bool active: false
property int interval: 0
property int progress: 0

signal clicked()

width: 10
height: 10
width: active ? 13 : 10
height: width

color: active ? border.color : "transparent"
color: "transparent"

border.width: 2
border.color: "grey"
Expand All @@ -20,4 +23,49 @@ Rectangle {
anchors.fill: parent
onClicked: parent.clicked()
}

Canvas {
id: canvas

anchors.fill: parent
visible: parent.active
property var ctx
onAvailableChanged: if(available) ctx = getContext("2d")

onPaint: {
if(!ctx) return;
ctx.reset();

let centreX = width / 2;
let centreY = height / 2;
let paintedAngle = (progress * Math.PI * 2) / 100

ctx.beginPath();
ctx.fillStyle = "grey";
ctx.moveTo(centreX, centreY);
ctx.arc(centreX, centreY, centreX, Math.PI + Math.PI / 2, paintedAngle + Math.PI + Math.PI / 2, false);
ctx.lineTo(centreX, centreY);
ctx.fill();
}
}

Timer {
running: root.active
interval: 100
repeat: true

property int sumInterval: 0

onTriggered: {
if(sumInterval + interval > root.interval) {
sumInterval = 0
} else {
sumInterval += interval
}
root.progress = (sumInterval * interval) / root.interval
canvas.requestPaint();
}
}

anchors.verticalCenter: parent.verticalCenter
}
44 changes: 0 additions & 44 deletions plasma5-genial/contents/ui/TimerProgressBar.qml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,6 @@ AppRepresentation {
trackTitle: trackDataContainer.title
anchors.fill: parent


TimerProgressBar {
id: progressBar

targetValue: descriptionHolder.interval
running: !descriptionHolder.isEmpty
opacity: descriptionHolder.isEmpty ? 0 : 1
anchors.fill: parent
}

Row {

spacing: 8
Expand All @@ -55,6 +45,7 @@ AppRepresentation {
BulletsDelegate {
active: descriptionHolder.currentIndex === index
onClicked: descriptionHolder.currentIndex = index
interval: active ? descriptionHolder.interval : 0
}
}

Expand Down

0 comments on commit aed6892

Please sign in to comment.