123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- import QtQuick 2.5
- import Qt.labs.settings 1.0
- // Forgive me
- import "../.."
- View {
- id: root
- Component.onCompleted: {
- globalVars.globalDeathTimer = true
- }
- Settings {
- id: basicSettings
- category: "Basic"
- property bool animationEnabled: true
- property int animationDuration: 2000
- property int easingType: Easing.Linear
- }
- Component {
- id: columnComponent
- Item {
- id: column
- x: width * index
- height: parent.height
- width: parent.width/globalSettings.columnCount
- Item {
- id: artworkStack
- property var headElement
- property var pictureArray: []
- property int artworkHeight: 0
- property int compoundArtworkHeight: 0
- property bool full: artworkHeight > root.height
- property bool initialized: false
- Component.onCompleted: {
- columnArray.push(this)
- }
- onFullChanged: {
- if (!initialized) {
- initialized = true
- globalUtil.registerColumnPrimed()
- }
- }
- height: childrenRect.height
- width: parent.width
- function addImage() {
- var image = pictureDelegate.createObject(artworkStack)
- artworkHeight += image.height
- compoundArtworkHeight += image.height
- image.y = root.height - compoundArtworkHeight
- pictureArray.push(image)
- globalUtil.itemCount++
- }
- function removeImage(image) {
- image.destroy()
- globalUtil.itemCount--
- }
- function shift() {
- if (headElement) {
- removeImage(headElement)
- }
- headElement = pictureArray.shift()
- artworkHeight -= headElement.height
- while (!full) {
- addImage()
- }
- artworkStack.y += headElement.height
- }
- Timer {
- id: populateTimer
- running: !artworkStack.initialized
- repeat: true
- interval: 100
- onTriggered: artworkStack.addImage()
- }
- Timer {
- id: deathTimer
- running: !globalSettings.commonFeed && artworkStack.initialized
- repeat: true
- interval: globalUtil.adjustedInterval
- onTriggered: artworkStack.shift()
- }
- Behavior on y {
- enabled: artworkStack.initialized && basicSettings.animationEnabled
- NumberAnimation {
- duration: Math.min(globalUtil.adjustedInterval, basicSettings.animationDuration)
- easing.type: basicSettings.easingType
- }
- }
- }
- }
- }
- Keys.onUpPressed: globalSettings.interval++
- Keys.onDownPressed: globalSettings.interval = Math.max(1, globalSettings.interval - 1)
- }
|