The tiled welcome window was not keyboard-focused, so the primary action had no focus ring and Return did nothing; request activation and force focus. Refuse Escape during the destructive phase and say the operation cannot be cancelled. Show the AI connection guidance beside the controls. Guard the fixes with live_iso tests.
1147 lines
57 KiB
Bash
1147 lines
57 KiB
Bash
import QtQuick
|
|
import Quickshell
|
|
import Quickshell.Io
|
|
import "Common"
|
|
|
|
// The graphical Phoebus installer. A thin, typed frontend over the Rust
|
|
// backend: configuration, validation, the plan, authorization, progress and
|
|
// results all come from `Bridge` (the JSON protocol). This file contains no
|
|
// installation logic and never parses terminal output.
|
|
ShellRoot {
|
|
id: shell
|
|
|
|
property var cfg: null
|
|
property int step: 0
|
|
property string phase: "form" // form | progress | done | failed
|
|
property var issues: ({})
|
|
property string status: ""
|
|
property var disks: []
|
|
property string selectedDisk: ""
|
|
property var review: null
|
|
property string previewText: ""
|
|
property string planDigest: ""
|
|
property var handshake: null
|
|
|
|
// Secrets: held in memory only, sent over the bridge stdin, never in cfg.
|
|
property string userPw: ""
|
|
property string userPw2: ""
|
|
property string luksPw: ""
|
|
property string luksPw2: ""
|
|
property string apiKey: ""
|
|
|
|
property bool aiConnected: false
|
|
property bool aiChecking: false
|
|
property string aiError: ""
|
|
property var aiApplied: []
|
|
|
|
property var stageStatus: ({})
|
|
property var stageOrder: []
|
|
property var progressLog: []
|
|
property string failureText: ""
|
|
property string failureDisk: ""
|
|
property var failureNext: []
|
|
property bool showFailureLog: false
|
|
property var logLines: []
|
|
property bool showAdvanced: false
|
|
property bool showSecrets: false
|
|
|
|
readonly property var stepTitles: [
|
|
"Language and region",
|
|
"Network and prerequisites",
|
|
"AI model",
|
|
"Destination disk",
|
|
"Your account and encryption",
|
|
"Review",
|
|
"Confirm and install",
|
|
"Installing"
|
|
]
|
|
readonly property var stepFields: [
|
|
["locale", "keymap", "timezone"],
|
|
[],
|
|
[],
|
|
["target_disk"],
|
|
["hostname", "username"],
|
|
[],
|
|
[]
|
|
]
|
|
|
|
function clone(o) {
|
|
return JSON.parse(JSON.stringify(o));
|
|
}
|
|
|
|
// QML `var` properties do not emit change signals for nested assignments,
|
|
// so bindings that read `cfg.*` would not update. Reassigning a clone
|
|
// re-evaluates them. Used after a choice/toggle changes the configuration.
|
|
function touchConfig() {
|
|
if (shell.cfg)
|
|
shell.cfg = clone(shell.cfg);
|
|
}
|
|
|
|
// Re-read every input from the current configuration. Called when entering
|
|
// a step so back-navigation and AI-applied changes are reflected without
|
|
// discarding the user's non-secret choices.
|
|
function syncFields() {
|
|
if (!shell.cfg)
|
|
return;
|
|
localeField.inputItem.text = shell.cfg.system.locale;
|
|
keymapField.inputItem.text = shell.cfg.system.keymap;
|
|
tzField.inputItem.text = shell.cfg.system.timezone;
|
|
fullnameField.inputItem.text = shell.cfg.user.fullname;
|
|
userField.inputItem.text = shell.cfg.user.username;
|
|
hostField.inputItem.text = shell.cfg.system.hostname;
|
|
modelField.inputItem.text = shell.cfg.ai.model;
|
|
endpointField.inputItem.text = shell.cfg.ai.endpoint;
|
|
keyField.inputItem.text = shell.apiKey;
|
|
pwField.inputItem.text = shell.userPw;
|
|
pw2Field.inputItem.text = shell.userPw2;
|
|
luksField.inputItem.text = shell.luksPw;
|
|
luks2Field.inputItem.text = shell.luksPw2;
|
|
}
|
|
|
|
function setIssue(field, message) {
|
|
let next = clone(shell.issues);
|
|
next[field] = message;
|
|
shell.issues = next;
|
|
}
|
|
function clearIssues() {
|
|
shell.issues = ({});
|
|
}
|
|
function issueFor(field) {
|
|
return shell.issues[field] !== undefined ? shell.issues[field] : "";
|
|
}
|
|
|
|
function applyIssues(list) {
|
|
let next = ({});
|
|
for (let i = 0; i < list.length; i++)
|
|
next[list[i].field] = list[i].message;
|
|
shell.issues = next;
|
|
}
|
|
|
|
function startBridge() {
|
|
Bridge.start();
|
|
}
|
|
|
|
function onHandshake(reply) {
|
|
// A failed first write is retried by the Bridge timer; only surface
|
|
// real, parsed failures.
|
|
if (!reply.ok)
|
|
return;
|
|
shell.handshake = reply.data;
|
|
shell.cfg = clone(reply.data.defaults);
|
|
shell.cfg.storage.disk = "";
|
|
shell.step = 0;
|
|
shell.phase = "form";
|
|
shell.status = "";
|
|
shell.syncFields();
|
|
}
|
|
|
|
function refreshHandshake() {
|
|
Bridge.refreshHandshake(null);
|
|
}
|
|
|
|
function applyConfig(then) {
|
|
if (!shell.cfg) {
|
|
shell.status = "The installer backend is not ready yet.";
|
|
return;
|
|
}
|
|
Bridge.setConfig(clone(shell.cfg), reply => {
|
|
if (!reply.ok) {
|
|
shell.status = reply.error;
|
|
return;
|
|
}
|
|
if (then)
|
|
then();
|
|
});
|
|
}
|
|
|
|
// Persist the configuration and validate only the fields owned by the
|
|
// current step. The backend is the single source of validation truth.
|
|
function saveAndAdvance() {
|
|
shell.status = "Checking…";
|
|
applyConfig(() => {
|
|
Bridge.validate(reply => {
|
|
if (!reply.ok) {
|
|
shell.status = reply.error;
|
|
return;
|
|
}
|
|
const fields = shell.stepFields[shell.step] || [];
|
|
const relevant = reply.data.issues.filter(i => fields.indexOf(i.field) !== -1);
|
|
if (relevant.length > 0) {
|
|
applyIssues(relevant);
|
|
shell.status = "Please fix the highlighted fields.";
|
|
return;
|
|
}
|
|
clearIssues();
|
|
shell.status = "";
|
|
shell.step += 1;
|
|
shell.enterStep();
|
|
});
|
|
});
|
|
}
|
|
|
|
function advance() {
|
|
if (!shell.cfg) {
|
|
shell.status = "Waiting for the installer backend…";
|
|
return;
|
|
}
|
|
const s = shell.step;
|
|
if (s === 0 || s === 3) {
|
|
saveAndAdvance();
|
|
return;
|
|
}
|
|
if (s === 4) {
|
|
accountNext();
|
|
return;
|
|
}
|
|
if (s === 1) {
|
|
shell.step += 1;
|
|
shell.enterStep();
|
|
return;
|
|
}
|
|
if (s === 2) {
|
|
if (!shell.aiConnected) {
|
|
// Show the guidance beside the AI controls, not only in the
|
|
// footer, so the fix is obvious.
|
|
shell.aiError = "Connect and validate a model before continuing.";
|
|
shell.status = "";
|
|
return;
|
|
}
|
|
saveAndAdvance();
|
|
return;
|
|
}
|
|
if (s === 5) {
|
|
shell.step = 6;
|
|
shell.enterStep();
|
|
return;
|
|
}
|
|
shell.step += 1;
|
|
shell.enterStep();
|
|
}
|
|
|
|
function back() {
|
|
shell.status = "";
|
|
if (shell.step > 0) {
|
|
shell.step -= 1;
|
|
shell.enterStep();
|
|
}
|
|
}
|
|
|
|
function enterStep() {
|
|
shell.status = "";
|
|
const s = shell.step;
|
|
if (s === 2) {
|
|
if (!shell.cfg.ai.provider || shell.cfg.ai.provider === "none") {
|
|
shell.cfg.ai.provider = "deepseek";
|
|
shell.cfg.ai.enabled = true;
|
|
if (!shell.cfg.ai.model)
|
|
shell.cfg.ai.model = "deepseek-chat";
|
|
}
|
|
}
|
|
shell.syncFields();
|
|
shell.touchConfig();
|
|
if (s === 3)
|
|
refreshDisks();
|
|
if (s === 5)
|
|
loadReview();
|
|
if (s === 6) {
|
|
shell.previewText = "";
|
|
shell.planDigest = "";
|
|
Bridge.destructivePreview(reply => {
|
|
if (reply.ok) {
|
|
shell.previewText = reply.data.text;
|
|
shell.planDigest = reply.data.plan_digest;
|
|
} else {
|
|
shell.status = reply.error;
|
|
}
|
|
});
|
|
}
|
|
}
|
|
|
|
function refreshDisks() {
|
|
Bridge.listDisks(reply => {
|
|
if (reply.ok)
|
|
shell.disks = reply.data.disks;
|
|
else
|
|
shell.status = reply.error;
|
|
});
|
|
}
|
|
|
|
function loadReview() {
|
|
Bridge.plan(reply => {
|
|
if (reply.ok) {
|
|
shell.review = reply.data.review;
|
|
shell.planDigest = reply.data.plan_digest;
|
|
} else {
|
|
shell.status = reply.error;
|
|
}
|
|
});
|
|
}
|
|
|
|
function configureProvider(value) {
|
|
shell.cfg.ai.provider = value;
|
|
shell.cfg.ai.enabled = value !== "none";
|
|
shell.aiConnected = false;
|
|
shell.aiError = "";
|
|
shell.aiApplied = [];
|
|
if (value === "deepseek")
|
|
shell.cfg.ai.model = "deepseek-chat";
|
|
else if (value === "openai")
|
|
shell.cfg.ai.model = "gpt-4o-mini";
|
|
else if (value === "local")
|
|
shell.cfg.ai.model = shell.cfg.ai.model || "llama3.1";
|
|
modelField.inputItem.text = shell.cfg.ai.model;
|
|
endpointField.inputItem.text = shell.cfg.ai.endpoint;
|
|
shell.touchConfig();
|
|
}
|
|
|
|
function connectAi() {
|
|
shell.aiChecking = true;
|
|
shell.aiError = "";
|
|
shell.aiApplied = [];
|
|
shell.aiConnected = false;
|
|
const secrets = {};
|
|
if (shell.apiKey.length > 0)
|
|
secrets.ai_api_key = shell.apiKey;
|
|
Bridge.setSecrets(secrets, () => {
|
|
applyConfig(() => {
|
|
Bridge.aiCheck(reply => {
|
|
shell.aiChecking = false;
|
|
if (reply.ok) {
|
|
shell.aiConnected = true;
|
|
shell.aiApplied = reply.data.applied || [];
|
|
if (reply.data.config)
|
|
shell.cfg = clone(reply.data.config);
|
|
shell.status = "";
|
|
} else {
|
|
shell.aiError = reply.error;
|
|
}
|
|
});
|
|
});
|
|
});
|
|
}
|
|
|
|
function validateAccount() {
|
|
clearIssues();
|
|
let ok = true;
|
|
if (shell.userPw.length < 8) {
|
|
setIssue("password", "Use at least 8 characters.");
|
|
ok = false;
|
|
}
|
|
if (shell.userPw !== shell.userPw2) {
|
|
setIssue("password_confirm", "The passwords do not match.");
|
|
ok = false;
|
|
}
|
|
if (shell.luksPw.length < 8) {
|
|
setIssue("passphrase", "Use at least 8 characters.");
|
|
ok = false;
|
|
}
|
|
if (shell.luksPw !== shell.luksPw2) {
|
|
setIssue("passphrase_confirm", "The passphrases do not match.");
|
|
ok = false;
|
|
}
|
|
return ok;
|
|
}
|
|
|
|
function accountNext() {
|
|
if (!validateAccount()) {
|
|
shell.status = "Please fix the highlighted fields.";
|
|
return;
|
|
}
|
|
// The backend validates username/hostname; secrets go over stdin only.
|
|
const secrets = {
|
|
luks: shell.luksPw,
|
|
user_password: shell.userPw
|
|
};
|
|
Bridge.setSecrets(secrets, () => saveAndAdvance());
|
|
}
|
|
|
|
function authorizeAndInstall() {
|
|
if (shell.eraseText !== "ERASE") {
|
|
shell.status = "Type ERASE exactly (case sensitive) to continue.";
|
|
return;
|
|
}
|
|
if (!shell.finalConfirm) {
|
|
shell.status = "Tick the confirmation to continue.";
|
|
return;
|
|
}
|
|
shell.status = "Authorizing…";
|
|
Bridge.destructivePreview(reply => {
|
|
if (!reply.ok) {
|
|
shell.status = reply.error;
|
|
return;
|
|
}
|
|
const digest = reply.data.plan_digest;
|
|
Bridge.approve("ERASE", true, appr => {
|
|
if (!appr.ok) {
|
|
shell.status = appr.error;
|
|
return;
|
|
}
|
|
shell.startInstall(digest);
|
|
});
|
|
});
|
|
}
|
|
|
|
function startInstall(digest) {
|
|
shell.phase = "progress";
|
|
shell.stageStatus = ({});
|
|
shell.stageOrder = [];
|
|
shell.progressLog = [];
|
|
shell.status = "";
|
|
Bridge.startInstall(digest, "ERASE", reply => {
|
|
if (reply.ok) {
|
|
shell.phase = "done";
|
|
} else {
|
|
shell.phase = "failed";
|
|
shell.failureText = reply.error;
|
|
shell.failureDisk = parseDiskChange(reply.error);
|
|
shell.failureNext = parseNextActions(reply.error);
|
|
Bridge.logTail(200, r => {
|
|
if (r.ok)
|
|
shell.logLines = r.data.lines;
|
|
});
|
|
}
|
|
});
|
|
}
|
|
|
|
function parseDiskChange(text) {
|
|
const m = ("" + text).match(/disk_changed: ([a-z]+)/);
|
|
return m ? m[1] : "unknown";
|
|
}
|
|
function parseNextActions(text) {
|
|
const m = ("" + text).match(/next: (.+)$/m);
|
|
return m ? [m[1]] : [];
|
|
}
|
|
|
|
function onProgress(event) {
|
|
let next = clone(shell.stageStatus);
|
|
next[event.stage] = event.status;
|
|
shell.stageStatus = next;
|
|
if (event.status === "started" && shell.stageOrder.indexOf(event.stage) === -1) {
|
|
let order = shell.stageOrder.slice();
|
|
order.push(event.stage);
|
|
shell.stageOrder = order;
|
|
}
|
|
let log = shell.progressLog.slice();
|
|
log.push(event);
|
|
shell.progressLog = log;
|
|
}
|
|
|
|
function restartNow() {
|
|
Quickshell.execDetached(["systemctl", "reboot"]);
|
|
}
|
|
function closeInstaller() {
|
|
Qt.quit();
|
|
}
|
|
|
|
Connections {
|
|
target: Bridge
|
|
function onAvailabilityChanged() {
|
|
if (Bridge.ready)
|
|
shell.refreshHandshake();
|
|
}
|
|
function onHandshakeReady() {
|
|
if (Bridge.handshake)
|
|
shell.onHandshake({ ok: true, data: Bridge.handshake });
|
|
}
|
|
function onEvent(name, data) {
|
|
if (name === "progress")
|
|
shell.onProgress(data);
|
|
}
|
|
}
|
|
|
|
Component.onCompleted: startBridge()
|
|
|
|
// Keyboard navigation: Ctrl+Right advances (running the same validation as
|
|
// the Next button), Ctrl+Left goes back, Escape closes. Handled on the
|
|
// page item so events bubble from any focused control.
|
|
function nextAction() {
|
|
if (shell.phase !== "form")
|
|
return;
|
|
if (shell.step === 6)
|
|
shell.authorizeAndInstall();
|
|
else
|
|
shell.advance();
|
|
}
|
|
|
|
Timer {
|
|
id: windowFocusTimer
|
|
interval: 700
|
|
repeat: false
|
|
running: false
|
|
onTriggered: {
|
|
if (typeof window.requestActivate === "function")
|
|
window.requestActivate();
|
|
page.forceActiveFocus();
|
|
}
|
|
}
|
|
|
|
FloatingWindow {
|
|
id: window
|
|
Component.onCompleted: {
|
|
if (typeof window.requestActivate === "function")
|
|
window.requestActivate();
|
|
windowFocusTimer.start();
|
|
}
|
|
visible: true
|
|
color: Theme.charcoal
|
|
implicitWidth: 980
|
|
implicitHeight: 680
|
|
title: "Install Phoebus OS"
|
|
|
|
Rectangle {
|
|
anchors.fill: parent
|
|
gradient: Gradient {
|
|
GradientStop { position: 0.0; color: "#1c1c22" }
|
|
GradientStop { position: 1.0; color: "#141418" }
|
|
}
|
|
}
|
|
|
|
Column {
|
|
id: page
|
|
anchors.fill: parent
|
|
anchors.margins: Theme.gutter
|
|
spacing: 12
|
|
focus: true
|
|
Keys.onPressed: event => {
|
|
if (event.key === Qt.Key_Right && (event.modifiers & Qt.ControlModifier)) {
|
|
shell.nextAction();
|
|
event.accepted = true;
|
|
} else if (event.key === Qt.Key_Left && (event.modifiers & Qt.ControlModifier)) {
|
|
shell.back();
|
|
event.accepted = true;
|
|
} else if (event.key === Qt.Key_Escape) {
|
|
// Closing the frontend mid-install would abandon a
|
|
// destructive operation without explanation. Refuse it and
|
|
// say so truthfully instead.
|
|
if (shell.phase === "progress")
|
|
shell.status = "The installation is in progress and cannot be cancelled safely. Wait for it to finish or for an error report."
|
|
else
|
|
shell.closeInstaller();
|
|
event.accepted = true;
|
|
} else if (event.key === Qt.Key_Return || event.key === Qt.Key_Enter) {
|
|
shell.nextAction();
|
|
event.accepted = true;
|
|
}
|
|
}
|
|
|
|
// -- header ----------------------------------------------------
|
|
Item {
|
|
width: parent.width
|
|
height: 48
|
|
Row {
|
|
anchors.left: parent.left
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
spacing: 12
|
|
PhoebusEmblem { width: 40; height: 40; anchors.verticalCenter: parent.verticalCenter }
|
|
Column {
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
Text {
|
|
text: "Install Phoebus OS"
|
|
color: Theme.warmWhite
|
|
font.family: Theme.family
|
|
font.pixelSize: Theme.fontTitle
|
|
font.weight: Font.DemiBold
|
|
}
|
|
Text {
|
|
text: shell.phase === "form" ? "Step " + (shell.step + 1) + " of 7 · " + shell.stepTitles[shell.step] : "Installation"
|
|
color: Theme.amber
|
|
font.family: Theme.family
|
|
font.pixelSize: Theme.fontSmall
|
|
}
|
|
}
|
|
}
|
|
PhoebusButton {
|
|
anchors.right: parent.right
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
label: "Close"
|
|
compact: true
|
|
actionEnabled: shell.phase !== "progress"
|
|
onClicked: shell.closeInstaller()
|
|
}
|
|
}
|
|
|
|
// -- step dots -------------------------------------------------
|
|
Row {
|
|
spacing: 8
|
|
visible: shell.phase === "form"
|
|
Repeater {
|
|
model: 7
|
|
delegate: Rectangle {
|
|
required property int index
|
|
width: index === shell.step ? 26 : 10
|
|
height: 10
|
|
radius: 5
|
|
color: index < shell.step ? Theme.amberDeep
|
|
: index === shell.step ? Theme.amber
|
|
: Theme.border
|
|
Behavior on width { NumberAnimation { duration: 120 } }
|
|
}
|
|
}
|
|
}
|
|
|
|
// -- body ------------------------------------------------------
|
|
Flickable {
|
|
id: flick
|
|
width: parent.width
|
|
height: parent.height - 48 - 12 - (shell.phase === "form" ? 56 : 0) - 12
|
|
contentWidth: width
|
|
contentHeight: stepColumn.height + 8
|
|
clip: true
|
|
interactive: contentHeight > height
|
|
visible: shell.phase === "form"
|
|
|
|
Column {
|
|
id: stepColumn
|
|
width: flick.width
|
|
spacing: 16
|
|
|
|
// ============ STEP 0: language ========================
|
|
Column {
|
|
width: parent.width
|
|
spacing: 16
|
|
visible: shell.step === 0
|
|
PhoebusCard {
|
|
width: parent.width
|
|
Text { width: parent.width; text: "Language and region"; color: Theme.warmWhite; font.family: Theme.family; font.pixelSize: Theme.fontHeading; font.weight: Font.DemiBold }
|
|
PhoebusField {
|
|
id: localeField
|
|
label: "Locale"
|
|
placeholder: "en_US.UTF-8"
|
|
error: shell.issueFor("locale")
|
|
onEdited: value => shell.cfg.system.locale = value
|
|
Component.onCompleted: inputItem.text = shell.cfg ? shell.cfg.system.locale : ""
|
|
}
|
|
PhoebusChoice {
|
|
id: localePresets
|
|
options: [
|
|
{ value: "en_US.UTF-8", label: "English (US)" },
|
|
{ value: "en_GB.UTF-8", label: "English (UK)" },
|
|
{ value: "de_DE.UTF-8", label: "Deutsch" },
|
|
{ value: "fr_FR.UTF-8", label: "Français" },
|
|
{ value: "es_ES.UTF-8", label: "Español" }
|
|
]
|
|
value: shell.cfg ? shell.cfg.system.locale : ""
|
|
onSelected: value => { shell.cfg.system.locale = value; localeField.inputItem.text = value; shell.touchConfig(); }
|
|
}
|
|
PhoebusField {
|
|
id: keymapField
|
|
label: "Keyboard layout"
|
|
placeholder: "us"
|
|
error: shell.issueFor("keymap")
|
|
onEdited: value => shell.cfg.system.keymap = value
|
|
Component.onCompleted: inputItem.text = shell.cfg ? shell.cfg.system.keymap : ""
|
|
}
|
|
PhoebusChoice {
|
|
id: keymapPresets
|
|
options: ["us", "gb", "de", "fr", "es", "dvorak"]
|
|
value: shell.cfg ? shell.cfg.system.keymap : ""
|
|
onSelected: value => { shell.cfg.system.keymap = value; keymapField.inputItem.text = value; shell.touchConfig(); }
|
|
}
|
|
PhoebusField {
|
|
id: tzField
|
|
label: "Timezone"
|
|
placeholder: "UTC"
|
|
error: shell.issueFor("timezone")
|
|
onEdited: value => shell.cfg.system.timezone = value
|
|
Component.onCompleted: inputItem.text = shell.cfg ? shell.cfg.system.timezone : ""
|
|
}
|
|
}
|
|
PhoebusCard {
|
|
width: parent.width
|
|
Text { width: parent.width; text: "Test your keyboard"; color: Theme.warmWhite; font.family: Theme.family; font.pixelSize: Theme.fontHeading; font.weight: Font.DemiBold }
|
|
Text { width: parent.width; text: "Type a sentence to confirm the layout produces the characters you expect."; color: Theme.muted; font.family: Theme.family; font.pixelSize: Theme.fontSmall; wrapMode: Text.WordWrap }
|
|
PhoebusField { id: kbTest; label: "Type here"; placeholder: "The quick brown fox…" }
|
|
}
|
|
}
|
|
|
|
// ============ STEP 1: network =========================
|
|
Column {
|
|
width: parent.width
|
|
spacing: 16
|
|
visible: shell.step === 1
|
|
PhoebusCard {
|
|
width: parent.width
|
|
Text { width: parent.width; text: "Network connection"; color: Theme.warmWhite; font.family: Theme.family; font.pixelSize: Theme.fontHeading; font.weight: Font.DemiBold }
|
|
Text {
|
|
width: parent.width
|
|
text: shell.handshake && shell.handshake.readiness.network
|
|
? "Connected. Phoebus downloads a verified Gentoo stage3 and packages during installation."
|
|
: "No default route detected. Connect to a network to install Phoebus."
|
|
color: shell.handshake && shell.handshake.readiness.network ? Theme.success : Theme.warning
|
|
font.family: Theme.family
|
|
font.pixelSize: Theme.fontBody
|
|
wrapMode: Text.WordWrap
|
|
}
|
|
Row {
|
|
spacing: 12
|
|
PhoebusButton { label: "Network settings"; onClicked: Quickshell.execDetached(["sh", "-c", "command -v dms >/dev/null && exec dms ipc call settings focusOrToggle || exec kitty -e sh -c 'nmcli device status; read -r _'"]) }
|
|
PhoebusButton { label: "Re-check"; onClicked: shell.refreshHandshake() }
|
|
}
|
|
}
|
|
PhoebusCard {
|
|
width: parent.width
|
|
Text { width: parent.width; text: "Prerequisites"; color: Theme.warmWhite; font.family: Theme.family; font.pixelSize: Theme.fontHeading; font.weight: Font.DemiBold }
|
|
PrereqRow { label: "64-bit x86_64 firmware"; ok: true; detail: shell.handshake ? shell.handshake.readiness.firmware : "?"; }
|
|
PrereqRow { label: "Memory"; ok: shell.handshake && shell.handshake.readiness.memory_mib >= 4096; detail: shell.handshake ? (shell.handshake.readiness.memory_mib + " MiB") : "?" }
|
|
PrereqRow { label: "Processors"; ok: true; detail: shell.handshake ? (shell.handshake.readiness.cpu_cores + " cores · " + shell.handshake.readiness.cpu_model) : "?" }
|
|
PrereqRow { label: "Network"; ok: shell.handshake && shell.handshake.readiness.network; detail: shell.handshake && shell.handshake.readiness.network ? "connected" : "offline" }
|
|
}
|
|
}
|
|
|
|
// ============ STEP 2: AI ==============================
|
|
Column {
|
|
width: parent.width
|
|
spacing: 16
|
|
visible: shell.step === 2
|
|
PhoebusCard {
|
|
width: parent.width
|
|
Text { width: parent.width; text: "Connect an AI model"; color: Theme.warmWhite; font.family: Theme.family; font.pixelSize: Theme.fontHeading; font.weight: Font.DemiBold }
|
|
Text {
|
|
width: parent.width
|
|
text: "Phoebus is AI-first: installation requires a connected model. Choose a hosted provider, or point Phoebus at a model you have downloaded and are serving locally. The installed system boots, runs and recovers without one."
|
|
color: Theme.muted
|
|
font.family: Theme.family
|
|
font.pixelSize: Theme.fontBody
|
|
wrapMode: Text.WordWrap
|
|
}
|
|
PhoebusChoice {
|
|
id: providerChoice
|
|
options: [
|
|
{ value: "deepseek", label: "DeepSeek" },
|
|
{ value: "openai", label: "OpenAI" },
|
|
{ value: "local", label: "Local model" }
|
|
]
|
|
value: shell.cfg ? shell.cfg.ai.provider : "deepseek"
|
|
onSelected: value => shell.configureProvider(value)
|
|
}
|
|
PhoebusField {
|
|
id: keyField
|
|
label: "API key"
|
|
placeholder: "Paste your provider key"
|
|
secret: true
|
|
visible: shell.cfg && (shell.cfg.ai.provider === "deepseek" || shell.cfg.ai.provider === "openai")
|
|
onEdited: value => shell.apiKey = value
|
|
}
|
|
PhoebusField {
|
|
id: modelField
|
|
label: "Model"
|
|
placeholder: "model name"
|
|
error: ""
|
|
onEdited: value => shell.cfg.ai.model = value
|
|
Component.onCompleted: inputItem.text = shell.cfg && shell.cfg.ai.model ? shell.cfg.ai.model : ""
|
|
}
|
|
PhoebusField {
|
|
id: endpointField
|
|
label: "Endpoint (local models)"
|
|
placeholder: "http://127.0.0.1:11434/v1/chat/completions"
|
|
visible: shell.cfg && shell.cfg.ai.provider === "local"
|
|
onEdited: value => shell.cfg.ai.endpoint = value
|
|
Component.onCompleted: inputItem.text = shell.cfg && shell.cfg.ai.endpoint ? shell.cfg.ai.endpoint : ""
|
|
}
|
|
Row {
|
|
spacing: 12
|
|
PhoebusButton {
|
|
label: shell.aiChecking ? "Checking…" : "Connect and validate"
|
|
primary: true
|
|
actionEnabled: !shell.aiChecking
|
|
onClicked: shell.connectAi()
|
|
}
|
|
PhoebusChip {
|
|
visible: shell.aiConnected
|
|
text: "Connected"
|
|
tone: Theme.success
|
|
}
|
|
}
|
|
Text {
|
|
width: parent.width
|
|
visible: shell.aiError.length > 0
|
|
text: shell.aiError
|
|
color: Theme.danger
|
|
font.family: Theme.family
|
|
font.pixelSize: Theme.fontSmall
|
|
wrapMode: Text.WordWrap
|
|
}
|
|
}
|
|
PhoebusCard {
|
|
width: parent.width
|
|
visible: shell.aiApplied.length > 0
|
|
Text { width: parent.width; text: "Validated changes"; color: Theme.warmWhite; font.family: Theme.family; font.pixelSize: Theme.fontHeading; font.weight: Font.DemiBold }
|
|
Repeater {
|
|
model: shell.aiApplied
|
|
delegate: Column {
|
|
required property var modelData
|
|
width: parent.width
|
|
spacing: 2
|
|
Text { width: parent.width; text: "• " + modelData.description; color: Theme.warmWhite; font.family: Theme.family; font.pixelSize: Theme.fontBody; wrapMode: Text.WordWrap }
|
|
Text { width: parent.width; text: " " + modelData.reason; color: Theme.muted; font.family: Theme.family; font.pixelSize: Theme.fontSmall; wrapMode: Text.WordWrap }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// ============ STEP 3: disk ============================
|
|
Column {
|
|
width: parent.width
|
|
spacing: 16
|
|
visible: shell.step === 3
|
|
Text { width: parent.width; text: "Choose the destination disk"; color: Theme.warmWhite; font.family: Theme.family; font.pixelSize: Theme.fontHeading; font.weight: Font.DemiBold }
|
|
Text { width: parent.width; text: "The listed disk is erased completely. Protected disks and the installation medium cannot be selected."; color: Theme.muted; font.family: Theme.family; font.pixelSize: Theme.fontSmall; wrapMode: Text.WordWrap }
|
|
Text { width: parent.width; visible: shell.issueFor("target_disk").length > 0; text: shell.issueFor("target_disk"); color: Theme.danger; font.family: Theme.family; font.pixelSize: Theme.fontSmall; wrapMode: Text.WordWrap }
|
|
Repeater {
|
|
model: shell.disks
|
|
delegate: DiskCard {
|
|
required property var modelData
|
|
width: stepColumn.width
|
|
disk: modelData
|
|
selected: shell.cfg && shell.cfg.storage.disk === modelData.path
|
|
onPicked: path => { shell.cfg.storage.disk = path; shell.selectedDisk = path; }
|
|
}
|
|
}
|
|
PhoebusButton { label: "Rescan disks"; compact: true; onClicked: shell.refreshDisks() }
|
|
}
|
|
|
|
// ============ STEP 4: account =========================
|
|
Column {
|
|
width: parent.width
|
|
spacing: 16
|
|
visible: shell.step === 4
|
|
PhoebusCard {
|
|
width: parent.width
|
|
Text { width: parent.width; text: "Your account"; color: Theme.warmWhite; font.family: Theme.family; font.pixelSize: Theme.fontHeading; font.weight: Font.DemiBold }
|
|
PhoebusField { id: fullnameField; label: "Full name"; onEdited: value => shell.cfg.user.fullname = value; Component.onCompleted: inputItem.text = shell.cfg ? shell.cfg.user.fullname : "" }
|
|
PhoebusField { id: userField; label: "Username"; placeholder: "lowercase"; error: shell.issueFor("username"); onEdited: value => shell.cfg.user.username = value; Component.onCompleted: inputItem.text = shell.cfg ? shell.cfg.user.username : "" }
|
|
PhoebusField { id: hostField; label: "Computer name"; placeholder: "phoebus"; error: shell.issueFor("hostname"); onEdited: value => shell.cfg.system.hostname = value; Component.onCompleted: inputItem.text = shell.cfg ? shell.cfg.system.hostname : "" }
|
|
PhoebusField { id: pwField; label: "Password"; secret: true; error: shell.issueFor("password"); onEdited: value => shell.userPw = value }
|
|
PhoebusField { id: pw2Field; label: "Confirm password"; secret: true; error: shell.issueFor("password_confirm"); onEdited: value => shell.userPw2 = value }
|
|
}
|
|
PhoebusCard {
|
|
width: parent.width
|
|
Text { width: parent.width; text: "Disk encryption"; color: Theme.warmWhite; font.family: Theme.family; font.pixelSize: Theme.fontHeading; font.weight: Font.DemiBold }
|
|
Text { width: parent.width; text: "LUKS2 whole-disk encryption protects your data at rest. Keep this passphrase safe: without it the disk cannot be unlocked."; color: Theme.muted; font.family: Theme.family; font.pixelSize: Theme.fontSmall; wrapMode: Text.WordWrap }
|
|
PhoebusField { id: luksField; label: "Encryption passphrase"; secret: true; error: shell.issueFor("passphrase"); onEdited: value => shell.luksPw = value }
|
|
PhoebusField { id: luks2Field; label: "Confirm passphrase"; secret: true; error: shell.issueFor("passphrase_confirm"); onEdited: value => shell.luksPw2 = value }
|
|
}
|
|
PhoebusCard {
|
|
width: parent.width
|
|
PhoebusButton { label: shell.showAdvanced ? "Hide advanced options" : "Advanced options"; compact: true; onClicked: shell.showAdvanced = !shell.showAdvanced }
|
|
Column {
|
|
width: parent.width
|
|
spacing: 12
|
|
visible: shell.showAdvanced
|
|
Text { width: parent.width; text: "Filesystem"; color: Theme.muted; font.family: Theme.family; font.pixelSize: Theme.fontSmall }
|
|
PhoebusChoice {
|
|
options: [{ value: "btrfs", label: "Btrfs (snapshots, recommended)" }, { value: "ext4", label: "ext4" }]
|
|
value: shell.cfg ? shell.cfg.storage.filesystem : "btrfs"
|
|
onSelected: value => { shell.cfg.storage.filesystem = value; shell.touchConfig(); }
|
|
}
|
|
Text { width: parent.width; text: "Kernel"; color: Theme.muted; font.family: Theme.family; font.pixelSize: Theme.fontSmall }
|
|
PhoebusChoice {
|
|
options: [{ value: "optimized", label: "Optimized" }, { value: "safe", label: "Safe (binary)" }, { value: "aggressive", label: "Aggressive" }]
|
|
value: shell.cfg ? shell.cfg.kernel.profile : "optimized"
|
|
onSelected: value => { shell.cfg.kernel.profile = value; shell.touchConfig(); }
|
|
}
|
|
Text { width: parent.width; text: "Package policy"; color: Theme.muted; font.family: Theme.family; font.pixelSize: Theme.fontSmall }
|
|
PhoebusChoice {
|
|
options: [{ value: "balanced", label: "Balanced" }, { value: "source_first", label: "Source first" }, { value: "binary_first", label: "Binary first" }]
|
|
value: shell.cfg ? shell.cfg.packages.policy : "balanced"
|
|
onSelected: value => { shell.cfg.packages.policy = value; shell.touchConfig(); }
|
|
}
|
|
Text { width: parent.width; text: "Desktop"; color: Theme.muted; font.family: Theme.family; font.pixelSize: Theme.fontSmall }
|
|
PhoebusChoice {
|
|
options: [{ value: "mango", label: "Mango + DankMaterialShell (recommended)" }, { value: "dwl", label: "dwl (fallback)" }, { value: "none", label: "No desktop" }]
|
|
value: shell.cfg ? shell.cfg.desktop.profile : "mango"
|
|
onSelected: value => { shell.cfg.desktop.profile = value; shell.touchConfig(); }
|
|
}
|
|
PhoebusToggle { label: "Flatpak"; description: "Install Flatpak and configure Flathub"; checked: shell.cfg ? shell.cfg.desktop.flatpak : true; onToggled: value => { shell.cfg.desktop.flatpak = value; shell.touchConfig(); } }
|
|
PhoebusToggle { label: "Nix"; description: "Second package lane for development tools"; checked: shell.cfg ? shell.cfg.packages.nix : true; onToggled: value => { shell.cfg.packages.nix = value; shell.touchConfig(); } }
|
|
PhoebusToggle { label: "Signed binary packages"; description: "Reuse the official Gentoo binhost where USE matches"; checked: shell.cfg ? shell.cfg.packages.binary_packages : true; onToggled: value => { shell.cfg.packages.binary_packages = value; shell.touchConfig(); } }
|
|
}
|
|
}
|
|
}
|
|
|
|
// ============ STEP 5: review ==========================
|
|
Column {
|
|
width: parent.width
|
|
spacing: 16
|
|
visible: shell.step === 5
|
|
PhoebusCard {
|
|
width: parent.width
|
|
Text { width: parent.width; text: "Review the installation plan"; color: Theme.warmWhite; font.family: Theme.family; font.pixelSize: Theme.fontHeading; font.weight: Font.DemiBold }
|
|
Text { width: parent.width; text: "Target disk"; color: Theme.muted; font.family: Theme.family; font.pixelSize: Theme.fontSmall }
|
|
Text { width: parent.width; text: shell.review ? shell.review.target_disk : "…"; color: Theme.danger; font.family: Theme.family; font.pixelSize: Theme.fontTitle; font.weight: Font.DemiBold }
|
|
Text { width: parent.width; text: "The disk above will be erased. Everything on it is destroyed."; color: Theme.warmWhite; font.family: Theme.family; font.pixelSize: Theme.fontBody; wrapMode: Text.WordWrap }
|
|
}
|
|
PhoebusCard {
|
|
width: parent.width
|
|
Text { width: parent.width; text: "What will be created"; color: Theme.warmWhite; font.family: Theme.family; font.pixelSize: Theme.fontHeading; font.weight: Font.DemiBold }
|
|
ReviewRow { label: "Encryption"; value: shell.review ? shell.review.encryption : "…" }
|
|
ReviewRow { label: "Filesystem"; value: shell.review ? shell.review.filesystem : "…" }
|
|
ReviewRow { label: "Desktop"; value: shell.review ? shell.review.desktop : "…" }
|
|
ReviewRow { label: "Computer name"; value: shell.review ? shell.review.hostname : "…" }
|
|
ReviewRow { label: "User"; value: shell.review ? shell.review.username : "…" }
|
|
ReviewRow { label: "Locale"; value: shell.review ? shell.review.locale : "…" }
|
|
ReviewRow { label: "Timezone"; value: shell.review ? shell.review.timezone : "…" }
|
|
ReviewRow { label: "Subsystems"; value: shell.review ? shell.review.subsystems.join(", ") : "…" }
|
|
ReviewRow { label: "Subvolumes"; value: shell.review ? shell.review.subvolumes.join(" ") : "…" }
|
|
}
|
|
PhoebusCard {
|
|
width: parent.width
|
|
Text { width: parent.width; text: "Destructive preview"; color: Theme.warning; font.family: Theme.family; font.pixelSize: Theme.fontHeading; font.weight: Font.DemiBold }
|
|
Text { width: parent.width; text: shell.previewText; color: Theme.muted; font.family: "monospace"; font.pixelSize: Theme.fontSmall; wrapMode: Text.WordWrap }
|
|
}
|
|
}
|
|
|
|
// ============ STEP 6: confirm =========================
|
|
Column {
|
|
width: parent.width
|
|
spacing: 16
|
|
visible: shell.step === 6
|
|
PhoebusCard {
|
|
width: parent.width
|
|
Text { width: parent.width; text: "Authorize the installation"; color: Theme.warmWhite; font.family: Theme.family; font.pixelSize: Theme.fontHeading; font.weight: Font.DemiBold }
|
|
Text { width: parent.width; text: "All data on " + (shell.cfg ? shell.cfg.storage.disk : "the target") + " will be erased. This cannot be undone."; color: Theme.danger; font.family: Theme.family; font.pixelSize: Theme.fontBody; wrapMode: Text.WordWrap }
|
|
PhoebusField { id: eraseField; label: "Type ERASE to authorize"; placeholder: "ERASE"; onEdited: value => shell.eraseText = value }
|
|
PhoebusToggle { label: "I understand that the target disk will be erased"; checked: shell.finalConfirm; onToggled: value => shell.finalConfirm = value }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// -- progress / result ----------------------------------------
|
|
Column {
|
|
width: parent.width
|
|
height: parent.height - 48 - 12
|
|
spacing: 14
|
|
visible: shell.phase !== "form"
|
|
|
|
Column {
|
|
width: parent.width
|
|
spacing: 10
|
|
visible: shell.phase === "progress"
|
|
Text { text: "Installing Phoebus OS"; color: Theme.warmWhite; font.family: Theme.family; font.pixelSize: Theme.fontTitle; font.weight: Font.DemiBold }
|
|
Text { width: parent.width; text: "The stages below are the real backend stages. Downloads, compilation, configuration and verification are reported as they happen; no percentage is estimated."; color: Theme.muted; font.family: Theme.family; font.pixelSize: Theme.fontSmall; wrapMode: Text.WordWrap }
|
|
Text { width: parent.width; text: "This cannot be cancelled safely once disk changes begin. Leave the window open until the installation finishes or reports an error."; color: Theme.warning; font.family: Theme.family; font.pixelSize: Theme.fontSmall; wrapMode: Text.WordWrap }
|
|
Rectangle {
|
|
id: progressTrack
|
|
width: parent.width; height: 6; radius: 3; color: Theme.border
|
|
Rectangle {
|
|
id: progressBar
|
|
width: progressTrack.width * 0.3; height: parent.height; radius: 3; color: Theme.amber
|
|
SequentialAnimation on x {
|
|
loops: Animation.Infinite
|
|
NumberAnimation { from: 0; to: progressTrack.width - progressBar.width; duration: 1100; easing.type: Easing.InOutQuad }
|
|
NumberAnimation { from: progressTrack.width - progressBar.width; to: 0; duration: 1100; easing.type: Easing.InOutQuad }
|
|
}
|
|
}
|
|
}
|
|
Repeater {
|
|
model: shell.stageOrder
|
|
delegate: Row {
|
|
required property var modelData
|
|
width: parent.width
|
|
spacing: 10
|
|
Rectangle {
|
|
width: 12; height: 12; radius: 6
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
color: shell.stageStatus[modelData] === "failed" ? Theme.danger
|
|
: shell.stageStatus[modelData] === "finished" ? Theme.success
|
|
: Theme.amber
|
|
}
|
|
Text {
|
|
text: stageLabel(modelData)
|
|
color: Theme.warmWhite
|
|
font.family: Theme.family
|
|
font.pixelSize: Theme.fontBody
|
|
}
|
|
Text {
|
|
text: stageCategory(modelData)
|
|
color: Theme.muted
|
|
font.family: Theme.family
|
|
font.pixelSize: Theme.fontSmall
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
Column {
|
|
width: parent.width
|
|
spacing: 12
|
|
visible: shell.phase === "done"
|
|
Row {
|
|
spacing: 14
|
|
PhoebusEmblem { width: 64; height: 64 }
|
|
Column {
|
|
Text { text: "Phoebus OS is installed"; color: Theme.success; font.family: Theme.family; font.pixelSize: Theme.fontTitle; font.weight: Font.DemiBold }
|
|
Text { text: "Your system is ready. It can boot, run and recover without a network or a model."; color: Theme.muted; font.family: Theme.family; font.pixelSize: Theme.fontBody; wrapMode: Text.WordWrap }
|
|
}
|
|
}
|
|
PhoebusCard {
|
|
width: parent.width
|
|
Text { width: parent.width; text: "Next steps"; color: Theme.warmWhite; font.family: Theme.family; font.pixelSize: Theme.fontHeading; font.weight: Font.DemiBold }
|
|
Text { width: parent.width; text: "1. Remove the installation medium.\n2. Restart the computer."; color: Theme.warmWhite; font.family: Theme.family; font.pixelSize: Theme.fontBody; wrapMode: Text.WordWrap }
|
|
}
|
|
Row {
|
|
spacing: 12
|
|
PhoebusButton { label: "Restart now"; primary: true; onClicked: shell.restartNow() }
|
|
PhoebusButton { label: "Close installer"; onClicked: shell.closeInstaller() }
|
|
}
|
|
}
|
|
|
|
Column {
|
|
width: parent.width
|
|
spacing: 12
|
|
visible: shell.phase === "failed"
|
|
Text { text: "Installation stopped"; color: Theme.danger; font.family: Theme.family; font.pixelSize: Theme.fontTitle; font.weight: Font.DemiBold }
|
|
PhoebusCard {
|
|
width: parent.width
|
|
Text { width: parent.width; text: "What happened"; color: Theme.warmWhite; font.family: Theme.family; font.pixelSize: Theme.fontHeading; font.weight: Font.DemiBold }
|
|
Text { width: parent.width; text: shell.failureText; color: Theme.warmWhite; font.family: Theme.family; font.pixelSize: Theme.fontBody; wrapMode: Text.WordWrap }
|
|
Text { width: parent.width; text: "Disk changes: " + shell.failureDisk; color: shell.failureDisk === "yes" || shell.failureDisk === "partial" ? Theme.warning : Theme.success; font.family: Theme.family; font.pixelSize: Theme.fontBody }
|
|
Repeater {
|
|
model: shell.failureNext
|
|
delegate: Text { required property var modelData; width: parent.width; text: "• " + modelData; color: Theme.muted; font.family: Theme.family; font.pixelSize: Theme.fontSmall; wrapMode: Text.WordWrap }
|
|
}
|
|
}
|
|
Row {
|
|
spacing: 12
|
|
PhoebusButton { label: shell.showFailureLog ? "Hide log" : "View redacted log"; onClicked: { shell.showFailureLog = !shell.showFailureLog; if (shell.showFailureLog) Bridge.logTail(200, r => { if (r.ok) shell.logLines = r.data.lines; }); } }
|
|
PhoebusButton { label: "Back to review"; onClicked: { shell.phase = "form"; shell.step = 5; shell.enterStep(); } }
|
|
PhoebusButton { label: "Close installer"; compact: true; onClicked: shell.closeInstaller() }
|
|
}
|
|
PhoebusCard {
|
|
width: parent.width
|
|
visible: shell.showFailureLog
|
|
Text { width: parent.width; text: shell.logLines.join("\n"); color: Theme.muted; font.family: "monospace"; font.pixelSize: Theme.fontSmall; wrapMode: Text.WrapAnywhere }
|
|
}
|
|
}
|
|
}
|
|
|
|
// -- footer ----------------------------------------------------
|
|
Item {
|
|
width: parent.width
|
|
height: 56
|
|
visible: shell.phase === "form"
|
|
Text {
|
|
anchors.left: parent.left
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
text: (!Bridge.ready ? "Installer backend starting… " : "") + (Bridge.lastError.length > 0 ? "[" + Bridge.lastError + "] " : "") + shell.status
|
|
color: shell.status.indexOf("fix") !== -1 || shell.status.indexOf("requires") !== -1 ? Theme.danger : Theme.muted
|
|
font.family: Theme.family
|
|
font.pixelSize: Theme.fontSmall
|
|
width: Math.max(120, parent.width - 320)
|
|
wrapMode: Text.WordWrap
|
|
}
|
|
Row {
|
|
anchors.right: parent.right
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
spacing: 12
|
|
PhoebusButton { label: "Back"; actionEnabled: shell.step > 0 && shell.step < 7; onClicked: shell.back() }
|
|
PhoebusButton {
|
|
visible: shell.step < 6
|
|
label: "Next"
|
|
primary: true
|
|
onClicked: shell.advance()
|
|
}
|
|
PhoebusButton {
|
|
visible: shell.step === 6
|
|
label: "Install now"
|
|
primary: true
|
|
onClicked: shell.authorizeAndInstall()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// -- inline helper components ------------------------------------------
|
|
component PrereqRow: Row {
|
|
property string label: ""
|
|
property bool ok: true
|
|
property string detail: ""
|
|
width: parent.width
|
|
spacing: 10
|
|
Rectangle {
|
|
width: 10; height: 10; radius: 5
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
color: parent.ok ? Theme.success : Theme.danger
|
|
}
|
|
Text { text: parent.label; color: Theme.warmWhite; font.family: Theme.family; font.pixelSize: Theme.fontBody; width: 260 }
|
|
Text { text: parent.detail; color: Theme.muted; font.family: Theme.family; font.pixelSize: Theme.fontSmall; width: parent.width - 300; wrapMode: Text.WordWrap }
|
|
}
|
|
|
|
component ReviewRow: Row {
|
|
property string label: ""
|
|
property string value: ""
|
|
width: parent.width
|
|
spacing: 10
|
|
Text { text: parent.label; color: Theme.muted; font.family: Theme.family; font.pixelSize: Theme.fontBody; width: 160 }
|
|
Text { text: parent.value; color: Theme.warmWhite; font.family: Theme.family; font.pixelSize: Theme.fontBody; width: parent.width - 180; wrapMode: Text.WordWrap }
|
|
}
|
|
|
|
component DiskCard: Rectangle {
|
|
id: diskCard
|
|
property var disk: null
|
|
property bool selected: false
|
|
signal picked(string path)
|
|
readonly property bool usable: disk !== null && !disk.protected
|
|
height: inner.implicitHeight + 24
|
|
radius: Theme.radius
|
|
color: selected ? Qt.rgba(0.91, 0.64, 0.24, 0.12) : Theme.surface
|
|
border.width: selected || activeFocus ? 2 : 1
|
|
border.color: activeFocus ? Theme.focusRing : (selected ? Theme.amber : Theme.border)
|
|
opacity: usable ? 1 : 0.7
|
|
activeFocusOnTab: usable
|
|
Accessible.role: Accessible.RadioButton
|
|
Accessible.name: disk ? disk.path : ""
|
|
Accessible.checked: selected
|
|
|
|
Keys.onReturnPressed: if (usable) diskCard.picked(diskCard.disk.path)
|
|
Keys.onEnterPressed: if (usable) diskCard.picked(diskCard.disk.path)
|
|
Keys.onSpacePressed: if (usable) diskCard.picked(diskCard.disk.path)
|
|
|
|
MouseArea {
|
|
anchors.fill: parent
|
|
enabled: diskCard.usable
|
|
cursorShape: Qt.PointingHandCursor
|
|
onClicked: diskCard.picked(diskCard.disk.path)
|
|
}
|
|
|
|
Column {
|
|
id: inner
|
|
anchors.left: parent.left
|
|
anchors.right: parent.right
|
|
anchors.top: parent.top
|
|
anchors.margins: 12
|
|
spacing: 4
|
|
Row {
|
|
spacing: 10
|
|
Text { text: diskCard.disk ? diskCard.disk.path : ""; color: diskCard.usable ? Theme.warmWhite : Theme.muted; font.family: Theme.family; font.pixelSize: Theme.fontBody; font.weight: Font.DemiBold }
|
|
Text { text: diskCard.disk ? diskCard.disk.size_human : ""; color: Theme.amber; font.family: Theme.family; font.pixelSize: Theme.fontBody }
|
|
PhoebusChip { visible: diskCard.disk && diskCard.disk.live_medium; text: "installation medium"; tone: Theme.amber }
|
|
PhoebusChip { visible: diskCard.disk && diskCard.disk.protected && !diskCard.disk.live_medium; text: "protected"; tone: Theme.danger }
|
|
PhoebusChip { visible: diskCard.selected; text: "selected"; tone: Theme.amber }
|
|
}
|
|
Text { width: parent.width; text: diskCard.disk ? diskCard.disk.model + " · " + diskCard.disk.transport : ""; color: Theme.muted; font.family: Theme.family; font.pixelSize: Theme.fontSmall; wrapMode: Text.WordWrap }
|
|
Text { width: parent.width; visible: diskCard.disk !== null && diskCard.disk.protection != null; text: (diskCard.disk !== null && diskCard.disk.protection != null) ? ("Reason: " + diskCard.disk.protection) : ""; color: Theme.danger; font.family: Theme.family; font.pixelSize: Theme.fontSmall; wrapMode: Text.WordWrap }
|
|
Text { width: parent.width; visible: diskCard.disk && diskCard.disk.partitions.length > 0; text: "Existing partitions: " + (diskCard.disk ? diskCard.disk.partitions.join(", ") : ""); color: Theme.muted; font.family: Theme.family; font.pixelSize: Theme.fontSmall; wrapMode: Text.WordWrap }
|
|
}
|
|
}
|
|
|
|
function stageLabel(stage) {
|
|
for (let i = 0; i < shell.progressLog.length; i++) {
|
|
if (shell.progressLog[i].stage === stage)
|
|
return shell.progressLog[i].label;
|
|
}
|
|
return stage;
|
|
}
|
|
function stageCategory(stage) {
|
|
for (let i = 0; i < shell.progressLog.length; i++) {
|
|
if (shell.progressLog[i].stage === stage && shell.progressLog[i].status === "started")
|
|
return "(" + shell.progressLog[i].category + ")";
|
|
}
|
|
return "";
|
|
}
|
|
|
|
property string eraseText: ""
|
|
property bool finalConfirm: false
|
|
}
|