main window: added colors and tooltips to action button

- they all depend on current launcher state
This commit is contained in:
Observer KRypt0n_ 2023-02-22 22:48:36 +02:00
parent 1d420d27aa
commit 4e6325dd4f
No known key found for this signature in database
GPG key ID: 844DA47BA25FE1E2
3 changed files with 54 additions and 3 deletions

View file

@ -26,6 +26,9 @@ create-prefix = Create prefix
update = Update
download = Download
main-window--patch-unavailable-tooltip = Patch servers are unavailable and launcher can't verify the game's patching status. You're allowed to run the game on your own risk
main-window--patch-outdated-tooltip = Patch is outdated or in preparation state, so unavailable for usage. Return back later to see its status
main-window--version-outdated-tooltip = Version is too outdated and can't be updated
preferences = Preferences
general = General

View file

@ -32,6 +32,10 @@ create-prefix = Создать префикс
update = Обновить
download = Установить
main-window--patch-unavailable-tooltip = Серверы патча недоступны и лаунчер не может проверить статус патча игры. Вам разрешено запустить игру на ваш страх и риск
main-window--patch-outdated-tooltip = Патч устарел или находится в процессе разработки, поэтому не может быть применен. Возвращайтесь позже чтобы проверить его статус
main-window--version-outdated-tooltip = Версия слишком стара и не может быть обновлена
preferences = Настройки
general = Основное

View file

@ -232,18 +232,62 @@ impl SimpleComponent for App {
},
#[watch]
set_sensitive: match model.state {
Some(LauncherState::GameOutdated { .. }) => false,
set_sensitive: match model.state.as_ref() {
Some(LauncherState::GameOutdated { .. }) |
Some(LauncherState::VoiceOutdated(_)) => false,
Some(LauncherState::PatchAvailable(patch)) => match patch {
Patch::NotAvailable |
Patch::Outdated { .. } |
Patch::Preparation { .. } => false,
Patch::Testing { .. } |
Patch::Available { .. } => true
},
Some(_) => true,
None => false
},
#[watch]
set_css_classes: match model.state.as_ref() {
Some(LauncherState::GameOutdated { .. }) |
Some(LauncherState::VoiceOutdated(_)) => &["warning"],
Some(LauncherState::PatchAvailable(patch)) => match patch {
Patch::NotAvailable |
Patch::Outdated { .. } |
Patch::Preparation { .. } => &["error"],
Patch::Testing { .. } => &["warning"],
Patch::Available { .. } => &["suggested-action"]
},
Some(_) => &["suggested-action"],
None => &[]
},
#[watch]
set_tooltip_text: Some(&match model.state.as_ref() {
Some(LauncherState::GameOutdated { .. }) |
Some(LauncherState::VoiceOutdated(_)) => tr("main-window--version-outdated-tooltip"),
Some(LauncherState::PatchAvailable(patch)) => match patch {
Patch::NotAvailable => tr("main-window--patch-unavailable-tooltip"),
Patch::Outdated { .. } |
Patch::Preparation { .. } => tr("main-window--patch-outdated-tooltip"),
_ => String::new()
},
_ => String::new()
}),
set_hexpand: false,
set_width_request: 200,
add_css_class: "suggested-action",
connect_clicked => AppMsg::PerformAction
},