blob: 0cfcc2221fdb34b9d411c134c16f5feb2b4a11d7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
|
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import Quickshell
import qs.Commons
import qs.Widgets
Item {
id: root
property var pluginApi: null
// Standard panel properties
readonly property var geometryPlaceholder: panelContainer
property real contentPreferredWidth: 320 * Style.uiScaleRatio
property real contentPreferredHeight: 450 * Style.uiScaleRatio
readonly property var mainInstance: pluginApi?.mainInstance
readonly property bool allowAttach: true
Rectangle {
id: panelContainer
anchors.fill: parent
color: "transparent"
ColumnLayout {
anchors.fill: parent
anchors.margins: Style.marginM
spacing: Style.marginM
// Header Box
NBox {
Layout.fillWidth: true
Layout.preferredHeight: headerRow.implicitHeight + Style.marginM * 2
RowLayout {
id: headerRow
anchors.fill: parent
anchors.margins: Style.marginM
spacing: Style.marginS
NIcon {
icon: "shield-check"
color: Color.mPrimary
pointSize: Style.fontSizeL
}
NText {
Layout.fillWidth: true
text: pluginApi?.tr("history.title")
font.weight: Style.fontWeightBold
pointSize: Style.fontSizeL
color: Color.mOnSurface
}
NIconButton {
icon: "trash"
baseSize: Style.baseWidgetSize * 0.8
onClicked: {
if (mainInstance) mainInstance.clearHistory();
}
}
}
}
Item {
Layout.fillWidth: true
Layout.fillHeight: true
NScrollView {
id: scrollView
anchors.fill: parent
horizontalPolicy: ScrollBar.AlwaysOff
verticalPolicy: ScrollBar.AsNeeded
ColumnLayout {
width: scrollView.availableWidth
spacing: Style.marginS
Repeater {
model: mainInstance ? mainInstance.accessHistory : []
delegate: Rectangle {
Layout.fillWidth: true
implicitHeight: 56 * Style.uiScaleRatio
radius: Style.radiusM
color: Color.mSurfaceVariant
RowLayout {
anchors.fill: parent
anchors.margins: Style.marginM
spacing: Style.marginM
Rectangle {
width: 32 * Style.uiScaleRatio
height: 32 * Style.uiScaleRatio
radius: width/2
color: Qt.alpha(iconColor, 0.1)
readonly property color iconColor: Color.resolveColorKey(modelData.colorKey || "primary")
NIcon {
anchors.centerIn: parent
icon: modelData.icon
color: parent.iconColor
pointSize: Style.fontSizeM
}
}
ColumnLayout {
Layout.fillWidth: true
spacing: 0
NText {
Layout.fillWidth: true
text: modelData.appName
elide: Text.ElideRight
font.weight: Style.fontWeightBold
pointSize: Style.fontSizeM
}
RowLayout {
Layout.fillWidth: true
spacing: Style.marginS
NText {
text: modelData.time
color: Qt.alpha(Color.mOnSurface, 0.7)
pointSize: Style.fontSizeS
}
NText {
text: "•"
color: Qt.alpha(Color.mOnSurface, 0.3)
pointSize: Style.fontSizeS
}
NText {
text: {
const action = modelData.action || "started";
return pluginApi?.tr("history.action." + action) || action;
}
color: (modelData.action || "started") === "stopped" ? Color.resolveColorKey("error") : Color.resolveColorKey("primary")
font.weight: Style.fontWeightBold
pointSize: Style.fontSizeS
}
}
}
}
}
}
// Empty state
NText {
Layout.alignment: Qt.AlignHCenter
visible: (!mainInstance || mainInstance.accessHistory.length === 0)
text: pluginApi?.tr("history.empty")
color: Qt.alpha(Color.mOnSurface, 0.5)
pointSize: Style.fontSizeM
Layout.topMargin: Style.marginL
}
Item { Layout.fillHeight: true } // spacer
}
}
}
}
}
}
|