add wt app quit.
All checks were successful
Deploy / Build (push) Successful in 6m26s

This commit is contained in:
amass 2025-01-06 00:01:08 +08:00
parent 38e6447885
commit ac6fae0f47
2 changed files with 6 additions and 1 deletions

View File

@ -26,7 +26,7 @@
namespace WebToolkit {
Application::Application(const Wt::WEnvironment &env, bool embedded)
: Wt::WApplication(env), m_startup(this, "startup"), m_logout(this, "logout") {
: Wt::WApplication(env), m_startup(this, "startup"), m_quit(this, "quit"), m_logout(this, "logout") {
messageResourceBundle().use(appRoot() + "wt");
messageResourceBundle().use(appRoot() + "auth_strings");
messageResourceBundle().use(appRoot() + "auth_css_theme");
@ -96,6 +96,10 @@ Application::Application(const Wt::WEnvironment &env, bool embedded)
dynamic_cast<Application *>(app)->handlePathChange(path);
}
});
m_quit.connect(this, []() {
LOG(info) << "wtapp quit.";
Wt::WApplication::instance()->quit();
});
internalPathChanged().connect(this, &Application::handlePathChange);
doJavaScript(m_startup.createCall({}));
}

View File

@ -37,6 +37,7 @@ protected:
private:
std::unique_ptr<Session> m_session;
Wt::JSignal<> m_startup;
Wt::JSignal<> m_quit;
Wt::WContainerWidget *m_root = nullptr;
NavigationBar *m_navigationBar = nullptr;