mirror of
https://github.com/D-Modem/gui.git
synced 2026-11-28 22:30:49 -08:00
- windows/: the Windows app in plain Win32 C++ (ANSI APIs, Win95 common controls, Winsock 1.1), so that it runs on Windows 95 and later: Modem, Terminal, Settings, Call Stats and Log pages over libdmodemctl. dmodemd is started where Windows can run it; on 9x the app reaches a modem over TCP or a COM port. build-watcom.sh builds it with Open Watcom; CMake builds it with MinGW or MSVC. - macos/: the SwiftUI app (XcodeGen project), with the terminal drawn from libdmodemctl's screen, the SIP password in the keychain. - The app icon (assets/dmodem.svg, from the brand's jack art) as .ico and an asset catalogue, by tools/icons.js and tools/icons.py. - libdmodemctl: anonymous enums (Swift imports them as constants), Backspace as BS (the modem's S5), key table without designated initialisers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01B82eRVTPinTtLUajudobBC
91 lines
3.4 KiB
Swift
91 lines
3.4 KiB
Swift
// SPDX-License-Identifier: BSD-3-Clause
|
|
// Copyright (c) 2026, D-Modem
|
|
//
|
|
// LineSettingsView.swift - the line settings (D-Modem > Settings):
|
|
// where the modem's calls go
|
|
|
|
import SwiftUI
|
|
import UniformTypeIdentifiers
|
|
|
|
struct LineSettingsView: View {
|
|
@EnvironmentObject var modem: Modem
|
|
@State private var c = LineConfig()
|
|
@State private var loaded = false
|
|
@State private var choosing = false
|
|
|
|
var body: some View {
|
|
Form {
|
|
Picker("Line", selection: $c.line) {
|
|
ForEach(LineKind.allCases) { Text($0.label).tag($0) }
|
|
}
|
|
.pickerStyle(.radioGroup)
|
|
|
|
switch c.line {
|
|
case .sip:
|
|
Section("SIP account") {
|
|
TextField("User", text: $c.sipUser)
|
|
SecureField("Password", text: $c.sipPassword)
|
|
TextField("Server", text: $c.sipServer, prompt: Text("sip.example.net"))
|
|
Toggle("Take incoming calls", isOn: $c.listen)
|
|
}
|
|
Section("Calls") {
|
|
Toggle("Fax over T.38", isOn: $c.t38)
|
|
Toggle("Modem over V.152", isOn: $c.v152)
|
|
Toggle("Modem relay (V.150.1)", isOn: $c.v150)
|
|
Picker("Encryption (SRTP)", selection: $c.srtp) {
|
|
Text("When offered").tag("")
|
|
Text("Never").tag("no")
|
|
Text("Required").tag("require")
|
|
}
|
|
}
|
|
case .usb:
|
|
Section("USB modem") {
|
|
TextField("Modem", text: $c.usb, prompt: Text("auto"))
|
|
Text("“auto” takes the first USB voice modem found.")
|
|
.font(.caption).foregroundStyle(.secondary)
|
|
}
|
|
case .device:
|
|
Section("The modem's device") {
|
|
TextField("Device", text: $c.device, prompt: Text("/dev/ttyDM0"))
|
|
Text("A D-Modem that already runs, as a service or by hand.")
|
|
.font(.caption).foregroundStyle(.secondary)
|
|
}
|
|
}
|
|
|
|
Section("The modem") {
|
|
TextField("Country", text: $c.country, prompt: Text("as the modem's default"))
|
|
TextField("Init string", text: $c.initString, prompt: Text("sent each time it opens"))
|
|
.font(.body.monospaced())
|
|
if c.line != .device {
|
|
HStack {
|
|
TextField("dmodemd", text: $c.dmodemd, prompt: Text("looked for"))
|
|
Button("Choose…") { choosing = true }
|
|
}
|
|
Stepper("Debug level: \(c.debug)", value: $c.debug, in: 0...5)
|
|
}
|
|
}
|
|
|
|
HStack {
|
|
Spacer()
|
|
Button("Save") {
|
|
modem.saveConfig(c)
|
|
if modem.running { modem.say("The new settings apply when the modem starts again") }
|
|
}
|
|
.keyboardShortcut(.defaultAction)
|
|
}
|
|
}
|
|
.formStyle(.grouped)
|
|
.frame(width: 480)
|
|
.fixedSize(horizontal: false, vertical: true)
|
|
.onAppear {
|
|
if !loaded {
|
|
c = modem.config
|
|
loaded = true
|
|
}
|
|
}
|
|
.fileImporter(isPresented: $choosing, allowedContentTypes: [.unixExecutable, .item]) { r in
|
|
if case .success(let url) = r { c.dmodemd = url.path }
|
|
}
|
|
}
|
|
}
|