Make sure update window is in foreground
This commit is contained in:
parent
8e86b676ff
commit
5aefef6171
@ -71,6 +71,11 @@ namespace splash
|
||||
this->destroy();
|
||||
}
|
||||
|
||||
HWND get_window() const
|
||||
{
|
||||
return this->window_;
|
||||
}
|
||||
|
||||
private:
|
||||
std::atomic_bool join_safe_{false};
|
||||
HWND window_{};
|
||||
@ -212,6 +217,17 @@ namespace splash
|
||||
splash_component->hide();
|
||||
}
|
||||
}
|
||||
|
||||
HWND get_window()
|
||||
{
|
||||
auto* splash_component = component_loader::get<component>();
|
||||
if (splash_component)
|
||||
{
|
||||
return splash_component->get_window();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
REGISTER_COMPONENT(splash::component)
|
||||
|
@ -3,4 +3,5 @@
|
||||
namespace splash
|
||||
{
|
||||
void hide();
|
||||
HWND get_window();
|
||||
}
|
||||
|
@ -93,12 +93,12 @@ namespace updater
|
||||
}
|
||||
}
|
||||
|
||||
void perform_update()
|
||||
void perform_update(HWND parent_window)
|
||||
{
|
||||
const utils::progress_ui progress_ui{};
|
||||
progress_ui.set_title("Updating BOIII");
|
||||
progress_ui.set_line(1, "Downloading update...");
|
||||
progress_ui.show(true);
|
||||
progress_ui.show(true, parent_window);
|
||||
|
||||
const auto update_data = download_update();
|
||||
|
||||
@ -180,8 +180,7 @@ namespace updater
|
||||
{
|
||||
if (requires_update())
|
||||
{
|
||||
splash::hide();
|
||||
perform_update();
|
||||
perform_update(splash::get_window());
|
||||
activate_update();
|
||||
}
|
||||
}
|
||||
|
@ -18,9 +18,9 @@ namespace utils
|
||||
this->dialog_->StopProgressDialog();
|
||||
}
|
||||
|
||||
void progress_ui::show(const bool marquee) const
|
||||
void progress_ui::show(const bool marquee, HWND parent) const
|
||||
{
|
||||
this->dialog_->StartProgressDialog(nullptr, nullptr, PROGDLG_AUTOTIME | (marquee ? PROGDLG_MARQUEEPROGRESS : 0), nullptr);
|
||||
this->dialog_->StartProgressDialog(parent, nullptr, PROGDLG_AUTOTIME | (marquee ? PROGDLG_MARQUEEPROGRESS : 0), nullptr);
|
||||
}
|
||||
|
||||
void progress_ui::set_progress(const size_t current, const size_t max) const
|
||||
|
@ -10,7 +10,7 @@ namespace utils
|
||||
progress_ui();
|
||||
~progress_ui();
|
||||
|
||||
void show(bool marquee) const;
|
||||
void show(bool marquee, HWND parent = nullptr) const;
|
||||
|
||||
void set_progress(size_t current, size_t max) const;
|
||||
void set_line(int line, const std::string& text) const;
|
||||
|
Loading…
Reference in New Issue
Block a user