cleaned and optimized launcher + added actionsview on listview items on launcher. TAB to open it or right click. Added typing animation for Crypto.qml and also anchored the icon on the left so it doesnt keep moving around when changing sizes.
This commit is contained in:
@@ -16,7 +16,9 @@ ModuleChip {
|
||||
id: configWriter
|
||||
}
|
||||
|
||||
width: chipRow.implicitWidth + 24
|
||||
width: cryptoIcon.visible
|
||||
? (12 + cryptoIcon.implicitWidth + 7 + chipRow.implicitWidth + 12)
|
||||
: (chipRow.implicitWidth + 24)
|
||||
radius: panelRadius
|
||||
|
||||
chipColor: t.cryptoBg
|
||||
@@ -152,6 +154,7 @@ ModuleChip {
|
||||
if (root.localPairs.length <= 1) return
|
||||
root.activeCoinIndex = (root.activeCoinIndex - 1 + root.localPairs.length) % root.localPairs.length
|
||||
root._applyFromCache()
|
||||
root._restartTyping()
|
||||
rotateTimer.restart()
|
||||
}
|
||||
|
||||
@@ -159,6 +162,7 @@ ModuleChip {
|
||||
if (root.localPairs.length <= 1) return
|
||||
root.activeCoinIndex = (root.activeCoinIndex + 1) % root.localPairs.length
|
||||
root._applyFromCache()
|
||||
root._restartTyping()
|
||||
rotateTimer.restart()
|
||||
}
|
||||
|
||||
@@ -184,6 +188,51 @@ ModuleChip {
|
||||
sparklineData = entry.sparkline || []
|
||||
change7d = entry.change7d || 0
|
||||
hasError = false
|
||||
root._restartTyping()
|
||||
}
|
||||
|
||||
property bool _typing: false
|
||||
property int _typedLabel: 0
|
||||
property int _typedValue: 0
|
||||
property int _typedIcon: 0
|
||||
|
||||
function _restartTyping() {
|
||||
typeAnim.stop()
|
||||
_typing = true
|
||||
_typedLabel = 0
|
||||
_typedValue = 0
|
||||
_typedIcon = 0
|
||||
typeAnimLabel.to = (root.coinSymbol + "/" + root.displayCurrency.toUpperCase() + ": ").length
|
||||
typeAnimValue.to = (root.hasError ? "err" : root.price < 0 ? "…" : root.compactPrice(root.price)).length
|
||||
typeAnimIcon.to = (root.price >= 0 ? 1 : 0)
|
||||
typeAnim.start()
|
||||
}
|
||||
|
||||
SequentialAnimation {
|
||||
id: typeAnim
|
||||
onStopped: { root._typing = false }
|
||||
|
||||
NumberAnimation {
|
||||
id: typeAnimLabel
|
||||
target: root
|
||||
property: "_typedLabel"
|
||||
duration: 200
|
||||
easing.type: Easing.Linear
|
||||
}
|
||||
NumberAnimation {
|
||||
id: typeAnimValue
|
||||
target: root
|
||||
property: "_typedValue"
|
||||
duration: 200
|
||||
easing.type: Easing.Linear
|
||||
}
|
||||
NumberAnimation {
|
||||
id: typeAnimIcon
|
||||
target: root
|
||||
property: "_typedIcon"
|
||||
duration: 50
|
||||
easing.type: Easing.Linear
|
||||
}
|
||||
}
|
||||
|
||||
function fetchPrice() {
|
||||
@@ -291,9 +340,26 @@ ModuleChip {
|
||||
onLocalRefreshSecChanged: refreshTimer.restart()
|
||||
onLocalRotateSecChanged: rotateTimer.restart()
|
||||
|
||||
Text {
|
||||
id: cryptoIcon
|
||||
visible: root.localShowIcon
|
||||
text: ""
|
||||
color: t.cryptoIcon
|
||||
font.pixelSize: 14
|
||||
anchors {
|
||||
left: parent.left
|
||||
leftMargin: 12
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
}
|
||||
|
||||
RowLayout {
|
||||
id: chipRow
|
||||
anchors.centerIn: parent
|
||||
anchors {
|
||||
left: cryptoIcon.visible ? cryptoIcon.right : parent.left
|
||||
leftMargin: cryptoIcon.visible ? 7 : 12
|
||||
verticalCenter: parent.verticalCenter
|
||||
}
|
||||
spacing: 0
|
||||
|
||||
SequentialAnimation on opacity {
|
||||
@@ -310,34 +376,61 @@ ModuleChip {
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
visible: root.localShowIcon
|
||||
text: ""
|
||||
color: t.cryptoIcon
|
||||
font.pixelSize: 14
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
Layout.rightMargin: 7
|
||||
Item {
|
||||
implicitWidth: labelSizer.implicitWidth
|
||||
implicitHeight: labelSizer.implicitHeight
|
||||
|
||||
Text {
|
||||
id: labelSizer
|
||||
text: root.coinSymbol + "/" + root.displayCurrency.toUpperCase() + ": "
|
||||
color: "transparent"
|
||||
font.pixelSize: 12
|
||||
font.bold: true
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
|
||||
Text {
|
||||
text: root._typing
|
||||
? (root.coinSymbol + "/" + root.displayCurrency.toUpperCase() + ": ").substring(0, root._typedLabel)
|
||||
: root.coinSymbol + "/" + root.displayCurrency.toUpperCase() + ": "
|
||||
color: t.cryptoLabel
|
||||
font.pixelSize: 12
|
||||
font.bold: true
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
anchors.fill: labelSizer
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
implicitWidth: valueSizer.implicitWidth
|
||||
implicitHeight: valueSizer.implicitHeight
|
||||
|
||||
Text {
|
||||
id: valueSizer
|
||||
text: root.hasError ? "err" : root.price < 0 ? "…" : root.compactPrice(root.price)
|
||||
color: "transparent"
|
||||
font.pixelSize: 13
|
||||
font.bold: true
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
|
||||
Text {
|
||||
text: root._typing
|
||||
? (root.hasError ? "err" : root.price < 0 ? "…" : root.compactPrice(root.price)).substring(0, root._typedValue)
|
||||
: root.hasError ? "err" : root.price < 0 ? "…" : root.compactPrice(root.price)
|
||||
color: t.cryptoValue
|
||||
font.pixelSize: 13
|
||||
font.bold: true
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
anchors.fill: valueSizer
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
text: root.coinSymbol + "/" + root.displayCurrency.toUpperCase() + ": "
|
||||
color: t.cryptoLabel
|
||||
font.pixelSize: 12
|
||||
font.bold: true
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
|
||||
Text {
|
||||
text: root.hasError ? "err" : root.price < 0 ? "…" : root.compactPrice(root.price)
|
||||
color: t.cryptoValue
|
||||
font.pixelSize: 13
|
||||
font.bold: true
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
|
||||
Text {
|
||||
visible: root.price >= 0
|
||||
text: root.change24h >= 0 ? "▲" : "▼"
|
||||
visible: root._typing || root.price >= 0
|
||||
text: root._typing
|
||||
? (root.price >= 0 ? (root.change24h >= 0 ? "▲" : "▼") : "").substring(0, root._typedIcon)
|
||||
: (root.price >= 0 ? (root.change24h >= 0 ? "▲" : "▼") : "")
|
||||
color: root.change24h >= 0 ? (t.cryptoUp) : (t.cryptoDown)
|
||||
font.pixelSize: 9
|
||||
font.bold: true
|
||||
|
||||
Reference in New Issue
Block a user