Trim Heavy Includes From GUI_App.hpp (#16841)

* Trim Heavy Includes from GUI_App.hpp

* Include winternl.h in the Windows Troubleshoot Dialog Code

The Windows builds failed in TroubleshootDialog.cpp with unknown type name NTSTATUS.
This commit is contained in:
HanifKoh authored and GitHub committed 2026-10-26 12:39:32 +08:00
1 parent 0fb11ef556
commit cbbe590230
15 files changed
+127 -93

No files matched your search

+32 -22
View File
@@ -250,6 +250,7 @@
#include "slic3r/GUI/ActionRegistry.hpp"
#include "slic3r/GUI/Camera.hpp"
#include "slic3r/GUI/ConfigWizard.hpp"
#include "slic3r/GUI/ConfigWizardTypes.hpp"
#include "slic3r/GUI/Gizmos/GLGizmosManager.hpp"
#include "slic3r/GUI/HttpServer.hpp"
#include "slic3r/GUI/ImGuiWrapper.hpp"
@@ -1257,10 +1258,13 @@ GUI_App::GUI_App()
//, m_app_mode(mode)
, m_app_mode(EAppMode::Editor)
, m_em_unit(10)
, m_opengl_mgr(std::make_unique<OpenGLManager>())
, m_imgui(new ImGuiWrapper())
, m_removable_drive_manager(std::make_unique<RemovableDriveManager>())
, m_downloader(std::make_unique<Downloader>())
, m_other_instance_message_handler(std::make_unique<OtherInstanceMessageHandler>())
, m_http_server(std::make_unique<HttpServer>())
, m_action_registry(std::make_unique<ActionRegistry>())
{
//app config initializes early becasuse it is used in instance checking in OrcaSlicer.cpp
this->init_app_config();
@@ -1275,6 +1279,12 @@ GUI_App::GUI_App()
reset_to_active();
}
GLShaderProgram* GUI_App::get_shader(const std::string& shader_name) { return m_opengl_mgr->get_shader(shader_name); }
GLShaderProgram* GUI_App::get_current_shader() { return m_opengl_mgr->get_current_shader(); }
bool GUI_App::is_gl_version_greater_or_equal_to(unsigned int major, unsigned int minor) const { return m_opengl_mgr->get_gl_info().is_version_greater_or_equal_to(major, minor); }
bool GUI_App::is_glsl_version_greater_or_equal_to(unsigned int major, unsigned int minor) const { return m_opengl_mgr->get_gl_info().is_glsl_version_greater_or_equal_to(major, minor); }
void GUI_App::shutdown()
{
BOOST_LOG_TRIVIAL(info) << "GUI_App::shutdown enter";
@@ -2623,19 +2633,19 @@ std::string GUI_App::get_gl_info(bool for_github)
wxGLContext* GUI_App::init_glcontext(wxGLCanvas& canvas)
{
return m_opengl_mgr.init_glcontext(canvas, init_params != nullptr ? init_params->opengl_version : std::make_pair(0, 0),
return m_opengl_mgr->init_glcontext(canvas, init_params != nullptr ? init_params->opengl_version : std::make_pair(0, 0),
init_params != nullptr ? init_params->opengl_compatibility_profile : false, init_params != nullptr ? init_params->opengl_debug : false);
}
bool GUI_App::init_opengl()
{
#ifdef __linux__
bool status = m_opengl_mgr.init_gl();
bool status = m_opengl_mgr->init_gl();
if (status)
m_opengl_initialized = true;
return status;
#else
return m_opengl_mgr.init_gl();
return m_opengl_mgr->init_gl();
#endif
}
@@ -3613,7 +3623,7 @@ bool GUI_App::on_init_inner()
init_plugin_gui_wiring();
// Subscribe to the plugin loader and enumerate current actions (UI thread, once).
m_action_registry.init();
m_action_registry->init();
for (const std::string& plugin_key : plugin_mgr.get_enabled_plugin_keys()) {
if (!plugin_mgr.is_plugin_loaded(plugin_key)) {
@@ -8364,12 +8374,12 @@ void GUI_App::on_stealth_mode_enter()
void GUI_App::start_http_server(const std::string& provider)
{
m_http_server.set_request_handler([provider](const std::string& url) {
m_http_server->set_request_handler([provider](const std::string& url) {
return HttpServer::auth_handle_request(url, provider);
});
if (!m_http_server.is_started())
m_http_server.start();
if (!m_http_server->is_started())
m_http_server->start();
}
void GUI_App::start_http_server(int port, const std::string& provider)
@@ -8379,24 +8389,24 @@ void GUI_App::start_http_server(int port, const std::string& provider)
return;
}
m_http_server.set_request_handler([provider](const std::string& url) {
m_http_server->set_request_handler([provider](const std::string& url) {
return HttpServer::auth_handle_request(url, provider);
});
if (m_http_server.is_started()) {
if (m_http_server.get_port() == static_cast<boost::asio::ip::port_type>(port)) {
if (m_http_server->is_started()) {
if (m_http_server->get_port() == static_cast<boost::asio::ip::port_type>(port)) {
return;
}
m_http_server.stop();
m_http_server->stop();
}
m_http_server.set_port(static_cast<boost::asio::ip::port_type>(port));
m_http_server.start();
m_http_server->set_port(static_cast<boost::asio::ip::port_type>(port));
m_http_server->start();
}
void GUI_App::stop_http_server()
{
m_http_server.stop();
m_http_server->stop();
}
#ifdef __linux__
@@ -9172,7 +9182,7 @@ void GUI_App::open_preferences(PreferencesTab tab, const std::string& highlight_
}
// Built-in Speed Dial command titles are copied from the catalog at init and don't follow a
// live locale switch; rebuild them in the new language before the GUI (and palette) rebuilds.
m_action_registry.relocalize_builtins();
m_action_registry->relocalize_builtins();
}
if (need_recreate_gui)
@@ -9999,7 +10009,7 @@ bool GUI_App::may_switch_to_SLA_preset(const wxString& caption)
return true;
}
bool GUI_App::run_wizard(ConfigWizard::RunReason reason, ConfigWizard::StartPage start_page)
bool GUI_App::run_wizard(RunReason reason, StartPage start_page)
{
wxCHECK_MSG(mainframe != nullptr, false, "Internal error: Main frame not created / null");
@@ -10018,7 +10028,7 @@ bool GUI_App::run_wizard(ConfigWizard::RunReason reason, ConfigWizard::StartPage
}
#endif
//if (reason == ConfigWizard::RR_USER) {
//if (reason == RunReason::RR_USER) {
// //TODO: turn off it currently, maybe need to turn on in the future
// if (preset_updater->config_update(app_config->orig_version(), PresetUpdater::UpdateParams::FORCED_BEFORE_WIZARD) == PresetUpdater::R_ALL_CANCELED)
// return false;
@@ -10033,9 +10043,9 @@ bool GUI_App::run_wizard(ConfigWizard::RunReason reason, ConfigWizard::StartPage
pStyle = wxCAPTION | wxTAB_TRAVERSAL;
GuideFrame wizard(this, pStyle);
auto page = start_page == ConfigWizard::SP_WELCOME ? GuideFrame::BBL_WELCOME :
start_page == ConfigWizard::SP_FILAMENTS ? GuideFrame::BBL_FILAMENT_ONLY :
start_page == ConfigWizard::SP_PRINTERS ? GuideFrame::BBL_MODELS_ONLY :
auto page = start_page == StartPage::SP_WELCOME ? GuideFrame::BBL_WELCOME :
start_page == StartPage::SP_FILAMENTS ? GuideFrame::BBL_FILAMENT_ONLY :
start_page == StartPage::SP_PRINTERS ? GuideFrame::BBL_MODELS_ONLY :
GuideFrame::BBL_MODELS;
wizard.SetStartPage(page);
bool res = wizard.run();
@@ -10202,7 +10212,7 @@ bool GUI_App::config_wizard_startup()
{
if (!m_app_conf_exists || preset_bundle->printers.only_default_printers()) {
BOOST_LOG_TRIVIAL(info) << "run wizard...";
run_wizard(ConfigWizard::RR_DATA_EMPTY);
run_wizard(RunReason::RR_DATA_EMPTY);
BOOST_LOG_TRIVIAL(info) << "finished run wizard";
return true;
} /*else if (get_app_config()->legacy_datadir()) {
@@ -10212,7 +10222,7 @@ bool GUI_App::config_wizard_startup()
MsgDataLegacy dlg;
dlg.ShowModal();
run_wizard(ConfigWizard::RR_DATA_LEGACY);
run_wizard(RunReason::RR_DATA_LEGACY);
return true;
}*/
return false;