mirror of
https://github.com/QIDITECH/QIDISlicer.git
synced 2026-01-30 23:48:44 +03:00
WebView
This commit is contained in:
@@ -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)))
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user