feat: added feature to map wine drives

This commit is contained in:
Observer KRypt0n_ 2023-08-17 16:02:29 +02:00
parent 76d7aaa792
commit 018b3c3d77
No known key found for this signature in database
GPG key ID: 844DA47BA25FE1E2
16 changed files with 155 additions and 4 deletions

View file

@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [Unreleased]
### Added
- Added feature to map wine drives
### Changed ### Changed
- Updated Turkish - Updated Turkish

4
Cargo.lock generated
View file

@ -88,8 +88,8 @@ dependencies = [
[[package]] [[package]]
name = "anime-launcher-sdk" name = "anime-launcher-sdk"
version = "1.10.0" version = "1.11.0"
source = "git+https://github.com/an-anime-team/anime-launcher-sdk?tag=1.10.0#916d4b56e0de0b3ed7720603da2090cbd9a11210" source = "git+https://github.com/an-anime-team/anime-launcher-sdk?tag=1.11.0#b858205ca74d3ce930d0d6cd36eb0b9dc749a7a7"
dependencies = [ dependencies = [
"anime-game-core", "anime-game-core",
"anyhow", "anyhow",

View file

@ -19,7 +19,7 @@ glib-build-tools = "0.18"
[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.10.0" tag = "1.11.0"
features = ["all", "genshin"] features = ["all", "genshin"]
# path = "../anime-launcher-sdk" # ! for dev purposes only # path = "../anime-launcher-sdk" # ! for dev purposes only

View file

@ -14,6 +14,12 @@ system = System
borderless-window = Randloses Fenster borderless-window = Randloses Fenster
virtual-desktop = Virtueller Desktop virtual-desktop = Virtueller Desktop
map-drive-c = Map drive C:
map-drive-c-description = Automatically symlink drive_c folder from the wine prefix to the dosdevices
map-game-folder = Map game folder
map-game-folder-description = Automatically symlink game folder to the dosdevices
game = Spiel game = Spiel
hud = HUD hud = HUD

View file

@ -14,6 +14,12 @@ system = System
borderless-window = Borderless window borderless-window = Borderless window
virtual-desktop = Virtual desktop virtual-desktop = Virtual desktop
map-drive-c = Map drive C:
map-drive-c-description = Automatically symlink drive_c folder from the wine prefix to the dosdevices
map-game-folder = Map game folder
map-game-folder-description = Automatically symlink game folder to the dosdevices
game = Game game = Game
hud = HUD hud = HUD

View file

@ -14,6 +14,12 @@ system = Sistema
borderless-window = Ventana sin bordes borderless-window = Ventana sin bordes
virtual-desktop = Escritorio virtual virtual-desktop = Escritorio virtual
map-drive-c = Map drive C:
map-drive-c-description = Automatically symlink drive_c folder from the wine prefix to the dosdevices
map-game-folder = Map game folder
map-game-folder-description = Automatically symlink game folder to the dosdevices
game = Juego game = Juego
hud = HUD hud = HUD

View file

@ -14,6 +14,12 @@ system = Système
borderless-window = Utiliser une fenêtre sans bordure borderless-window = Utiliser une fenêtre sans bordure
virtual-desktop = Bureau virtuel virtual-desktop = Bureau virtuel
map-drive-c = Map drive C:
map-drive-c-description = Automatically symlink drive_c folder from the wine prefix to the dosdevices
map-game-folder = Map game folder
map-game-folder-description = Automatically symlink game folder to the dosdevices
game = Jeu game = Jeu
hud = HUD hud = HUD

View file

@ -14,6 +14,12 @@ system = Rendszer
borderless-window = Kerettelen ablak(borderless) borderless-window = Kerettelen ablak(borderless)
virtual-desktop = Virtuális asztal virtual-desktop = Virtuális asztal
map-drive-c = Map drive C:
map-drive-c-description = Automatically symlink drive_c folder from the wine prefix to the dosdevices
map-game-folder = Map game folder
map-game-folder-description = Automatically symlink game folder to the dosdevices
game = Játék game = Játék
hud = HUD hud = HUD

View file

@ -14,6 +14,12 @@ system = Sistem
borderless-window = window tanpa border borderless-window = window tanpa border
virtual-desktop = Desktop virtual virtual-desktop = Desktop virtual
map-drive-c = Map drive C:
map-drive-c-description = Automatically symlink drive_c folder from the wine prefix to the dosdevices
map-game-folder = Map game folder
map-game-folder-description = Automatically symlink game folder to the dosdevices
game = Game game = Game
hud = HUD hud = HUD

View file

@ -14,6 +14,12 @@ system = Sistema
borderless-window = Finestra senza bordi borderless-window = Finestra senza bordi
virtual-desktop = Desktop virtuale virtual-desktop = Desktop virtuale
map-drive-c = Map drive C:
map-drive-c-description = Automatically symlink drive_c folder from the wine prefix to the dosdevices
map-game-folder = Map game folder
map-game-folder-description = Automatically symlink game folder to the dosdevices
game = Gioco game = Gioco
hud = HUD hud = HUD

View file

@ -14,6 +14,12 @@ system = システム
borderless-window = ボーダーレスウィンドウ borderless-window = ボーダーレスウィンドウ
virtual-desktop = 仮想デスクトップ virtual-desktop = 仮想デスクトップ
map-drive-c = Map drive C:
map-drive-c-description = Automatically symlink drive_c folder from the wine prefix to the dosdevices
map-game-folder = Map game folder
map-game-folder-description = Automatically symlink game folder to the dosdevices
game = ゲーム game = ゲーム
hud = HUD hud = HUD

View file

@ -14,6 +14,12 @@ system = Системный
borderless-window = Окно без рамок borderless-window = Окно без рамок
virtual-desktop = Виртуальный рабочий стол virtual-desktop = Виртуальный рабочий стол
map-drive-c = Создавать диск C:
map-drive-c-description = Автоматически создавать ссылку на папку drive_c из префикса Wine в dosdevices
map-game-folder = Создавать диск с папкой игры
map-game-folder-description = Автоматически создавать ссылку на папку с игрой в dosdevices
game = Игра game = Игра
hud = HUD hud = HUD

View file

@ -14,6 +14,12 @@ system = System
borderless-window = Kantlöst fönster borderless-window = Kantlöst fönster
virtual-desktop = Virtuellt skrivbord virtual-desktop = Virtuellt skrivbord
map-drive-c = Map drive C:
map-drive-c-description = Automatically symlink drive_c folder from the wine prefix to the dosdevices
map-game-folder = Map game folder
map-game-folder-description = Automatically symlink game folder to the dosdevices
game = Spel game = Spel
hud = HUD hud = HUD

View file

@ -14,6 +14,12 @@ system = Sistem
borderless-window = Köşesiz Pencere borderless-window = Köşesiz Pencere
virtual-desktop = Sanal Masaüstü virtual-desktop = Sanal Masaüstü
map-drive-c = Map drive C:
map-drive-c-description = Automatically symlink drive_c folder from the wine prefix to the dosdevices
map-game-folder = Map game folder
map-game-folder-description = Automatically symlink game folder to the dosdevices
game = Oyun game = Oyun
hud = HUD hud = HUD

View file

@ -14,6 +14,12 @@ system = 系统
borderless-window = 无边框窗口 borderless-window = 无边框窗口
virtual-desktop = 虚拟桌面 virtual-desktop = 虚拟桌面
map-drive-c = Map drive C:
map-drive-c-description = Automatically symlink drive_c folder from the wine prefix to the dosdevices
map-game-folder = Map game folder
map-game-folder-description = Automatically symlink game folder to the dosdevices
game = 游戏 game = 游戏
hud = HUD hud = HUD

View file

@ -1,6 +1,11 @@
use relm4::prelude::*; use relm4::prelude::*;
use relm4::component::*; use relm4::component::*;
use relm4::factory::*;
use relm4::factory::{
AsyncFactoryComponent,
AsyncFactorySender,
AsyncFactoryVecDeque
};
use adw::prelude::*; use adw::prelude::*;
@ -285,6 +290,76 @@ impl SimpleAsyncComponent for EnhancementsApp {
if let Ok(mut config) = Config::get() { if let Ok(mut config) = Config::get() {
config.game.wine.virtual_desktop.enabled = switch.state(); config.game.wine.virtual_desktop.enabled = switch.state();
Config::update(config);
}
}
}
}
},
adw::ActionRow {
set_title: &tr!("map-drive-c"),
set_subtitle: &tr!("map-drive-c-description"),
add_suffix = &gtk::Switch {
set_valign: gtk::Align::Center,
set_state: CONFIG.game.wine.drives.drive_c,
connect_state_notify => |switch| {
if is_ready() {
if let Ok(mut config) = Config::get() {
config.game.wine.drives.drive_c = switch.state();
Config::update(config);
}
}
}
}
},
#[name = "map_game_folder_row"]
adw::ComboRow {
set_title: &tr!("map-game-folder"),
set_subtitle: &tr!("map-game-folder-description"),
#[wrap(Some)]
set_model = &gtk::StringList::new(&AllowedDrives::list().iter()
.map(|drive| drive.to_drive())
.collect::<Vec<_>>()),
set_selected: match CONFIG.game.wine.drives.game_folder {
Some(drive) => AllowedDrives::list().iter()
.position(|allowed| *allowed == drive)
.unwrap_or(8) as u32,
None => 8 // G:
},
connect_selected_notify => |row| {
if is_ready() {
if let Ok(mut config) = Config::get() {
config.game.wine.drives.game_folder = Some(AllowedDrives::list()[row.selected() as usize]);
Config::update(config);
}
}
},
add_suffix = &gtk::Switch {
set_valign: gtk::Align::Center,
set_state: CONFIG.game.wine.drives.game_folder.is_some(),
connect_state_notify[map_game_folder_row] => move |switch| {
if is_ready() {
if let Ok(mut config) = Config::get() {
if switch.state() {
config.game.wine.drives.game_folder = Some(AllowedDrives::list()[map_game_folder_row.selected() as usize]);
} else {
config.game.wine.drives.game_folder = None;
}
Config::update(config); Config::update(config);
} }
} }