mirror of
https://github.com/an-anime-team/an-anime-game-launcher.git
synced 2025-02-16 15:22:01 +03:00
feat: replaced "auto-close" option by "launcher behavior"
New option will allow to keep launcher window open as well
This commit is contained in:
parent
efc7229717
commit
d04bb3e5e0
26 changed files with 106 additions and 42 deletions
4
Cargo.lock
generated
4
Cargo.lock
generated
|
@ -87,8 +87,8 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "anime-launcher-sdk"
|
name = "anime-launcher-sdk"
|
||||||
version = "1.8.11"
|
version = "1.8.12"
|
||||||
source = "git+https://github.com/an-anime-team/anime-launcher-sdk?tag=1.8.11#4b2e02c10e7d3bc7f240b8fb7cd881d6b489b49f"
|
source = "git+https://github.com/an-anime-team/anime-launcher-sdk?tag=1.8.12#e9814f33dd1e1bd3648b6d6fc761e62b39b8736c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"anime-game-core",
|
"anime-game-core",
|
||||||
"anyhow",
|
"anyhow",
|
||||||
|
|
|
@ -17,7 +17,7 @@ glib-build-tools = "0.17"
|
||||||
|
|
||||||
[dependencies.anime-launcher-sdk]
|
[dependencies.anime-launcher-sdk]
|
||||||
git = "https://github.com/an-anime-team/anime-launcher-sdk"
|
git = "https://github.com/an-anime-team/anime-launcher-sdk"
|
||||||
tag = "1.8.11"
|
tag = "1.8.12"
|
||||||
features = ["all", "genshin", "genshin-patch"]
|
features = ["all", "genshin", "genshin-patch"]
|
||||||
|
|
||||||
# path = "../anime-launcher-sdk" # ! for dev purposes only
|
# path = "../anime-launcher-sdk" # ! for dev purposes only
|
||||||
|
|
|
@ -58,8 +58,8 @@ disable-mhypbase-description = Experimentell. Wenn sie diese option aktivieren,
|
||||||
ask-superuser-permissions = Superuser-Berechtigungen anfordern
|
ask-superuser-permissions = Superuser-Berechtigungen anfordern
|
||||||
ask-superuser-permissions-description = Launcher benötigt Superuser-Zugriff, um Ihre Hosts-Datei automatisch zu aktualisieren. Dies ist in der Flatpak-Edition nicht erforderlich
|
ask-superuser-permissions-description = Launcher benötigt Superuser-Zugriff, um Ihre Hosts-Datei automatisch zu aktualisieren. Dies ist in der Flatpak-Edition nicht erforderlich
|
||||||
|
|
||||||
auto-close-launcher = Auto-close launcher
|
launcher-behavior = Launcher behavior
|
||||||
auto-close-launcher-description = Close the launcher after the game is closed
|
launcher-behavior-description = What should launcher window do when it starts the game
|
||||||
|
|
||||||
wine-tools = Wine-Tools
|
wine-tools = Wine-Tools
|
||||||
command-line = Befehlszeile
|
command-line = Befehlszeile
|
||||||
|
|
|
@ -18,6 +18,8 @@ about = Über
|
||||||
|
|
||||||
|
|
||||||
close = Schließen
|
close = Schließen
|
||||||
|
hide = Hide
|
||||||
|
nothing = Nothing
|
||||||
save = Speichern
|
save = Speichern
|
||||||
continue = Weiter
|
continue = Weiter
|
||||||
resume = Fortsetzen
|
resume = Fortsetzen
|
||||||
|
|
|
@ -58,8 +58,8 @@ disable-mhypbase-description = Experimental. If enabled, launcher will disable m
|
||||||
ask-superuser-permissions = Ask superuser permissions
|
ask-superuser-permissions = Ask superuser permissions
|
||||||
ask-superuser-permissions-description = Launcher will use them to automatically update your hosts file. This is not needed in flatpak edition
|
ask-superuser-permissions-description = Launcher will use them to automatically update your hosts file. This is not needed in flatpak edition
|
||||||
|
|
||||||
auto-close-launcher = Auto-close launcher
|
launcher-behavior = Launcher behavior
|
||||||
auto-close-launcher-description = Close the launcher after the game is closed
|
launcher-behavior-description = What should launcher window do when it starts the game
|
||||||
|
|
||||||
wine-tools = Wine tools
|
wine-tools = Wine tools
|
||||||
command-line = Command line
|
command-line = Command line
|
||||||
|
|
|
@ -18,6 +18,8 @@ about = About
|
||||||
|
|
||||||
|
|
||||||
close = Close
|
close = Close
|
||||||
|
hide = Hide
|
||||||
|
nothing = Nothing
|
||||||
save = Save
|
save = Save
|
||||||
continue = Continue
|
continue = Continue
|
||||||
resume = Resume
|
resume = Resume
|
||||||
|
|
|
@ -58,8 +58,8 @@ disable-mhypbase-description = Experimental. Si se activa, el launcher desactiva
|
||||||
ask-superuser-permissions = Pedir permisos de superusuario
|
ask-superuser-permissions = Pedir permisos de superusuario
|
||||||
ask-superuser-permissions-description = El launcher usará los permisos para actualizar automáticamente tu archivo hosts. Esto no es necesario en la versión de Flatpak
|
ask-superuser-permissions-description = El launcher usará los permisos para actualizar automáticamente tu archivo hosts. Esto no es necesario en la versión de Flatpak
|
||||||
|
|
||||||
auto-close-launcher = Auto-close launcher
|
launcher-behavior = Launcher behavior
|
||||||
auto-close-launcher-description = Close the launcher after the game is closed
|
launcher-behavior-description = What should launcher window do when it starts the game
|
||||||
|
|
||||||
wine-tools = Herramientas de Wine
|
wine-tools = Herramientas de Wine
|
||||||
command-line = Línea de Comandos
|
command-line = Línea de Comandos
|
||||||
|
|
|
@ -18,6 +18,8 @@ about = Acerca de
|
||||||
|
|
||||||
|
|
||||||
close = Cerrar
|
close = Cerrar
|
||||||
|
hide = Hide
|
||||||
|
nothing = Nothing
|
||||||
save = Guardar
|
save = Guardar
|
||||||
continue = Continuar
|
continue = Continuar
|
||||||
resume = Reanudar
|
resume = Reanudar
|
||||||
|
|
|
@ -58,8 +58,8 @@ disable-mhypbase-description = Experimental. If enabled, launcher will disable m
|
||||||
ask-superuser-permissions = Ask superuser permissions
|
ask-superuser-permissions = Ask superuser permissions
|
||||||
ask-superuser-permissions-description = Launcher will use them to automatically update your hosts file. This is not needed in flatpak edition
|
ask-superuser-permissions-description = Launcher will use them to automatically update your hosts file. This is not needed in flatpak edition
|
||||||
|
|
||||||
auto-close-launcher = Auto-close launcher
|
launcher-behavior = Launcher behavior
|
||||||
auto-close-launcher-description = Close the launcher after the game is closed
|
launcher-behavior-description = What should launcher window do when it starts the game
|
||||||
|
|
||||||
wine-tools = Wine tools
|
wine-tools = Wine tools
|
||||||
command-line = Command line
|
command-line = Command line
|
||||||
|
|
|
@ -18,6 +18,8 @@ about = À propos
|
||||||
|
|
||||||
|
|
||||||
close = Fermer
|
close = Fermer
|
||||||
|
hide = Hide
|
||||||
|
nothing = Nothing
|
||||||
save = Sauvegarder
|
save = Sauvegarder
|
||||||
continue = Continuer
|
continue = Continuer
|
||||||
resume = Reprendre
|
resume = Reprendre
|
||||||
|
|
|
@ -58,8 +58,8 @@ disable-mhypbase-description = Tesztelés alatt. Ha bekapcsolod, kikapcsolja a m
|
||||||
ask-superuser-permissions = Superuser engedély kérése
|
ask-superuser-permissions = Superuser engedély kérése
|
||||||
ask-superuser-permissions-description = A Launcher autómatikusan használni fogja hogy frissítse a hosts fájlodat. A Flatpak verzióhoz nem kell
|
ask-superuser-permissions-description = A Launcher autómatikusan használni fogja hogy frissítse a hosts fájlodat. A Flatpak verzióhoz nem kell
|
||||||
|
|
||||||
auto-close-launcher = Auto-close launcher
|
launcher-behavior = Launcher behavior
|
||||||
auto-close-launcher-description = Close the launcher after the game is closed
|
launcher-behavior-description = What should launcher window do when it starts the game
|
||||||
|
|
||||||
wine-tools = Wine eszközök
|
wine-tools = Wine eszközök
|
||||||
command-line = Parancssor
|
command-line = Parancssor
|
||||||
|
|
|
@ -18,6 +18,8 @@ about = Részletek
|
||||||
|
|
||||||
|
|
||||||
close = Bezárás
|
close = Bezárás
|
||||||
|
hide = Hide
|
||||||
|
nothing = Nothing
|
||||||
save = Mentés
|
save = Mentés
|
||||||
continue = Folytatás
|
continue = Folytatás
|
||||||
resume = Resume
|
resume = Resume
|
||||||
|
|
|
@ -58,8 +58,8 @@ disable-mhypbase-description = Masih dalam pengujicobaan. Jika diaktifkan, launc
|
||||||
ask-superuser-permissions = Minta izin dari admin
|
ask-superuser-permissions = Minta izin dari admin
|
||||||
ask-superuser-permissions-description = Launcher akan otomatis memperbarui file hosts Anda. Opsi ini tidak diperlukan jika Anda memakai edisi flatpak
|
ask-superuser-permissions-description = Launcher akan otomatis memperbarui file hosts Anda. Opsi ini tidak diperlukan jika Anda memakai edisi flatpak
|
||||||
|
|
||||||
auto-close-launcher = Auto-close launcher
|
launcher-behavior = Launcher behavior
|
||||||
auto-close-launcher-description = Close the launcher after the game is closed
|
launcher-behavior-description = What should launcher window do when it starts the game
|
||||||
|
|
||||||
wine-tools = Peralatan wine
|
wine-tools = Peralatan wine
|
||||||
command-line = Command line
|
command-line = Command line
|
||||||
|
|
|
@ -17,7 +17,9 @@ wish-url = Buka wishes
|
||||||
about = Tentang
|
about = Tentang
|
||||||
|
|
||||||
|
|
||||||
close = Tutup
|
close = Tutup
|
||||||
|
hide = Hide
|
||||||
|
nothing = Nothing
|
||||||
save = Simpan
|
save = Simpan
|
||||||
continue = Lanjutkan
|
continue = Lanjutkan
|
||||||
resume = Lanjutkan
|
resume = Lanjutkan
|
||||||
|
|
|
@ -58,8 +58,8 @@ disable-mhypbase-description = Sperimentale. Se abiliata, il launcher disabilite
|
||||||
ask-superuser-permissions = Chiedi permessi di amministratore
|
ask-superuser-permissions = Chiedi permessi di amministratore
|
||||||
ask-superuser-permissions-description = Il launcher li userà per aggiornare automaticamente il tuo file hosts. Questo non è necessario nell'edizione flatpak
|
ask-superuser-permissions-description = Il launcher li userà per aggiornare automaticamente il tuo file hosts. Questo non è necessario nell'edizione flatpak
|
||||||
|
|
||||||
auto-close-launcher = Chiusura automatica del launcher
|
launcher-behavior = Launcher behavior
|
||||||
auto-close-launcher-description = Chiudi il launcher dopo che il gioco è stato chiuso
|
launcher-behavior-description = What should launcher window do when it starts the game
|
||||||
|
|
||||||
wine-tools = Strumenti di Wine
|
wine-tools = Strumenti di Wine
|
||||||
command-line = Linea di comando
|
command-line = Linea di comando
|
||||||
|
|
|
@ -18,6 +18,8 @@ about = Informazioni
|
||||||
|
|
||||||
|
|
||||||
close = Chiudi
|
close = Chiudi
|
||||||
|
hide = Hide
|
||||||
|
nothing = Nothing
|
||||||
save = Salva
|
save = Salva
|
||||||
continue = Continua
|
continue = Continua
|
||||||
resume = Riprendi
|
resume = Riprendi
|
||||||
|
|
|
@ -58,8 +58,8 @@ disable-mhypbase-description = 試験的です。有効にすると、ランチ
|
||||||
ask-superuser-permissions = スーパーユーザーを尋ねる。
|
ask-superuser-permissions = スーパーユーザーを尋ねる。
|
||||||
ask-superuser-permissions-description = あなたのホストのファイルを自動更新するために、 これらを利用します。flatpak版では必要ありません。
|
ask-superuser-permissions-description = あなたのホストのファイルを自動更新するために、 これらを利用します。flatpak版では必要ありません。
|
||||||
|
|
||||||
auto-close-launcher = ランチャーを自動で閉じる
|
launcher-behavior = Launcher behavior
|
||||||
auto-close-launcher-description = ゲーム終了後にランチャーも閉じるようにする
|
launcher-behavior-description = What should launcher window do when it starts the game
|
||||||
|
|
||||||
wine-tools = ワインツール
|
wine-tools = ワインツール
|
||||||
command-line = コマンドライン
|
command-line = コマンドライン
|
||||||
|
|
|
@ -18,6 +18,8 @@ about = "An anime Game launcher"について
|
||||||
|
|
||||||
|
|
||||||
close = 閉じる
|
close = 閉じる
|
||||||
|
hide = Hide
|
||||||
|
nothing = Nothing
|
||||||
save = 保存
|
save = 保存
|
||||||
continue = 続行
|
continue = 続行
|
||||||
resume = 一時停止
|
resume = 一時停止
|
||||||
|
|
|
@ -58,8 +58,8 @@ disable-mhypbase-description = Экспериментально. Когда вк
|
||||||
ask-superuser-permissions = Запрашивать права суперпользователя
|
ask-superuser-permissions = Запрашивать права суперпользователя
|
||||||
ask-superuser-permissions-description = Лаунчер будет использовать их чтобы автоматически обновлять ваш hosts файл для отключения телеметрии игры. Не требуется при использовании flatpak
|
ask-superuser-permissions-description = Лаунчер будет использовать их чтобы автоматически обновлять ваш hosts файл для отключения телеметрии игры. Не требуется при использовании flatpak
|
||||||
|
|
||||||
auto-close-launcher = Автоматически закрывать лаунчер
|
launcher-behavior = Поведение лаунчера
|
||||||
auto-close-launcher-description = Закрывать лаунчер после выхода из игры
|
launcher-behavior-description = Что должно делать окно лаунчера когда оно запускает игру
|
||||||
|
|
||||||
wine-tools = Инструменты Wine
|
wine-tools = Инструменты Wine
|
||||||
command-line = Коммандная строка
|
command-line = Коммандная строка
|
||||||
|
|
|
@ -17,7 +17,17 @@ wish-url = История молитв
|
||||||
about = О программе
|
about = О программе
|
||||||
|
|
||||||
|
|
||||||
close = Закрыть
|
close = { $form ->
|
||||||
|
[verb] Закрываться
|
||||||
|
*[noun] Закрыть
|
||||||
|
}
|
||||||
|
|
||||||
|
hide = { $form ->
|
||||||
|
[verb] Скрываться
|
||||||
|
*[noun] Скрыть
|
||||||
|
}
|
||||||
|
|
||||||
|
nothing = Ничего
|
||||||
save = Сохранить
|
save = Сохранить
|
||||||
continue = Продолжить
|
continue = Продолжить
|
||||||
resume = Возобновить
|
resume = Возобновить
|
||||||
|
|
|
@ -58,8 +58,8 @@ disable-mhypbase-description = Deneysel. Etkinleştirilirse, istemci ana yamayı
|
||||||
ask-superuser-permissions = Yönetici izinlerini sor
|
ask-superuser-permissions = Yönetici izinlerini sor
|
||||||
ask-superuser-permissions-description = İstemci yönetici iznini hostunuzun dosyalarını güncellemek için otomatik olarak kullanacaktır. Buna flatpak versiyonunda gerek yoktur
|
ask-superuser-permissions-description = İstemci yönetici iznini hostunuzun dosyalarını güncellemek için otomatik olarak kullanacaktır. Buna flatpak versiyonunda gerek yoktur
|
||||||
|
|
||||||
auto-close-launcher = Auto-close launcher
|
launcher-behavior = Launcher behavior
|
||||||
auto-close-launcher-description = Close the launcher after the game is closed
|
launcher-behavior-description = What should launcher window do when it starts the game
|
||||||
|
|
||||||
wine-tools = Wine araçları
|
wine-tools = Wine araçları
|
||||||
command-line = Komut istemi
|
command-line = Komut istemi
|
||||||
|
|
|
@ -18,6 +18,8 @@ about = Hakkında
|
||||||
|
|
||||||
|
|
||||||
close = Kapat
|
close = Kapat
|
||||||
|
hide = Hide
|
||||||
|
nothing = Nothing
|
||||||
save = Kaydet
|
save = Kaydet
|
||||||
continue = Devam et
|
continue = Devam et
|
||||||
resume = Sürdürmek
|
resume = Sürdürmek
|
||||||
|
|
|
@ -58,8 +58,8 @@ disable-mhypbase-description = 实验性功能。启用此选项后,启动器
|
||||||
ask-superuser-permissions = 请求超级用户权限
|
ask-superuser-permissions = 请求超级用户权限
|
||||||
ask-superuser-permissions-description = 启动器需要超级用户权限来修改 hosts 文件。Flatpak 版无需此权限
|
ask-superuser-permissions-description = 启动器需要超级用户权限来修改 hosts 文件。Flatpak 版无需此权限
|
||||||
|
|
||||||
auto-close-launcher = Auto-close launcher
|
launcher-behavior = Launcher behavior
|
||||||
auto-close-launcher-description = Close the launcher after the game is closed
|
launcher-behavior-description = What should launcher window do when it starts the game
|
||||||
|
|
||||||
wine-tools = Wine 工具
|
wine-tools = Wine 工具
|
||||||
command-line = 命令行
|
command-line = 命令行
|
||||||
|
|
|
@ -18,6 +18,8 @@ about = 关于
|
||||||
|
|
||||||
|
|
||||||
close = 关闭
|
close = 关闭
|
||||||
|
hide = Hide
|
||||||
|
nothing = Nothing
|
||||||
save = 保存
|
save = 保存
|
||||||
continue = 继续
|
continue = 继续
|
||||||
resume = 恢复
|
resume = 恢复
|
||||||
|
|
|
@ -1,11 +1,23 @@
|
||||||
use relm4::prelude::*;
|
use relm4::prelude::*;
|
||||||
|
use gtk::prelude::*;
|
||||||
|
|
||||||
|
use anime_launcher_sdk::genshin::config::schema::prelude::LauncherBehavior;
|
||||||
|
|
||||||
|
use crate::*;
|
||||||
use crate::i18n::*;
|
use crate::i18n::*;
|
||||||
|
|
||||||
use super::{App, AppMsg};
|
use super::{App, AppMsg};
|
||||||
|
|
||||||
pub fn launch(sender: ComponentSender<App>) {
|
pub fn launch(sender: ComponentSender<App>) {
|
||||||
sender.input(AppMsg::HideWindow);
|
let config = Config::get().unwrap();
|
||||||
|
|
||||||
|
match config.launcher.behavior {
|
||||||
|
// Disable launch button if behavior set to "Nothing" to prevent sussy actions
|
||||||
|
LauncherBehavior::Nothing => sender.input(AppMsg::DisableButtons(true)),
|
||||||
|
|
||||||
|
// Hide launcher window if behavior set to "Hide" or "Close"
|
||||||
|
LauncherBehavior::Hide | LauncherBehavior::Close => sender.input(AppMsg::HideWindow)
|
||||||
|
}
|
||||||
|
|
||||||
std::thread::spawn(move || {
|
std::thread::spawn(move || {
|
||||||
if let Err(err) = anime_launcher_sdk::genshin::game::run() {
|
if let Err(err) = anime_launcher_sdk::genshin::game::run() {
|
||||||
|
@ -17,6 +29,18 @@ pub fn launch(sender: ComponentSender<App>) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
sender.input(AppMsg::ShowWindow);
|
match config.launcher.behavior {
|
||||||
|
// Enable launch button if behavior set to "Nothing" after the game has closed
|
||||||
|
LauncherBehavior::Nothing => sender.input(AppMsg::DisableButtons(false)),
|
||||||
|
|
||||||
|
// Show back launcher window if behavior set to "Hide" and the game has closed
|
||||||
|
LauncherBehavior::Hide => sender.input(AppMsg::ShowWindow),
|
||||||
|
|
||||||
|
// Otherwise close the launcher if behavior set to "Close" and the game has closed
|
||||||
|
// We're calling quit method from the main context here because otherwise app won't be closed properly
|
||||||
|
LauncherBehavior::Close => gtk::glib::MainContext::default().invoke(|| {
|
||||||
|
relm4::main_application().quit();
|
||||||
|
})
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@ use anime_launcher_sdk::wincompatlib::prelude::*;
|
||||||
|
|
||||||
use anime_launcher_sdk::config::ConfigExt;
|
use anime_launcher_sdk::config::ConfigExt;
|
||||||
use anime_launcher_sdk::genshin::config::Config;
|
use anime_launcher_sdk::genshin::config::Config;
|
||||||
use anime_launcher_sdk::genshin::config::schema::launcher::LauncherStyle;
|
use anime_launcher_sdk::genshin::config::schema::prelude::*;
|
||||||
|
|
||||||
use anime_launcher_sdk::anime_game_core::genshin::consts::GameEdition;
|
use anime_launcher_sdk::anime_game_core::genshin::consts::GameEdition;
|
||||||
use anime_launcher_sdk::genshin::env_emulation::Environment;
|
use anime_launcher_sdk::genshin::env_emulation::Environment;
|
||||||
|
@ -576,22 +576,32 @@ impl SimpleAsyncComponent for GeneralApp {
|
||||||
add = &adw::PreferencesGroup {
|
add = &adw::PreferencesGroup {
|
||||||
set_title: &tr("options"),
|
set_title: &tr("options"),
|
||||||
|
|
||||||
adw::ActionRow {
|
adw::ComboRow {
|
||||||
set_title: &tr("auto-close-launcher"),
|
set_title: &tr("launcher-behavior"),
|
||||||
set_subtitle: &tr("auto-close-launcher-description"),
|
set_subtitle: &tr("launcher-behavior-description"),
|
||||||
|
|
||||||
add_suffix = >k::Switch {
|
set_model: Some(>k::StringList::new(&[
|
||||||
set_valign: gtk::Align::Center,
|
&tr("nothing"),
|
||||||
|
&tr_args("hide", [("form", "verb".into())]),
|
||||||
|
&tr_args("close", [("form", "verb".into())]),
|
||||||
|
])),
|
||||||
|
|
||||||
set_state: CONFIG.launcher.auto_close,
|
set_selected: match CONFIG.launcher.behavior {
|
||||||
|
LauncherBehavior::Nothing => 0,
|
||||||
|
LauncherBehavior::Hide => 1,
|
||||||
|
LauncherBehavior::Close => 2
|
||||||
|
},
|
||||||
|
|
||||||
connect_state_notify => |switch| {
|
connect_selected_notify => |row| {
|
||||||
if is_ready() {
|
if is_ready() {
|
||||||
if let Ok(mut config) = Config::get() {
|
if let Ok(mut config) = Config::get() {
|
||||||
config.launcher.auto_close = switch.state();
|
config.launcher.behavior = [
|
||||||
|
LauncherBehavior::Nothing,
|
||||||
|
LauncherBehavior::Hide,
|
||||||
|
LauncherBehavior::Close
|
||||||
|
][row.selected() as usize];
|
||||||
|
|
||||||
Config::update(config);
|
Config::update(config);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue