chore: clear clippy warnings and refresh the GUI README
`cargo clippy --fix`: drop needless borrows in interactive.rs, remove an unneeded `return`, and derive `Default` for `HostState` / the config struct instead of hand-writing it. No behaviour change. README: the GUI host screen now lists connected viewers with a Kick button and notifies on join/leave — update the description, which still mentioned only a "live viewer count". Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -83,8 +83,9 @@ pixelpass --gui
|
|||||||
```
|
```
|
||||||
|
|
||||||
Host: pick quality / max-viewers / options, click **Start hosting**, and the
|
Host: pick quality / max-viewers / options, click **Start hosting**, and the
|
||||||
share code appears with a copy button alongside a live viewer count. View:
|
share code appears with a copy button. Connected viewers are listed with a
|
||||||
paste a code, pick mpv or VLC, click **Connect** and the player launches.
|
**Kick** button each, and a desktop notification fires as they join or leave.
|
||||||
|
View: paste a code, pick mpv or VLC, click **Connect** and the player launches.
|
||||||
|
|
||||||
The window is a thin driver — it runs the same headless `pixelpass` as a
|
The window is a thin driver — it runs the same headless `pixelpass` as a
|
||||||
child process and reads its event stream, so the GUI is purely additive and
|
child process and reads its event stream, so the GUI is purely additive and
|
||||||
|
|||||||
@@ -37,18 +37,15 @@ pub struct BandwidthEntry {
|
|||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
||||||
#[serde(rename_all = "lowercase")]
|
#[serde(rename_all = "lowercase")]
|
||||||
|
#[derive(Default)]
|
||||||
pub enum BandwidthStatus {
|
pub enum BandwidthStatus {
|
||||||
|
#[default]
|
||||||
Unmeasured,
|
Unmeasured,
|
||||||
Measured,
|
Measured,
|
||||||
Skipped,
|
Skipped,
|
||||||
Failed,
|
Failed,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for BandwidthStatus {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self::Unmeasured
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn default_status() -> BandwidthStatus {
|
fn default_status() -> BandwidthStatus {
|
||||||
BandwidthStatus::Unmeasured
|
BandwidthStatus::Unmeasured
|
||||||
|
|||||||
+1
-21
@@ -165,6 +165,7 @@ impl PlayerSel {
|
|||||||
|
|
||||||
/// Host-screen state: the config form fields plus, once started, the running
|
/// Host-screen state: the config form fields plus, once started, the running
|
||||||
/// child and the latest values parsed from its event stream.
|
/// child and the latest values parsed from its event stream.
|
||||||
|
#[derive(Default)]
|
||||||
struct HostState {
|
struct HostState {
|
||||||
// form
|
// form
|
||||||
quality: QualitySel,
|
quality: QualitySel,
|
||||||
@@ -190,27 +191,6 @@ struct HostState {
|
|||||||
viewers: Vec<String>,
|
viewers: Vec<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for HostState {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self {
|
|
||||||
quality: QualitySel::default(),
|
|
||||||
max_viewers: 0,
|
|
||||||
no_hwencode: false,
|
|
||||||
window: false,
|
|
||||||
proc: None,
|
|
||||||
ticket: None,
|
|
||||||
info: None,
|
|
||||||
active: 0,
|
|
||||||
max: 0,
|
|
||||||
capturing: false,
|
|
||||||
copied: false,
|
|
||||||
last_refusal: None,
|
|
||||||
error: None,
|
|
||||||
viewers: Vec::new(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The host config summary echoed back by the child's `host_info` event.
|
/// The host config summary echoed back by the child's `host_info` event.
|
||||||
struct HostInfo {
|
struct HostInfo {
|
||||||
display: String,
|
display: String,
|
||||||
|
|||||||
+6
-6
@@ -13,7 +13,7 @@ pub async fn run(cli: Cli) -> Result<()> {
|
|||||||
let theme = ColorfulTheme::default();
|
let theme = ColorfulTheme::default();
|
||||||
let choice = Select::with_theme(&theme)
|
let choice = Select::with_theme(&theme)
|
||||||
.with_prompt("What do you want to do?")
|
.with_prompt("What do you want to do?")
|
||||||
.items(&[
|
.items([
|
||||||
"Host (share my screen)",
|
"Host (share my screen)",
|
||||||
"View (watch someone else's screen)",
|
"View (watch someone else's screen)",
|
||||||
])
|
])
|
||||||
@@ -112,7 +112,7 @@ fn pick_quality(theme: &ColorfulTheme) -> Result<Quality> {
|
|||||||
|
|
||||||
let choice = Select::with_theme(theme)
|
let choice = Select::with_theme(theme)
|
||||||
.with_prompt("What quality should the viewer(s) get?")
|
.with_prompt("What quality should the viewer(s) get?")
|
||||||
.items(&items)
|
.items(items)
|
||||||
.default(0)
|
.default(0)
|
||||||
.interact()?;
|
.interact()?;
|
||||||
|
|
||||||
@@ -138,7 +138,7 @@ pub async fn run_reconfigure() -> Result<()> {
|
|||||||
async fn preflight_if_needed(theme: &ColorfulTheme) {
|
async fn preflight_if_needed(theme: &ColorfulTheme) {
|
||||||
let mut cfg = config::load().unwrap_or_default();
|
let mut cfg = config::load().unwrap_or_default();
|
||||||
match cfg.bandwidth.status {
|
match cfg.bandwidth.status {
|
||||||
config::BandwidthStatus::Measured | config::BandwidthStatus::Skipped => return,
|
config::BandwidthStatus::Measured | config::BandwidthStatus::Skipped => (),
|
||||||
config::BandwidthStatus::Unmeasured => {
|
config::BandwidthStatus::Unmeasured => {
|
||||||
eprintln!();
|
eprintln!();
|
||||||
eprintln!("First-time setup");
|
eprintln!("First-time setup");
|
||||||
@@ -154,7 +154,7 @@ async fn preflight_if_needed(theme: &ColorfulTheme) {
|
|||||||
|
|
||||||
let Ok(choice) = Select::with_theme(theme)
|
let Ok(choice) = Select::with_theme(theme)
|
||||||
.with_prompt("What would you like to do?")
|
.with_prompt("What would you like to do?")
|
||||||
.items(&[
|
.items([
|
||||||
"Run the bandwidth test (recommended)",
|
"Run the bandwidth test (recommended)",
|
||||||
"Skip — use the conservative default",
|
"Skip — use the conservative default",
|
||||||
])
|
])
|
||||||
@@ -180,7 +180,7 @@ async fn preflight_if_needed(theme: &ColorfulTheme) {
|
|||||||
eprintln!();
|
eprintln!();
|
||||||
let Ok(choice) = Select::with_theme(theme)
|
let Ok(choice) = Select::with_theme(theme)
|
||||||
.with_prompt("Last bandwidth test failed. Try again?")
|
.with_prompt("Last bandwidth test failed. Try again?")
|
||||||
.items(&[
|
.items([
|
||||||
"Yes — retry now",
|
"Yes — retry now",
|
||||||
"No — use the conservative default",
|
"No — use the conservative default",
|
||||||
])
|
])
|
||||||
@@ -341,7 +341,7 @@ pub fn prompt_player() -> Result<Player> {
|
|||||||
let theme = ColorfulTheme::default();
|
let theme = ColorfulTheme::default();
|
||||||
let choice = Select::with_theme(&theme)
|
let choice = Select::with_theme(&theme)
|
||||||
.with_prompt("Connected. Pick a player to launch")
|
.with_prompt("Connected. Pick a player to launch")
|
||||||
.items(&["mpv", "VLC"])
|
.items(["mpv", "VLC"])
|
||||||
.default(0)
|
.default(0)
|
||||||
.interact()?;
|
.interact()?;
|
||||||
Ok(if choice == 0 { Player::Mpv } else { Player::Vlc })
|
Ok(if choice == 0 { Player::Mpv } else { Player::Vlc })
|
||||||
|
|||||||
Reference in New Issue
Block a user