Watch
1
0
Fork
You've already forked souveraine
0
souveraine/surfaces/quickshell/ii-base/modules/ii/screenTranslator/ScreenTranslatorPanel.qml
Fimeg 8f42fc953d publish: the public projection begins here
This is a projection, not a development branch. The tree above was constructed
from the internal source named below under a manifest that decides which paths
may leave, then scanned as a whole tree rather than as a series of patches, and
only then published.

Public history starts here because the history before it was not admissible,
and neither was the tree. What used to stand in this repository included a
rescue copy of another machine, a directory of phone handoffs, deployment
wired to one house, and a submodule pointing at a forge no stranger can reach.
None of that was ever the product. It stays in the private forge, which is
allowed to hold the whole working organism, and this is what was deliberately
sent out instead.

Three mechanisms produced this tree, in decreasing order of trust. A top-level
path the manifest does not name never arrives at all, which is the one that
catches directories nobody has thought of yet. Named internal files inside
admitted roots are dropped. A short, reviewed table replaces deployment
defaults that a public build must not carry -- an endpoint aimed at one LAN, a
VPN profile belonging to one phone, packaging built from one checkout path.

Everything after this commit is an ordinary publication with the same three
trailers, so a force push stops being routine and starts meaning that
something deliberate happened. The trailers bind the projection to its source
without pretending the public SHA is the private one: same lineage, different
tree, and the record says so.

Source-Sha: 8f27b1e76a8fef560a336aba18e6990713ff1047
Policy-Sha: 6b261d2f3e6e1fb19874846ba4bb1dfe15565d25b8618c1c1afba0419c101d27
Tree-Digest: 18ec3563c5e5ef9a414993a9f6734b251ff9ed3cd56eebdd6cac01e45c6e3067
2026-09-04 15:55:48 -04:00

225 lines
6.2 KiB
QML

pragma ComponentBehavior: Bound
import QtQuick
import QtQuick.Layouts
import Quickshell
import Quickshell.Wayland
import qs.modules.common
import qs.modules.common.utils
import qs.modules.common.widgets
import qs.services
PanelWindow {
id: root
// Interface
signal dismiss
// Window props
visible: false
// color: Appearance.colors.colLayer0
color: "black"
WlrLayershell.namespace: "quickshell:regionSelector"
WlrLayershell.layer: WlrLayer.Overlay
WlrLayershell.keyboardFocus: WlrKeyboardFocus.OnDemand
exclusionMode: ExclusionMode.Ignore
anchors {
left: true
right: true
top: true
bottom: true
}
// Config
readonly property string screenshotDir: Directories.screenshotTemp
readonly property string screenshotPath: `${root.screenshotDir}/image-${screen.name}`
// Preparation
property bool screenshotReady: false
function performTranslation() {
screenshotReady = true;
}
TempScreenshotProcess {
id: screenshotProc
running: true
screen: root.screen
screenshotDir: root.screenshotDir
screenshotPath: root.screenshotPath
onExited: (_, __) => {
root.visible = true;
root.performTranslation();
}
}
// Actual content
property real scale: 1.0
property real contentX: 0
property real contentY: 0
MouseArea {
anchors.fill: parent
clip: true
property real lastX: 0
property real lastY: 0
cursorShape: Qt.SizeAllCursor
onPressed: mouse => {
lastX = mouse.x;
lastY = mouse.y;
}
onPositionChanged: mouse => {
if (pressed) {
root.contentX += (mouse.x - lastX);
root.contentY += (mouse.y - lastY);
lastX = mouse.x;
lastY = mouse.y;
}
}
onWheel: event => {
const zoomFactor = event.angleDelta.y > 0 ? 1.1 : 0.9;
const oldScale = root.scale;
const newScale = Math.min(Math.max(0.1, oldScale * zoomFactor), 5);
if (newScale !== oldScale) {
// Determine mouse position relative to the content's unscaled origin
const localX = (event.x - root.contentX) / oldScale;
const localY = (event.y - root.contentY) / oldScale;
// Apply zoom
root.scale = newScale;
// Shift offsets to keep the same local point under the cursor
root.contentX = event.x - (localX * newScale);
root.contentY = event.y - (localY * newScale);
}
}
ScreencopyView { // Freeze screen
id: screencopy
width: parent.width
height: parent.height
x: root.contentX
y: root.contentY
scale: root.scale
transformOrigin: Item.TopLeft
live: false
captureSource: root.screen
}
Loader {
width: parent.width * root.scale
height: parent.height * root.scale
x: root.contentX
y: root.contentY
active: root.screenshotReady
sourceComponent: ScreenTextOverlay {
screenshotPath: root.screenshotPath
scaleFactor: root.scale
}
}
}
Row {
anchors {
horizontalCenter: parent.horizontalCenter
bottom: parent.bottom
bottomMargin: -height
}
Behavior on anchors.bottomMargin {
animation: Appearance.animation.elementMove.numberAnimation.createObject(this)
}
Component.onCompleted: {
anchors.bottomMargin = 8;
}
spacing: 6
Toolbar {
id: toolbar
focus: root.visible
Keys.onPressed: event => { // Esc to close
if (event.key === Qt.Key_Escape) {
root.dismiss();
}
}
spacing: 0
IconToolbarButton {
id: sleepButton
onClicked: {
toggled = !toggled
if (toggled) keyInput.forceActiveFocus()
}
text: "key"
StyledToolTip {
z: 9999
text: Translation.tr("Key input")
}
}
Revealer {
reveal: sleepButton.toggled
Layout.fillHeight: true
RowLayout {
anchors.left: parent.left
spacing: 6
Item {} // extra padding
ToolbarTextField {
id: keyInput
implicitWidth: 400
placeholderText: Translation.tr("Paste service account key JSON here")
inputMethodHints: Qt.ImhSensitiveData
onAccepted: submit()
function submit() {
const success = GoogleCloud.setKeyJson(text);
if (!success) {
invalidJsonAnimation.restart();
} else {
text = "";
sleepButton.toggled = false;
}
}
ErrorShakeAnimation {
id: invalidJsonAnimation
target: keyInput
}
}
IconToolbarButton {
id: submitButton
onClicked: keyInput.submit()
text: "check"
toggled: keyInput.text.length > 0
StyledToolTip {
z: 9999
text: Translation.tr("Confirm")
}
}
}
}
}
ToolbarPairedFab {
iconText: "close"
onClicked: root.dismiss()
StyledToolTip {
text: Translation.tr("Close")
}
}
}
}