use eframe::egui;
use std::collections::HashSet;
#[derive(Default)]
pub struct WhisperShieldApp {
allowed_tones: HashSet<String>,
blocked_tones: HashSet<String>,
current_input: String,
override_enabled: bool,
reflex_enabled: bool,
save_message: Option<String>,
}
impl eframe::App for WhisperShieldApp {
fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
egui::CentralPanel::default().show(ctx, |ui| {
ui.heading("🛡 Whisper Shield™ — Emotional Firewall");
ui.horizontal(|ui| {
ui.label("🎙 Add Tone:");
ui.text_edit_singleline(&mut self.current_input);
if ui.button("✅ Allow").clicked() {
self.allowed_tones
.insert(self.current_input.trim().to_string());
self.current_input.clear();
}
if ui.button("â›” Block").clicked() {
self.blocked_tones
.insert(self.current_input.trim().to_string());
self.current_input.clear();
}
});
ui.separator();
ui.collapsing("✅ Allowed Tones", |ui| {
for tone in &self.allowed_tones {
ui.label(tone);
}
});
ui.collapsing("â›” Blocked Tones", |ui| {
for tone in &self.blocked_tones {
ui.label(tone);
}
});
ui.separator();
ui.checkbox(&mut self.override_enabled, "🔓 Allow Emergency Override");
ui.checkbox(
&mut self.reflex_enabled,
"🧠Activate Whisper Reflex™ Auto-Block",
);
if ui.button("💾 Save Firewall Settings").clicked() {
self.save_message = Some("✅ Settings saved (in-memory demo)".to_string());
}
if let Some(ref msg) = self.save_message {
ui.separator();
ui.label(msg);
}
});
}
}
fn main() -> Result<(), eframe::Error> {
let options = eframe::NativeOptions::default();
eframe::run_native(
"Whisper Shieldâ„¢",
options,
Box::new(|_cc| Box::<WhisperShieldApp>::default()),
)
}