@@ -90,6 +90,51 @@ impl MyEguiApp {
90
90
platforms,
91
91
}
92
92
}
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
+ }
93
138
}
94
139
95
140
fn get_rename_map ( ) -> HashMap < u32 , String > {
@@ -174,7 +219,11 @@ impl App for MyEguiApp {
174
219
|| ui
175
220
. selectable_value ( & mut self . selected_menu , Menues :: Disconnect , "Disconnect" )
176
221
. 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
+ }
178
227
if changed {
179
228
self . backup_state . available_backups = None ;
180
229
}
@@ -187,66 +236,6 @@ impl App for MyEguiApp {
187
236
}
188
237
} ) ;
189
238
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
-
250
239
egui:: CentralPanel :: default ( ) . show ( ctx, |ui| {
251
240
match self . selected_menu {
252
241
Menues :: Import => {
@@ -266,6 +255,20 @@ impl App for MyEguiApp {
266
255
}
267
256
} ;
268
257
} ) ;
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
+ }
269
272
}
270
273
}
271
274
@@ -353,7 +356,7 @@ pub fn run_ui(args: Vec<String>) {
353
356
let fullscreen = args. contains ( & "--fullscreen" . to_string ( ) ) ;
354
357
let native_options = eframe:: NativeOptions {
355
358
fullscreen,
356
- maximized : true ,
359
+ maximized : true ,
357
360
//initial_window_size: Some(egui::Vec2 { x: 1280., y: 800. }),
358
361
icon_data : Some ( get_logo_icon ( ) ) ,
359
362
vsync : !no_v_sync,
0 commit comments