Skip to content

Commit

Permalink
Merge pull request #51 from AchetaGames/selected_files_size
Browse files Browse the repository at this point in the history
Selected files size
  • Loading branch information
aknarts authored Apr 16, 2021
2 parents 57e8e8a + 0323a9a commit de1b470
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 24 deletions.
7 changes: 4 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "epic_asset_manager"
version = "1.0.3"
version = "1.0.8"
authors = ["Milan Stastny <[email protected]>"]
edition = "2018"

Expand Down Expand Up @@ -38,8 +38,9 @@ version = "1.0.123"
features = ["derive"]

[dependencies.egs-api]
git = "https://github.com/AchetaGames/egs-api-rs"
#path = "../egs-api"
version = "0.3.0"
#git = "https://github.com/AchetaGames/egs-api-rs"
#path = "../egs-api-rs"

[dependencies.tokio]
version = "1.2.0"
Expand Down
4 changes: 2 additions & 2 deletions src/download/chunks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ impl Chunks for Win {
}
};

let rel = match asset.get_release_name(&release) {
let rel = match asset.release_name(&release) {
None => {
return;
}
Expand Down Expand Up @@ -273,7 +273,7 @@ impl Chunks for Win {
}
});

for (filename, manifest) in dm.get_files() {
for (filename, manifest) in dm.files() {
debug!("Checking download {}", filename);
if let Some(file_list) = files {
if !file_list.contains(&filename) {
Expand Down
2 changes: 2 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ struct AssetDownloadDetails {
asset_download_info_revealer: Revealer,
asset_download_info_revealer_button_image: Image,
download_asset_name: Label,
selected_files_size: Label,
asset_download_content: Box,
download_selected: Option<Button>,
download_all: Option<Button>,
Expand Down Expand Up @@ -377,6 +378,7 @@ impl Widget for Win {
asset_download_actions_box,
download_progress_sender,
download_all: None,
selected_files_size: Label::new(None),
};

window.show_all();
Expand Down
4 changes: 2 additions & 2 deletions src/ui/assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ impl Assets for Win {
platforms_label.set_halign(Align::Start);
table.attach(&platforms_label, 0, 1, 1, 1);
let platforms = Label::new(Some(
&asset_info.get_platforms().unwrap_or_default().join(", "),
&asset_info.platforms().unwrap_or_default().join(", "),
));
platforms.set_halign(Align::Start);
platforms.set_xalign(0.0);
Expand All @@ -196,7 +196,7 @@ impl Assets for Win {
comp_label.set_halign(Align::Start);

table.attach(&comp_label, 0, 2, 1, 1);
if let Some(comp) = &asset_info.get_compatible_apps() {
if let Some(comp) = &asset_info.compatible_apps() {
let compat = Label::new(Some(&comp.join(", ").replace("UE_", "")));
compat.set_halign(Align::Start);
compat.set_line_wrap(true);
Expand Down
27 changes: 11 additions & 16 deletions src/ui/download_manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -88,24 +88,19 @@ impl DownloadManifests for Win {
let mut eg = self.model.epic_games.clone();
thread::spawn(move || {
let start = std::time::Instant::now();
if let Some(manifest) = Runtime::new().unwrap().block_on(eg.get_asset_manifest(
if let Some(manifest) = Runtime::new().unwrap().block_on(eg.asset_manifest(
None,
None,
Some(asset.namespace),
Some(asset.id),
Some(release_info.app_id.unwrap_or_default()),
)) {
for elem in manifest.elements {
for man in elem.manifests {
if let Ok(d) = Runtime::new()
.unwrap()
.block_on(eg.get_asset_download_manifest(man.clone()))
{
sender.send(d).unwrap();
break;
};
}
}
if let Ok(d) = Runtime::new()
.unwrap()
.block_on(eg.asset_download_manifest(manifest))
{
sender.send(d).unwrap();
};
};
debug!(
"{:?} - Download Manifest requests took {:?}",
Expand All @@ -118,7 +113,7 @@ impl DownloadManifests for Win {
fn process_download_manifest(&mut self, id: String, dm: DownloadManifest) {
if self.model.selected_asset == Some(id.clone()) {
let size_box = Box::new(gtk::Orientation::Horizontal, 0);
let size = dm.get_total_size();
let size = dm.total_size();
let size_label = Label::new(Some("Total Download Size: "));
size_box.add(&size_label);
size_label.set_halign(Align::Start);
Expand All @@ -137,7 +132,7 @@ impl DownloadManifests for Win {
.asset_download_widgets
.asset_download_info_box
.show_all();
let files = dm.get_files();
let files = dm.files();
let mut target = PathBuf::from(
self.model
.configuration
Expand Down Expand Up @@ -258,7 +253,7 @@ impl DownloadManifests for Win {
"<b><u><big>{}</big></u></b>",
asset_info.title.clone().unwrap_or("Nothing".to_string())
));
if let Some(releases) = asset_info.get_sorted_releases() {
if let Some(releases) = asset_info.sorted_releases() {
for (id, release) in releases.iter().enumerate() {
self.widgets
.asset_download_widgets
Expand Down Expand Up @@ -347,7 +342,7 @@ impl DownloadManifests for Win {
.valign(Align::Start)
.expand(false)
.build();
if let Some(release) = asset_info.get_release_id(&id.to_string()) {
if let Some(release) = asset_info.release_info(&id.to_string()) {
let mut line = 0;
if let Some(ref compatible) = release.compatible_apps {
let versions_label = Label::new(Some("Supported versions:"));
Expand Down
2 changes: 1 addition & 1 deletion src/ui/epic_assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ impl EpicAssets for Win {
match AssetInfo::load_from_cache(ass.catalog_item_id.clone(), None) {
None => {
if let Some(asset) =
Runtime::new().unwrap().block_on(e.get_asset_info(ass))
Runtime::new().unwrap().block_on(e.asset_info(ass))
{
asset.save(None, None);
if let Ok(mut asset_info) = crate::DATA.asset_info.write() {
Expand Down

0 comments on commit de1b470

Please sign in to comment.