switch to libcosmics builtin rfd instead of our own

This commit is contained in:
Chris Cochrun 2025-03-15 23:16:47 -05:00
parent 66e33be26c
commit 54ef90442e
6 changed files with 22 additions and 109 deletions

View file

@ -2,7 +2,6 @@ use miette::{miette, IntoDiagnostic, Result};
use std::{fs::File, io::BufReader, path::PathBuf, sync::Arc};
use cosmic::{
dialog::ashpd::url::Url,
iced::{
alignment::Horizontal,
font::{Family, Stretch, Style, Weight},
@ -26,6 +25,7 @@ use cosmic::{
use iced_video_player::{gst_pbutils, Position, Video, VideoPlayer};
use rodio::{Decoder, OutputStream, Sink};
use tracing::{debug, error, info, warn};
use url::Url;
use crate::{
core::{service_items::ServiceItemModel, slide::Slide},

View file

@ -1,6 +1,7 @@
use std::{io, path::PathBuf};
use cosmic::{
dialog::file_chooser::open::Dialog,
iced::{
font::{Family, Stretch, Style, Weight},
Font, Length,
@ -432,12 +433,18 @@ impl Default for SongEditor {
}
async fn pick_background() -> Result<PathBuf, SongError> {
rfd::AsyncFileDialog::new()
.set_title("Choose a background...")
.pick_file()
let dialog = Dialog::new().title("Choose a background...");
dialog
.open_file()
.await
.ok_or(SongError::DialogClosed)
.map(|file| file.path().to_owned())
.map_err(|_| SongError::DialogClosed)
.map(|file| file.url().to_file_path().unwrap())
// rfd::AsyncFileDialog::new()
// .set_title("Choose a background...")
// .pick_file()
// .await
// .ok_or(SongError::DialogClosed)
// .map(|file| file.path().to_owned())
}
#[derive(Debug, Clone)]