Files
nexus/rust/app/src/views.rs
T
Andy Dixon 9805681c2c license: release Nexus Terminal under the GNU AGPL v3
- LICENSE: the GNU Affero General Public License, version 3 (verbatim
  from gnu.org).
- SPDX-License-Identifier: AGPL-3.0-only plus a copyright line on every
  first-party source file (Rust, shell, Python, PHP); vendored crates keep
  their own licenses.
- Cargo manifests carry license/authors/repository; the macOS bundle
  copyright and the About page state the license and link the source.
- Release zips (and the macOS app bundle) include LICENSE.
- README: License section.
2026-10-13 09:46:31 +01:00

53 lines
1.5 KiB
Rust

// SPDX-License-Identifier: AGPL-3.0-only
// Copyright (C) 2026 Andy Dixon
//! How a session is drawn. Terminal-style protocols share `TermView`; the rest have their own.
use crate::desktop_view::DesktopView;
use crate::github_view::GithubView;
use crate::irc_view::IrcView;
use crate::raw_view::RawView;
use crate::terminal::TermView;
pub enum View {
Terminal(Box<TermView>),
Raw(Box<RawView>),
Irc(Box<IrcView>),
Github(Box<GithubView>),
/// VNC or RDP.
Desktop(Box<DesktopView>),
}
/// Protocol badge colour (the web build's --protocol-* tokens).
pub fn protocol_color(p: nexus_core::models::Protocol) -> egui::Color32 {
use nexus_core::models::Protocol::*;
let rgb = egui::Color32::from_rgb;
match p {
Ssh => rgb(0x4e, 0xcd, 0xc4),
Telnet => rgb(0xff, 0xa7, 0x26),
Raw => rgb(0xab, 0x47, 0xbc),
Github => rgb(0x7c, 0x8a, 0xff),
Vnc => rgb(0xe8, 0x5d, 0x4a),
Rdp => rgb(0x26, 0xa6, 0x9a),
Irc => rgb(0xd8, 0xb2, 0x4c),
Local => rgb(0x8b, 0xc3, 0x4a),
Serial => rgb(0x4f, 0xa3, 0xe0),
}
}
/// Short badge text ("SSH", "TELNET"…).
pub fn protocol_badge(p: nexus_core::models::Protocol) -> &'static str {
use nexus_core::models::Protocol::*;
match p {
Ssh => "SSH",
Telnet => "TELNET",
Raw => "RAW",
Github => "GitHub",
Vnc => "VNC",
Rdp => "RDP",
Irc => "IRC",
Local => "LOCAL",
Serial => "SERIAL",
}
}