Splitted localization files & added about dialog

This commit is contained in:
Observer KRypt0n_ 2023-01-19 13:23:17 +02:00
parent 7bb2ecb270
commit e3d36f1f3a
No known key found for this signature in database
GPG key ID: 844DA47BA25FE1E2
10 changed files with 265 additions and 139 deletions

View file

@ -0,0 +1,49 @@
wine = Wine
synchronization = Synchronization
wine-sync-description = Technology used to synchronize inner wine events
language = Language
wine-lang-description = Language used in the wine environment. Can fix keyboard layout issues
system = System
borderless-window = Borderless window
virtual-desktop = Virtual desktop
game = Game
hud = HUD
fsr = FSR
fsr-description = Upscales game to your monitor size. To use select lower resolution in the game's settings and press Alt+Enter
ultra-quality = Ultra quality
quality = Quality
balanced = Balanced
performance = Performance
gamemode = Gamemode
gamemode-description = Prioritize the game over the rest of the processes
fps-unlocker = FPS Unlocker
enabled = Enabled
fps-unlocker-description = Remove frames rendering limitation by modifying the game's memory. Can be detected by the anti-cheat
power-saving = Power saving
power-saving-description = Automatically set the FPS limit to 10 and low process priority upon losing focus to the game (e.g. tabbing out)
monitor = Monitor
monitor-description = Number of monitor you want to run the game on
window-mode = Window Mode
popup = Popup
fullscreen = Fullscreen
priority = Priority
priority-description = Game process priority
realtime = Realtime
high = High
above-normal = Above Normal
normal = Normal
below-normal = Below Normal
low = Low

View file

@ -0,0 +1,15 @@
launcher-language = Launcher language
launcher-language-description = Applies after restart
game-voiceovers = Game voiceovers
english = English
japanese = Japanese
korean = Korean
chinese = Chinese
repair-game = Repair game
status = Status
game-version = Game version
patch-version = Patch version

View file

@ -3,76 +3,9 @@ none = None
default = Default
launch = Launch
preferences = Preferences
general = General
launcher-language = Launcher language
game-voiceovers = Game voiceovers
english = English
japanese = Japanese
korean = Korean
chinese = Chinese
repair-game = Repair game
status = Status
game-version = Game version
patch-version = Patch version
enhancements = Enhancements
wine = Wine
synchronization = Synchronization
wine-sync-description = Technology used to synchronize inner wine events
language = Language
wine-lang-description = Language used in the wine environment. Can fix keyboard layout issues
system = System
borderless-window = Borderless window
virtual-desktop = Virtual desktop
game = Game
hud = HUD
fsr = FSR
fsr-description = Upscales game to your monitor size. To use select lower resolution in the game's settings and press Alt+Enter
ultra-quality = Ultra quality
quality = Quality
balanced = Balanced
performance = Performance
gamemode = Gamemode
gamemode-description = Prioritize the game over the rest of the processes
fps-unlocker = FPS Unlocker
enabled = Enabled
fps-unlocker-description = Remove frames rendering limitation by modifying the game's memory. Can be detected by the anti-cheat
power-saving = Power saving
power-saving-description = Automatically set the FPS limit to 10 and low process priority upon losing focus to the game (e.g. tabbing out)
monitor = Monitor
monitor-description = Number of monitor you want to run the game on
window-mode = Window Mode
popup = Popup
fullscreen = Fullscreen
priority = Priority
priority-description = Game process priority
realtime = Realtime
high = High
above-normal = Above Normal
normal = Normal
below-normal = Below Normal
low = Low

View file

@ -0,0 +1,49 @@
wine = Wine
synchronization = Синхронизация
wine-sync-description = Технология, используемая для синхронизации внутренних событий Wine
language = Язык
wine-lang-description = Язык, используемый в окружении Wine. Может исправить проблемы с раскладкой клавиатуры
system = Системный
borderless-window = Окно без рамок
virtual-desktop = Виртуальный рабочий стол
game = Игра
hud = HUD
fsr = FSR
fsr-description = Для использования установите меньшее разрешение в настройках игры и нажмите Alt+Enter
ultra-quality = Ультра
quality = Хорошо
balanced = Сбалансированно
performance = Производительно
gamemode = Gamemode
gamemode-description = Выделять игре приоритет перед остальными процессами
fps-unlocker = FPS Unlocker
enabled = Включен
fps-unlocker-description = Убрать ограничение количества кадров модифицируя память игры. Может быть обнаружено античитом
power-saving = Энергосбережение
power-saving-description = Автоматически устанавливать предел количества кадров до 10 и снижать приоритет процесса игры когда она не находится в фокусе
monitor = Монитор
monitor-description = Номер монитора, на котором стоит запустить игру
window-mode = Режим окна
popup = Всплывающий
fullscreen = Полноэкранный
priority = Приоритет
priority-description = Приоритет процесса игры
realtime = Реального времени
high = Высокий
above-normal = Выше среднего
normal = Средний
below-normal = Ниже среднего
low = Низкий

View file

@ -0,0 +1,15 @@
launcher-language = Язык лаунчера
launcher-language-description = Применяется после перезапуска
game-voiceovers = Язык озвучки
english = Английский
japanese = Японский
korean = Корейский
chinese = Китайский
repair-game = Починить игру
status = Статус
game-version = Версия игры
patch-version = Версия патча

View file

@ -3,76 +3,9 @@ none = Нет
default = По умолчанию
launch = Запустить
preferences = Настройки
general = Основное
launcher-language = Язык лаунчера
game-voiceovers = Язык озвучки
english = Английский
japanese = Японский
korean = Корейский
chinese = Китайский
repair-game = Починить игру
status = Статус
game-version = Версия игры
patch-version = Версия патча
enhancements = Улучшения
wine = Wine
synchronization = Синхронизация
wine-sync-description = Технология, используемая для синхронизации внутренних событий Wine
language = Язык
wine-lang-description = Язык, используемый в окружении Wine. Может исправить проблемы с раскладкой клавиатуры
system = Системный
borderless-window = Окно без рамок
virtual-desktop = Виртуальный рабочий стол
game = Игра
hud = HUD
fsr = FSR
fsr-description = Для использования установите меньшее разрешение в настройках игры и нажмите Alt+Enter
ultra-quality = Ультра
quality = Хорошо
balanced = Сбалансированно
performance = Производительно
gamemode = Gamemode
gamemode-description = Выделять игре приоритет перед остальными процессами
fps-unlocker = FPS Unlocker
enabled = Включен
fps-unlocker-description = Убрать ограничение количества кадров модифицируя память игры. Может быть обнаружено античитом
power-saving = Энергосбережение
power-saving-description = Автоматически устанавливать предел количества кадров до 10 и снижать приоритет процесса игры когда она не находится в фокусе
monitor = Монитор
monitor-description = Номер монитора, на котором стоит запустить игру
window-mode = Режим окна
popup = Всплывающий
fullscreen = Полноэкранный
priority = Приоритет
priority-description = Приоритет процесса игры
realtime = Реального времени
high = Высокий
above-normal = Выше среднего
normal = Средний
below-normal = Ниже среднего
low = Низкий

71
src/ui/about.rs Normal file
View file

@ -0,0 +1,71 @@
use relm4::prelude::*;
use gtk::prelude::*;
use adw::prelude::*;
use crate::i18n::tr;
pub struct AboutDialog {
visible: bool
}
#[derive(Debug)]
pub enum AppMsg {
Show,
Hide
}
#[relm4::component(pub)]
impl SimpleComponent for AboutDialog {
type Init = ();
type Input = AppMsg;
type Output = ();
view! {
dialog = adw::AboutWindow {
set_application_name: "An Anime Game Launcher",
set_application_icon: "moe.launcher.an-anime-game-launcher-gtk",
set_website: "https://github.com/an-anime-team/an-anime-game-launcher-gtk",
set_issue_url: "https://github.com/an-anime-team/an-anime-game-launcher-gtk/issues",
set_modal: true,
set_hide_on_close: true,
#[watch]
set_visible: model.visible,
connect_close_request[sender] => move |_| {
sender.input(AppMsg::Hide);
gtk::Inhibit(false)
}
}
}
fn init(
_init: Self::Init,
root: &Self::Root,
sender: ComponentSender<Self>,
) -> ComponentParts<Self> {
let model = AboutDialog {
visible: false
};
let widgets = view_output!();
ComponentParts { model, widgets }
}
fn update(&mut self, msg: Self::Input, _sender: ComponentSender<Self>) {
match msg {
AppMsg::Show => {
self.visible = true;
}
AppMsg::Hide => {
self.visible = false;
}
}
}
}

View file

@ -1,4 +1,4 @@
use relm4::prelude::*;
use relm4::{prelude::*, actions::*, MessageBroker};
use gtk::prelude::*;
use adw::prelude::*;
@ -6,6 +6,15 @@ use adw::prelude::*;
use crate::i18n::tr;
use super::preferences::main::App as PreferencesApp;
use super::about::{AboutDialog, AppMsg as AboutDialogMsg};
relm4::new_action_group!(WindowActionGroup, "win");
relm4::new_stateless_action!(LauncherFolder, WindowActionGroup, "launcher_folder");
relm4::new_stateless_action!(GameFolder, WindowActionGroup, "game_folder");
relm4::new_stateless_action!(ConfigFile, WindowActionGroup, "config_file");
relm4::new_stateless_action!(About, WindowActionGroup, "about");
/// Sets to `true` when the `App` component is ready (fully initialized)
pub static mut READY: bool = false;
@ -17,7 +26,10 @@ pub fn is_ready() -> bool {
}
pub struct App {
preferences_window: Controller<PreferencesApp>
preferences_window: Controller<PreferencesApp>,
#[allow(dead_code)]
about_dialog: Controller<AboutDialog>
}
#[derive(Debug)]
@ -32,6 +44,20 @@ impl SimpleComponent for App {
type Input = AppMsg;
type Output = ();
menu! {
main_menu: {
section! {
"Launcher folder" => LauncherFolder,
"Game folder" => GameFolder,
"Config file" => ConfigFile,
},
section! {
"About" => About
}
}
}
view! {
main_window = adw::Window {
set_title: Some("An Anime Game Launcher"),
@ -40,7 +66,12 @@ impl SimpleComponent for App {
gtk::Box {
set_orientation: gtk::Orientation::Vertical,
adw::HeaderBar {},
adw::HeaderBar {
pack_end = &gtk::MenuButton {
set_icon_name: "open-menu-symbolic",
set_menu_model: Some(&main_menu)
}
},
adw::PreferencesPage {
add = &adw::PreferencesGroup {
@ -96,12 +127,39 @@ impl SimpleComponent for App {
) -> ComponentParts<Self> {
let widgets = view_output!();
let about_dialog_broker: MessageBroker<AboutDialog> = MessageBroker::new();
let model = App {
preferences_window: PreferencesApp::builder()
.launch(widgets.main_window.clone().into())
.detach(),
about_dialog: AboutDialog::builder()
.transient_for(widgets.main_window.clone())
.launch_with_broker((), &about_dialog_broker)
.detach()
};
let group = RelmActionGroup::<WindowActionGroup>::new();
group.add_action::<LauncherFolder>(&RelmAction::new_stateless(move |_| {
println!("Open launcher folder!");
}));
group.add_action::<GameFolder>(&RelmAction::new_stateless(move |_| {
println!("Open game folder!");
}));
group.add_action::<ConfigFile>(&RelmAction::new_stateless(move |_| {
println!("Open config file!");
}));
group.add_action::<About>(&RelmAction::new_stateless(move |_| {
about_dialog_broker.send(AboutDialogMsg::Show);
}));
widgets.main_window.insert_action_group("win", Some(&group.into_action_group()));
unsafe {
READY = true;
}

View file

@ -1,2 +1,4 @@
pub mod main;
pub mod about;
pub mod preferences;

View file

@ -24,6 +24,7 @@ impl WidgetTemplate for General {
adw::ComboRow {
set_title: &tr("launcher-language"),
set_subtitle: &tr("launcher-language-description"),
// TODO: maybe simplify it by some way? e.g. specify such stuff in i18n mod