mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-01 06:12:00 +08:00
login logout dialog
This commit is contained in:
parent
b2e80bd5be
commit
fd205c937c
@ -901,6 +901,9 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
|||||||
wxGetApp().update_login_dialog();
|
wxGetApp().update_login_dialog();
|
||||||
#endif // 0
|
#endif // 0
|
||||||
this->show_action_buttons(this->ready_to_slice);
|
this->show_action_buttons(this->ready_to_slice);
|
||||||
|
|
||||||
|
LogoutWebViewDialog dlg(this->q);
|
||||||
|
dlg.ShowModal();
|
||||||
});
|
});
|
||||||
|
|
||||||
this->q->Bind(EVT_UA_ID_USER_SUCCESS, [this](UserAccountSuccessEvent& evt) {
|
this->q->Bind(EVT_UA_ID_USER_SUCCESS, [this](UserAccountSuccessEvent& evt) {
|
||||||
|
@ -861,6 +861,7 @@ WebViewDialog::WebViewDialog(wxWindow* parent, const wxString& url, const wxStri
|
|||||||
Bind(wxEVT_MENU, &WebViewDialog::on_add_user_script, this, addUserScript->GetId());
|
Bind(wxEVT_MENU, &WebViewDialog::on_add_user_script, this, addUserScript->GetId());
|
||||||
#endif
|
#endif
|
||||||
Bind(wxEVT_WEBVIEW_NAVIGATING, &WebViewDialog::on_navigation_request, this, m_browser->GetId());
|
Bind(wxEVT_WEBVIEW_NAVIGATING, &WebViewDialog::on_navigation_request, this, m_browser->GetId());
|
||||||
|
Bind(wxEVT_WEBVIEW_LOADED, &WebViewDialog::on_loaded, this, m_browser->GetId());
|
||||||
|
|
||||||
Bind(wxEVT_CLOSE_WINDOW, ([this](wxCloseEvent& evt) { EndModal(wxID_CANCEL); }));
|
Bind(wxEVT_CLOSE_WINDOW, ([this](wxCloseEvent& evt) { EndModal(wxID_CANCEL); }));
|
||||||
|
|
||||||
@ -1258,7 +1259,7 @@ LoginWebViewDialog::LoginWebViewDialog(wxWindow *parent, std::string &ret_val, c
|
|||||||
: WebViewDialog(parent
|
: WebViewDialog(parent
|
||||||
, url
|
, url
|
||||||
, _L("Log in dialog")
|
, _L("Log in dialog")
|
||||||
, wxSize(std::max(parent->GetClientSize().x / 2, 100 * wxGetApp().em_unit()), std::max(parent->GetClientSize().y / 2, 50 * wxGetApp().em_unit()))
|
, wxSize(std::max(parent->GetClientSize().x / 2, 100 * wxGetApp().em_unit()), std::max(parent->GetClientSize().y / 4 * 3, 50 * wxGetApp().em_unit()))
|
||||||
, {})
|
, {})
|
||||||
, m_ret_val(ret_val)
|
, m_ret_val(ret_val)
|
||||||
{
|
{
|
||||||
@ -1266,7 +1267,6 @@ LoginWebViewDialog::LoginWebViewDialog(wxWindow *parent, std::string &ret_val, c
|
|||||||
}
|
}
|
||||||
void LoginWebViewDialog::on_navigation_request(wxWebViewEvent &evt)
|
void LoginWebViewDialog::on_navigation_request(wxWebViewEvent &evt)
|
||||||
{
|
{
|
||||||
BOOST_LOG_TRIVIAL(error) << evt.GetURL();
|
|
||||||
wxString url = evt.GetURL();
|
wxString url = evt.GetURL();
|
||||||
if (url.starts_with(L"prusaslicer")) {
|
if (url.starts_with(L"prusaslicer")) {
|
||||||
evt.Veto();
|
evt.Veto();
|
||||||
@ -1274,5 +1274,19 @@ void LoginWebViewDialog::on_navigation_request(wxWebViewEvent &evt)
|
|||||||
EndModal(wxID_OK);
|
EndModal(wxID_OK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LogoutWebViewDialog::LogoutWebViewDialog(wxWindow *parent)
|
||||||
|
: WebViewDialog(parent
|
||||||
|
, L"https://account.prusa3d.com/logout"
|
||||||
|
, _L("Logout dialog")
|
||||||
|
, wxSize(std::max(parent->GetClientSize().x / 4, 10 * wxGetApp().em_unit()), std::max(parent->GetClientSize().y / 4, 10 * wxGetApp().em_unit()))
|
||||||
|
, {})
|
||||||
|
{
|
||||||
|
Centre();
|
||||||
|
}
|
||||||
|
void LogoutWebViewDialog::on_loaded(wxWebViewEvent &evt)
|
||||||
|
{
|
||||||
|
EndModal(wxID_OK);
|
||||||
|
}
|
||||||
} // GUI
|
} // GUI
|
||||||
} // Slic3r
|
} // Slic3r
|
||||||
|
@ -129,6 +129,7 @@ public:
|
|||||||
void On_enable_dev_tools(wxCommandEvent& evt);
|
void On_enable_dev_tools(wxCommandEvent& evt);
|
||||||
|
|
||||||
virtual void on_navigation_request(wxWebViewEvent &evt);
|
virtual void on_navigation_request(wxWebViewEvent &evt);
|
||||||
|
virtual void on_loaded(wxWebViewEvent &evt) {}
|
||||||
|
|
||||||
void run_script(const wxString& javascript);
|
void run_script(const wxString& javascript);
|
||||||
|
|
||||||
@ -254,10 +255,18 @@ class LoginWebViewDialog : public WebViewDialog
|
|||||||
public:
|
public:
|
||||||
LoginWebViewDialog(wxWindow *parent, std::string &ret_val, const wxString& url);
|
LoginWebViewDialog(wxWindow *parent, std::string &ret_val, const wxString& url);
|
||||||
void on_navigation_request(wxWebViewEvent &evt) override;
|
void on_navigation_request(wxWebViewEvent &evt) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string &m_ret_val;
|
std::string &m_ret_val;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class LogoutWebViewDialog : public WebViewDialog
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
LogoutWebViewDialog(wxWindow* parent);
|
||||||
|
void on_loaded(wxWebViewEvent &evt) override;
|
||||||
|
};
|
||||||
|
|
||||||
} // GUI
|
} // GUI
|
||||||
} // Slic3r
|
} // Slic3r
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user