mirror of
https://github.com/D-Modem/gui.git
synced 2026-11-28 14:19:58 -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
52 lines
1.5 KiB
Swift
52 lines
1.5 KiB
Swift
// SPDX-License-Identifier: BSD-3-Clause
|
|
// Copyright (c) 2026, D-Modem
|
|
//
|
|
// DModemApp.swift - the app: its window, menus and the line settings
|
|
|
|
import SwiftUI
|
|
|
|
@main
|
|
struct DModemApp: App {
|
|
@NSApplicationDelegateAdaptor(AppDelegate.self) var delegate
|
|
@StateObject private var modem = Modem()
|
|
|
|
var body: some Scene {
|
|
Window("D-Modem", id: "main") {
|
|
ContentView()
|
|
.environmentObject(modem)
|
|
.frame(minWidth: 760, minHeight: 520)
|
|
.onAppear { delegate.modem = modem }
|
|
}
|
|
.commands {
|
|
CommandMenu("Modem") {
|
|
Button(modem.running ? "Stop" : "Start") {
|
|
modem.running ? modem.stop() : modem.start()
|
|
}
|
|
.keyboardShortcut("r")
|
|
Divider()
|
|
Button("Answer") { modem.answer() }
|
|
.disabled(modem.state != Int(DMC_RINGING))
|
|
Button("Hang Up") { modem.hangUp() }
|
|
.keyboardShortcut(".")
|
|
.disabled(!modem.canHangUp)
|
|
}
|
|
}
|
|
Settings {
|
|
LineSettingsView()
|
|
.environmentObject(modem)
|
|
}
|
|
}
|
|
}
|
|
|
|
final class AppDelegate: NSObject, NSApplicationDelegate {
|
|
weak var modem: Modem?
|
|
|
|
func applicationShouldTerminateAfterLastWindowClosed(_ app: NSApplication) -> Bool {
|
|
true
|
|
}
|
|
|
|
func applicationWillTerminate(_ notification: Notification) {
|
|
modem?.stop()
|
|
}
|
|
}
|