mirror of
https://github.com/gopher64/gopher64.git
synced 2026-07-11 01:25:20 +02:00
@@ -137,12 +137,14 @@ fn set_current_user_message(app: &ui::gui::AppWindow, rx: tokio::sync::oneshot::
|
||||
rx.await.unwrap();
|
||||
weak_app
|
||||
.upgrade_in_event_loop(move |handle| {
|
||||
if unsafe { ra_is_user_logged_in() } {
|
||||
if is_user_logged_in() {
|
||||
handle.set_ra_current_user_message(
|
||||
format!("Logged in as {}", handle.get_ra_username()).into(),
|
||||
);
|
||||
handle.set_ra_show_profile(true);
|
||||
} else {
|
||||
handle.set_ra_current_user_message("Login failed".into());
|
||||
handle.set_ra_show_profile(false);
|
||||
}
|
||||
handle.set_ra_logging_in(false);
|
||||
})
|
||||
@@ -223,6 +225,10 @@ pub fn ra_window(app: &ui::gui::AppWindow) {
|
||||
app.on_ra_games_clicked(move || {
|
||||
open::that_detached("https://retroachievements.org/system/2-nintendo-64/games").unwrap();
|
||||
});
|
||||
|
||||
app.on_ra_show_profile_clicked(move |username| {
|
||||
open::that_detached(format!("https://retroachievements.org/user/{}", username)).unwrap();
|
||||
});
|
||||
}
|
||||
|
||||
pub fn load_game(rom: &[u8], rom_size: usize) {
|
||||
|
||||
@@ -37,12 +37,14 @@ export component AppWindow inherits Window {
|
||||
callback cheat_toggled(string, string, string, bool);
|
||||
callback ra_button_clicked(string);
|
||||
callback ra_games_clicked;
|
||||
callback ra_show_profile_clicked(string);
|
||||
callback ra_toggled(bool,bool);
|
||||
in property version <=> AboutData.version;
|
||||
in property has_update <=> AboutData.has_update;
|
||||
in-out property ra_username <=> RAData.ra_username;
|
||||
in-out property ra_password <=> RAData.ra_password;
|
||||
in-out property ra_logging_in <=> RAData.ra_logging_in;
|
||||
in-out property ra_show_profile <=> RAData.ra_show_profile;
|
||||
in-out property ra_current_user_message <=> RAData.current_user_message;
|
||||
in-out property ra_enabled <=> RAData.enabled;
|
||||
in-out property ra_hardcore <=> RAData.hardcore;
|
||||
@@ -138,6 +140,9 @@ export component AppWindow inherits Window {
|
||||
ra_games_clicked => {
|
||||
ra_games_clicked();
|
||||
}
|
||||
ra_show_profile_clicked(username) => {
|
||||
ra_show_profile_clicked(username);
|
||||
}
|
||||
}
|
||||
if(side-bar.current-item == 5): Settings { }
|
||||
if(side-bar.current-item == 6): About {
|
||||
|
||||
@@ -8,6 +8,7 @@ export global RAData {
|
||||
in-out property <bool> enabled;
|
||||
in-out property <bool> hardcore;
|
||||
in-out property <bool> ra_logging_in;
|
||||
in-out property <bool> ra_show_profile;
|
||||
in-out property <string> ra_username;
|
||||
in-out property <string> ra_password;
|
||||
in-out property <string> current_user_message;
|
||||
@@ -17,6 +18,7 @@ export component RetroAchievements inherits Page {
|
||||
callback ra_button_clicked(string);
|
||||
callback ra_toggled(bool,bool);
|
||||
callback ra_games_clicked;
|
||||
callback ra_show_profile_clicked(string);
|
||||
title: @tr("RetroAchievements");
|
||||
|
||||
VerticalBox {
|
||||
@@ -33,6 +35,7 @@ export component RetroAchievements inherits Page {
|
||||
username_widget.text = "";
|
||||
password_widget.text = "";
|
||||
RAData.current_user_message = "Not currently logged in";
|
||||
RAData.ra_show_profile = false;
|
||||
}
|
||||
ra_toggled(RAData.enabled,RAData.hardcore);
|
||||
}
|
||||
@@ -54,6 +57,14 @@ export component RetroAchievements inherits Page {
|
||||
alignment: center;
|
||||
Text {
|
||||
text: RAData.current_user_message;
|
||||
vertical-alignment: center;
|
||||
}
|
||||
if RAData.ra_show_profile:Button {
|
||||
enabled: RAData.enabled;
|
||||
text: @tr("View Profile");
|
||||
clicked => {
|
||||
ra_show_profile_clicked(RAData.ra_username);
|
||||
}
|
||||
}
|
||||
}
|
||||
HorizontalBox {
|
||||
|
||||
Reference in New Issue
Block a user