- Move the ~17 top-level QML files into views/, settings/, and forms/ subdirectories, grouped so cross-directory type references stay minimal (only 3 files need an added `import` line). Root now only holds the four surfaces plugin.json points at directly. - Add a `dms ipc call dankChat popout` IPC target to open the floating window directly, alongside the existing `toggle`, and document both in the README along with the new directory layout. - Add one line of breathing room between the last message and the composer bar via the message ListView's bottomMargin (measured with FontMetrics rather than a guessed pixel value). Co-Authored-By: Claude Sonnet 5 <[email protected]>
106 lines
3.2 KiB
QML
106 lines
3.2 KiB
QML
import QtQuick
|
|
import QtQuick.Layouts
|
|
import qs.Common
|
|
import qs.Widgets
|
|
|
|
// Tor's own settings category, loaded by ChatSettings.qml's protocol rail.
|
|
// There is exactly one embedded Tor client shared by the whole daemon (see
|
|
// chatd-rs's net/tor.rs TorManager) - not one per account - so everything
|
|
// here is daemon-global: which transport mode Sneedchat accounts use, and
|
|
// actions on the shared circuit/client itself. Contrast with
|
|
// SneedchatSettingsPanel.qml's "Channels" section, which is genuinely
|
|
// per-account.
|
|
ColumnLayout {
|
|
id: root
|
|
|
|
property var accounts: []
|
|
|
|
signal torConfigChanged(string torMode, string proxy)
|
|
signal regenerateCircuitRequested()
|
|
signal restartFromScratchRequested()
|
|
|
|
readonly property var sockchatAccount: root.accounts.find(a => a.service === "sockchat") || null
|
|
|
|
spacing: Theme.spacingXS
|
|
|
|
StyledText {
|
|
Layout.fillWidth: true
|
|
text: "Tor"
|
|
font.pixelSize: Theme.fontSizeLarge
|
|
font.weight: Font.Bold
|
|
color: Theme.surfaceVariantText
|
|
}
|
|
|
|
StyledText {
|
|
Layout.fillWidth: true
|
|
text: "Sneedchat is Tor-only. Embedded runs Tor in-process (no setup needed); an external proxy uses a Tor daemon or Tor Browser you already have running. This applies to every configured Sneedchat account."
|
|
wrapMode: Text.WordWrap
|
|
font.pixelSize: Theme.fontSizeSmall
|
|
color: Theme.surfaceVariantText
|
|
}
|
|
|
|
RowLayout {
|
|
Layout.fillWidth: true
|
|
spacing: Theme.spacingS
|
|
|
|
DankToggle {
|
|
id: proxyToggle
|
|
Layout.preferredHeight: height
|
|
text: "Use an external SOCKS5 proxy instead of embedded Tor"
|
|
checked: root.sockchatAccount ? root.sockchatAccount.torMode === "proxy" : false
|
|
}
|
|
}
|
|
|
|
DankTextField {
|
|
id: proxyField
|
|
Layout.fillWidth: true
|
|
visible: proxyToggle.checked
|
|
placeholderText: "socks5h://127.0.0.1:9050"
|
|
text: root.sockchatAccount ? (root.sockchatAccount.torProxy || "") : ""
|
|
}
|
|
|
|
DankButton {
|
|
text: "Save connection settings"
|
|
onClicked: {
|
|
const mode = proxyToggle.checked ? "proxy" : "embedded";
|
|
root.torConfigChanged(mode, proxyToggle.checked ? proxyField.text : "");
|
|
}
|
|
}
|
|
|
|
Rectangle {
|
|
Layout.fillWidth: true
|
|
height: 1
|
|
color: Theme.outlineMedium
|
|
}
|
|
|
|
StyledText {
|
|
Layout.fillWidth: true
|
|
text: "Circuit"
|
|
font.weight: Font.Medium
|
|
color: Theme.surfaceVariantText
|
|
}
|
|
|
|
StyledText {
|
|
Layout.fillWidth: true
|
|
text: "Regenerate gets a fresh circuit using the existing cached consensus/guard data (fast). Restart from scratch also wipes that cache for a full cold bootstrap (can take up to a minute). Both reconnect every Sneedchat account afterward."
|
|
wrapMode: Text.WordWrap
|
|
font.pixelSize: Theme.fontSizeSmall
|
|
color: Theme.surfaceVariantText
|
|
}
|
|
|
|
RowLayout {
|
|
Layout.fillWidth: true
|
|
spacing: Theme.spacingS
|
|
|
|
DankButton {
|
|
text: "Regenerate circuit"
|
|
onClicked: root.regenerateCircuitRequested()
|
|
}
|
|
|
|
DankButton {
|
|
text: "Restart Tor from scratch"
|
|
onClicked: root.restartFromScratchRequested()
|
|
}
|
|
}
|
|
}
|