mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-20 15:21:21 -06:00
NEW: homepage and UserManual
Change-Id: Iecdb4d0151a0cf76614548aee69e525ad7e1fe68 (cherry picked from commit 4c7403683b334e42d8676a933012e2133cd1ce7f)
This commit is contained in:
parent
3b021d4443
commit
f44a0b88d9
13 changed files with 478 additions and 12 deletions
|
@ -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
|
||||
|
|
|
@ -372,6 +372,7 @@ public:
|
|||
void download_project(std::string project_id);
|
||||
void request_project_download(std::string project_id);
|
||||
void request_open_project(std::string project_id);
|
||||
void request_remove_project(std::string project_id);
|
||||
|
||||
void handle_http_error(unsigned int status, std::string body);
|
||||
void on_http_error(wxCommandEvent &evt);
|
||||
|
|
|
@ -2611,6 +2611,28 @@ void MainFrame::open_recent_project(size_t file_id, wxString const & filename)
|
|||
}
|
||||
}
|
||||
|
||||
void MainFrame::remove_recent_project(size_t file_id, wxString const &filename)
|
||||
{
|
||||
if (file_id == size_t(-1)) {
|
||||
if (filename.IsEmpty())
|
||||
while (m_recent_projects.GetCount() > 0)
|
||||
m_recent_projects.RemoveFileFromHistory(0);
|
||||
else
|
||||
file_id = m_recent_projects.FindFileInHistory(filename);
|
||||
}
|
||||
if (file_id != size_t(-1))
|
||||
m_recent_projects.RemoveFileFromHistory(file_id);
|
||||
std::vector<std::string> recent_projects;
|
||||
size_t count = m_recent_projects.GetCount();
|
||||
for (size_t i = 0; i < count; ++i)
|
||||
{
|
||||
recent_projects.push_back(into_u8(m_recent_projects.GetHistoryFile(i)));
|
||||
}
|
||||
wxGetApp().app_config->set_recent_projects(recent_projects);
|
||||
wxGetApp().app_config->save();
|
||||
m_webview->SendRecentList("");
|
||||
}
|
||||
|
||||
void MainFrame::load_url(wxString url)
|
||||
{
|
||||
BOOST_LOG_TRIVIAL(trace) << "load_url:" << url;
|
||||
|
|
|
@ -296,6 +296,7 @@ public:
|
|||
void add_to_recent_projects(const wxString& filename);
|
||||
void get_recent_projects(boost::property_tree::wptree & tree);
|
||||
void open_recent_project(size_t file_id, wxString const & filename);
|
||||
void remove_recent_project(size_t file_id, wxString const &filename);
|
||||
|
||||
void technology_changed();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue