This commit is contained in:
sunsets
2023-06-26 18:20:40 +08:00
parent ea8bd92e15
commit d918a96f24
4 changed files with 80 additions and 54 deletions

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 25.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 16 16" enable-background="new 0 0 16 16" xml:space="preserve">
<g>
<path fill="#4479FB" d="M9.2,6.7l0-0.4l0.4-0.3c0-0.3-0.1-0.5-0.3-0.7L8.7,5.5L8.5,5.2l0.1-0.4C8.4,4.7,8.2,4.6,7.9,4.5L7.7,4.9
l-0.4,0L7,4.5C6.7,4.6,6.5,4.7,6.3,4.9l0.1,0.5L6.1,5.6L5.7,5.5C5.5,5.8,5.4,5.9,5.4,6.2l0.4,0.2l0,0.4L5.4,7.1
c0.1,0.2,0.2,0.5,0.3,0.7l0.4-0.1L6.5,8L6.4,8.4c0.2,0.1,0.4,0.2,0.7,0.3l0.2-0.4l0.4,0l0.3,0.4c0.2-0.1,0.5-0.1,0.7-0.3L8.6,7.9
l0.2-0.3l0.5,0.1C9.4,7.5,9.5,7.3,9.6,7L9.2,6.7z M7.5,7.5C7,7.5,6.6,7.1,6.6,6.7c0-0.4,0.4-0.8,0.8-0.8c0.4,0,0.8,0.4,0.8,0.8
C8.3,7.1,8,7.4,7.5,7.5"/>
<rect x="4.1" y="13.6" fill="#4479FB" width="6.9" height="1.4"/>
<rect x="6" y="12.1" transform="matrix(-1.836970e-16 1 -1 -1.836970e-16 20.3214 5.235)" fill="#4479FB" width="3" height="1.4"/>
<g>
<polygon fill="#4479FB" points="9.5,12.2 1,12.2 1,1 13.9,1 13.9,7.3 12.6,7.3 12.6,2.4 2.4,2.4 2.4,10.9 9.5,10.9 "/>
</g>
<g>
<polygon fill="#4479FB" points="11.6,12.3 10.2,12.3 10.2,8 14.5,8 14.5,9.4 11.6,9.4 "/>
</g>
<g>
<rect x="12" y="8" transform="matrix(0.7071 -0.7071 0.7071 0.7071 -3.706 12.0514)" fill="#4479FB" width="1.4" height="5.1"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -50,9 +50,6 @@
#include "NotificationManager.hpp"
#include "Preferences.hpp"
//B4
//#include "WebViewDialog.hpp"
#ifdef _WIN32
#include <dbt.h>
#include <shlobj.h>
@@ -773,27 +770,11 @@ void MainFrame::init_tabpanel()
else
select_tab(size_t(0)); // select Plater
});
//B4
//if (wxGetApp().is_editor()) {
// m_webview = new WebViewPanel(m_tabpanel);
// Bind(EVT_LOAD_URL, [this](wxCommandEvent &evt) {
// wxString url = evt.GetString();
// select_tab(MainFrame::tpHome);
// m_webview->load_url(url);
// });
// m_tabpanel->AddPage(m_webview, "", "tab_home_active");
// //m_param_panel = new ParamsPanel(m_tabpanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBK_LEFT | wxTAB_TRAVERSAL);
//}
//m_printer_view = new PrinterWebView(m_tabpanel);
//Bind(EVT_LOAD_PRINTER_URL, [this](wxCommandEvent &evt) {
// wxString url = evt.GetString();
// // select_tab(MainFrame::tpMonitor);
// m_printer_view->load_url(url);
//});
//wxString url = "http://www.baidu.com";
//m_printer_view->load_url(url);
//m_printer_view->Hide();
//m_tabpanel->AddPage(m_printer_view, "", "tab_home_active");
m_plater = new Plater(this, this);
m_plater->Hide();
@@ -814,14 +795,6 @@ void MainFrame::init_tabpanel()
}
}
}
//B4
//void MainFrame::load_url(wxString url)
//{
// BOOST_LOG_TRIVIAL(trace) << "load_url:" << url;
// auto evt = new wxCommandEvent(EVT_LOAD_URL, this->GetId());
// evt->SetString(url);
// wxQueueEvent(this, evt);
//}
#ifdef WIN32
void MainFrame::register_win32_callbacks()
@@ -887,6 +860,16 @@ void MainFrame::create_preset_tabs()
add_created_tab(new TabSLAPrint(m_tabpanel), "cog");
add_created_tab(new TabSLAMaterial(m_tabpanel), "resin");
add_created_tab(new TabPrinter(m_tabpanel), wxGetApp().preset_bundle->printers.get_edited_preset().printer_technology() == ptFFF ? "printer" : "sla_printer");
//B4
m_printer_view = new PrinterWebView(m_tabpanel);
m_printer_view->Hide();
dynamic_cast<Notebook *>(m_tabpanel)->AddPage(m_printer_view, _L("Device"), "tab_monitor_active");
//B28
m_guide_view = new GuideWebView(m_tabpanel);
wxString url = wxString::Format("file://%s/web/qidi/missing_connection.html", from_u8(resources_dir()));
m_guide_view->load_url(url);
m_guide_view->Hide();
dynamic_cast<Notebook *>(m_tabpanel)->AddPage(m_guide_view, _L("Guide"), "notification_preferences");
}
void MainFrame::add_created_tab(Tab* panel, const std::string& bmp_name /*= ""*/)
@@ -2064,7 +2047,7 @@ void MainFrame::select_tab(Tab* tab)
page_idx++;
select_tab(size_t(page_idx));
}
//B4
void MainFrame::select_tab(size_t tab/* = size_t(-1)*/)
{
bool tabpanel_was_hidden = false;
@@ -2074,9 +2057,32 @@ void MainFrame::select_tab(size_t tab/* = size_t(-1)*/)
auto select = [this, tab](bool was_hidden) {
// when tab == -1, it means we should show the last selected tab
size_t new_selection = tab == (size_t)(-1) ? m_last_selected_tab : (m_layout == ESettingsLayout::Dlg && tab != 0) ? tab - 1 : tab;
//B4
if (m_tabpanel->GetSelection() == 4) {
if (const DynamicPrintConfig *cfg = wxGetApp().preset_bundle->physical_printers.get_selected_printer_config(); cfg) {
PresetBundle & preset_bundle = *wxGetApp().preset_bundle;
const PhysicalPrinter &pp = preset_bundle.physical_printers.get_selected_printer();
wxString host = pp.config.opt_string("print_host");
if (host.empty())
host = wxString::Format("file://%s/web/qidi/missing_connection.html", from_u8(resources_dir()));
else {
if (!host.Lower().starts_with("http"))
host = wxString::Format("http://%s", host);
if (!host.Lower().ends_with("10088"))
host = wxString::Format("%s:10088", host);
}
if (tem_host != host) {
m_printer_view->load_url(host);
tem_host = host;
}
if (m_tabpanel->GetSelection() != (int)new_selection)
m_tabpanel->SetSelection(new_selection);
} else {
wxString url = wxString::Format("file://%s/web/qidi/missing_connection.html", from_u8(resources_dir()));
m_printer_view->load_url(url);
}
}
// if (m_tabpanel->GetSelection() != (int)new_selection)
// m_tabpanel->SetSelection(new_selection);
#ifdef _MSW_DARK_MODE
if (wxGetApp().tabs_as_menu()) {
if (Tab* cur_tab = dynamic_cast<Tab*>(m_tabpanel->GetPage(new_selection)))

View File

@@ -19,6 +19,8 @@
#include "UnsavedChangesDialog.hpp"
//B4
#include "PrinterWebView.hpp"
// B28
#include "GuideWebView.hpp"
class wxBookCtrlBase;
class wxProgressDialog;
@@ -36,7 +38,6 @@ class Plater;
class MainFrame;
class PreferencesDialog;
class GalleryDialog;
//class WebViewPanel;
enum QuickSlice
@@ -146,16 +147,6 @@ public:
MainFrame(const int font_point_size);
~MainFrame() = default;
enum TabPosition {
tpHome = 0,
tp3DEditor = 1,
// tpSettings = 1,
tpPreview = 2,
tpMonitor = 3,
tpProject = 4,
toDebugTool = 5,
};
void update_layout();
void update_mode_markers();
@@ -216,10 +207,15 @@ public:
void technology_changed();
PrintHostQueueDialog *printhost_queue_dlg() { return m_printhost_queue_dlg; }
//B4
Plater *m_plater{nullptr};
//WebViewPanel * m_webview{nullptr};
//B4
wxString tem_host;
PrinterWebView * m_printer_view{nullptr};
//B28
GuideWebView * m_guide_view{nullptr};
wxBookCtrlBase * m_tabpanel{nullptr};
SettingsDialog m_settings_dialog;
DiffPresetDialog diff_dialog;

View File

@@ -239,17 +239,18 @@ void Mainsail::set_auth(Http &http) const
if (!m_cafile.empty())
http.ca_file(m_cafile);
}
//B4
std::string Mainsail::make_url(const std::string &path) const
{
if (m_host.find("http://") == 0 || m_host.find("https://") == 0) {
if (m_host.back() == '/') {
return (boost::format("%1%%2%") % m_host % path).str();
std::string m_host_add = m_host + ":10088";
if (m_host_add.find("http://") == 0 || m_host_add.find("https://") == 0) {
if (m_host_add.back() == '/') {
return (boost::format("%1%%2%") % m_host_add % path).str();
} else {
return (boost::format("%1%/%2%") % m_host % path).str();
return (boost::format("%1%/%2%") % m_host_add % path).str();
}
} else {
return (boost::format("http://%1%/%2%") % m_host % path).str();
return (boost::format("http://%1%/%2%") % m_host_add % path).str();
}
}