Skip to content

Commit ffb9b65

Browse files
authored
Remove "download all" and move import button (#287)
* Remove download all on specific images * Remove unusued id field * Move import button to left menu to save on vertical space * Update version to 1.7.9
1 parent df7f0e6 commit ffb9b65

File tree

5 files changed

+107
-94
lines changed

5 files changed

+107
-94
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
edition = "2021"
33
name = "boilr"
4-
version = "1.7.8"
4+
version = "1.7.9"
55

66
[dependencies]
77
base64 = "^0.20.0"

flatpak/io.github.philipk.boilr.appdata.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ https://hughsie.github.io/oars/index.html
2525
-->
2626
<content_rating type="oars-1.1" />
2727
<releases>
28+
<release version="1.7.9" date="2022-12-28">
29+
<description>
30+
<ul>
31+
<li>Fix import button hidden on steam deck in game mode</li>
32+
</ul>
33+
</description>
34+
</release>
35+
2836
<release version="1.7.8" date="2022-12-27">
2937
<description>
3038
<ul>

src/ui/ui_image_download.rs

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ pub struct PossibleImage {
7272
thumbnail_url: String,
7373
mime: MimeTypes,
7474
full_url: String,
75-
id: u32,
7675
}
7776

7877
impl Default for ImageSelectState {
@@ -180,26 +179,26 @@ impl MyEguiApp {
180179
} else if let Some(action) = render_steam_game_select(ui, state) {
181180
return action;
182181
}
183-
}
184182

185-
match *self.status_reciever.borrow() {
186-
crate::sync::SyncProgress::FindingImages => {
187-
ui.spinner();
188-
ui.label("Finding images to download");
189-
ui.ctx().request_repaint();
190-
}
191-
crate::sync::SyncProgress::DownloadingImages { to_download } => {
192-
ui.spinner();
193-
ui.label(format!("Downloading {to_download} images"));
194-
ui.ctx().request_repaint();
195-
}
196-
crate::sync::SyncProgress::Done => {
197-
ui.ctx().request_repaint();
198-
return UserAction::RefreshImages;
199-
}
200-
_ => {
201-
if ui.button("Download images for all games").clicked() {
202-
return UserAction::DownloadAllImages;
183+
match *self.status_reciever.borrow() {
184+
crate::sync::SyncProgress::FindingImages => {
185+
ui.spinner();
186+
ui.label("Finding images to download");
187+
ui.ctx().request_repaint();
188+
}
189+
crate::sync::SyncProgress::DownloadingImages { to_download } => {
190+
ui.spinner();
191+
ui.label(format!("Downloading {to_download} images"));
192+
ui.ctx().request_repaint();
193+
}
194+
crate::sync::SyncProgress::Done => {
195+
ui.ctx().request_repaint();
196+
return UserAction::RefreshImages;
197+
}
198+
_ => {
199+
if ui.button("Download images for all games").clicked() {
200+
return UserAction::DownloadAllImages;
201+
}
203202
}
204203
}
205204
}
@@ -515,23 +514,22 @@ impl MyEguiApp {
515514
self.status_reciever = reciever;
516515
let mut sender_op = Some(sender);
517516
let settings = self.settings.clone();
518-
let users = users.clone();
517+
let users = users.clone();
519518
self.rt.spawn_blocking(move || {
520519
let task = download_images(&settings, &users, &mut sender_op);
521520
block_on(task);
522521
let _ = sender_op.unwrap().send(SyncProgress::Done);
523522
});
524-
525523
}
526524
}
527525
UserAction::RefreshImages => {
528-
let (_, reciever) = watch::channel(SyncProgress::NotStarted);
526+
let (_, reciever) = watch::channel(SyncProgress::NotStarted);
529527
let user = self.image_selected_state.steam_user.clone();
530-
if let Some(user) = &user{
531-
load_image_grids(user,&mut self.image_selected_state,ui);
528+
if let Some(user) = &user {
529+
load_image_grids(user, &mut self.image_selected_state, ui);
532530
}
533-
self.status_reciever = reciever;
534-
},
531+
self.status_reciever = reciever;
532+
}
535533
};
536534
}
537535

@@ -619,7 +617,8 @@ impl MyEguiApp {
619617
self.rt.spawn_blocking(move || {
620618
let thumbnails_folder = get_thumbnails_folder();
621619
let client = steamgriddb_api::Client::new(auth_key);
622-
let query = get_query_type(false, &image_type, settings.steamgrid_db.allow_nsfw);
620+
let query =
621+
get_query_type(false, &image_type, settings.steamgrid_db.allow_nsfw);
623622
let search_res = block_on(client.get_images_for_id(grid_id, &query));
624623
if let Ok(possible_images) = search_res {
625624
let mut result = vec![];
@@ -632,7 +631,6 @@ impl MyEguiApp {
632631
mime: possible_image.mime.clone(),
633632
thumbnail_url: possible_image.thumb.clone(),
634633
full_url: possible_image.url.clone(),
635-
id: possible_image.id,
636634
});
637635
}
638636
let _ = tx.send(FetcStatus::Fetched(result));
@@ -775,7 +773,11 @@ impl MyEguiApp {
775773
}
776774
}
777775

778-
fn load_image_grids(user: &SteamUsersInfo, state: &mut ImageSelectState, ui: &mut egui::Ui) -> Vec<ShortcutOwned> {
776+
fn load_image_grids(
777+
user: &SteamUsersInfo,
778+
state: &mut ImageSelectState,
779+
ui: &mut egui::Ui,
780+
) -> Vec<ShortcutOwned> {
779781
let user_info = crate::steam::get_shortcuts_for_user(user);
780782
let mut user_folder = user_info.path.clone();
781783
user_folder.pop();

src/ui/uiapp.rs

Lines changed: 65 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,51 @@ impl MyEguiApp {
9090
platforms,
9191
}
9292
}
93+
94+
fn render_import_button(&mut self, ui: &mut egui::Ui) {
95+
let (status_string, syncing) = match &*self.status_reciever.borrow() {
96+
SyncProgress::NotStarted => ("".to_string(), false),
97+
SyncProgress::Starting => ("Starting Import".to_string(), true),
98+
SyncProgress::FoundGames { games_found } => {
99+
(format!("Found {} games to import", games_found), true)
100+
}
101+
SyncProgress::FindingImages => ("Searching for images".to_string(), true),
102+
SyncProgress::DownloadingImages { to_download } => {
103+
(format!("Downloading {} images ", to_download), true)
104+
}
105+
SyncProgress::Done => ("Done importing games".to_string(), false),
106+
};
107+
if syncing {
108+
ui.ctx().request_repaint();
109+
}
110+
if !status_string.is_empty() {
111+
if syncing {
112+
ui.horizontal(|c| {
113+
c.spinner();
114+
c.label(&status_string);
115+
});
116+
} else {
117+
ui.label(&status_string);
118+
}
119+
}
120+
let all_ready = all_ready(&self.games_to_sync);
121+
let texture = self.get_import_image(ui);
122+
let size = texture.size_vec2();
123+
let image_button = ImageButton::new(texture, size * 0.40);
124+
if all_ready && !syncing{
125+
if ui
126+
.add(image_button)
127+
.on_hover_text("Import your games into steam")
128+
.clicked(){
129+
save_settings(&self.settings, &self.platforms);
130+
self.run_sync(false);
131+
}
132+
}else{
133+
ui
134+
.add(image_button)
135+
.on_hover_text("Waiting for sync to finish");
136+
}
137+
}
93138
}
94139

95140
fn get_rename_map() -> HashMap<u32, String> {
@@ -174,7 +219,11 @@ impl App for MyEguiApp {
174219
|| ui
175220
.selectable_value(&mut self.selected_menu, Menues::Disconnect, "Disconnect")
176221
.changed();
177-
222+
if self.selected_menu == Menues::Import {
223+
ui.with_layout(egui::Layout::bottom_up(egui::Align::Center), |ui| {
224+
self.render_import_button(ui);
225+
});
226+
}
178227
if changed {
179228
self.backup_state.available_backups = None;
180229
}
@@ -187,66 +236,6 @@ impl App for MyEguiApp {
187236
}
188237
});
189238

190-
if self.selected_menu == Menues::Settings {
191-
egui::TopBottomPanel::new(egui::panel::TopBottomSide::Bottom, "Bottom Panel")
192-
.frame(frame)
193-
.show(ctx, |ui| {
194-
let texture = self.get_save_image(ui);
195-
let size = texture.size_vec2();
196-
let save_button = ImageButton::new(texture, size * 0.5);
197-
198-
if ui.add(save_button).on_hover_text("Save settings").clicked() {
199-
save_settings(&self.settings, &self.platforms);
200-
}
201-
});
202-
}
203-
if self.selected_menu == Menues::Import {
204-
egui::TopBottomPanel::new(egui::panel::TopBottomSide::Bottom, "Bottom Panel")
205-
.frame(frame)
206-
.show(ctx, |ui| {
207-
let (status_string, syncing) = match &*self.status_reciever.borrow() {
208-
SyncProgress::NotStarted => ("".to_string(), false),
209-
SyncProgress::Starting => ("Starting Import".to_string(), true),
210-
SyncProgress::FoundGames { games_found } => {
211-
(format!("Found {} games to import", games_found), true)
212-
}
213-
SyncProgress::FindingImages => ("Searching for images".to_string(), true),
214-
SyncProgress::DownloadingImages { to_download } => {
215-
(format!("Downloading {} images ", to_download), true)
216-
}
217-
SyncProgress::Done => ("Done importing games".to_string(), false),
218-
};
219-
if syncing {
220-
ui.ctx().request_repaint();
221-
}
222-
if !status_string.is_empty() {
223-
if syncing {
224-
ui.horizontal(|c| {
225-
c.spinner();
226-
c.label(&status_string);
227-
});
228-
} else {
229-
ui.label(&status_string);
230-
}
231-
}
232-
let all_ready = all_ready(&self.games_to_sync);
233-
234-
let texture = self.get_import_image(ui);
235-
let size = texture.size_vec2();
236-
let image_button = ImageButton::new(texture, size * 0.5);
237-
if all_ready
238-
&& ui
239-
.add(image_button)
240-
.on_hover_text("Import your games into steam")
241-
.clicked()
242-
&& !syncing
243-
{
244-
save_settings(&self.settings, &self.platforms);
245-
self.run_sync(false);
246-
}
247-
});
248-
}
249-
250239
egui::CentralPanel::default().show(ctx, |ui| {
251240
match self.selected_menu {
252241
Menues::Import => {
@@ -266,6 +255,20 @@ impl App for MyEguiApp {
266255
}
267256
};
268257
});
258+
259+
if self.selected_menu == Menues::Settings {
260+
egui::TopBottomPanel::new(egui::panel::TopBottomSide::Bottom, "Bottom Panel")
261+
.frame(frame)
262+
.show(ctx, |ui| {
263+
let texture = self.get_save_image(ui);
264+
let size = texture.size_vec2();
265+
let save_button = ImageButton::new(texture, size * 0.5);
266+
267+
if ui.add(save_button).on_hover_text("Save settings").clicked() {
268+
save_settings(&self.settings, &self.platforms);
269+
}
270+
});
271+
}
269272
}
270273
}
271274

@@ -353,7 +356,7 @@ pub fn run_ui(args: Vec<String>) {
353356
let fullscreen = args.contains(&"--fullscreen".to_string());
354357
let native_options = eframe::NativeOptions {
355358
fullscreen,
356-
maximized:true,
359+
maximized: true,
357360
//initial_window_size: Some(egui::Vec2 { x: 1280., y: 800. }),
358361
icon_data: Some(get_logo_icon()),
359362
vsync: !no_v_sync,

0 commit comments

Comments
 (0)