formatting
This commit is contained in:
parent
c0a068ddc0
commit
0fca050ce3
8 changed files with 93 additions and 103 deletions
|
|
@ -224,10 +224,10 @@ Singleton {
|
||||||
property string fontDefault: "Roboto" // Default font for all text
|
property string fontDefault: "Roboto" // Default font for all text
|
||||||
property string fontFixed: "DejaVu Sans Mono" // Fixed width font for terminal
|
property string fontFixed: "DejaVu Sans Mono" // Fixed width font for terminal
|
||||||
property string fontBillboard: "Inter" // Large bold font for clocks and prominent displays
|
property string fontBillboard: "Inter" // Large bold font for clocks and prominent displays
|
||||||
|
|
||||||
// Legacy compatibility
|
// Legacy compatibility
|
||||||
property string fontFamily: fontDefault // Keep for backward compatibility
|
property string fontFamily: fontDefault // Keep for backward compatibility
|
||||||
|
|
||||||
// Idle inhibitor state
|
// Idle inhibitor state
|
||||||
property bool idleInhibitorEnabled: false
|
property bool idleInhibitorEnabled: false
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,20 +34,15 @@ QtObject {
|
||||||
} else {
|
} else {
|
||||||
// Fallback to basic evaluation
|
// Fallback to basic evaluation
|
||||||
console.log("AdvancedMath not available, using basic eval")
|
console.log("AdvancedMath not available, using basic eval")
|
||||||
|
|
||||||
// Basic preprocessing for common functions
|
// Basic preprocessing for common functions
|
||||||
var processed = expression.trim()
|
var processed = expression.trim(
|
||||||
.replace(/\bpi\b/gi, Math.PI)
|
).replace(/\bpi\b/gi,
|
||||||
.replace(/\be\b/gi, Math.E)
|
Math.PI).replace(/\be\b/gi,
|
||||||
.replace(/\bsqrt\s*\(/g, 'Math.sqrt(')
|
Math.E).replace(/\bsqrt\s*\(/g,
|
||||||
.replace(/\bsin\s*\(/g, 'Math.sin(')
|
'Math.sqrt(').replace(/\bsin\s*\(/g,
|
||||||
.replace(/\bcos\s*\(/g, 'Math.cos(')
|
'Math.sin(').replace(/\bcos\s*\(/g,
|
||||||
.replace(/\btan\s*\(/g, 'Math.tan(')
|
'Math.cos(').replace(/\btan\s*\(/g, 'Math.tan(').replace(/\blog\s*\(/g, 'Math.log10(').replace(/\bln\s*\(/g, 'Math.log(').replace(/\bexp\s*\(/g, 'Math.exp(').replace(/\bpow\s*\(/g, 'Math.pow(').replace(/\babs\s*\(/g, 'Math.abs(')
|
||||||
.replace(/\blog\s*\(/g, 'Math.log10(')
|
|
||||||
.replace(/\bln\s*\(/g, 'Math.log(')
|
|
||||||
.replace(/\bexp\s*\(/g, 'Math.exp(')
|
|
||||||
.replace(/\bpow\s*\(/g, 'Math.pow(')
|
|
||||||
.replace(/\babs\s*\(/g, 'Math.abs(')
|
|
||||||
|
|
||||||
// Sanitize and evaluate
|
// Sanitize and evaluate
|
||||||
if (!/^[0-9+\-*/().\s\w,]+$/.test(processed)) {
|
if (!/^[0-9+\-*/().\s\w,]+$/.test(processed)) {
|
||||||
|
|
@ -90,15 +85,13 @@ QtObject {
|
||||||
"name": "Invalid expression",
|
"name": "Invalid expression",
|
||||||
"content": evaluation.error,
|
"content": evaluation.error,
|
||||||
"icon": "error",
|
"icon": "error",
|
||||||
"execute": function () {
|
"execute": function () {// Do nothing for invalid expressions
|
||||||
// Do nothing for invalid expressions
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const displayName = searchContext === "calc"
|
const displayName = searchContext
|
||||||
? `${expression} = ${evaluation.displayResult}`
|
=== "calc" ? `${expression} = ${evaluation.displayResult}` : `${expression} = ${evaluation.displayResult}`
|
||||||
: `${expression} = ${evaluation.displayResult}`
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"isCalculator": true,
|
"isCalculator": true,
|
||||||
|
|
@ -110,12 +103,10 @@ QtObject {
|
||||||
"execute": function () {
|
"execute": function () {
|
||||||
Quickshell.clipboardText = evaluation.displayResult
|
Quickshell.clipboardText = evaluation.displayResult
|
||||||
// Also copy using shell command for better compatibility
|
// Also copy using shell command for better compatibility
|
||||||
Quickshell.execDetached(["sh", "-lc", `printf %s ${evaluation.displayResult} | wl-copy -t text/plain;charset=utf-8`])
|
Quickshell.execDetached(
|
||||||
Quickshell.execDetached([
|
["sh", "-lc", `printf %s ${evaluation.displayResult} | wl-copy -t text/plain;charset=utf-8`])
|
||||||
"notify-send",
|
Quickshell.execDetached(
|
||||||
"Calculator",
|
["notify-send", "Calculator", `${expression} = ${evaluation.displayResult} (copied to clipboard)`])
|
||||||
`${expression} = ${evaluation.displayResult} (copied to clipboard)`
|
|
||||||
])
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -127,8 +118,7 @@ QtObject {
|
||||||
"name": "Calculator",
|
"name": "Calculator",
|
||||||
"content": "Try: sqrt(16), sin(1), cos(0), pi*2, exp(1), pow(2,8), abs(-5)",
|
"content": "Try: sqrt(16), sin(1), cos(0), pi*2, exp(1), pow(2,8), abs(-5)",
|
||||||
"icon": "calculate",
|
"icon": "calculate",
|
||||||
"execute": function () {
|
"execute": function () {// Do nothing for placeholder
|
||||||
// Do nothing for placeholder
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -149,7 +139,7 @@ QtObject {
|
||||||
// Handle direct math expressions after ">"
|
// Handle direct math expressions after ">"
|
||||||
const mathExpr = query.slice(1).trim()
|
const mathExpr = query.slice(1).trim()
|
||||||
const evaluation = evaluate(mathExpr)
|
const evaluation = evaluate(mathExpr)
|
||||||
|
|
||||||
if (evaluation.isValid) {
|
if (evaluation.isValid) {
|
||||||
results.push(createEntry(mathExpr, "direct"))
|
results.push(createEntry(mathExpr, "direct"))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -58,8 +58,9 @@ QtObject {
|
||||||
"type": 'text',
|
"type": 'text',
|
||||||
"timestamp": clip.timestamp,
|
"timestamp": clip.timestamp,
|
||||||
"index": index,
|
"index": index,
|
||||||
"textData": textContent, // Store the text data for the execute function
|
"textData": textContent,
|
||||||
"execute": function () {
|
"execute"// Store the text data for the execute function
|
||||||
|
: function () {
|
||||||
const text = this.textData || clip.content || clip
|
const text = this.textData || clip.content || clip
|
||||||
Quickshell.clipboardText = String(text)
|
Quickshell.clipboardText = String(text)
|
||||||
copyText(String(text))
|
copyText(String(text))
|
||||||
|
|
@ -77,8 +78,7 @@ QtObject {
|
||||||
"name": "No clipboard history",
|
"name": "No clipboard history",
|
||||||
"content": "No matching clipboard entries found",
|
"content": "No matching clipboard entries found",
|
||||||
"icon": "content_paste_off",
|
"icon": "content_paste_off",
|
||||||
"execute": function () {
|
"execute": function () {// Do nothing for empty state
|
||||||
// Do nothing for empty state
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -122,8 +122,7 @@ QtObject {
|
||||||
"name": ">clip",
|
"name": ">clip",
|
||||||
"content": "Clipboard history - browse and restore clipboard items",
|
"content": "Clipboard history - browse and restore clipboard items",
|
||||||
"icon": "content_paste",
|
"icon": "content_paste",
|
||||||
"execute": function () {
|
"execute": function () {// This should be handled by the parent component
|
||||||
// This should be handled by the parent component
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,12 +14,12 @@ import qs.Widgets
|
||||||
|
|
||||||
NLoader {
|
NLoader {
|
||||||
id: lockScreen
|
id: lockScreen
|
||||||
|
|
||||||
// Log state changes to help debug lock screen issues
|
// Log state changes to help debug lock screen issues
|
||||||
onIsLoadedChanged: {
|
onIsLoadedChanged: {
|
||||||
Logger.log("LockScreen", "State changed - isLoaded:", isLoaded)
|
Logger.log("LockScreen", "State changed - isLoaded:", isLoaded)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allow a small grace period after unlocking so the compositor releases the lock surfaces
|
// Allow a small grace period after unlocking so the compositor releases the lock surfaces
|
||||||
Timer {
|
Timer {
|
||||||
id: unloadAfterUnlockTimer
|
id: unloadAfterUnlockTimer
|
||||||
|
|
|
||||||
|
|
@ -101,15 +101,16 @@ Singleton {
|
||||||
if (!exists) {
|
if (!exists) {
|
||||||
// Normalize existing history and add the new image
|
// Normalize existing history and add the new image
|
||||||
const normalizedHistory = root.history.map(item => {
|
const normalizedHistory = root.history.map(item => {
|
||||||
if (typeof item === 'string') {
|
if (typeof item === 'string') {
|
||||||
return {
|
return {
|
||||||
"type": 'text',
|
"type": 'text',
|
||||||
"content": item,
|
"content": item,
|
||||||
"timestamp": new Date().getTime() - 1000 // Make it slightly older
|
"timestamp": new Date().getTime(
|
||||||
}
|
) - 1000 // Make it slightly older
|
||||||
}
|
}
|
||||||
return item
|
}
|
||||||
})
|
return item
|
||||||
|
})
|
||||||
root.history = [entry, ...normalizedHistory].slice(0, maxHistory)
|
root.history = [entry, ...normalizedHistory].slice(0, maxHistory)
|
||||||
saveHistory()
|
saveHistory()
|
||||||
}
|
}
|
||||||
|
|
@ -133,7 +134,7 @@ Singleton {
|
||||||
|
|
||||||
onExited: (exitCode, exitStatus) => {
|
onExited: (exitCode, exitStatus) => {
|
||||||
textProcess.isLoading = false
|
textProcess.isLoading = false
|
||||||
|
|
||||||
if (exitCode === 0) {
|
if (exitCode === 0) {
|
||||||
const content = String(stdout.text).trim()
|
const content = String(stdout.text).trim()
|
||||||
if (content && content.length > 0) {
|
if (content && content.length > 0) {
|
||||||
|
|
@ -154,15 +155,16 @@ Singleton {
|
||||||
if (!exists) {
|
if (!exists) {
|
||||||
// Normalize existing history entries
|
// Normalize existing history entries
|
||||||
const normalizedHistory = root.history.map(item => {
|
const normalizedHistory = root.history.map(item => {
|
||||||
if (typeof item === 'string') {
|
if (typeof item === 'string') {
|
||||||
return {
|
return {
|
||||||
"type": 'text',
|
"type": 'text',
|
||||||
"content": item,
|
"content": item,
|
||||||
"timestamp": new Date().getTime() - 1000 // Make it slightly older
|
"timestamp": new Date().getTime(
|
||||||
}
|
) - 1000 // Make it slightly older
|
||||||
}
|
}
|
||||||
return item
|
}
|
||||||
})
|
return item
|
||||||
|
})
|
||||||
|
|
||||||
root.history = [entry, ...normalizedHistory].slice(0, maxHistory)
|
root.history = [entry, ...normalizedHistory].slice(0, maxHistory)
|
||||||
saveHistory()
|
saveHistory()
|
||||||
|
|
@ -204,7 +206,7 @@ Singleton {
|
||||||
try {
|
try {
|
||||||
// Ensure we don't exceed the maximum history limit
|
// Ensure we don't exceed the maximum history limit
|
||||||
const limitedHistory = root.history.slice(0, maxHistory)
|
const limitedHistory = root.history.slice(0, maxHistory)
|
||||||
|
|
||||||
historyAdapter.history = limitedHistory
|
historyAdapter.history = limitedHistory
|
||||||
historyAdapter.timestamp = Time.timestamp
|
historyAdapter.timestamp = Time.timestamp
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,7 @@ Singleton {
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
Logger.log("IdleInhibitor", "Service started")
|
Logger.log("IdleInhibitor", "Service started")
|
||||||
detectStrategy()
|
detectStrategy()
|
||||||
|
|
||||||
// Restore previous state from settings
|
// Restore previous state from settings
|
||||||
if (Settings.data.ui.idleInhibitorEnabled) {
|
if (Settings.data.ui.idleInhibitorEnabled) {
|
||||||
addInhibitor("manual", "Restored from previous session")
|
addInhibitor("manual", "Restored from previous session")
|
||||||
|
|
@ -37,18 +37,20 @@ Singleton {
|
||||||
Logger.log("IdleInhibitor", "Using systemd-inhibit strategy")
|
Logger.log("IdleInhibitor", "Using systemd-inhibit strategy")
|
||||||
return
|
return
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
||||||
// systemd-inhibit not found, try Wayland tools
|
// systemd-inhibit not found, try Wayland tools
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var waylandResult = Quickshell.execDetached(["which", "wayhibitor"])
|
var waylandResult = Quickshell.execDetached(["which", "wayhibitor"])
|
||||||
strategy = "wayland"
|
strategy = "wayland"
|
||||||
Logger.log("IdleInhibitor", "Using wayhibitor strategy")
|
Logger.log("IdleInhibitor", "Using wayhibitor strategy")
|
||||||
return
|
return
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|
||||||
// wayhibitor not found
|
// wayhibitor not found
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.warn("IdleInhibitor", "No suitable inhibitor found - will try systemd as fallback")
|
Logger.warn("IdleInhibitor", "No suitable inhibitor found - will try systemd as fallback")
|
||||||
strategy = "systemd" // Fallback to systemd even if not detected
|
strategy = "systemd" // Fallback to systemd even if not detected
|
||||||
}
|
}
|
||||||
|
|
@ -84,9 +86,10 @@ Singleton {
|
||||||
// Update the actual system inhibition
|
// Update the actual system inhibition
|
||||||
function updateInhibition(newReason = reason) {
|
function updateInhibition(newReason = reason) {
|
||||||
const shouldInhibit = activeInhibitors.length > 0
|
const shouldInhibit = activeInhibitors.length > 0
|
||||||
|
|
||||||
if (shouldInhibit === isInhibited) {
|
if (shouldInhibit === isInhibited) {
|
||||||
return // No change needed
|
return
|
||||||
|
// No change needed
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shouldInhibit) {
|
if (shouldInhibit) {
|
||||||
|
|
@ -99,7 +102,7 @@ Singleton {
|
||||||
// Start system inhibition
|
// Start system inhibition
|
||||||
function startInhibition(newReason) {
|
function startInhibition(newReason) {
|
||||||
reason = newReason
|
reason = newReason
|
||||||
|
|
||||||
if (strategy === "systemd") {
|
if (strategy === "systemd") {
|
||||||
startSystemdInhibition()
|
startSystemdInhibition()
|
||||||
} else if (strategy === "wayland") {
|
} else if (strategy === "wayland") {
|
||||||
|
|
@ -108,32 +111,28 @@ Singleton {
|
||||||
Logger.warn("IdleInhibitor", "No inhibition strategy available")
|
Logger.warn("IdleInhibitor", "No inhibition strategy available")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
isInhibited = true
|
isInhibited = true
|
||||||
Logger.log("IdleInhibitor", "Started inhibition:", reason)
|
Logger.log("IdleInhibitor", "Started inhibition:", reason)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Stop system inhibition
|
// Stop system inhibition
|
||||||
function stopInhibition() {
|
function stopInhibition() {
|
||||||
if (!isInhibited) return
|
if (!isInhibited)
|
||||||
|
return
|
||||||
|
|
||||||
if (inhibitorProcess.running) {
|
if (inhibitorProcess.running) {
|
||||||
inhibitorProcess.signal(15) // SIGTERM
|
inhibitorProcess.signal(15) // SIGTERM
|
||||||
}
|
}
|
||||||
|
|
||||||
isInhibited = false
|
isInhibited = false
|
||||||
Logger.log("IdleInhibitor", "Stopped inhibition")
|
Logger.log("IdleInhibitor", "Stopped inhibition")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Systemd inhibition using systemd-inhibit
|
// Systemd inhibition using systemd-inhibit
|
||||||
function startSystemdInhibition() {
|
function startSystemdInhibition() {
|
||||||
inhibitorProcess.command = [
|
inhibitorProcess.command = ["systemd-inhibit", "--what=idle:sleep:handle-lid-switch", "--why="
|
||||||
"systemd-inhibit",
|
+ reason, "--mode=block", "sleep", "infinity"]
|
||||||
"--what=idle:sleep:handle-lid-switch",
|
|
||||||
"--why=" + reason,
|
|
||||||
"--mode=block",
|
|
||||||
"sleep", "infinity"
|
|
||||||
]
|
|
||||||
inhibitorProcess.running = true
|
inhibitorProcess.running = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -147,15 +146,15 @@ Singleton {
|
||||||
Process {
|
Process {
|
||||||
id: inhibitorProcess
|
id: inhibitorProcess
|
||||||
running: false
|
running: false
|
||||||
|
|
||||||
onExited: function(exitCode, exitStatus) {
|
onExited: function (exitCode, exitStatus) {
|
||||||
if (isInhibited) {
|
if (isInhibited) {
|
||||||
Logger.warn("IdleInhibitor", "Inhibitor process exited unexpectedly:", exitCode)
|
Logger.warn("IdleInhibitor", "Inhibitor process exited unexpectedly:", exitCode)
|
||||||
isInhibited = false
|
isInhibited = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onStarted: function() {
|
onStarted: function () {
|
||||||
Logger.log("IdleInhibitor", "Inhibitor process started successfully")
|
Logger.log("IdleInhibitor", "Inhibitor process started successfully")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -47,4 +47,4 @@ Image {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ RowLayout {
|
||||||
property bool enabled: true
|
property bool enabled: true
|
||||||
property bool hovering: false
|
property bool hovering: false
|
||||||
property int baseSize: Style.baseWidgetSize
|
property int baseSize: Style.baseWidgetSize
|
||||||
|
|
||||||
// Convenience properties for common naming
|
// Convenience properties for common naming
|
||||||
property alias minimum: spinBox.from
|
property alias minimum: spinBox.from
|
||||||
property alias maximum: spinBox.to
|
property alias maximum: spinBox.to
|
||||||
|
|
@ -55,10 +55,10 @@ RowLayout {
|
||||||
// Value
|
// Value
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: spinBoxContainer
|
id: spinBoxContainer
|
||||||
|
|
||||||
implicitWidth: 100 * scaling // Wider for better proportions
|
implicitWidth: 100 * scaling // Wider for better proportions
|
||||||
implicitHeight: (root.baseSize - 4) * scaling // Slightly shorter than toggle
|
implicitHeight: (root.baseSize - 4) * scaling // Slightly shorter than toggle
|
||||||
radius: height * 0.5 // Fully rounded like toggle
|
radius: height * 0.5 // Fully rounded like toggle
|
||||||
color: Color.mSurfaceVariant
|
color: Color.mSurfaceVariant
|
||||||
border.color: root.hovering ? Color.mPrimary : Color.mOutline
|
border.color: root.hovering ? Color.mPrimary : Color.mOutline
|
||||||
border.width: 1
|
border.width: 1
|
||||||
|
|
@ -83,7 +83,7 @@ RowLayout {
|
||||||
root.hovering = false
|
root.hovering = false
|
||||||
root.exited()
|
root.exited()
|
||||||
}
|
}
|
||||||
onWheel: function(wheel) {
|
onWheel: function (wheel) {
|
||||||
if (wheel.angleDelta.y > 0 && spinBox.value < spinBox.to) {
|
if (wheel.angleDelta.y > 0 && spinBox.value < spinBox.to) {
|
||||||
spinBox.increase()
|
spinBox.increase()
|
||||||
} else if (wheel.angleDelta.y < 0 && spinBox.value > spinBox.from) {
|
} else if (wheel.angleDelta.y < 0 && spinBox.value > spinBox.from) {
|
||||||
|
|
@ -95,29 +95,29 @@ RowLayout {
|
||||||
// Decrease button (left)
|
// Decrease button (left)
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: decreaseButton
|
id: decreaseButton
|
||||||
width: parent.height * 0.8 // Make it circular
|
width: parent.height * 0.8 // Make it circular
|
||||||
height: parent.height * 0.8
|
height: parent.height * 0.8
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.leftMargin: parent.height * 0.1
|
anchors.leftMargin: parent.height * 0.1
|
||||||
radius: width * 0.5 // Perfect circle
|
radius: width * 0.5 // Perfect circle
|
||||||
color: decreaseArea.containsMouse ? Color.mPrimary : "transparent"
|
color: decreaseArea.containsMouse ? Color.mPrimary : "transparent"
|
||||||
opacity: root.enabled && spinBox.value > spinBox.from ? 1.0 : 0.3
|
opacity: root.enabled && spinBox.value > spinBox.from ? 1.0 : 0.3
|
||||||
|
|
||||||
Behavior on color {
|
Behavior on color {
|
||||||
ColorAnimation {
|
ColorAnimation {
|
||||||
duration: Style.animationFast
|
duration: Style.animationFast
|
||||||
easing.type: Easing.InOutCubic
|
easing.type: Easing.InOutCubic
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NIcon {
|
NIcon {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
text: "remove"
|
text: "remove"
|
||||||
font.pointSize: Style.fontSizeS * scaling
|
font.pointSize: Style.fontSizeS * scaling
|
||||||
color: decreaseArea.containsMouse ? Color.mOnPrimary : Color.mPrimary
|
color: decreaseArea.containsMouse ? Color.mOnPrimary : Color.mPrimary
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: decreaseArea
|
id: decreaseArea
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
@ -127,33 +127,33 @@ RowLayout {
|
||||||
onClicked: spinBox.decrease()
|
onClicked: spinBox.decrease()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Increase button (right)
|
// Increase button (right)
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: increaseButton
|
id: increaseButton
|
||||||
width: parent.height * 0.8 // Make it circular
|
width: parent.height * 0.8 // Make it circular
|
||||||
height: parent.height * 0.8
|
height: parent.height * 0.8
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
anchors.rightMargin: parent.height * 0.1
|
anchors.rightMargin: parent.height * 0.1
|
||||||
radius: width * 0.5 // Perfect circle
|
radius: width * 0.5 // Perfect circle
|
||||||
color: increaseArea.containsMouse ? Color.mPrimary : "transparent"
|
color: increaseArea.containsMouse ? Color.mPrimary : "transparent"
|
||||||
opacity: root.enabled && spinBox.value < spinBox.to ? 1.0 : 0.3
|
opacity: root.enabled && spinBox.value < spinBox.to ? 1.0 : 0.3
|
||||||
|
|
||||||
Behavior on color {
|
Behavior on color {
|
||||||
ColorAnimation {
|
ColorAnimation {
|
||||||
duration: Style.animationFast
|
duration: Style.animationFast
|
||||||
easing.type: Easing.InOutCubic
|
easing.type: Easing.InOutCubic
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NIcon {
|
NIcon {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
text: "add"
|
text: "add"
|
||||||
font.pointSize: Style.fontSizeS * scaling
|
font.pointSize: Style.fontSizeS * scaling
|
||||||
color: increaseArea.containsMouse ? Color.mOnPrimary : Color.mPrimary
|
color: increaseArea.containsMouse ? Color.mOnPrimary : Color.mPrimary
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: increaseArea
|
id: increaseArea
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
@ -163,7 +163,7 @@ RowLayout {
|
||||||
onClicked: spinBox.increase()
|
onClicked: spinBox.increase()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Center value display
|
// Center value display
|
||||||
SpinBox {
|
SpinBox {
|
||||||
id: spinBox
|
id: spinBox
|
||||||
|
|
@ -172,23 +172,23 @@ RowLayout {
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
anchors.margins: 4 * scaling
|
anchors.margins: 4 * scaling
|
||||||
height: parent.height
|
height: parent.height
|
||||||
|
|
||||||
background: Item {}
|
background: Item {}
|
||||||
up.indicator: Item {}
|
up.indicator: Item {}
|
||||||
down.indicator: Item {}
|
down.indicator: Item {}
|
||||||
|
|
||||||
font.pointSize: Style.fontSizeM * scaling
|
font.pointSize: Style.fontSizeM * scaling
|
||||||
font.family: Settings.data.ui.fontDefault
|
font.family: Settings.data.ui.fontDefault
|
||||||
|
|
||||||
from: 0
|
from: 0
|
||||||
to: 100
|
to: 100
|
||||||
stepSize: 1
|
stepSize: 1
|
||||||
editable: false // Only use buttons/scroll
|
editable: false // Only use buttons/scroll
|
||||||
enabled: root.enabled
|
enabled: root.enabled
|
||||||
|
|
||||||
contentItem: Item {
|
contentItem: Item {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
|
|
||||||
NText {
|
NText {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
text: root.prefix + spinBox.value + root.suffix
|
text: root.prefix + spinBox.value + root.suffix
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue