Add profile download policy

This commit is contained in:
2026-05-07 21:43:28 -04:00
parent 0ed8c09395
commit 6d47b26090
9 changed files with 347 additions and 12 deletions
+18 -2
View File
@@ -1,4 +1,4 @@
use crate::ProfileId;
use crate::{DownloadPolicy, ProfileId};
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum ProfileKind {
@@ -12,12 +12,19 @@ pub struct Profile {
name: String,
color_hex: u32,
kind: ProfileKind,
download_policy: DownloadPolicy,
}
impl Profile {
#[must_use]
pub fn new(name: impl Into<String>, color_hex: u32, kind: ProfileKind) -> Self {
Self { id: ProfileId::new(), name: name.into(), color_hex, kind }
Self {
id: ProfileId::new(),
name: name.into(),
color_hex,
kind,
download_policy: DownloadPolicy::ask_every_time(),
}
}
#[must_use]
@@ -39,4 +46,13 @@ impl Profile {
pub fn kind(&self) -> &ProfileKind {
&self.kind
}
#[must_use]
pub fn download_policy(&self) -> &DownloadPolicy {
&self.download_policy
}
pub fn set_download_policy(&mut self, download_policy: DownloadPolicy) {
self.download_policy = download_policy;
}
}