mirror of
https://github.com/an-anime-team/an-anime-game-launcher.git
synced 2024-11-21 12:26:00 +03:00
commit
75f09cb73e
7 changed files with 31 additions and 152 deletions
|
@ -13,7 +13,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
### Changed
|
||||
|
||||
- Prioritize parsed game version over the API response
|
||||
- Prioritize parsed game version over the API response
|
||||
|
||||
### Removed
|
||||
|
||||
- Removed migrate installation feature
|
||||
|
||||
## [3.10.3] - 21.07.2024
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ impl SimpleComponent for AboutDialog {
|
|||
set_website: "https://github.com/an-anime-team/an-anime-game-launcher",
|
||||
set_issue_url: "https://github.com/an-anime-team/an-anime-game-launcher/issues",
|
||||
|
||||
set_license_type: gtk::License::Gpl30,
|
||||
set_license_type: gtk::License::Gpl30Only,
|
||||
set_version: &APP_VERSION,
|
||||
|
||||
set_developers: &[
|
||||
|
@ -95,12 +95,22 @@ impl SimpleComponent for AboutDialog {
|
|||
|
||||
set_release_notes_version: &APP_VERSION,
|
||||
set_release_notes: &[
|
||||
"<p>Fixed</p>",
|
||||
"<p>Added</p>",
|
||||
|
||||
"<ul>",
|
||||
"<li>Fixed \"game.log\" file overfilling at the start of the game</li>",
|
||||
"<li>Fixed RAM filling with the buffered game logs</li>",
|
||||
"<li>Fixed Discord RPC updates</li>",
|
||||
"<li>Respect root \".version\" file for game version parsing</li>",
|
||||
"</ul>",
|
||||
|
||||
"<p>Changed</p>",
|
||||
|
||||
"<ul>",
|
||||
"<li>Prioritize parsed game version over the API response</li>",
|
||||
"</ul>",
|
||||
|
||||
"<p>Removed</p>",
|
||||
|
||||
"<ul>",
|
||||
"<li>Removed migrate installation feature</li>",
|
||||
"</ul>"
|
||||
].join("\n"),
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@ pub struct DefaultPathsApp {
|
|||
progress_bar: AsyncController<ProgressBar>,
|
||||
|
||||
show_additional: bool,
|
||||
migrate_installation: bool,
|
||||
show_progress: bool,
|
||||
|
||||
launcher: PathBuf,
|
||||
|
@ -49,8 +48,7 @@ pub enum DefaultPathsAppMsg {
|
|||
|
||||
#[relm4::component(async, pub)]
|
||||
impl SimpleAsyncComponent for DefaultPathsApp {
|
||||
/// If `true`, then use migrate installation mode
|
||||
type Init = bool;
|
||||
type Init = ();
|
||||
type Input = DefaultPathsAppMsg;
|
||||
type Output = FirstRunAppMsg;
|
||||
|
||||
|
@ -242,11 +240,7 @@ impl SimpleAsyncComponent for DefaultPathsApp {
|
|||
set_spacing: 8,
|
||||
|
||||
gtk::Button {
|
||||
set_label: &if model.migrate_installation {
|
||||
tr!("migrate")
|
||||
} else {
|
||||
tr!("continue")
|
||||
},
|
||||
set_label: &tr!("continue"),
|
||||
|
||||
set_css_classes: &["suggested-action", "pill"],
|
||||
|
||||
|
@ -254,17 +248,10 @@ impl SimpleAsyncComponent for DefaultPathsApp {
|
|||
},
|
||||
|
||||
gtk::Button {
|
||||
set_label: &if model.migrate_installation {
|
||||
tr!("close", { "form" = "noun" })
|
||||
} else {
|
||||
tr!("exit")
|
||||
},
|
||||
set_label: &tr!("exit"),
|
||||
|
||||
add_css_class: "pill",
|
||||
|
||||
#[watch]
|
||||
set_visible: !model.migrate_installation,
|
||||
|
||||
connect_clicked => DefaultPathsAppMsg::Exit
|
||||
}
|
||||
}
|
||||
|
@ -287,7 +274,7 @@ impl SimpleAsyncComponent for DefaultPathsApp {
|
|||
}
|
||||
}
|
||||
|
||||
async fn init(init: Self::Init, root: Self::Root, _sender: AsyncComponentSender<Self>) -> AsyncComponentParts<Self> {
|
||||
async fn init(_init: Self::Init, root: Self::Root, _sender: AsyncComponentSender<Self>) -> AsyncComponentParts<Self> {
|
||||
let model = Self {
|
||||
progress_bar: ProgressBar::builder()
|
||||
.launch(ProgressBarInit {
|
||||
|
@ -299,7 +286,6 @@ impl SimpleAsyncComponent for DefaultPathsApp {
|
|||
.detach(),
|
||||
|
||||
show_additional: false,
|
||||
migrate_installation: init,
|
||||
show_progress: false,
|
||||
|
||||
launcher: LAUNCHER_FOLDER.to_path_buf(),
|
||||
|
@ -311,12 +297,13 @@ impl SimpleAsyncComponent for DefaultPathsApp {
|
|||
fps_unlocker: CONFIG.game.enhancements.fps_unlocker.path.clone(),
|
||||
components: CONFIG.components.path.clone(),
|
||||
|
||||
#[allow(clippy::or_fun_call)]
|
||||
temp: CONFIG.launcher.temp.clone().unwrap_or(std::env::temp_dir())
|
||||
temp: CONFIG.launcher.temp.clone()
|
||||
.unwrap_or_else(std::env::temp_dir)
|
||||
};
|
||||
|
||||
// Set progress bar width
|
||||
model.progress_bar.widget().set_width_request(400);
|
||||
model.progress_bar.widget()
|
||||
.set_width_request(400);
|
||||
|
||||
let widgets = view_output!();
|
||||
|
||||
|
@ -364,49 +351,9 @@ impl SimpleAsyncComponent for DefaultPathsApp {
|
|||
|
||||
#[allow(unused_must_use)]
|
||||
DefaultPathsAppMsg::Continue => {
|
||||
let old_config = Config::get().unwrap_or_else(|_| CONFIG.clone());
|
||||
|
||||
match self.update_config() {
|
||||
Ok(_) => {
|
||||
if self.migrate_installation {
|
||||
self.progress_bar.sender().send(ProgressBarMsg::SetVisible(true));
|
||||
|
||||
self.show_progress = true;
|
||||
|
||||
let folders = [
|
||||
(old_config.game.wine.builds, &self.runners),
|
||||
(old_config.game.dxvk.builds, &self.dxvks),
|
||||
(old_config.game.wine.prefix, &self.prefix),
|
||||
(old_config.game.path.global, &self.game_global),
|
||||
(old_config.game.path.china, &self.game_china),
|
||||
(old_config.components.path, &self.components),
|
||||
|
||||
(old_config.game.enhancements.fps_unlocker.path, &self.fps_unlocker)
|
||||
];
|
||||
|
||||
#[allow(clippy::expect_fun_call)]
|
||||
for (i, (from, to)) in folders.iter().enumerate() {
|
||||
self.progress_bar.sender().send(ProgressBarMsg::UpdateCaption(Some(
|
||||
from.to_str().map(|str| str.to_string()).unwrap_or_else(|| format!("{:?}", from))
|
||||
)));
|
||||
|
||||
if &from != to && from.exists() {
|
||||
move_files::move_files(from, to).expect(&format!("Failed to move folder: {:?} -> {:?}", from, to));
|
||||
}
|
||||
|
||||
self.progress_bar.sender().send(ProgressBarMsg::UpdateProgress(i as u64 + 1, folders.len() as u64));
|
||||
}
|
||||
|
||||
// Restart the app
|
||||
|
||||
std::process::Command::new(std::env::current_exe().unwrap()).spawn().unwrap();
|
||||
|
||||
relm4::main_application().quit();
|
||||
}
|
||||
|
||||
else {
|
||||
sender.output(Self::Output::ScrollToSelectVoiceovers);
|
||||
}
|
||||
sender.output(Self::Output::ScrollToSelectVoiceovers);
|
||||
}
|
||||
|
||||
Err(err) => {
|
||||
|
@ -419,14 +366,7 @@ impl SimpleAsyncComponent for DefaultPathsApp {
|
|||
}
|
||||
|
||||
DefaultPathsAppMsg::Exit => {
|
||||
if self.migrate_installation {
|
||||
// TODO: this shit should return message to general preferences component somehow to close MigrateInstallation window
|
||||
todo!();
|
||||
}
|
||||
|
||||
else {
|
||||
relm4::main_application().quit();
|
||||
}
|
||||
relm4::main_application().quit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -131,7 +131,7 @@ impl SimpleComponent for FirstRunApp {
|
|||
.forward(sender.input_sender(), std::convert::identity),
|
||||
|
||||
default_paths: DefaultPathsApp::builder()
|
||||
.launch(false)
|
||||
.launch(())
|
||||
.forward(sender.input_sender(), std::convert::identity),
|
||||
|
||||
select_voiceovers: SelectVoiceoversApp::builder()
|
||||
|
|
|
@ -1,52 +0,0 @@
|
|||
use relm4::prelude::*;
|
||||
use gtk::prelude::*;
|
||||
|
||||
use crate::tr;
|
||||
|
||||
use super::first_run::default_paths::DefaultPathsApp;
|
||||
|
||||
pub struct MigrateInstallationApp {
|
||||
default_paths: AsyncController<DefaultPathsApp>,
|
||||
}
|
||||
|
||||
#[relm4::component(pub)]
|
||||
impl SimpleComponent for MigrateInstallationApp {
|
||||
type Init = ();
|
||||
type Input = ();
|
||||
type Output = ();
|
||||
|
||||
view! {
|
||||
adw::Window {
|
||||
set_default_size: (780, 560),
|
||||
set_modal: true,
|
||||
set_hide_on_close: true,
|
||||
|
||||
#[watch]
|
||||
set_title: Some(&tr!("migrate-installation")),
|
||||
|
||||
gtk::Box {
|
||||
set_orientation: gtk::Orientation::Vertical,
|
||||
|
||||
adw::HeaderBar {
|
||||
add_css_class: "flat"
|
||||
},
|
||||
|
||||
append = model.default_paths.widget(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn init(_init: Self::Init, root: Self::Root, _sender: ComponentSender<Self>) -> ComponentParts<Self> {
|
||||
tracing::info!("Initializing migration window");
|
||||
|
||||
let model = Self {
|
||||
default_paths: DefaultPathsApp::builder()
|
||||
.launch(true)
|
||||
.detach()
|
||||
};
|
||||
|
||||
let widgets = view_output!();
|
||||
|
||||
ComponentParts { model, widgets }
|
||||
}
|
||||
}
|
|
@ -3,4 +3,3 @@ pub mod about;
|
|||
pub mod preferences;
|
||||
pub mod components;
|
||||
pub mod first_run;
|
||||
pub mod migrate_installation;
|
||||
|
|
|
@ -22,7 +22,6 @@ pub mod components;
|
|||
|
||||
use components::*;
|
||||
|
||||
use crate::ui::migrate_installation::MigrateInstallationApp;
|
||||
use crate::i18n::*;
|
||||
use crate::*;
|
||||
|
||||
|
@ -103,7 +102,6 @@ impl AsyncFactoryComponent for VoicePackageComponent {
|
|||
|
||||
pub struct GeneralApp {
|
||||
voice_packages: AsyncFactoryVecDeque<VoicePackageComponent>,
|
||||
migrate_installation: Controller<MigrateInstallationApp>,
|
||||
components_page: AsyncController<ComponentsPage>,
|
||||
|
||||
game_diff: Option<VersionDiff>,
|
||||
|
@ -127,7 +125,6 @@ pub enum GeneralAppMsg {
|
|||
UpdateDownloadedWine,
|
||||
UpdateDownloadedDxvk,
|
||||
|
||||
OpenMigrateInstallation,
|
||||
RepairGame,
|
||||
|
||||
OpenMainPage,
|
||||
|
@ -341,13 +338,6 @@ impl SimpleAsyncComponent for GeneralApp {
|
|||
set_spacing: 8,
|
||||
set_margin_top: 16,
|
||||
|
||||
gtk::Button {
|
||||
set_label: &tr!("migrate-installation"),
|
||||
set_tooltip_text: Some(&tr!("migrate-installation-description")),
|
||||
|
||||
connect_clicked => GeneralAppMsg::OpenMigrateInstallation
|
||||
},
|
||||
|
||||
gtk::Button {
|
||||
set_label: &tr!("repair-game"),
|
||||
|
||||
|
@ -543,10 +533,6 @@ impl SimpleAsyncComponent for GeneralApp {
|
|||
.launch_default()
|
||||
.forward(sender.input_sender(), std::convert::identity),
|
||||
|
||||
migrate_installation: MigrateInstallationApp::builder()
|
||||
.launch(())
|
||||
.detach(),
|
||||
|
||||
components_page: ComponentsPage::builder()
|
||||
.launch(())
|
||||
.forward(sender.input_sender(), std::convert::identity),
|
||||
|
@ -648,14 +634,6 @@ impl SimpleAsyncComponent for GeneralApp {
|
|||
.unwrap();
|
||||
}
|
||||
|
||||
GeneralAppMsg::OpenMigrateInstallation => unsafe {
|
||||
if let Some(window) = crate::ui::main::PREFERENCES_WINDOW.as_ref() {
|
||||
self.migrate_installation.widget().set_transient_for(Some(window.widget()));
|
||||
}
|
||||
|
||||
self.migrate_installation.widget().present();
|
||||
}
|
||||
|
||||
GeneralAppMsg::RepairGame => {
|
||||
sender.output(Self::Output::RepairGame).unwrap();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue