NEW: homepage and UserManual

Change-Id: Iecdb4d0151a0cf76614548aee69e525ad7e1fe68
(cherry picked from commit 4c7403683b334e42d8676a933012e2133cd1ce7f)
This commit is contained in:
zorro.zhang 2022-08-26 15:58:19 +08:00 committed by Lane.Wei
parent 3b021d4443
commit f44a0b88d9
13 changed files with 478 additions and 12 deletions

View file

@ -3002,6 +3002,31 @@ std::string GUI_App::handle_web_request(std::string cmd)
this->request_open_project(path.value());
}
}
}
else if (command_str.compare("homepage_delete_recentfile") == 0) {
if (root.get_child_optional("data") != boost::none) {
pt::ptree data_node = root.get_child("data");
boost::optional<std::string> path = data_node.get_optional<std::string>("path");
if (path.has_value()) {
this->request_remove_project(path.value());
}
}
}
else if (command_str.compare("homepage_delete_all_recentfile") == 0) {
this->request_remove_project("");
}
else if (command_str.compare("homepage_explore_recentfile") == 0) {
if (root.get_child_optional("data") != boost::none) {
pt::ptree data_node = root.get_child("data");
boost::optional<std::string> path = data_node.get_optional<std::string>("path");
if (path.has_value())
{
boost::filesystem::path NowFile(path.value());
std::string FolderPath = NowFile.parent_path().make_preferred().string();
desktop_open_any_folder(FolderPath);
}
}
}
else if (command_str.compare("homepage_open_hotspot") == 0) {
if (root.get_child_optional("data") != boost::none) {
@ -3036,7 +3061,17 @@ std::string GUI_App::handle_web_request(std::string cmd)
e.SetEventObject(mainframe);
wxPostEvent(mainframe, e);
}
}
else if (command_str.compare("userguide_wiki_open") == 0) {
if (root.get_child_optional("data") != boost::none) {
pt::ptree data_node = root.get_child("data");
boost::optional<std::string> path = data_node.get_optional<std::string>("url");
if (path.has_value()) {
wxLaunchDefaultBrowser(path.value());
}
}
}
}
}
catch (...) {
@ -3111,6 +3146,11 @@ void GUI_App::request_open_project(std::string project_id)
CallAfter([this, project_id] { mainframe->open_recent_project(-1, wxString::FromUTF8(project_id)); });
}
void GUI_App::request_remove_project(std::string project_id)
{
mainframe->remove_recent_project(-1, wxString::FromUTF8(project_id));
}
void GUI_App::handle_http_error(unsigned int status, std::string body)
{
// tips body size must less than 1024