Compare commits
No commits in common. "6f46c768ce5761bb0acc5f64af2c6907c810f741" and "ef898dfb7667b6823903c61a53960c882f9fab6e" have entirely different histories.
6f46c768ce
...
ef898dfb76
3 changed files with 7 additions and 62 deletions
|
@ -57,13 +57,6 @@ impl From<String> for Codec {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn check() -> Result<()> {
|
|
||||||
std::process::Command::new("ffmpeg").output()?;
|
|
||||||
std::process::Command::new("ffprobe").output()?;
|
|
||||||
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
pub async fn get_video_meta(path: &Path) -> Result<VideoMeta> {
|
pub async fn get_video_meta(path: &Path) -> Result<VideoMeta> {
|
||||||
let output = Command::new("ffprobe")
|
let output = Command::new("ffprobe")
|
||||||
.args([
|
.args([
|
||||||
|
|
12
src/main.rs
12
src/main.rs
|
@ -7,7 +7,7 @@ use std::{borrow::Cow, path::PathBuf, time::Duration};
|
||||||
|
|
||||||
use color_eyre::eyre::{OptionExt, Result, bail};
|
use color_eyre::eyre::{OptionExt, Result, bail};
|
||||||
use gobject::GtkZiplineFolder;
|
use gobject::GtkZiplineFolder;
|
||||||
use relm::{Dialog, DialogInput, StandaloneDialog, Toast, ToastInput};
|
use relm::{Dialog, DialogInput, Toast, ToastInput};
|
||||||
use relm4::{
|
use relm4::{
|
||||||
Component, ComponentController, Controller, RelmApp, Sender,
|
Component, ComponentController, Controller, RelmApp, Sender,
|
||||||
adw::{self, prelude::*},
|
adw::{self, prelude::*},
|
||||||
|
@ -391,6 +391,7 @@ impl AsyncComponent for Tyrolienne {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO check for ffmpeg
|
||||||
// TODO app icon
|
// TODO app icon
|
||||||
fn main() -> Result<()> {
|
fn main() -> Result<()> {
|
||||||
tracing_subscriber::fmt()
|
tracing_subscriber::fmt()
|
||||||
|
@ -399,10 +400,11 @@ fn main() -> Result<()> {
|
||||||
|
|
||||||
color_eyre::install()?;
|
color_eyre::install()?;
|
||||||
|
|
||||||
match ffmpeg::check().and_then(|_| get_config()) {
|
// TODO: show dialog in case these error
|
||||||
Ok(config) => RelmApp::new("net.uku3lig.Tyrolienne").run_async::<Tyrolienne>(config),
|
let config = get_config()?;
|
||||||
Err(e) => RelmApp::new("net.uku3lig.Tyrolienne").run::<StandaloneDialog>(e.to_string()),
|
|
||||||
}
|
let app = RelmApp::new("net.uku3lig.Tyrolienne");
|
||||||
|
app.run_async::<Tyrolienne>(config);
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
50
src/relm.rs
50
src/relm.rs
|
@ -148,53 +148,3 @@ impl SimpleComponent for Toast {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct StandaloneDialog;
|
|
||||||
|
|
||||||
impl SimpleComponent for StandaloneDialog {
|
|
||||||
type Init = String;
|
|
||||||
type Input = ();
|
|
||||||
type Output = ();
|
|
||||||
type Root = adw::ApplicationWindow;
|
|
||||||
type Widgets = ();
|
|
||||||
|
|
||||||
fn init_root() -> Self::Root {
|
|
||||||
adw::ApplicationWindow::builder()
|
|
||||||
.title("Tyrolienne")
|
|
||||||
.default_width(400)
|
|
||||||
.default_height(300)
|
|
||||||
.build()
|
|
||||||
}
|
|
||||||
|
|
||||||
fn init(
|
|
||||||
init: Self::Init,
|
|
||||||
root: Self::Root,
|
|
||||||
_sender: relm4::ComponentSender<Self>,
|
|
||||||
) -> relm4::ComponentParts<Self> {
|
|
||||||
let dialog = adw::AlertDialog::builder()
|
|
||||||
.heading("Could not open Tyrolienne")
|
|
||||||
.body(init)
|
|
||||||
.close_response("close")
|
|
||||||
.build();
|
|
||||||
dialog.add_response("close", "Close");
|
|
||||||
|
|
||||||
dialog.connect_closed(clone!(
|
|
||||||
#[strong]
|
|
||||||
root,
|
|
||||||
move |_| root.close()
|
|
||||||
));
|
|
||||||
|
|
||||||
root.connect_show(clone!(
|
|
||||||
#[strong]
|
|
||||||
dialog,
|
|
||||||
#[strong]
|
|
||||||
root,
|
|
||||||
move |_| dialog.present(Some(&root))
|
|
||||||
));
|
|
||||||
|
|
||||||
relm4::ComponentParts {
|
|
||||||
model: StandaloneDialog,
|
|
||||||
widgets: (),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue