feature add common function for soft

This commit is contained in:
alves
2025-12-17 11:42:07 +08:00
parent 399fbc7a33
commit 5ed729e27c
23 changed files with 116 additions and 60 deletions

View File

@@ -16,7 +16,7 @@
#include "FileHelp.hpp"
#include "Tab.hpp"
#include "MainFrame.hpp"
#include "libslic3r_version.h"
#include "common_func/common_func.hpp"
#define NAME_OPTION_COMBOBOX_SIZE wxSize(FromDIP(200), FromDIP(24))
#define FILAMENT_PRESET_COMBOBOX_SIZE wxSize(FromDIP(300), FromDIP(24))

View File

@@ -6,7 +6,7 @@
#include "slic3r/GUI/UserManager.hpp"
#include "slic3r/GUI/TaskManager.hpp"
#include "format.hpp"
#include "libslic3r_version.h"
#include "common_func/common_func.hpp"
#include "Downloader.hpp"
#include "slic3r/GUI/WebUrlDialog.hpp"

View File

@@ -72,9 +72,9 @@
#include <dbt.h>
#include <shlobj.h>
#include <shellapi.h>
#include "sentry_wrapper/SentryWrapper.hpp"
#endif // _WIN32
#include <slic3r/GUI/CreatePresetsDialog.hpp>
#include "sentry_wrapper/SentryWrapper.hpp"
namespace Slic3r {
@@ -1008,41 +1008,6 @@ void MainFrame::show_option(bool show)
}
}
}
void MainFrame::get_local_webview_version()
{
std::string versionFilePath = "";
#ifdef _WIN32
wchar_t appDataPath[MAX_PATH] = {0};
auto hr = SHGetFolderPathW(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, appDataPath);
char* path = new char[MAX_PATH];
size_t pathLength;
wcstombs_s(&pathLength, path, MAX_PATH, appDataPath, MAX_PATH);
std::string filePath = path;
versionFilePath = filePath + "\\" + std::string("Snapmaker_Orca\\web\\flutter_web\\version.json");
#elif __APPLE__
const char* home_env = getenv("HOME");
versionFilePath = home_env;
versionFilePath = versionFilePath + "/Library/Application Support/Snapmaker_Orca/web/flutter_web/version.json";
#else
#endif
std::ifstream json_file(versionFilePath);
if (!json_file.is_open()) {
std::ifstream json_file(versionFilePath);
BOOST_LOG_TRIVIAL(error) << "check flutter version error with file path:" << versionFilePath;
return;
}
nlohmann::json json_data;
json_file >> json_data;
std::string str_version = json_data["version"];
std::string str_build_number = json_data["build_number"];
std::string tag = std::string("flutter_version: ") + str_version + std::string(" ") + std::string("build_number: ") + str_build_number;
set_sentry_tags("flutter_version", tag);
}
void MainFrame::init_tabpanel() {
// wxNB_NOPAGETHEME: Disable Windows Vista theme for the Notebook background. The theme performance is terrible on
@@ -1126,7 +1091,6 @@ void MainFrame::init_tabpanel() {
m_param_panel = new ParamsPanel(m_tabpanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBK_LEFT | wxTAB_TRAVERSAL);
}
get_local_webview_version();
m_plater = new Plater(this, this);
m_plater->SetBackgroundColour(*wxWHITE);
m_plater->Hide();

View File

@@ -264,7 +264,6 @@ public:
void update_title_colour_after_set_title();
void show_option(bool show);
void init_tabpanel();
void get_local_webview_version();
void create_preset_tabs();
//BBS: GUI refactor
void add_created_tab(Tab* panel, const std::string& bmp_name = "");

View File

@@ -1,6 +1,6 @@
#include "Plater.hpp"
#include "libslic3r/Config.hpp"
#include "libslic3r_version.h"
#include "common_func/common_func.hpp"
#include <cstddef>
#include <algorithm>

View File

@@ -5,7 +5,7 @@
#include "slic3r/GUI/wxExtensions.hpp"
#include "slic3r/GUI/GUI_App.hpp"
#include "slic3r/GUI/MainFrame.hpp"
#include "libslic3r_version.h"
#include "common_func/common_func.hpp"
#include <wx/sizer.h>
#include <wx/string.h>

View File

@@ -91,7 +91,6 @@ bool WCP_Logger::set_level(wxString& level)
}
}
std::string WCP_Logger::get_pc_name() { return boost::asio::ip::host_name(); }
// Add a log message to the queue
void WCP_Logger::add_log(const wxString& content, bool is_web = false, wxString time = "", wxString module = "Default", wxString level = "debug")

View File

@@ -6,7 +6,7 @@
#include "libslic3r/AppConfig.hpp"
#include "slic3r/GUI/wxExtensions.hpp"
#include "slic3r/GUI/GUI_App.hpp"
#include "libslic3r_version.h"
#include "common_func/common_func.hpp"
#include <wx/sizer.h>
#include <wx/toolbar.h>

View File

@@ -10,7 +10,7 @@
#include "libslic3r/PresetBundle.hpp"
#include "slic3r/GUI/wxExtensions.hpp"
#include "slic3r/GUI/GUI_App.hpp"
#include "libslic3r_version.h"
#include "common_func/common_func.hpp"
#include <wx/sizer.h>
#include <wx/toolbar.h>

View File

@@ -6,7 +6,7 @@
#include "libslic3r/AppConfig.hpp"
#include "slic3r/GUI/wxExtensions.hpp"
#include "slic3r/GUI/GUI_App.hpp"
#include "libslic3r_version.h"
#include "common_func/common_func.hpp"
#include <wx/sizer.h>
#include <wx/toolbar.h>

View File

@@ -5,7 +5,7 @@
#include "libslic3r/AppConfig.hpp"
#include "slic3r/GUI/wxExtensions.hpp"
#include "slic3r/GUI/GUI_App.hpp"
#include "libslic3r_version.h"
#include "common_func/common_func.hpp"
#include <wx/sizer.h>
#include <wx/toolbar.h>

View File

@@ -5,7 +5,7 @@
#include "libslic3r/AppConfig.hpp"
#include "slic3r/GUI/wxExtensions.hpp"
#include "slic3r/GUI/GUI_App.hpp"
#include "libslic3r_version.h"
#include "common_func/common_func.hpp"
#include <wx/sizer.h>
#include <wx/toolbar.h>

View File

@@ -4,7 +4,7 @@
#include "slic3r/GUI/wxExtensions.hpp"
#include "slic3r/GUI/GUI_App.hpp"
#include "slic3r/GUI/MainFrame.hpp"
#include "libslic3r_version.h"
#include "common_func/common_func.hpp"
#include "../Utils/Http.hpp"
#include "SSWCP.hpp"