|
|
|
|
@@ -1,8 +1,6 @@
|
|
|
|
|
#![windows_subsystem = "windows"]
|
|
|
|
|
|
|
|
|
|
// use gio::prelude::*;
|
|
|
|
|
// use gtk::prelude::*;
|
|
|
|
|
// use gtk::Orientation;
|
|
|
|
|
use iced::{Settings, Application, Element, executor, Length, Container, Column, Scrollable, Slider};
|
|
|
|
|
use rodio::{Sink, Source};
|
|
|
|
|
use std::env::args;
|
|
|
|
|
use std::fs::File;
|
|
|
|
|
@@ -12,6 +10,71 @@ use std::process::Command;
|
|
|
|
|
|
|
|
|
|
const SPACING: i32 = 16;
|
|
|
|
|
|
|
|
|
|
struct Sound {
|
|
|
|
|
name: String,
|
|
|
|
|
path: String, // bytes instead?
|
|
|
|
|
sink: Sink,
|
|
|
|
|
volume: f32,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// todo: maybe add a play/pause state or global volume? saved presets?
|
|
|
|
|
struct State {
|
|
|
|
|
sounds: Vec<Sound>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
enum Lull {
|
|
|
|
|
Loading,
|
|
|
|
|
Loaded(State),
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl Application for Lull {
|
|
|
|
|
type Executor = executor::Default;
|
|
|
|
|
type Message = Message;
|
|
|
|
|
type Flags = ();
|
|
|
|
|
|
|
|
|
|
fn new(_flags: Self::Flags) -> (Self, Command) {
|
|
|
|
|
(
|
|
|
|
|
Lull {sounds: Vec::new()},
|
|
|
|
|
Command::none(),
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn title(&self) -> String {
|
|
|
|
|
String::from("lull")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn update(&mut self, message: Self::Message) -> Command {
|
|
|
|
|
match self {
|
|
|
|
|
self::Loading => {},
|
|
|
|
|
self::Loaded => {},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Command::none()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn view(&mut self) -> Element<'_, Self::Message> {
|
|
|
|
|
unimplemented!()
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn get_data_dir() -> PathBuf {
|
|
|
|
|
let mut data_dir = dirs::data_dir().expect("Couldn't find user data directory");
|
|
|
|
|
|
|
|
|
|
data_dir.push("ruin/lull");
|
|
|
|
|
|
|
|
|
|
if !data_dir.exists() {
|
|
|
|
|
std::fs::create_dir_all(&data_dir).expect("Couldn't create lull data directory");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
data_dir
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn main() -> iced::Result {
|
|
|
|
|
env_logger::init();
|
|
|
|
|
|
|
|
|
|
Lull::run(Settings::default())
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// fn error_popup(message: &str) {
|
|
|
|
|
// let popup = gtk::Window::new(gtk::WindowType::Toplevel);
|
|
|
|
|
// popup.set_title("error");
|
|
|
|
|
@@ -34,19 +97,7 @@ const SPACING: i32 = 16;
|
|
|
|
|
// popup.destroy();
|
|
|
|
|
// });
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// fn get_data_dir() -> PathBuf {
|
|
|
|
|
// let mut data_dir = dirs::data_dir().expect("Couldn't find user data directory");
|
|
|
|
|
//
|
|
|
|
|
// data_dir.push("ruin/lull");
|
|
|
|
|
//
|
|
|
|
|
// if !data_dir.exists() {
|
|
|
|
|
// std::fs::create_dir_all(&data_dir).expect("Couldn't create lull data directory");
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// data_dir
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
// fn build_ui(application: >k::Application) {
|
|
|
|
|
// let window = gtk::ApplicationWindow::new(application);
|
|
|
|
|
//
|
|
|
|
|
@@ -145,42 +196,3 @@ const SPACING: i32 = 16;
|
|
|
|
|
//
|
|
|
|
|
// window.show_all();
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// fn main() {
|
|
|
|
|
// let application = gtk::Application::new(
|
|
|
|
|
// Some("dev.tinybird.max.lull"),
|
|
|
|
|
// Default::default()
|
|
|
|
|
// ).expect("Initialization failed...");
|
|
|
|
|
//
|
|
|
|
|
// application.connect_activate(|app| {
|
|
|
|
|
// build_ui(app);
|
|
|
|
|
// });
|
|
|
|
|
//
|
|
|
|
|
// application.run(&args().collect::<Vec<_>>());
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
use druid::{AppLauncher, WindowDesc, Widget, PlatformError};
|
|
|
|
|
use druid::widget::{Label, Padding, Flex, Align, FlexParams, CrossAxisAlignment, Slider};
|
|
|
|
|
|
|
|
|
|
fn build_ui() -> impl Widget<()> {
|
|
|
|
|
Padding::new(
|
|
|
|
|
10.0,
|
|
|
|
|
Flex::column()
|
|
|
|
|
.with_flex_child(
|
|
|
|
|
Flex::row()
|
|
|
|
|
.with_flex_child(Align::centered(Label::new("sound 1")), FlexParams::new(1.0, CrossAxisAlignment::End))
|
|
|
|
|
.with_child(Align::centered(Label::new("slider"))),
|
|
|
|
|
1.0
|
|
|
|
|
)
|
|
|
|
|
.with_child(
|
|
|
|
|
Flex::row()
|
|
|
|
|
.with_flex_child(Label::new("top right"), 1.0)
|
|
|
|
|
.with_flex_child(Align::centered(Label::new("bottom right")), 1.0)
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
fn main() -> Result<(), PlatformError> {
|
|
|
|
|
AppLauncher::with_window(WindowDesc::new(build_ui)).launch(())?;
|
|
|
|
|
Ok(())
|
|
|
|
|
}
|
|
|
|
|
|