blob: cc392dbdf1b10c8c88d1cd910e55bc0e105e8c77 (
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
|
// Copyright (C) 2026 Danilo M. <danix@danix.xyz>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License version 2 as
// published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
import QtQuick
import "../.."
import "../ai"
import "../deckit"
import "../qtmaildir"
// Shells, deck-it and the daemons, one row each: Start when stopped, Stop and
// Restart when running. The desktop shell has no Stop: it draws this page.
Column {
id: page
required property var services
spacing: 8
Component.onCompleted: { page.services.watchers++; DeckIt.watchers++; page.services.refresh(); }
Component.onDestruction: { page.services.watchers--; DeckIt.watchers--; }
Heading { text: "Shells" }
AiRow {
width: page.width
title: "All shells"
detail: "Restarts every one, this drawer included"
on: true
action: "Restart all"
onTriggered: page.services.restartShell("")
}
Repeater {
model: page.services.shells
AiRow {
required property var modelData
readonly property bool self: modelData.name === "desktop"
objectName: "shell:" + modelData.name
width: page.width
title: modelData.name
on: modelData.running
detail: (modelData.running ? "Running" : "Stopped") + (self ? " · hosts this drawer" : "")
action: !modelData.running ? "Start" : self ? "" : "Stop"
restartable: modelData.running
onTriggered: modelData.running ? page.services.stopShell(modelData.name)
: page.services.restartShell(modelData.name)
onRestart: page.services.restartShell(modelData.name)
}
}
Heading { text: "deck-it" }
AiRow {
width: page.width
title: "deck-it"
detail: ({ start: "Starting…", stop: "Stopping…", restart: "Restarting…" })[DeckIt.busy] ?? DeckIt.summary
on: DeckIt.running
busy: DeckIt.busy !== ""
action: DeckIt.busy ? "" : DeckIt.running ? "Stop" : "Start"
restartable: DeckIt.running && !DeckIt.busy
onTriggered: DeckIt.control(DeckIt.running ? "stop" : "start")
onRestart: DeckIt.control("restart")
}
Heading { text: "Daemons" }
Repeater {
model: page.services.daemons
AiRow {
required property var modelData
objectName: "daemon:" + modelData.label
width: page.width
title: modelData.label
on: modelData.running
detail: modelData.running ? "Running" : modelData.start ? "Stopped" : "Stopped · not in autostart"
action: modelData.running ? "Stop" : modelData.start ? "Start" : ""
restartable: modelData.running && modelData.start !== ""
onTriggered: page.services.daemon(modelData, modelData.running ? "stop" : "start")
onRestart: page.services.daemon(modelData, "restart")
}
}
}
|