2023-02-20 17:23:08 +08:00
|
|
|
import QtQuick 2.12
|
2023-02-14 09:34:15 +08:00
|
|
|
import QtQuick.Layouts 1.12
|
2023-02-20 17:23:08 +08:00
|
|
|
import QtQuick.Controls 2.5
|
|
|
|
import org.ukui.menu.core 1.0
|
2023-12-07 10:59:26 +08:00
|
|
|
import org.ukui.quick.items 1.0 as UkuiItems
|
2023-02-14 09:34:15 +08:00
|
|
|
|
2023-03-31 16:08:10 +08:00
|
|
|
MouseArea {
|
|
|
|
id: control
|
2023-05-04 15:09:52 +08:00
|
|
|
property bool isSelect: false
|
2023-03-31 16:08:10 +08:00
|
|
|
hoverEnabled: true
|
2023-04-26 17:04:22 +08:00
|
|
|
states: State {
|
|
|
|
when: control.activeFocus
|
|
|
|
PropertyChanges {
|
|
|
|
target: controlBase
|
2023-12-07 10:59:26 +08:00
|
|
|
borderColor: UkuiItems.Theme.Highlight
|
2023-08-14 11:15:54 +08:00
|
|
|
border.width: 2
|
2023-04-26 17:04:22 +08:00
|
|
|
}
|
|
|
|
}
|
2023-12-07 10:59:26 +08:00
|
|
|
UkuiItems.StyleBackground {
|
2023-04-26 17:04:22 +08:00
|
|
|
id: controlBase
|
2023-02-20 17:23:08 +08:00
|
|
|
anchors.fill: parent
|
2023-03-31 16:08:10 +08:00
|
|
|
radius: 4
|
2023-12-07 10:59:26 +08:00
|
|
|
useStyleTransparency: false
|
|
|
|
paletteRole: UkuiItems.Theme.Text
|
|
|
|
alpha: isSelect ? 1.00 : control.containsPress ? 0.16 : control.containsMouse ? 0.08 : 0.00
|
|
|
|
ToolTip.visible: content.textTruncated && control.containsMouse
|
|
|
|
ToolTip.text: name
|
|
|
|
ToolTip.delay: 500
|
2023-02-14 09:34:15 +08:00
|
|
|
|
2023-04-12 17:13:28 +08:00
|
|
|
RowLayout {
|
2023-03-31 16:08:10 +08:00
|
|
|
anchors.fill: parent
|
2023-04-12 17:13:28 +08:00
|
|
|
spacing: 2
|
|
|
|
|
|
|
|
IconLabel {
|
|
|
|
id: content
|
|
|
|
Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
|
|
|
|
|
|
|
iconHeight: 32; iconWidth: iconHeight
|
|
|
|
appName: name; appIcon: icon
|
|
|
|
display: Display.TextBesideIcon
|
|
|
|
spacing: 12
|
|
|
|
}
|
|
|
|
|
|
|
|
Loader {
|
|
|
|
id: tag
|
2023-12-07 10:59:26 +08:00
|
|
|
visible: mainWindow.editMode
|
2023-04-12 17:13:28 +08:00
|
|
|
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillHeight: true
|
2023-12-07 10:59:26 +08:00
|
|
|
Layout.maximumWidth: visible ? 28 : 0
|
2023-04-12 17:13:28 +08:00
|
|
|
Layout.maximumHeight: width
|
2023-12-07 10:59:26 +08:00
|
|
|
Layout.rightMargin: visible ? 4 : 0
|
2023-04-12 17:13:28 +08:00
|
|
|
|
|
|
|
Component {
|
2023-12-07 10:59:26 +08:00
|
|
|
id: editImage
|
|
|
|
UkuiItems.Button {
|
|
|
|
width: 28
|
|
|
|
height: 28
|
|
|
|
icon.width: 16
|
|
|
|
icon.height: 16
|
|
|
|
background.paletteRole: UkuiItems.Theme.Light
|
|
|
|
background.alpha: 1
|
|
|
|
activeFocusOnTab: false
|
2023-04-12 17:13:28 +08:00
|
|
|
|
2023-12-07 10:59:26 +08:00
|
|
|
onClicked: {
|
|
|
|
appManager.changeFavoriteState(id, favorite);
|
2023-04-12 17:13:28 +08:00
|
|
|
}
|
2023-12-07 10:59:26 +08:00
|
|
|
|
|
|
|
background.radius: width / 2
|
|
|
|
icon.source: favorite ? "ukui-cancel-star-symbolic" : "non-starred-symbolic"
|
2023-04-12 17:13:28 +08:00
|
|
|
}
|
|
|
|
}
|
2023-12-07 10:59:26 +08:00
|
|
|
sourceComponent: mainWindow.editMode ? editImage : null
|
2023-04-12 17:13:28 +08:00
|
|
|
}
|
2023-02-14 09:34:15 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|