@ -1,4 +1,6 @@
use std ::time ::{ Duration , SystemTime } ;
use std ::io ::Write ;
use std ::net ::TcpStream ;
use eframe ::egui ;
use egui ::FontFamily ::Proportional ;
use egui ::FontId ;
@ -20,7 +22,9 @@ pub struct App {
pub show_irc : bool ,
pub irc_message : String ,
pub irc_connected : bool ,
pub show_market_data : bool
pub show_market_data : bool ,
pub show_radio : bool ,
pub irc_stream : Result < TcpStream , std ::io ::Error > ,
}
impl Default for App {
@ -36,7 +40,9 @@ impl Default for App {
show_irc : false ,
irc_connected : false ,
to_data : "" . to_owned ( ) ,
irc_message : "" . to_owned ( )
irc_message : "" . to_owned ( ) ,
show_radio : true ,
irc_stream : TcpStream ::connect ( "0.0.0.0:0" )
}
}
}
@ -73,10 +79,14 @@ impl eframe::App for App {
if ( self . tor_connected & & self . tor_required ) | | ( ! self . tor_required ) {
ui . checkbox ( & mut self . show_market_data , "Show Market Data" ) ;
ui . checkbox ( & mut self . show_irc , "Show IRC" ) ;
ui . checkbox ( & mut self . show_radio , "Show Radio" ) ;
}
} ) ;
ui . separator ( ) ;
// WOW!Radio
if self . show_radio {
ui . heading ( egui ::RichText ::new ( "WOW!Radio" ) . color ( egui ::Color32 ::WHITE ) ) ;
ui . label ( egui ::RichText ::new ( "Your home for the most diabolical playlist of the century, made by the skeevers, scallywags, chupacabras, snails, and whores of the Wownero community. Join da chat to peep da scoop.\n" ) . color ( egui ::Color32 ::WHITE ) ) ;
ui . horizontal ( | ui | {
@ -123,6 +133,7 @@ impl eframe::App for App {
}
} ) ;
// Show spinner when downloading, along with file size
if ! self . player . stream_thread . is_finished ( ) {
ui . horizontal ( | ui | {
@ -149,11 +160,12 @@ impl eframe::App for App {
self . player . exif_date = SystemTime ::now ( ) ;
self . player . stream_exif = self . player . get_song_meta ( ) . unwrap ( ) ;
}
if ui . button ( " !tune - i love this song! ") . clicked ( ) {
if ui . button ( " | +1 | ") . clicked ( ) {
let _ = self . irc . send_tune ( ) ;
}
}
ui . separator ( ) ;
}
// Tor
if self . tor_required {
@ -161,7 +173,7 @@ impl eframe::App for App {
ui . label (
egui ::RichText ::new (
format! (
"Tor Started: {} \nTor Connected: {}\n Proxy Up: {}",
"Tor Started: {} Tor Connected: {} Proxy Up: {}",
show_boolmoji ( self . tor_started ) ,
show_boolmoji ( self . tor_connected ) ,
show_boolmoji ( self . tor_connected )
@ -179,17 +191,20 @@ impl eframe::App for App {
// IRC
if self . show_irc & & ! self . irc_connected {
self . irc . run ( ) . expect ( "wtf mate" ) ;
self . irc _stream = self . irc . run ( ) ;
self . irc_connected = true ;
} else if self . show_irc {
egui ::ScrollArea ::vertical ( ) . stick_to_bottom ( true ) . show ( ui , | ui | {
ui . label ( self . irc . read_irc_log ( ) ) ;
ui . horizontal ( | ui | {
ui . text_edit_singleline ( & mut self . irc_message ) ;
if ui . button ( "> Send <" ) . clicked ( ) {
// send_cmd(self.irc.)
let _ = self . irc_stream . as_ref ( ) . unwrap ( ) . write ( self . irc_message . as_bytes ( ) ) ;
// let _ = crate::irc::send_cmd(&self.irc_stream.as_ref(), cmd, "");
self . irc_message = "" . to_owned ( ) ;
}
} ) ;
} ) ;
}
// Market