mirror of
https://github.com/an-anime-team/sleepy-launcher.git
synced 2024-11-25 14:20:08 +03:00
Added game voiceover selection ui
This commit is contained in:
parent
178c45ae48
commit
9d5c0cc9ee
6 changed files with 49 additions and 14 deletions
|
@ -17,3 +17,4 @@ serde = { version = "1.0", features = ["derive"] }
|
||||||
serde_json = "1.0"
|
serde_json = "1.0"
|
||||||
|
|
||||||
dirs = "4.0.0"
|
dirs = "4.0.0"
|
||||||
|
# tokio = { version = "1.19.2", features = ["rt", "rt-multi-thread", "macros"]}
|
||||||
|
|
|
@ -18,6 +18,47 @@ Adw.PreferencesPage general_page {
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Adw.ExpanderRow {
|
||||||
|
title: "Game voiceovers";
|
||||||
|
subtitle: "Select voice packages used in game";
|
||||||
|
|
||||||
|
Adw.ActionRow {
|
||||||
|
title: "English";
|
||||||
|
|
||||||
|
Gtk.Button {
|
||||||
|
icon-name: "document-save-symbolic";
|
||||||
|
valign: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Adw.ActionRow {
|
||||||
|
title: "Japanese";
|
||||||
|
|
||||||
|
Gtk.Button {
|
||||||
|
icon-name: "user-trash-symbolic";
|
||||||
|
valign: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Adw.ActionRow {
|
||||||
|
title: "Korean";
|
||||||
|
|
||||||
|
Gtk.Button {
|
||||||
|
icon-name: "document-save-symbolic";
|
||||||
|
valign: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Adw.ActionRow {
|
||||||
|
title: "Chinese";
|
||||||
|
|
||||||
|
Gtk.Button {
|
||||||
|
icon-name: "document-save-symbolic";
|
||||||
|
valign: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Adw.PreferencesGroup {
|
Adw.PreferencesGroup {
|
||||||
|
|
|
@ -6,6 +6,7 @@ pub mod lib;
|
||||||
|
|
||||||
use ui::*;
|
use ui::*;
|
||||||
|
|
||||||
|
// #[tokio::main]
|
||||||
fn main() {
|
fn main() {
|
||||||
gtk::init().expect("GTK initialization failed");
|
gtk::init().expect("GTK initialization failed");
|
||||||
adw::init();
|
adw::init();
|
||||||
|
@ -23,9 +24,7 @@ fn main() {
|
||||||
let app_copy = app.clone();
|
let app_copy = app.clone();
|
||||||
|
|
||||||
app.open_preferences.connect_clicked(move |_| {
|
app.open_preferences.connect_clicked(move |_| {
|
||||||
if let Err(err) = app_copy.open_preferences_page() {
|
app_copy.open_preferences_page();
|
||||||
app_copy.toast_error("Failed to open settings page", err);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
app.window.show();
|
app.window.show();
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
use gtk4::{self as gtk, prelude::*};
|
use gtk4::{self as gtk, prelude::*};
|
||||||
use libadwaita::{self as adw, prelude::*};
|
use libadwaita::{self as adw, prelude::*};
|
||||||
|
|
||||||
use std::io::Error;
|
|
||||||
|
|
||||||
use super::get_object;
|
use super::get_object;
|
||||||
use super::preferences::PreferencesStack;
|
use super::preferences::PreferencesStack;
|
||||||
use super::ToastError;
|
use super::ToastError;
|
||||||
|
@ -93,12 +91,12 @@ impl App {
|
||||||
Ok(result)
|
Ok(result)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn open_preferences_page(&self) -> Result<(), Error> {
|
pub fn open_preferences_page(&self) {
|
||||||
self.preferences_stack.update()?;
|
|
||||||
|
|
||||||
self.leaflet.set_visible_child_name("preferences_page");
|
self.leaflet.set_visible_child_name("preferences_page");
|
||||||
|
|
||||||
Ok(())
|
if let Err(err) = self.preferences_stack.update() {
|
||||||
|
self.toast_error("Failed to update preferences", err);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn update_state(&self, state: AppState) {
|
pub fn update_state(&self, state: AppState) {
|
||||||
|
|
|
@ -73,8 +73,6 @@ impl PreferencesStack {
|
||||||
self.status_page.set_visible(false);
|
self.status_page.set_visible(false);
|
||||||
self.flap.set_visible(true);
|
self.flap.set_visible(true);
|
||||||
|
|
||||||
self.toast_error("Aboba amogus", Error::last_os_error());
|
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
use gtk4::{self as gtk, prelude::*};
|
use gtk4::{self as gtk, prelude::*};
|
||||||
use libadwaita::{self as adw, prelude::*};
|
use libadwaita::{self as adw, prelude::*};
|
||||||
|
|
||||||
use std::io::Error;
|
|
||||||
|
|
||||||
use super::add_action;
|
use super::add_action;
|
||||||
|
|
||||||
pub trait ToastError {
|
pub trait ToastError {
|
||||||
|
@ -11,7 +9,7 @@ pub trait ToastError {
|
||||||
/// Show toast with `toast` title and `See message` button
|
/// Show toast with `toast` title and `See message` button
|
||||||
///
|
///
|
||||||
/// This button will show message dialog with error message
|
/// This button will show message dialog with error message
|
||||||
fn toast_error(&self, toast: &str, err: Error) {
|
fn toast_error<T: ToString + 'static>(&self, toast: &str, err: T) {
|
||||||
let toast = adw::Toast::new(toast);
|
let toast = adw::Toast::new(toast);
|
||||||
|
|
||||||
toast.set_button_label(Some("See message"));
|
toast.set_button_label(Some("See message"));
|
||||||
|
|
Loading…
Reference in a new issue