Formatting
This commit is contained in:
parent
ba69ccbf82
commit
7509bbd363
1 changed files with 301 additions and 307 deletions
|
|
@ -194,46 +194,48 @@ NLoader {
|
||||||
var result = eval(sanitizedExpr)
|
var result = eval(sanitizedExpr)
|
||||||
|
|
||||||
if (isFinite(result) && !isNaN(result)) {
|
if (isFinite(result) && !isNaN(result)) {
|
||||||
var displayResult = Number.isInteger(result) ? result.toString() : result.toFixed(6).replace(/\.?0+$/, '')
|
var displayResult = Number.isInteger(result) ? result.toString() : result.toFixed(6).replace(/\.?0+$/,
|
||||||
|
'')
|
||||||
results.push({
|
results.push({
|
||||||
"isCalculator": true,
|
"isCalculator": true,
|
||||||
"name": `${expr} = ${displayResult}`,
|
"name": `${expr} = ${displayResult}`,
|
||||||
"result": result,
|
"result": result,
|
||||||
"expr": expr,
|
"expr": expr,
|
||||||
"icon": "calculate",
|
"icon": "calculate",
|
||||||
"execute": function () {
|
"execute": function () {
|
||||||
Quickshell.clipboardText = displayResult
|
Quickshell.clipboardText = displayResult
|
||||||
copyText(displayResult)
|
copyText(displayResult)
|
||||||
Quickshell.execDetached(["notify-send", "Calculator", `${expr} = ${displayResult} (copied to clipboard)`])
|
Quickshell.execDetached(
|
||||||
}
|
["notify-send", "Calculator", `${expr} = ${displayResult} (copied to clipboard)`])
|
||||||
})
|
}
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
results.push({
|
results.push({
|
||||||
"isCalculator": true,
|
"isCalculator": true,
|
||||||
"name": "Invalid expression",
|
"name": "Invalid expression",
|
||||||
"content": "Please enter a valid mathematical expression",
|
"content": "Please enter a valid mathematical expression",
|
||||||
"icon": "calculate",
|
"icon": "calculate",
|
||||||
"execute": function () {}
|
"execute": function () {}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
results.push({
|
results.push({
|
||||||
"isCalculator": true,
|
"isCalculator": true,
|
||||||
"name": "Invalid expression",
|
"name": "Invalid expression",
|
||||||
"content": "Please enter a valid mathematical expression",
|
"content": "Please enter a valid mathematical expression",
|
||||||
"icon": "calculate",
|
"icon": "calculate",
|
||||||
"execute": function () {}
|
"execute": function () {}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Show placeholder when just ">calc" is entered
|
// Show placeholder when just ">calc" is entered
|
||||||
results.push({
|
results.push({
|
||||||
"isCalculator": true,
|
"isCalculator": true,
|
||||||
"name": "Calculator",
|
"name": "Calculator",
|
||||||
"content": "Enter a mathematical expression (e.g., 5+5, 2*3, 10/2)",
|
"content": "Enter a mathematical expression (e.g., 5+5, 2*3, 10/2)",
|
||||||
"icon": "calculate",
|
"icon": "calculate",
|
||||||
"execute": function () {}
|
"execute": function () {}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
return results
|
return results
|
||||||
}
|
}
|
||||||
|
|
@ -267,293 +269,285 @@ NLoader {
|
||||||
updateClipboardHistory()
|
updateClipboardHistory()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Main content container
|
||||||
|
Rectangle {
|
||||||
|
anchors.centerIn: parent
|
||||||
|
width: Math.min(700 * scaling, parent.width * 0.75)
|
||||||
|
height: Math.min(550 * scaling, parent.height * 0.8)
|
||||||
|
radius: Style.radiusLarge * scaling
|
||||||
|
color: Color.mSurface
|
||||||
|
border.color: Color.mOutline
|
||||||
|
border.width: Style.borderThin * scaling
|
||||||
|
|
||||||
|
// Subtle gradient background
|
||||||
|
gradient: Gradient {
|
||||||
|
GradientStop {
|
||||||
|
position: 0.0
|
||||||
|
color: Qt.lighter(Color.mSurface, 1.02)
|
||||||
|
}
|
||||||
|
GradientStop {
|
||||||
|
position: 1.0
|
||||||
|
color: Qt.darker(Color.mSurface, 1.1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Main content container
|
ColumnLayout {
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: Style.marginLarge * scaling
|
||||||
|
spacing: Style.marginMedium * scaling
|
||||||
|
|
||||||
|
// Search bar
|
||||||
|
Rectangle {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.preferredHeight: Style.barHeight * scaling
|
||||||
|
Layout.bottomMargin: Style.marginMedium * scaling
|
||||||
|
radius: Style.radiusMedium * scaling
|
||||||
|
color: Color.mSurface
|
||||||
|
border.color: searchInput.activeFocus ? Color.mPrimary : Color.mOutline
|
||||||
|
border.width: Math.max(1,
|
||||||
|
searchInput.activeFocus ? Style.borderMedium * scaling : Style.borderThin * scaling)
|
||||||
|
|
||||||
|
Item {
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: Style.marginMedium * scaling
|
||||||
|
|
||||||
|
NIcon {
|
||||||
|
id: searchIcon
|
||||||
|
text: "search"
|
||||||
|
font.pointSize: Style.fontSizeLarger * scaling
|
||||||
|
color: searchInput.activeFocus ? Color.mPrimary : Color.mOnSurface
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
}
|
||||||
|
|
||||||
|
TextField {
|
||||||
|
id: searchInput
|
||||||
|
placeholderText: searchText === "" ? "Search applications... (use > to view commands)" : "Search applications..."
|
||||||
|
color: Color.mOnSurface
|
||||||
|
placeholderTextColor: Color.mOnSurfaceVariant
|
||||||
|
background: null
|
||||||
|
font.pointSize: Style.fontSizeLarge * scaling
|
||||||
|
anchors.left: searchIcon.right
|
||||||
|
anchors.leftMargin: Style.marginSmall * scaling
|
||||||
|
anchors.right: parent.right
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
onTextChanged: {
|
||||||
|
searchText = text
|
||||||
|
selectedIndex = 0 // Reset selection when search changes
|
||||||
|
}
|
||||||
|
selectedTextColor: Color.mOnSurface
|
||||||
|
selectionColor: Color.mPrimary
|
||||||
|
padding: 0
|
||||||
|
verticalAlignment: TextInput.AlignVCenter
|
||||||
|
leftPadding: 0
|
||||||
|
rightPadding: 0
|
||||||
|
topPadding: 0
|
||||||
|
bottomPadding: 0
|
||||||
|
font.bold: true
|
||||||
|
Component.onCompleted: {
|
||||||
|
contentItem.cursorColor = Color.mOnSurface
|
||||||
|
contentItem.verticalAlignment = TextInput.AlignVCenter
|
||||||
|
// Focus the search bar by default
|
||||||
|
Qt.callLater(() => {
|
||||||
|
searchInput.forceActiveFocus()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
onActiveFocusChanged: contentItem.cursorColor = Color.mOnSurface
|
||||||
|
|
||||||
|
Keys.onDownPressed: selectNext()
|
||||||
|
Keys.onUpPressed: selectPrev()
|
||||||
|
Keys.onEnterPressed: activateSelected()
|
||||||
|
Keys.onReturnPressed: activateSelected()
|
||||||
|
Keys.onEscapePressed: appLauncherPanel.hide()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on border.color {
|
||||||
|
ColorAnimation {
|
||||||
|
duration: Style.animationFast
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on border.width {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Style.animationFast
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Applications list
|
||||||
|
ScrollView {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.fillHeight: true
|
||||||
|
clip: true
|
||||||
|
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
||||||
|
ScrollBar.vertical.policy: ScrollBar.AsNeeded
|
||||||
|
|
||||||
|
ListView {
|
||||||
|
id: appsList
|
||||||
|
anchors.fill: parent
|
||||||
|
spacing: Style.marginTiniest * scaling
|
||||||
|
model: filteredEntries
|
||||||
|
currentIndex: selectedIndex
|
||||||
|
|
||||||
|
delegate: Rectangle {
|
||||||
|
width: appsList.width - Style.marginSmall * scaling
|
||||||
|
height: 65 * scaling
|
||||||
|
radius: Style.radiusMedium * scaling
|
||||||
|
property bool isSelected: index === selectedIndex
|
||||||
|
color: (appCardArea.containsMouse || isSelected) ? Qt.darker(Color.mPrimary, 1.1) : Color.mSurface
|
||||||
|
border.color: (appCardArea.containsMouse || isSelected) ? Color.mPrimary : Color.transparent
|
||||||
|
border.width: Math.max(1, (appCardArea.containsMouse || isSelected) ? Style.borderMedium * scaling : 0)
|
||||||
|
|
||||||
|
Behavior on color {
|
||||||
|
ColorAnimation {
|
||||||
|
duration: Style.animationFast
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on border.color {
|
||||||
|
ColorAnimation {
|
||||||
|
duration: Style.animationFast
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Behavior on border.width {
|
||||||
|
NumberAnimation {
|
||||||
|
duration: Style.animationFast
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
anchors.fill: parent
|
||||||
|
anchors.margins: Style.marginMedium * scaling
|
||||||
|
spacing: Style.marginMedium * scaling
|
||||||
|
|
||||||
|
// App icon with background
|
||||||
Rectangle {
|
Rectangle {
|
||||||
anchors.centerIn: parent
|
Layout.preferredWidth: Style.baseWidgetSize * 1.25 * scaling
|
||||||
width: Math.min(700 * scaling, parent.width * 0.75)
|
Layout.preferredHeight: Style.baseWidgetSize * 1.25 * scaling
|
||||||
height: Math.min(550 * scaling, parent.height * 0.8)
|
radius: Style.radiusSmall * scaling
|
||||||
radius: Style.radiusLarge * scaling
|
color: appCardArea.containsMouse ? Qt.darker(Color.mPrimary, 1.1) : Color.mSurfaceVariant
|
||||||
color: Color.mSurface
|
property bool iconLoaded: (modelData.isCalculator || modelData.isClipboard || modelData.isCommand)
|
||||||
border.color: Color.mOutline
|
|| (iconImg.status === Image.Ready && iconImg.source !== ""
|
||||||
border.width: Style.borderThin * scaling
|
&& iconImg.status !== Image.Error && iconImg.source !== "")
|
||||||
|
visible: !searchText.startsWith(">calc") // Hide icon when in calculator mode
|
||||||
|
|
||||||
// Subtle gradient background
|
// Clipboard image display
|
||||||
gradient: Gradient {
|
Image {
|
||||||
GradientStop {
|
id: clipboardImage
|
||||||
position: 0.0
|
anchors.fill: parent
|
||||||
color: Qt.lighter(Color.mSurface, 1.02)
|
anchors.margins: Style.marginTiny * scaling
|
||||||
}
|
visible: modelData.type === 'image'
|
||||||
GradientStop {
|
source: modelData.data || ""
|
||||||
position: 1.0
|
fillMode: Image.PreserveAspectCrop
|
||||||
color: Qt.darker(Color.mSurface, 1.1)
|
asynchronous: true
|
||||||
}
|
cache: true
|
||||||
}
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
IconImage {
|
||||||
|
id: iconImg
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
anchors.margins: Style.marginLarge * scaling
|
anchors.margins: Style.marginTiny * scaling
|
||||||
spacing: Style.marginMedium * scaling
|
asynchronous: true
|
||||||
|
source: modelData.isCalculator ? "calculate" : modelData.isClipboard ? (modelData.type === 'image' ? "" : "content_paste") : modelData.isCommand ? modelData.icon : (modelData.icon ? Quickshell.iconPath(modelData.icon, "application-x-executable") : "")
|
||||||
|
visible: (modelData.isCalculator || modelData.isClipboard || modelData.isCommand
|
||||||
|
|| parent.iconLoaded) && modelData.type !== 'image'
|
||||||
|
}
|
||||||
|
|
||||||
// Search bar
|
// Fallback icon container
|
||||||
Rectangle {
|
Rectangle {
|
||||||
Layout.fillWidth: true
|
anchors.fill: parent
|
||||||
Layout.preferredHeight: Style.barHeight * scaling
|
anchors.margins: Style.marginTiny * scaling
|
||||||
Layout.bottomMargin: Style.marginMedium * scaling
|
radius: Style.radiusTiny * scaling
|
||||||
radius: Style.radiusMedium * scaling
|
color: Color.mPrimary
|
||||||
color: Color.mSurface
|
opacity: Style.opacityMedium
|
||||||
border.color: searchInput.activeFocus ? Color.mPrimary : Color.mOutline
|
visible: !parent.iconLoaded
|
||||||
border.width: Math.max(
|
}
|
||||||
1,
|
|
||||||
searchInput.activeFocus ? Style.borderMedium * scaling : Style.borderThin * scaling)
|
|
||||||
|
|
||||||
Item {
|
Text {
|
||||||
anchors.fill: parent
|
anchors.centerIn: parent
|
||||||
anchors.margins: Style.marginMedium * scaling
|
visible: !parent.iconLoaded && !(modelData.isCalculator || modelData.isClipboard
|
||||||
|
|| modelData.isCommand)
|
||||||
|
text: modelData.name ? modelData.name.charAt(0).toUpperCase() : "?"
|
||||||
|
font.pointSize: Style.fontSizeXL * scaling
|
||||||
|
font.weight: Font.Bold
|
||||||
|
color: Color.mPrimary
|
||||||
|
}
|
||||||
|
|
||||||
NIcon {
|
Behavior on color {
|
||||||
id: searchIcon
|
ColorAnimation {
|
||||||
text: "search"
|
duration: Style.animationFast
|
||||||
font.pointSize: Style.fontSizeLarger * scaling
|
|
||||||
color: searchInput.activeFocus ? Color.mPrimary : Color.mOnSurface
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
TextField {
|
|
||||||
id: searchInput
|
|
||||||
placeholderText: searchText
|
|
||||||
=== "" ? "Search applications... (use > to view commands)" : "Search applications..."
|
|
||||||
color: Color.mOnSurface
|
|
||||||
placeholderTextColor: Color.mOnSurfaceVariant
|
|
||||||
background: null
|
|
||||||
font.pointSize: Style.fontSizeLarge * scaling
|
|
||||||
anchors.left: searchIcon.right
|
|
||||||
anchors.leftMargin: Style.marginSmall * scaling
|
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
onTextChanged: {
|
|
||||||
searchText = text
|
|
||||||
selectedIndex = 0 // Reset selection when search changes
|
|
||||||
}
|
|
||||||
selectedTextColor: Color.mOnSurface
|
|
||||||
selectionColor: Color.mPrimary
|
|
||||||
padding: 0
|
|
||||||
verticalAlignment: TextInput.AlignVCenter
|
|
||||||
leftPadding: 0
|
|
||||||
rightPadding: 0
|
|
||||||
topPadding: 0
|
|
||||||
bottomPadding: 0
|
|
||||||
font.bold: true
|
|
||||||
Component.onCompleted: {
|
|
||||||
contentItem.cursorColor = Color.mOnSurface
|
|
||||||
contentItem.verticalAlignment = TextInput.AlignVCenter
|
|
||||||
// Focus the search bar by default
|
|
||||||
Qt.callLater(() => {
|
|
||||||
searchInput.forceActiveFocus()
|
|
||||||
})
|
|
||||||
}
|
|
||||||
onActiveFocusChanged: contentItem.cursorColor = Color.mOnSurface
|
|
||||||
|
|
||||||
Keys.onDownPressed: selectNext()
|
|
||||||
Keys.onUpPressed: selectPrev()
|
|
||||||
Keys.onEnterPressed: activateSelected()
|
|
||||||
Keys.onReturnPressed: activateSelected()
|
|
||||||
Keys.onEscapePressed: appLauncherPanel.hide()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Behavior on border.color {
|
|
||||||
ColorAnimation {
|
|
||||||
duration: Style.animationFast
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Behavior on border.width {
|
|
||||||
NumberAnimation {
|
|
||||||
duration: Style.animationFast
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Applications list
|
|
||||||
ScrollView {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.fillHeight: true
|
|
||||||
clip: true
|
|
||||||
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
|
||||||
ScrollBar.vertical.policy: ScrollBar.AsNeeded
|
|
||||||
|
|
||||||
ListView {
|
|
||||||
id: appsList
|
|
||||||
anchors.fill: parent
|
|
||||||
spacing: Style.marginTiniest * scaling
|
|
||||||
model: filteredEntries
|
|
||||||
currentIndex: selectedIndex
|
|
||||||
|
|
||||||
delegate: Rectangle {
|
|
||||||
width: appsList.width - Style.marginSmall * scaling
|
|
||||||
height: 65 * scaling
|
|
||||||
radius: Style.radiusMedium * scaling
|
|
||||||
property bool isSelected: index === selectedIndex
|
|
||||||
color: (appCardArea.containsMouse || isSelected) ? Qt.darker(Color.mPrimary,
|
|
||||||
1.1) : Color.mSurface
|
|
||||||
border.color: (appCardArea.containsMouse || isSelected) ? Color.mPrimary : Color.transparent
|
|
||||||
border.width: Math.max(1, (appCardArea.containsMouse
|
|
||||||
|| isSelected) ? Style.borderMedium * scaling : 0)
|
|
||||||
|
|
||||||
Behavior on color {
|
|
||||||
ColorAnimation {
|
|
||||||
duration: Style.animationFast
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Behavior on border.color {
|
|
||||||
ColorAnimation {
|
|
||||||
duration: Style.animationFast
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Behavior on border.width {
|
|
||||||
NumberAnimation {
|
|
||||||
duration: Style.animationFast
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
RowLayout {
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.margins: Style.marginMedium * scaling
|
|
||||||
spacing: Style.marginMedium * scaling
|
|
||||||
|
|
||||||
// App icon with background
|
|
||||||
Rectangle {
|
|
||||||
Layout.preferredWidth: Style.baseWidgetSize * 1.25 * scaling
|
|
||||||
Layout.preferredHeight: Style.baseWidgetSize * 1.25 * scaling
|
|
||||||
radius: Style.radiusSmall * scaling
|
|
||||||
color: appCardArea.containsMouse ? Qt.darker(Color.mPrimary,
|
|
||||||
1.1) : Color.mSurfaceVariant
|
|
||||||
property bool iconLoaded: (modelData.isCalculator || modelData.isClipboard
|
|
||||||
|| modelData.isCommand) || (iconImg.status === Image.Ready
|
|
||||||
&& iconImg.source !== ""
|
|
||||||
&& iconImg.status !== Image.Error
|
|
||||||
&& iconImg.source !== "")
|
|
||||||
visible: !searchText.startsWith(">calc") // Hide icon when in calculator mode
|
|
||||||
|
|
||||||
// Clipboard image display
|
|
||||||
Image {
|
|
||||||
id: clipboardImage
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.margins: Style.marginTiny * scaling
|
|
||||||
visible: modelData.type === 'image'
|
|
||||||
source: modelData.data || ""
|
|
||||||
fillMode: Image.PreserveAspectCrop
|
|
||||||
asynchronous: true
|
|
||||||
cache: true
|
|
||||||
}
|
|
||||||
|
|
||||||
IconImage {
|
|
||||||
id: iconImg
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.margins: Style.marginTiny * scaling
|
|
||||||
asynchronous: true
|
|
||||||
source: modelData.isCalculator ? "calculate" : modelData.isClipboard ? (modelData.type === 'image' ? "" : "content_paste") : modelData.isCommand ? modelData.icon : (modelData.icon ? Quickshell.iconPath(modelData.icon, "application-x-executable") : "")
|
|
||||||
visible: (modelData.isCalculator || modelData.isClipboard || modelData.isCommand
|
|
||||||
|| parent.iconLoaded) && modelData.type !== 'image'
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fallback icon container
|
|
||||||
Rectangle {
|
|
||||||
anchors.fill: parent
|
|
||||||
anchors.margins: Style.marginTiny * scaling
|
|
||||||
radius: Style.radiusTiny * scaling
|
|
||||||
color: Color.mPrimary
|
|
||||||
opacity: Style.opacityMedium
|
|
||||||
visible: !parent.iconLoaded
|
|
||||||
}
|
|
||||||
|
|
||||||
Text {
|
|
||||||
anchors.centerIn: parent
|
|
||||||
visible: !parent.iconLoaded && !(modelData.isCalculator || modelData.isClipboard
|
|
||||||
|| modelData.isCommand)
|
|
||||||
text: modelData.name ? modelData.name.charAt(0).toUpperCase() : "?"
|
|
||||||
font.pointSize: Style.fontSizeXL * scaling
|
|
||||||
font.weight: Font.Bold
|
|
||||||
color: Color.mPrimary
|
|
||||||
}
|
|
||||||
|
|
||||||
Behavior on color {
|
|
||||||
ColorAnimation {
|
|
||||||
duration: Style.animationFast
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// App info
|
|
||||||
ColumnLayout {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
spacing: Style.marginTiniest * scaling
|
|
||||||
|
|
||||||
NText {
|
|
||||||
text: modelData.name || "Unknown"
|
|
||||||
font.pointSize: Style.fontSizeLarge * scaling
|
|
||||||
font.weight: Font.Bold
|
|
||||||
color: (appCardArea.containsMouse || isSelected) ? Color.mOnPrimary : Color.mOnSurface
|
|
||||||
elide: Text.ElideRight
|
|
||||||
Layout.fillWidth: true
|
|
||||||
}
|
|
||||||
|
|
||||||
NText {
|
|
||||||
text: modelData.isCalculator ? (modelData.expr + " = " + modelData.result) : modelData.isClipboard ? modelData.content : modelData.isCommand ? modelData.content : (modelData.genericName || modelData.comment || "")
|
|
||||||
font.pointSize: Style.fontSizeMedium * scaling
|
|
||||||
color: (appCardArea.containsMouse || isSelected) ? Color.mOnPrimary : Color.mOnSurface
|
|
||||||
elide: Text.ElideRight
|
|
||||||
Layout.fillWidth: true
|
|
||||||
visible: text !== ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MouseArea {
|
|
||||||
id: appCardArea
|
|
||||||
anchors.fill: parent
|
|
||||||
hoverEnabled: true
|
|
||||||
cursorShape: Qt.PointingHandCursor
|
|
||||||
|
|
||||||
onClicked: {
|
|
||||||
selectedIndex = index
|
|
||||||
activateSelected()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// No results message
|
|
||||||
NText {
|
|
||||||
text: searchText.trim() !== "" ? "No applications found" : "No applications available"
|
|
||||||
font.pointSize: Style.fontSizeLarge * scaling
|
|
||||||
color: Color.mOnSurface
|
|
||||||
horizontalAlignment: Text.AlignHCenter
|
|
||||||
Layout.fillWidth: true
|
|
||||||
visible: filteredEntries.length === 0
|
|
||||||
}
|
|
||||||
|
|
||||||
// Results count
|
|
||||||
NText {
|
|
||||||
text: searchText.startsWith(
|
|
||||||
">clip") ? `${filteredEntries.length} clipboard item${filteredEntries.length
|
|
||||||
!== 1 ? 's' : ''}` : searchText.startsWith(
|
|
||||||
">calc") ? `${filteredEntries.length} result${filteredEntries.length
|
|
||||||
!== 1 ? 's' : ''}` : `${filteredEntries.length} application${filteredEntries.length !== 1 ? 's' : ''}`
|
|
||||||
font.pointSize: Style.fontSizeSmall * scaling
|
|
||||||
color: Color.mOnSurface
|
|
||||||
horizontalAlignment: Text.AlignHCenter
|
|
||||||
Layout.fillWidth: true
|
|
||||||
visible: searchText.trim() !== ""
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// App info
|
||||||
|
ColumnLayout {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
spacing: Style.marginTiniest * scaling
|
||||||
|
|
||||||
|
NText {
|
||||||
|
text: modelData.name || "Unknown"
|
||||||
|
font.pointSize: Style.fontSizeLarge * scaling
|
||||||
|
font.weight: Font.Bold
|
||||||
|
color: (appCardArea.containsMouse || isSelected) ? Color.mOnPrimary : Color.mOnSurface
|
||||||
|
elide: Text.ElideRight
|
||||||
|
Layout.fillWidth: true
|
||||||
|
}
|
||||||
|
|
||||||
|
NText {
|
||||||
|
text: modelData.isCalculator ? (modelData.expr + " = " + modelData.result) : modelData.isClipboard ? modelData.content : modelData.isCommand ? modelData.content : (modelData.genericName || modelData.comment || "")
|
||||||
|
font.pointSize: Style.fontSizeMedium * scaling
|
||||||
|
color: (appCardArea.containsMouse || isSelected) ? Color.mOnPrimary : Color.mOnSurface
|
||||||
|
elide: Text.ElideRight
|
||||||
|
Layout.fillWidth: true
|
||||||
|
visible: text !== ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
MouseArea {
|
||||||
|
id: appCardArea
|
||||||
|
anchors.fill: parent
|
||||||
|
hoverEnabled: true
|
||||||
|
cursorShape: Qt.PointingHandCursor
|
||||||
|
|
||||||
|
onClicked: {
|
||||||
|
selectedIndex = index
|
||||||
|
activateSelected()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// No results message
|
||||||
|
NText {
|
||||||
|
text: searchText.trim() !== "" ? "No applications found" : "No applications available"
|
||||||
|
font.pointSize: Style.fontSizeLarge * scaling
|
||||||
|
color: Color.mOnSurface
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
Layout.fillWidth: true
|
||||||
|
visible: filteredEntries.length === 0
|
||||||
|
}
|
||||||
|
|
||||||
|
// Results count
|
||||||
|
NText {
|
||||||
|
text: searchText.startsWith(
|
||||||
|
">clip") ? `${filteredEntries.length} clipboard item${filteredEntries.length
|
||||||
|
!== 1 ? 's' : ''}` : searchText.startsWith(
|
||||||
|
">calc") ? `${filteredEntries.length} result${filteredEntries.length
|
||||||
|
!== 1 ? 's' : ''}` : `${filteredEntries.length} application${filteredEntries.length
|
||||||
|
!== 1 ? 's' : ''}`
|
||||||
|
font.pointSize: Style.fontSizeSmall * scaling
|
||||||
|
color: Color.mOnSurface
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
Layout.fillWidth: true
|
||||||
|
visible: searchText.trim() !== ""
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue