+
Skip to content
This repository was archived by the owner on Sep 17, 2024. It is now read-only.

release/beta 4 #41

Merged
merged 14 commits into from
Aug 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
727 changes: 398 additions & 329 deletions Cargo.lock

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
[package]
name = "ajour"
description = "A World of Warcraft addon manager"
version = "0.1.0-beta3"
version = "0.1.0-beta4"
authors = ["Casper Rogild Storm"]
license = "MIT"
homepage = "https://github.com/casperstorm/ajour"
edition = "2018"

[dependencies]
iced = "0.1.1"
iced = { git = "https://github.com/hecrj/iced.git", features = ["debug"], rev = "2ce5df084456a92ed1a228738816cf8398b2e918" }
iced_futures = { git = "https://github.com/hecrj/iced.git", features = ["async-std"], rev = "2ce5df084456a92ed1a228738816cf8398b2e918" }
walkdir = "2.3.1"
regex = "1.3.9"
async-std = "1.6.2"
Expand Down
38 changes: 24 additions & 14 deletions src/addon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,36 @@ use std::path::PathBuf;
#[derive(Debug, Clone, Eq, PartialEq)]
pub enum AddonState {
Ajour(Option<String>),
Loading,
Updatable,
Downloading,
Unpacking,
}

#[derive(Debug, Clone)]
/// Struct which stores identifiers for the different repositories.
pub struct RepositoryIdentifiers {
pub wowi: Option<String>,
pub tukui: Option<String>,
pub curse: Option<u32>,
}

#[derive(Debug, Clone)]
/// Struct which stores information about a single Addon.
pub struct Addon {
pub id: String,
pub title: String,
pub notes: Option<String>,
pub version: Option<String>,
pub remote_version: Option<String>,
pub remote_url: Option<String>,
pub path: PathBuf,
pub dependencies: Vec<String>,
pub state: AddonState,
pub wowi_id: Option<String>,
pub tukui_id: Option<String>,
pub curse_id: Option<u32>,
pub repository_identifiers: RepositoryIdentifiers,

// States for GUI
pub details_btn_state: iced::button::State,
pub update_btn_state: iced::button::State,
pub delete_btn_state: iced::button::State,
}
Expand All @@ -33,28 +43,27 @@ impl Addon {
/// Creates a new Addon
pub fn new(
title: String,
notes: Option<String>,
version: Option<String>,
path: PathBuf,
wowi_id: Option<String>,
tukui_id: Option<String>,
curse_id: Option<u32>,
dependencies: Vec<String>,
repository_identifiers: RepositoryIdentifiers,
) -> Self {
let os_title = path.file_name().unwrap();
let str_title = os_title.to_str().unwrap();

Addon {
id: str_title.to_string(),
title,
notes,
version,
remote_version: None,
remote_url: None,
path,
dependencies,
state: AddonState::Ajour(None),
wowi_id,
tukui_id,
curse_id,
repository_identifiers,
details_btn_state: Default::default(),
update_btn_state: Default::default(),
delete_btn_state: Default::default(),
}
Expand All @@ -65,8 +74,8 @@ impl Addon {
/// This functions takes a `&Vec<Package>` and finds the one matching `self`.
/// It then updates self, with the information from that package.
pub fn apply_wowi_packages(&mut self, packages: &[wowinterface_api::Package]) {
let wowi_id = self.wowi_id.clone().unwrap();
let package = packages.iter().find(|a| a.id == wowi_id);
let wowi_id = self.repository_identifiers.wowi.as_ref().unwrap();
let package = packages.iter().find(|a| &a.id == wowi_id);
if let Some(package) = package {
self.remote_version = Some(package.version.clone());
self.remote_url = Some(crate::wowinterface_api::remote_url(&wowi_id));
Expand Down Expand Up @@ -133,6 +142,9 @@ impl Addon {
if self.is_updatable() {
self.state = AddonState::Updatable;
}

// Breaks out on first hit.
break;
}
}
}
Expand Down Expand Up @@ -207,9 +219,7 @@ impl Addon {
self.title = other.title.clone();
self.version = other.version.clone();
self.dependencies = other.dependencies.clone();
self.wowi_id = other.wowi_id.clone();
self.tukui_id = other.tukui_id.clone();
self.curse_id = other.curse_id;
self.repository_identifiers = other.repository_identifiers.clone();
}

/// Check if the `Addon` is updatable.
Expand Down
Loading
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载