157 lines
4.0 KiB
QML
157 lines
4.0 KiB
QML
import QtQuick
|
|
import QtQuick.Controls
|
|
import QtQuick.Window
|
|
import QtQuick.Controls.Material
|
|
import WayCast
|
|
|
|
ApplicationWindow {
|
|
id: win
|
|
visible: false
|
|
width: 600
|
|
height: 400
|
|
flags: Qt.FramelessWindowHint
|
|
property int timeoutInterval: 5000
|
|
|
|
Material.theme: Material.Dark
|
|
|
|
// Set window opacity for semi-transparency
|
|
opacity: 0.95
|
|
|
|
Shortcut {
|
|
sequence: "Escape"
|
|
onActivated: Qt.quit()
|
|
}
|
|
|
|
Component.onCompleted: {
|
|
forceActiveFocus()
|
|
}
|
|
|
|
Rectangle {
|
|
anchors.fill: parent
|
|
border.width: 1
|
|
border.color: Material.frameColor
|
|
color: Material.backgroundColor
|
|
|
|
Column {
|
|
anchors.fill: parent
|
|
anchors.margins: 10
|
|
spacing: 5
|
|
|
|
TextField {
|
|
id: searchField
|
|
width: parent.width
|
|
placeholderText: "Type to search applications..."
|
|
selectByMouse: true
|
|
focus: true
|
|
text: appModel.searchText
|
|
|
|
onTextChanged: {
|
|
appModel.searchText = text
|
|
listView.currentIndex = 0
|
|
}
|
|
|
|
Keys.onDownPressed: listView.incrementCurrentIndex()
|
|
Keys.onUpPressed: listView.decrementCurrentIndex()
|
|
Keys.onReturnPressed: {
|
|
if (listView.currentItem) {
|
|
appModel.executeItem(listView.currentIndex)
|
|
Qt.quit()
|
|
}
|
|
}
|
|
}
|
|
|
|
ScrollView {
|
|
width: parent.width
|
|
height: parent.height - searchField.height - parent.spacing
|
|
clip: true
|
|
|
|
ListView {
|
|
id: listView
|
|
model: appModel
|
|
currentIndex: 0
|
|
highlightFollowsCurrentItem: true
|
|
|
|
highlight: Rectangle {
|
|
color: Material.accent
|
|
radius: 4
|
|
}
|
|
|
|
delegate: ItemDelegate {
|
|
width: listView.width
|
|
height: 60
|
|
|
|
Rectangle {
|
|
anchors.fill: parent
|
|
color: parent.hovered ? Material.listHighlightColor : "transparent"
|
|
radius: 4
|
|
}
|
|
|
|
Row {
|
|
anchors.left: parent.left
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
anchors.margins: 10
|
|
spacing: 10
|
|
|
|
Image {
|
|
width: 24
|
|
height: 24
|
|
source: model.icon
|
|
fillMode: Image.PreserveAspectFit
|
|
|
|
// Fallback if icon fails to load
|
|
Rectangle {
|
|
anchors.fill: parent
|
|
color: Material.color(Material.Grey, Material.Shade600)
|
|
radius: 4
|
|
visible: parent.status === Image.Error || parent.status === Image.Null
|
|
|
|
Text {
|
|
anchors.centerIn: parent
|
|
text: "📱"
|
|
font.pixelSize: 16
|
|
}
|
|
}
|
|
}
|
|
|
|
Column {
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
spacing: 2
|
|
|
|
Text {
|
|
text: model.name
|
|
color: Material.foreground
|
|
font.pixelSize: 14
|
|
font.weight: Font.Medium
|
|
}
|
|
|
|
Text {
|
|
text: model.description || ""
|
|
color: Material.color(Material.Grey, Material.Shade400)
|
|
font.pixelSize: 11
|
|
visible: text.length > 0
|
|
opacity: 0.8
|
|
|
|
// Truncate long descriptions
|
|
elide: Text.ElideRight
|
|
maximumLineCount: 1
|
|
width: Math.min(implicitWidth, listView.width - 60) // Leave space for icon and margins
|
|
}
|
|
}
|
|
}
|
|
|
|
onClicked: {
|
|
listView.currentIndex = index
|
|
appModel.executeItem(index)
|
|
Qt.quit()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
AppListModel {
|
|
id: appModel
|
|
}
|
|
}
|