[Improvement] Shortcut to restart application

This commit is contained in:
Eric Kotato 2022-09-11 03:34:49 +03:00 committed by Eric Kotato
parent ced2a74e3f
commit 01b0009396
3 changed files with 7 additions and 0 deletions

View file

@ -1458,6 +1458,10 @@ void Application::startShortcuts() {
Ui::Toast::Show(ktr("ktg_language_reloaded"));
return true;
});
request->check(Command::Restart) && request->handle([=] {
Restart();
return true;
});
}, _lifetime);
}

View file

@ -101,6 +101,7 @@ const auto CommandByName = base::flat_map<QString, Command>{
{ qsl("save_draft") , Command::SaveDraft },
{ qsl("jump_to_date") , Command::JumpToDate },
{ qsl("reload_lang") , Command::ReloadLang },
{ qsl("restart_app") , Command::Restart },
};
const auto CommandNames = base::flat_map<Command, QString>{
@ -144,6 +145,7 @@ const auto CommandNames = base::flat_map<Command, QString>{
{ Command::SaveDraft , qsl("save_draft") },
{ Command::JumpToDate , qsl("jump_to_date") },
{ Command::ReloadLang , qsl("reload_lang") },
{ Command::Restart , qsl("restart_app") },
};
class Manager {

View file

@ -65,6 +65,7 @@ enum class Command {
SaveDraft,
JumpToDate,
ReloadLang,
Restart,
};
[[maybe_unused]] constexpr auto kShowFolder = {