Shutdown animation
This commit is contained in:
BIN
htdocs/images/shutdown.gif
Normal file
BIN
htdocs/images/shutdown.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 982 KiB |
@@ -205,5 +205,6 @@
|
||||
</div>
|
||||
<button id="ID_RenterUploadsOk" style="width: 110px" type="button">Back</button>
|
||||
</div>
|
||||
<div id="shutdown_window" class="hidden-element" style="padding: 0; margin: 0;position: fixed; height: 100%; width: 100%;background-image: url(./images/shutdown.gif); background-size: cover; z-index: 99999"></div>
|
||||
</body>
|
||||
</html>
|
@@ -186,6 +186,9 @@
|
||||
if (document.getElementById('sia_settings_window').classList.contains('hidden-element')) {
|
||||
setChecked('ID_SettingsLaunchFileManager', launch);
|
||||
}
|
||||
},
|
||||
displayShutdownWindow: () => {
|
||||
setMainWindow('shutdown_window');
|
||||
}
|
||||
};
|
||||
})();
|
||||
|
@@ -64,7 +64,7 @@ public:
|
||||
private:
|
||||
static void ExecuteSetter(CefRefPtr<CefV8Context> context, CefRefPtr<CefV8Value> obj, const SString& method, const SString& value);
|
||||
static void ExecuteSetter(CefRefPtr<CefV8Context> context, CefRefPtr<CefV8Value> obj, const SString& method, CefRefPtr<CefV8Value> value);
|
||||
void ShutdownServices(CefRefPtr<CefBrowser> browser, const bool& closing = false);
|
||||
void ShutdownServices(CefRefPtr<CefBrowser> browser);
|
||||
void SiaApiRefreshCallback(CefRefPtr<CefV8Context> context, const Api::CSiaCurl& siaCurl, Api::CSiaDriveConfig* siaDriveConfig);
|
||||
|
||||
private:
|
||||
|
@@ -302,10 +302,11 @@ void CSiaDriveApp::ExecuteSetter(CefRefPtr<CefV8Context> context, CefRefPtr<CefV
|
||||
bool CSiaDriveApp::OnProcessMessageReceived(CefRefPtr<CefBrowser> browser, CefProcessId source_process, CefRefPtr<CefProcessMessage> message)
|
||||
{
|
||||
CEF_REQUIRE_RENDERER_THREAD();
|
||||
auto context = CefV8Context::GetCurrentContext();
|
||||
const std::string& messageName = message->GetName();
|
||||
if (messageName == "shutdownServices")
|
||||
{
|
||||
this->ShutdownServices(browser, true);
|
||||
this->ShutdownServices(browser);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -398,22 +399,32 @@ void CSiaDriveApp::OnContextInitialized()
|
||||
}
|
||||
}
|
||||
|
||||
void CSiaDriveApp::ShutdownServices(CefRefPtr<CefBrowser> browser, const bool& closing)
|
||||
void CSiaDriveApp::ShutdownServices(CefRefPtr<CefBrowser> browser)
|
||||
{
|
||||
if (_refreshThread)
|
||||
{
|
||||
_appStarted = false;
|
||||
_refreshThread->StopAutoThread();
|
||||
_refreshThread.reset(nullptr);
|
||||
auto context = browser->GetMainFrame()->GetV8Context();
|
||||
context->Enter();
|
||||
auto global = context->GetGlobal();
|
||||
auto uiActions = global->GetValue("uiUpdate");
|
||||
//
|
||||
CefRefPtr<CefV8Value> displayShutdownWindow = uiActions->GetValue("displayShutdownWindow");
|
||||
CefV8ValueList args;
|
||||
displayShutdownWindow->ExecuteFunctionWithContext(context, nullptr, args);
|
||||
context->Exit();
|
||||
}
|
||||
std::thread([this, browser]() {
|
||||
if (_refreshThread)
|
||||
{
|
||||
_appStarted = false;
|
||||
_refreshThread->StopAutoThread();
|
||||
_refreshThread.reset(nullptr);
|
||||
}
|
||||
|
||||
if (_siaDrive)
|
||||
{
|
||||
_siaDrive->Unmount();
|
||||
}
|
||||
if (_siaDrive)
|
||||
{
|
||||
_siaDrive->Unmount();
|
||||
}
|
||||
|
||||
if (closing)
|
||||
{
|
||||
if (_siaDriveConfig && _siaDriveConfig->GetLockWalletOnExit())
|
||||
{
|
||||
_siaApi->GetWallet()->Lock();
|
||||
@@ -423,6 +434,7 @@ void CSiaDriveApp::ShutdownServices(CefRefPtr<CefBrowser> browser, const bool& c
|
||||
{
|
||||
_siaApi->StopBackgroundRefresh();
|
||||
}
|
||||
|
||||
_siaDrive.reset(nullptr);
|
||||
_siaApi.reset(nullptr);
|
||||
_siaCurl.reset(nullptr);
|
||||
@@ -431,7 +443,7 @@ void CSiaDriveApp::ShutdownServices(CefRefPtr<CefBrowser> browser, const bool& c
|
||||
|
||||
CefRefPtr<CefProcessMessage> msg = CefProcessMessage::Create("shutdownServicesComplete");
|
||||
browser->SendProcessMessage(PID_BROWSER, msg);
|
||||
}
|
||||
}).detach();
|
||||
}
|
||||
|
||||
void CSiaDriveApp::SiaApiRefreshCallback(CefRefPtr<CefV8Context> context, const CSiaCurl& siaCurl, CSiaDriveConfig* siaDriveConfig)
|
||||
|
Reference in New Issue
Block a user