small component patches + code cleanup

This commit is contained in:
SomeElse
2026-05-17 22:30:27 +00:00
parent 262fd8afa0
commit 6db876fc8a
21 changed files with 469 additions and 465 deletions

View File

@@ -12,29 +12,21 @@ ModuleChip {
readonly property var cfg: Cfg.Config
readonly property string configPath:
Quickshell.env("HOME") + "/.config/quickshell/config/config.qml"
Process {
id: cryptoConfigWriter
running: false
onExited: (code) => {
if (code !== 0)
console.warn("[Crypto] Failed to patch config.qml (exit " + code + ")")
}
ConfigWriter {
id: configWriter
}
width: chipRow.implicitWidth + 24
height: cfg.moduleHeight
radius: panelRadius
color: hoverHandler.hovered ? (t.cryptoBgHover ?? "#15ffffff") : (t.cryptoBg ?? "transparent")
border.color: (hoverHandler.hovered || cryptoPopup.popupOpen) ? (t.cryptoBorderHover ?? t.accent ?? "#ffc19375") : (t.cryptoBorder ?? "transparent")
border.width: borderWidth
Behavior on width { NumberAnimation { duration: 250; easing.type: Easing.OutCubic } }
Behavior on color { ColorAnimation { duration: 150 } }
Behavior on border.color { ColorAnimation { duration: 150 } }
chipColor: t.cryptoBg
chipColorHovered: t.cryptoBgHover
chipBorderColor: t.cryptoBorder
chipBorderColorHovered: t.cryptoBorderHover
chipHoverEnabled: true
chipTapAction: () => cryptoPopup.toggle()
popupOpen: cryptoPopup.popupOpen
chipAnimWidth: true
property var localPairs: [{ coin: "bitcoin", currency: "usd" }]
property int activeCoinIndex: 0
@@ -46,18 +38,18 @@ ModuleChip {
: "usd"
property string localVsCur: "usd"
property int localDecimals: cfg.cryptoDecimals ?? 1
property int localRefreshSec: cfg.cryptoRefreshSec ?? 60
property bool localShowIcon: cfg.cryptoShowIcon ?? true
property int localDecimals: cfg.cryptoDecimals
property int localRefreshSec: cfg.cryptoRefreshSec
property bool localShowIcon: cfg.cryptoShowIcon
function resolveWithPersistence() {
root.localPairs = Array.isArray(cfg.cryptoPairs) && cfg.cryptoPairs.length > 0 ? cfg.cryptoPairs : [{ coin: "bitcoin", currency: "usd" }]
root.localVsCur = root.localPairs[0].currency
root.displayCurrency = root.localPairs[0].currency
root.activeCoinIndex = 0
root.localDecimals = cfg.cryptoDecimals ?? 1
root.localRefreshSec = cfg.cryptoRefreshSec ?? 60
root.localShowIcon = cfg.cryptoShowIcon ?? true
root.localDecimals = cfg.cryptoDecimals
root.localRefreshSec = cfg.cryptoRefreshSec
root.localShowIcon = cfg.cryptoShowIcon
}
function persistSettings() {
@@ -65,30 +57,17 @@ ModuleChip {
const decimals = Math.round(root.localDecimals)
const refreshSec = Math.round(root.localRefreshSec)
const showIcon = root.localShowIcon
const cfgPath = root.configPath
const pairsQml = "[" + pairs.map(p =>
'{ coin: "' + p.coin + '", currency: "' + p.currency + '" }'
).join(", ") + "]"
const sh =
"CFG=" + JSON.stringify(cfgPath) + "\n" +
"sed -i" +
" -e 's/\\(property int[ ]\\+cryptoDecimals:[ ]\\+\\)[0-9.]\\+/\\1" + decimals.toString() + "/'" +
" -e 's/\\(property int[ ]\\+cryptoRefreshSec:[ ]\\+\\)[0-9.]\\+/\\1" + refreshSec.toString() + "/'" +
" -e 's/\\(property bool[ ]\\+cryptoShowIcon:[ ]\\+\\)\\(true\\|false\\)/\\1" + (showIcon ? "true" : "false") + "/'" +
" \"$CFG\"\n" +
"QS_PAIRS='" + pairsQml + "'\n" +
"awk -v pairs=\"$QS_PAIRS\" '" +
"/property var cryptoPairs:/{print \" property var cryptoPairs: \"pairs;sk=/\\]/?0:1;next}" +
"sk&&/\\]/{sk=0;next}" +
"sk{next}" +
"{print}'" +
" \"$CFG\" > \"${CFG}.tmp\" && mv \"${CFG}.tmp\" \"$CFG\"\n"
cryptoConfigWriter.command = ["/bin/sh", "-c", sh]
cryptoConfigWriter.running = true
configWriter.writeInts([
{ key: "cryptoDecimals", value: decimals },
{ key: "cryptoRefreshSec", value: refreshSec }
])
configWriter.writeBool("cryptoShowIcon", showIcon)
configWriter.writeArray("cryptoPairs", pairsQml)
}
property real price: -1
@@ -222,12 +201,6 @@ ModuleChip {
onLocalRefreshSecChanged: refreshTimer.restart()
HoverHandler {
id: hoverHandler
cursorShape: Qt.PointingHandCursor
}
TapHandler { onTapped: cryptoPopup.toggle() }
RowLayout {
id: chipRow
anchors.centerIn: parent
@@ -250,7 +223,7 @@ ModuleChip {
Text {
visible: root.localShowIcon
text: "󰿤"
color: t.cryptoIcon ?? t.accent ?? "#ffc19375"
color: t.cryptoIcon
font.pixelSize: 14
Layout.alignment: Qt.AlignVCenter
Layout.rightMargin: 7
@@ -258,14 +231,14 @@ ModuleChip {
Text {
text: root.coinSymbol + "/" + root.displayCurrency.toUpperCase() + ": "
color: t.cryptoLabel ?? t.textDim ?? "#997a8996"
color: t.cryptoLabel
font.pixelSize: 12
verticalAlignment: Text.AlignVCenter
}
Text {
text: root.hasError ? "err" : root.price < 0 ? "…" : root.compactPrice(root.price)
color: t.cryptoValue ?? t.textMain ?? "#ffe8eef2"
color: t.cryptoValue
font.pixelSize: 13
font.bold: true
verticalAlignment: Text.AlignVCenter
@@ -274,7 +247,7 @@ ModuleChip {
Text {
visible: root.price >= 0
text: root.change24h >= 0 ? "▲" : "▼"
color: root.change24h >= 0 ? (t.cryptoUp ?? "#ffb4c9a1") : (t.cryptoDown ?? "#fff38ba8")
color: root.change24h >= 0 ? (t.cryptoUp) : (t.cryptoDown)
font.pixelSize: 9
verticalAlignment: Text.AlignVCenter
Layout.alignment: Qt.AlignVCenter
@@ -284,37 +257,19 @@ ModuleChip {
}
PopupPanel {
StandardPopup {
id: cryptoPopup
ns: "crypto"
chipRoot: root
cardWidth: 300
hasKeyboardFocus: true
cardColor: t.cryptoPopupBg
cardBorderColor: t.cryptoPopupBorder
cardHeight: cardCol.implicitHeight + 24
layerEnabled: true
function open() {
popupCenterX = root.mapToItem(null, 0, 0).x + root.width / 2
_doOpen()
}
PopupCard {
id: card
popupOpen: cryptoPopup.popupOpen
isTop: root.isTop
animEnabled: cryptoPopup.visible
height: cardCol.implicitHeight + 24
Behavior on height { NumberAnimation { duration: 220; easing.type: Easing.OutCubic } }
color: t.cryptoPopupBg ?? t.calCardBg ?? "#cc0c0e12"
radius: Cfg.Config.popupRadius
border.color: t.cryptoPopupBorder ?? t.calCardBorder ?? "transparent"
border.width: Cfg.Config.popupBorderWidth
layer.enabled: true
property int activeTab: 0
ColumnLayout {
id: cardCol
ColumnLayout {
id: cardCol
anchors { left: parent.left; right: parent.right; top: parent.top }
anchors.margins: 16
anchors.topMargin: 16
@@ -324,7 +279,7 @@ ModuleChip {
Layout.fillWidth: true
height: 30
radius: 10
color: t.cryptoFieldBg ?? "#15ffffff"
color: t.cryptoFieldBg
RowLayout {
anchors.fill: parent
@@ -338,16 +293,16 @@ ModuleChip {
height: 24
radius: 8
readonly property bool active: card.activeTab === tabIndex
readonly property bool active: cryptoPopup.activeTab === tabIndex
color: active
? (t.accent ?? "#ffc19375")
: (tm.containsMouse ? (t.cryptoFieldBgFocus ?? "#22ffffff") : "transparent")
? (t.accent)
: (tm.containsMouse ? (t.cryptoFieldBgFocus) : "transparent")
Behavior on color { ColorAnimation { duration: 130 } }
Text {
anchors.centerIn: parent
text: parent.label
color: parent.active ? (t.cryptoTextOnAccent ?? "#ff0c0e12") : (t.cryptoPopupDim ?? t.textDim ?? "#997a8996")
color: parent.active ? (t.cryptoTextOnAccent) : (t.cryptoPopupDim)
font.pixelSize: 11
font.bold: parent.active
Behavior on color { ColorAnimation { duration: 130 } }
@@ -356,7 +311,7 @@ ModuleChip {
id: tm
anchors.fill: parent; hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: card.activeTab = tabIndex
onClicked: cryptoPopup.activeTab = tabIndex
}
}
@@ -376,8 +331,8 @@ ModuleChip {
ColumnLayout {
id: priceContent
width: tabContainer.width
x: card.activeTab === 0 ? 0 : -tabContainer.width
opacity: card.activeTab === 0 ? 1.0 : 0.0
x: cryptoPopup.activeTab === 0 ? 0 : -tabContainer.width
opacity: cryptoPopup.activeTab === 0 ? 1.0 : 0.0
Behavior on x { NumberAnimation { duration: 260; easing.type: Easing.OutCubic } }
Behavior on opacity { NumberAnimation { duration: 200; easing.type: Easing.OutCubic } }
spacing: 10
@@ -387,7 +342,7 @@ ModuleChip {
Text {
text: "󰿤"
color: t.cryptoIcon ?? t.accent ?? "#ffc19375"
color: t.cryptoIcon
font.pixelSize: 22
Layout.alignment: Qt.AlignVCenter
}
@@ -399,13 +354,13 @@ ModuleChip {
Text {
text: root.coinSymbol + " / " + root.displayCurrency.toUpperCase()
color: t.cryptoPopupHeader ?? t.clockPopupHeader ?? "#ffc19375"
color: t.cryptoPopupHeader
font.pixelSize: 15
font.bold: true
}
Text {
text: root.coinName !== "" ? root.coinName : (root.localCoinId.charAt(0).toUpperCase() + root.localCoinId.slice(1))
color: t.cryptoPopupDim ?? t.textDim ?? "#997a8996"
color: t.cryptoPopupDim
font.pixelSize: 11
}
}
@@ -413,13 +368,13 @@ ModuleChip {
Rectangle {
width: badge.implicitWidth + 12
height: 22; radius: 11
color: root.change24h >= 0 ? (t.cryptoUpBg ?? "#22b4c9a1") : (t.cryptoDownBg ?? "#22f38ba8")
color: root.change24h >= 0 ? (t.cryptoUpBg) : (t.cryptoDownBg)
Text {
id: badge
anchors.centerIn: parent
text: (root.change24h >= 0 ? "▲ +" : "▼ ") + root.change24h.toFixed(2) + "%"
color: root.change24h >= 0 ? (t.cryptoUp ?? "#ffb4c9a1") : (t.cryptoDown ?? "#fff38ba8")
color: root.change24h >= 0 ? (t.cryptoUp) : (t.cryptoDown)
font.pixelSize: 11
font.bold: true
}
@@ -430,20 +385,20 @@ ModuleChip {
Layout.fillWidth: true
horizontalAlignment: Text.AlignHCenter
text: root.price < 0 ? "Loading…" : root.displayCurrency.toUpperCase() + " " + root.fullPrice(root.price)
color: t.cryptoPopupText ?? t.textMain ?? "#ffe8eef2"
color: t.cryptoPopupText
font.pixelSize: 24
font.bold: true
font.family: "monospace"
}
Rectangle { Layout.fillWidth: true; height: 1; color: t.calSeparator ?? "#334a5d6e" }
Rectangle { Layout.fillWidth: true; height: 1; color: t.calSeparator }
component StatRow: RowLayout {
property string label: ""
property string value: ""
Layout.fillWidth: true
Text { text: label; color: t.cryptoPopupDim ?? t.textDim ?? "#997a8996"; font.pixelSize: 12; Layout.fillWidth: true }
Text { text: value; color: t.cryptoPopupText ?? t.textMain ?? "#ffe8eef2"; font.pixelSize: 12; font.bold: true; font.family: "monospace" }
Text { text: label; color: t.cryptoPopupDim; font.pixelSize: 12; Layout.fillWidth: true }
Text { text: value; color: t.cryptoPopupText; font.pixelSize: 12; font.bold: true; font.family: "monospace" }
}
StatRow { label: "Rank"; value: root.rank > 0 ? "#" + root.rank : "—" }
@@ -455,16 +410,16 @@ ModuleChip {
RowLayout {
Layout.fillWidth: true
Text { text: "ATH"; color: t.cryptoPopupDim ?? t.textDim ?? "#997a8996"; font.pixelSize: 12; Layout.fillWidth: true }
Text { text: "ATH"; color: t.cryptoPopupDim; font.pixelSize: 12; Layout.fillWidth: true }
Text {
text: root.ath > 0 ? root.fullPrice(root.ath) : "—"
color: t.cryptoPopupText ?? t.textMain ?? "#ffe8eef2"
color: t.cryptoPopupText
font.pixelSize: 12; font.bold: true; font.family: "monospace"
}
Text {
visible: root.ath > 0
text: "(" + root.athChange.toFixed(2) + "%)"
color: t.cryptoDown ?? "#fff38ba8"
color: t.cryptoDown
font.pixelSize: 11; font.bold: true; font.family: "monospace"
}
}
@@ -477,14 +432,14 @@ ModuleChip {
Layout.fillWidth: true
Text {
text: "24h Range"
color: t.cryptoPopupDim ?? t.textDim ?? "#997a8996"
color: t.cryptoPopupDim
font.pixelSize: 12
Layout.fillWidth: true
}
Text {
visible: root.high24h > root.low24h && root.price >= 0
text: ((root.price - root.low24h) / (root.high24h - root.low24h) * 100).toFixed(1) + "% of range"
color: t.cryptoPopupDim ?? t.textDim ?? "#997a8996"
color: t.cryptoPopupDim
font.pixelSize: 11
}
}
@@ -496,15 +451,15 @@ ModuleChip {
Rectangle {
anchors.fill: parent
radius: 3
color: t.cryptoRangeTrack ?? "#1affffff"
color: t.cryptoRangeTrack
}
Rectangle {
height: parent.height
radius: 3
color: root.change24h >= 0
? (t.cryptoUp ?? "#ffb4c9a1")
: (t.cryptoDown ?? "#fff38ba8")
? (t.cryptoUp)
: (t.cryptoDown)
width: (root.high24h > root.low24h && root.price >= 0)
? Math.max(radius * 2,
Math.min(parent.width,
@@ -519,28 +474,28 @@ ModuleChip {
Layout.fillWidth: true
Text {
text: root.low24h > 0 ? root.fullPrice(root.low24h) : "—"
color: t.cryptoDown ?? "#fff38ba8"
color: t.cryptoDown
font.pixelSize: 10
font.family: "monospace"
}
Item { Layout.fillWidth: true }
Text {
text: root.high24h > 0 ? root.fullPrice(root.high24h) : "—"
color: t.cryptoUp ?? "#ffb4c9a1"
color: t.cryptoUp
font.pixelSize: 10
font.family: "monospace"
}
}
}
Rectangle { Layout.fillWidth: true; height: 1; color: t.calSeparator ?? "#334a5d6e" }
Rectangle { Layout.fillWidth: true; height: 1; color: t.calSeparator }
RowLayout {
Layout.fillWidth: true
Text {
text: root.hasError ? "⚠ fetch error" : "Updated " + (root.lastUpdated || "—")
color: t.cryptoPopupDim ?? t.textDim ?? "#997a8996"
color: t.cryptoPopupDim
font.pixelSize: 11
Layout.fillWidth: true
}
@@ -549,7 +504,7 @@ ModuleChip {
id: refreshBtn
width: 26; height: 26; radius: 8
color: rMouse.containsMouse
? (rMouse.pressed ? (t.accent ?? "#ffc19375") : (t.cryptoFieldBgFocus ?? "#22ffffff"))
? (rMouse.pressed ? (t.accent) : (t.cryptoFieldBgFocus))
: "transparent"
Behavior on color { ColorAnimation { duration: 120 } }
@@ -557,7 +512,7 @@ ModuleChip {
id: refreshIcon
anchors.centerIn: parent
text: "󰑐"
color: t.cryptoIcon ?? t.accent ?? "#ffc19375"
color: t.cryptoIcon
font.pixelSize: 14
RotationAnimator {
@@ -585,8 +540,8 @@ ModuleChip {
ColumnLayout {
id: settingsContent
width: tabContainer.width
x: card.activeTab === 1 ? 0 : tabContainer.width
opacity: card.activeTab === 1 ? 1.0 : 0.0
x: cryptoPopup.activeTab === 1 ? 0 : tabContainer.width
opacity: cryptoPopup.activeTab === 1 ? 1.0 : 0.0
Behavior on x { NumberAnimation { duration: 260; easing.type: Easing.OutCubic } }
Behavior on opacity { NumberAnimation { duration: 200; easing.type: Easing.OutCubic } }
spacing: 12
@@ -600,7 +555,7 @@ ModuleChip {
Text {
text: label
color: t.cryptoPopupDim ?? t.textDim ?? "#997a8996"
color: t.cryptoPopupDim
font.pixelSize: 11
font.capitalization: Font.AllUppercase
}
@@ -609,8 +564,8 @@ ModuleChip {
Layout.fillWidth: true
height: 30
radius: 8
color: fi.activeFocus ? (t.cryptoFieldBgFocus ?? "#22ffffff") : (t.cryptoFieldBg ?? "#15ffffff")
border.color: fi.activeFocus ? (t.accent ?? "#ffc19375") : "transparent"
color: fi.activeFocus ? (t.cryptoFieldBgFocus) : (t.cryptoFieldBg)
border.color: fi.activeFocus ? (t.accent) : "transparent"
border.width: 1
Behavior on color { ColorAnimation { duration: 120 } }
Behavior on border.color { ColorAnimation { duration: 120 } }
@@ -618,16 +573,16 @@ ModuleChip {
TextInput {
id: fi
anchors { fill: parent; leftMargin: 10; rightMargin: 10; topMargin: 7; bottomMargin: 7 }
color: t.cryptoPopupText ?? t.textMain ?? "#ffe8eef2"
color: t.cryptoPopupText
font.pixelSize: 12
font.family: "monospace"
selectionColor: t.accent ?? "#ffc19375"
selectionColor: t.accent
clip: true
Text {
anchors.fill: parent
text: parent.parent.parent.placeholder
color: t.cryptoPlaceholder ?? "#557a8996"
color: t.cryptoPlaceholder
font.pixelSize: 12
font.family: "monospace"
visible: fi.text === "" && !fi.activeFocus
@@ -645,26 +600,26 @@ ModuleChip {
signal stepped(int v)
Layout.fillWidth: true
Text { text: label; color: t.cryptoPopupDim ?? t.textDim ?? "#997a8996"; font.pixelSize: 12; Layout.fillWidth: true }
Text { text: label; color: t.cryptoPopupDim; font.pixelSize: 12; Layout.fillWidth: true }
Rectangle {
width: 24; height: 24; radius: 7
color: mm.containsMouse ? (mm.pressed ? (t.accent ?? "#ffc19375") : (t.cryptoFieldBgFocus ?? "#22ffffff")) : (t.cryptoFieldBg ?? "#15ffffff")
color: mm.containsMouse ? (mm.pressed ? (t.accent) : (t.cryptoFieldBgFocus)) : (t.cryptoFieldBg)
Behavior on color { ColorAnimation { duration: 100 } }
Text { anchors.centerIn: parent; text: ""; font.pixelSize: 14; font.bold: true; color: t.cryptoPopupText ?? t.textMain ?? "#ffe8eef2" }
Text { anchors.centerIn: parent; text: ""; font.pixelSize: 14; font.bold: true; color: t.cryptoPopupText }
MouseArea { id: mm; anchors.fill: parent; hoverEnabled: true; cursorShape: Qt.PointingHandCursor; onClicked: if (value > minVal) stepped(value - 1) }
}
Rectangle {
width: 54; height: 24; radius: 6; color: t.cryptoFieldBg ?? "#15ffffff"
Text { anchors.centerIn: parent; text: value; color: t.cryptoPopupText ?? t.textMain ?? "#ffe8eef2"; font.pixelSize: 12; font.bold: true; font.family: "monospace" }
width: 54; height: 24; radius: 6; color: t.cryptoFieldBg
Text { anchors.centerIn: parent; text: value; color: t.cryptoPopupText; font.pixelSize: 12; font.bold: true; font.family: "monospace" }
}
Rectangle {
width: 24; height: 24; radius: 7
color: pm.containsMouse ? (pm.pressed ? (t.accent ?? "#ffc19375") : (t.cryptoFieldBgFocus ?? "#22ffffff")) : (t.cryptoFieldBg ?? "#15ffffff")
color: pm.containsMouse ? (pm.pressed ? (t.accent) : (t.cryptoFieldBgFocus)) : (t.cryptoFieldBg)
Behavior on color { ColorAnimation { duration: 100 } }
Text { anchors.centerIn: parent; text: "+"; font.pixelSize: 14; font.bold: true; color: t.cryptoPopupText ?? t.textMain ?? "#ffe8eef2" }
Text { anchors.centerIn: parent; text: "+"; font.pixelSize: 14; font.bold: true; color: t.cryptoPopupText }
MouseArea { id: pm; anchors.fill: parent; hoverEnabled: true; cursorShape: Qt.PointingHandCursor; onClicked: if (value < maxVal) stepped(value + 1) }
}
}
@@ -675,11 +630,11 @@ ModuleChip {
signal toggled(bool v)
Layout.fillWidth: true
Text { text: label; color: t.cryptoPopupDim ?? t.textDim ?? "#997a8996"; font.pixelSize: 12; Layout.fillWidth: true }
Text { text: label; color: t.cryptoPopupDim; font.pixelSize: 12; Layout.fillWidth: true }
Rectangle {
width: 36; height: 20; radius: 10
color: checked ? (t.accent ?? "#ffc19375") : (t.cryptoFieldBgFocus ?? "#22ffffff")
color: checked ? (t.accent) : (t.cryptoFieldBgFocus)
Behavior on color { ColorAnimation { duration: 150 } }
Rectangle {
@@ -699,7 +654,7 @@ ModuleChip {
Text {
text: "Pairs to cycle"
color: t.cryptoPopupDim ?? t.textDim ?? "#997a8996"
color: t.cryptoPopupDim
font.pixelSize: 11
font.capitalization: Font.AllUppercase
}
@@ -718,7 +673,7 @@ ModuleChip {
width: 12; z: 2
gradient: Gradient {
orientation: Gradient.Horizontal
GradientStop { position: 0.0; color: t.cryptoPopupBg ?? "#cc0c0e12" }
GradientStop { position: 0.0; color: t.cryptoPopupBg }
GradientStop { position: 1.0; color: "transparent" }
}
visible: chipScroll.contentX > 0
@@ -729,7 +684,7 @@ ModuleChip {
gradient: Gradient {
orientation: Gradient.Horizontal
GradientStop { position: 0.0; color: "transparent" }
GradientStop { position: 1.0; color: t.cryptoPopupBg ?? "#cc0c0e12" }
GradientStop { position: 1.0; color: t.cryptoPopupBg }
}
visible: chipScroll.contentX < chipScroll.contentWidth - chipScroll.width - 1
}
@@ -761,7 +716,7 @@ ModuleChip {
id: dotSpace
anchors.verticalCenter: parent.verticalCenter
x: 0; width: 5; height: 5; radius: 3
color: isActive ? (t.accent ?? "#ffc19375") : "#33ffffff"
color: isActive ? (t.accent) : "#33ffffff"
Behavior on color { ColorAnimation { duration: 150 } }
}
@@ -771,8 +726,8 @@ ModuleChip {
x: dotSpace.width + 5
text: (modelData.coin ?? "?") + "/" + (modelData.currency ?? "?").toUpperCase()
color: isActive
? (t.accent ?? "#ffc19375")
: (t.cryptoPopupText ?? t.textMain ?? "#ffe8eef2")
? (t.accent)
: (t.cryptoPopupText)
font.pixelSize: 12
font.bold: isActive
font.family: "monospace"
@@ -784,12 +739,12 @@ ModuleChip {
anchors { right: parent.right
verticalCenter: parent.verticalCenter }
width: 14; height: 14; radius: 4
color: rmChipMouse.containsMouse ? (t.cryptoChipRemoveBg ?? "#44f38ba8") : "transparent"
color: rmChipMouse.containsMouse ? (t.cryptoChipRemoveBg) : "transparent"
Behavior on color { ColorAnimation { duration: 100 } }
Text {
anchors.centerIn: parent
text: "×"; font.pixelSize: 11; font.bold: true
color: t.cryptoDown ?? "#fff38ba8"
color: t.cryptoDown
}
MouseArea {
id: rmChipMouse
@@ -818,13 +773,13 @@ ModuleChip {
Rectangle {
anchors.fill: parent
radius: 2
color: t.cryptoFieldBg ?? "#15ffffff"
color: t.cryptoFieldBg
}
Rectangle {
height: parent.height
radius: 2
color: t.accent ?? "#ffc19375"
color: t.accent
opacity: 0.7
readonly property real ratio: chipScroll.width / Math.max(1, chipScroll.contentWidth)
@@ -846,7 +801,7 @@ ModuleChip {
Text {
text: "Coin ID"
color: t.cryptoPopupDim ?? t.textDim ?? "#997a8996"
color: t.cryptoPopupDim
font.pixelSize: 11
font.capitalization: Font.AllUppercase
}
@@ -854,8 +809,8 @@ ModuleChip {
Rectangle {
Layout.fillWidth: true
height: 30; radius: 8
color: addCoinInput.activeFocus ? (t.cryptoFieldBgFocus ?? "#22ffffff") : (t.cryptoFieldBg ?? "#15ffffff")
border.color: addCoinInput.activeFocus ? (t.accent ?? "#ffc19375") : "transparent"
color: addCoinInput.activeFocus ? (t.cryptoFieldBgFocus) : (t.cryptoFieldBg)
border.color: addCoinInput.activeFocus ? (t.accent) : "transparent"
border.width: 1
Behavior on color { ColorAnimation { duration: 120 } }
Behavior on border.color { ColorAnimation { duration: 120 } }
@@ -863,15 +818,15 @@ ModuleChip {
TextInput {
id: addCoinInput
anchors { fill: parent; leftMargin: 10; rightMargin: 10; topMargin: 7; bottomMargin: 7 }
color: t.cryptoPopupText ?? t.textMain ?? "#ffe8eef2"
color: t.cryptoPopupText
font.pixelSize: 12; font.family: "monospace"
selectionColor: t.accent ?? "#ffc19375"
selectionColor: t.accent
clip: true
Text {
anchors.fill: parent
text: "e.g. bitcoin, monero, solana"
color: t.cryptoPlaceholder ?? "#557a8996"
color: t.cryptoPlaceholder
font.pixelSize: 12; font.family: "monospace"
visible: parent.text === "" && !parent.activeFocus
verticalAlignment: Text.AlignVCenter
@@ -888,7 +843,7 @@ ModuleChip {
Text {
text: "Currency"
color: t.cryptoPopupDim ?? t.textDim ?? "#997a8996"
color: t.cryptoPopupDim
font.pixelSize: 11
font.capitalization: Font.AllUppercase
}
@@ -900,8 +855,8 @@ ModuleChip {
Rectangle {
Layout.fillWidth: true
height: 30; radius: 8
color: addCurrencyInput.activeFocus ? (t.cryptoFieldBgFocus ?? "#22ffffff") : (t.cryptoFieldBg ?? "#15ffffff")
border.color: addCurrencyInput.activeFocus ? (t.accent ?? "#ffc19375") : "transparent"
color: addCurrencyInput.activeFocus ? (t.cryptoFieldBgFocus) : (t.cryptoFieldBg)
border.color: addCurrencyInput.activeFocus ? (t.accent) : "transparent"
border.width: 1
Behavior on color { ColorAnimation { duration: 120 } }
Behavior on border.color { ColorAnimation { duration: 120 } }
@@ -909,15 +864,15 @@ ModuleChip {
TextInput {
id: addCurrencyInput
anchors { fill: parent; leftMargin: 10; rightMargin: 10; topMargin: 7; bottomMargin: 7 }
color: t.cryptoPopupText ?? t.textMain ?? "#ffe8eef2"
color: t.cryptoPopupText
font.pixelSize: 12; font.family: "monospace"
selectionColor: t.accent ?? "#ffc19375"
selectionColor: t.accent
clip: true
Text {
anchors.fill: parent
text: "e.g. usd, eur, brl"
color: t.cryptoPlaceholder ?? "#557a8996"
color: t.cryptoPlaceholder
font.pixelSize: 12; font.family: "monospace"
visible: parent.text === "" && !parent.activeFocus
verticalAlignment: Text.AlignVCenter
@@ -938,13 +893,13 @@ ModuleChip {
Rectangle {
width: 30; height: 30; radius: 8
color: addPairMouse.containsMouse
? (addPairMouse.pressed ? (t.accent ?? "#ffc19375") : (t.cryptoFieldBgFocus ?? "#22ffffff"))
: (t.cryptoFieldBg ?? "#15ffffff")
? (addPairMouse.pressed ? (t.accent) : (t.cryptoFieldBgFocus))
: (t.cryptoFieldBg)
Behavior on color { ColorAnimation { duration: 100 } }
Text {
anchors.centerIn: parent; text: "+"
font.pixelSize: 14; font.bold: true
color: t.cryptoPopupText ?? t.textMain ?? "#ffe8eef2"
color: t.cryptoPopupText
}
MouseArea {
id: addPairMouse
@@ -978,7 +933,7 @@ ModuleChip {
Text {
text: "Refresh (seconds)"
color: t.cryptoPopupDim ?? t.textDim ?? "#997a8996"
color: t.cryptoPopupDim
font.pixelSize: 12
Layout.fillWidth: true
}
@@ -986,10 +941,10 @@ ModuleChip {
Rectangle {
width: 24; height: 24; radius: 7
color: decMouse.containsMouse
? (decMouse.pressed ? (t.accent ?? "#ffc19375") : (t.cryptoFieldBgFocus ?? "#22ffffff"))
: (t.cryptoFieldBg ?? "#15ffffff")
? (decMouse.pressed ? (t.accent) : (t.cryptoFieldBgFocus))
: (t.cryptoFieldBg)
Behavior on color { ColorAnimation { duration: 100 } }
Text { anchors.centerIn: parent; text: ""; font.pixelSize: 14; font.bold: true; color: t.cryptoPopupText ?? t.textMain ?? "#ffe8eef2" }
Text { anchors.centerIn: parent; text: ""; font.pixelSize: 14; font.bold: true; color: t.cryptoPopupText }
MouseArea {
id: decMouse
anchors.fill: parent; hoverEnabled: true; cursorShape: Qt.PointingHandCursor
@@ -999,8 +954,8 @@ ModuleChip {
Rectangle {
width: 54; height: 24; radius: 6
color: refreshInput.activeFocus ? (t.cryptoFieldBgFocus ?? "#22ffffff") : (t.cryptoFieldBg ?? "#15ffffff")
border.color: refreshInput.activeFocus ? (t.accent ?? "#ffc19375") : "transparent"
color: refreshInput.activeFocus ? (t.cryptoFieldBgFocus) : (t.cryptoFieldBg)
border.color: refreshInput.activeFocus ? (t.accent) : "transparent"
border.width: 1
Behavior on color { ColorAnimation { duration: 120 } }
Behavior on border.color { ColorAnimation { duration: 120 } }
@@ -1009,11 +964,11 @@ ModuleChip {
id: refreshInput
anchors { fill: parent; leftMargin: 6; rightMargin: 6; topMargin: 4; bottomMargin: 4 }
text: root.localRefreshSec.toString()
color: t.cryptoPopupText ?? t.textMain ?? "#ffe8eef2"
color: t.cryptoPopupText
font.pixelSize: 12
font.bold: true
font.family: "monospace"
selectionColor: t.accent ?? "#ffc19375"
selectionColor: t.accent
horizontalAlignment: TextInput.AlignHCenter
inputMethodHints: Qt.ImhDigitsOnly
validator: IntValidator { bottom: 10; top: 3600 }
@@ -1048,10 +1003,10 @@ ModuleChip {
Rectangle {
width: 24; height: 24; radius: 7
color: incMouse.containsMouse
? (incMouse.pressed ? (t.accent ?? "#ffc19375") : (t.cryptoFieldBgFocus ?? "#22ffffff"))
: (t.cryptoFieldBg ?? "#15ffffff")
? (incMouse.pressed ? (t.accent) : (t.cryptoFieldBgFocus))
: (t.cryptoFieldBg)
Behavior on color { ColorAnimation { duration: 100 } }
Text { anchors.centerIn: parent; text: "+"; font.pixelSize: 14; font.bold: true; color: t.cryptoPopupText ?? t.textMain ?? "#ffe8eef2" }
Text { anchors.centerIn: parent; text: "+"; font.pixelSize: 14; font.bold: true; color: t.cryptoPopupText }
MouseArea {
id: incMouse
anchors.fill: parent; hoverEnabled: true; cursorShape: Qt.PointingHandCursor
@@ -1066,7 +1021,7 @@ ModuleChip {
onToggled: (v) => root.localShowIcon = v
}
Rectangle { Layout.fillWidth: true; height: 1; color: t.calSeparator ?? "#334a5d6e" }
Rectangle { Layout.fillWidth: true; height: 1; color: t.calSeparator }
Rectangle {
Layout.fillWidth: true
@@ -1074,15 +1029,15 @@ ModuleChip {
radius: 9
color: applyMouse.containsMouse
? (applyMouse.pressed
? Qt.darker(t.accent ?? "#ffc19375", 1.15)
: (t.accent ?? "#ffc19375"))
: (t.cryptoApplyIdleBg ?? "#33c19375")
? Qt.darker(t.accent, 1.15)
: (t.accent))
: (t.cryptoApplyIdleBg)
Behavior on color { ColorAnimation { duration: 130 } }
Text {
anchors.centerIn: parent
text: "Apply & Refresh"
color: applyMouse.containsMouse ? (t.cryptoTextOnAccent ?? "#ff0c0e12") : (t.cryptoPopupText ?? t.textMain ?? "#ffe8eef2")
color: applyMouse.containsMouse ? (t.cryptoTextOnAccent) : (t.cryptoPopupText)
font.pixelSize: 12
font.bold: true
Behavior on color { ColorAnimation { duration: 130 } }
@@ -1097,7 +1052,7 @@ ModuleChip {
root.coinSymbol = root.localCoinId.toUpperCase().slice(0, 4)
root.persistSettings()
root.fetchPrice()
card.activeTab = 0
cryptoPopup.activeTab = 0
}
}
}
@@ -1105,7 +1060,7 @@ ModuleChip {
Text {
Layout.alignment: Qt.AlignHCenter
text: "Reset to defaults"
color: t.cryptoPopupDim ?? t.textDim ?? "#997a8996"
color: t.cryptoPopupDim
font.pixelSize: 11
font.underline: true
@@ -1116,12 +1071,12 @@ ModuleChip {
root.localVsCur = "usd"
root.displayCurrency = root.localPairs.length > 0 ? root.localPairs[0].currency : "usd"
root.activeCoinIndex = 0
root.localDecimals = cfg.cryptoDecimals ?? 1
root.localRefreshSec = cfg.cryptoRefreshSec ?? 60
root.localShowIcon = cfg.cryptoShowIcon ?? true
root.localDecimals = cfg.cryptoDecimals
root.localRefreshSec = cfg.cryptoRefreshSec
root.localShowIcon = cfg.cryptoShowIcon
root.persistSettings()
root.price = -1
card.activeTab = 0
cryptoPopup.activeTab = 0
}
}
}
@@ -1130,6 +1085,5 @@ ModuleChip {
}
}
}
}
}
}