Menu bar + settings window + about window
This commit is contained in:
+17
-15
@@ -1,21 +1,21 @@
|
||||
use std::time::Duration;
|
||||
use eframe::{Frame, Storage, CreationContext};
|
||||
use eframe::egui::{Context, Ui};
|
||||
use eframe::{CreationContext, Frame, Storage};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::time::Duration;
|
||||
use yt_dlp::model::VideoQuality;
|
||||
|
||||
pub(crate) struct Application {
|
||||
settings: AppSettings,
|
||||
layers: Vec<Box<dyn crate::layer::Layer>>,
|
||||
pub settings: AppSettings,
|
||||
layers: Vec<Box<dyn crate::layer::Layer>>,
|
||||
data: Data,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Default)]
|
||||
struct AppSettings {
|
||||
use_cookies: bool,
|
||||
use_firefox_cookies: bool,
|
||||
use_chrome_cookies: bool,
|
||||
save_thumbnails: bool,
|
||||
pub struct AppSettings {
|
||||
pub(crate) use_firefox_cookies: bool,
|
||||
pub(crate) use_chrome_cookies: bool,
|
||||
pub(crate) save_thumbnails: bool,
|
||||
pub(crate) video_download_quality: crate::video_quality::VideoDownloadQuality,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Default)]
|
||||
@@ -31,6 +31,7 @@ struct Video {
|
||||
uuid: String,
|
||||
original_url: String,
|
||||
video_path: String,
|
||||
has_thumbnail: bool,
|
||||
thumbnail_path: String,
|
||||
thumbnail_path_low_quality: String,
|
||||
video_quality: VideoQuality,
|
||||
@@ -43,11 +44,11 @@ struct Playlist {
|
||||
original_url: String,
|
||||
videos: Vec<Video>,
|
||||
creator: String,
|
||||
has_thumbnail: bool,
|
||||
thumbnail_path: String,
|
||||
thumbnail_path_low_quality: String,
|
||||
}
|
||||
|
||||
|
||||
impl Application {
|
||||
pub fn new(cc: &CreationContext, layers: Vec<Box<dyn crate::layer::Layer>>) -> Self {
|
||||
let mut settings = AppSettings::default();
|
||||
@@ -68,12 +69,15 @@ impl Application {
|
||||
}
|
||||
}
|
||||
|
||||
Self { settings, layers, data }
|
||||
Self {
|
||||
settings,
|
||||
layers,
|
||||
data,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl eframe::App for Application {
|
||||
|
||||
fn logic(&mut self, ctx: &Context, frame: &mut Frame) {
|
||||
let mut layers = std::mem::take(&mut self.layers);
|
||||
for layer in &mut layers {
|
||||
@@ -111,6 +115,4 @@ impl eframe::App for Application {
|
||||
fn auto_save_interval(&self) -> Duration {
|
||||
Duration::from_secs(5)
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user