Merge branch 'master' into SoftFever

# Conflicts:
#	bbl/i18n/zh_cn/BambuStudio_zh_CN.po
#	resources/i18n/de/BambuStudio.mo
#	resources/i18n/en/BambuStudio.mo
#	resources/i18n/es/BambuStudio.mo
#	resources/i18n/fr/BambuStudio.mo
#	resources/i18n/hu/BambuStudio.mo
#	resources/i18n/nl/BambuStudio.mo
#	resources/i18n/sv/BambuStudio.mo
#	resources/i18n/zh_cn/BambuStudio.mo
#	resources/profiles/Creality.json
#	resources/profiles/Voron.json
#	resources/web/guide/3/index.html
#	src/libslic3r/AppConfig.cpp
#	src/libslic3r/GCode.cpp
#	src/libslic3r/GCode/GCodeProcessor.cpp
#	src/libslic3r/LayerRegion.cpp
#	src/libslic3r/Preset.cpp
#	src/libslic3r/Print.cpp
#	src/libslic3r/PrintConfig.cpp
#	src/libslic3r/PrintConfig.hpp
#	src/libslic3r/PrintObject.cpp
#	src/slic3r/GUI/AboutDialog.cpp
#	src/slic3r/GUI/BBLTopbar.cpp
#	src/slic3r/GUI/ConfigManipulation.cpp
#	src/slic3r/GUI/ConfigWizard.cpp
#	src/slic3r/GUI/GCodeViewer.cpp
#	src/slic3r/GUI/GUI_App.cpp
#	src/slic3r/GUI/GUI_Factories.cpp
#	src/slic3r/GUI/MainFrame.cpp
#	src/slic3r/GUI/Plater.cpp
#	src/slic3r/GUI/Tab.cpp
#	version.inc
This commit is contained in:
SoftFever 2022-12-16 13:59:30 +08:00
commit bf8a9fee1f
689 changed files with 46784 additions and 10006 deletions

View file

@ -164,7 +164,9 @@ Http::priv::priv(const std::string &url)
::curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); // curl makes a copy internally
::curl_easy_setopt(curl, CURLOPT_USERAGENT, SLIC3R_APP_NAME "/" SLIC3R_VERSION);
::curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, &error_buffer.front());
#ifdef __WINDOWS__
::curl_easy_setopt(curl, CURLOPT_SSLVERSION, CURL_SSLVERSION_MAX_TLSv1_2);
#endif
::curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
::curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
}

View file

@ -11,6 +11,7 @@ extern bool mac_dark_mode();
extern double mac_max_scaling_factor();
extern void set_miniaturizable(void * window);
void WKWebView_evaluateJavaScript(void * web, wxString const & script, void (*callback)(wxString const &));
void WKWebView_setTransparentBackground(void * web);
void set_tag_when_enter_full_screen(bool isfullscreen);
void set_title_colour_after_set_title(void * window);
void initGestures(void * view, wxEvtHandler * handler);

View file

@ -8,6 +8,7 @@
#import <Cocoa/Cocoa.h>
#import <Foundation/Foundation.h>
#import <AppKit/NSScreen.h>
#import <WebKit/WebKit.h>
#include <objc/runtime.h>
@ -43,9 +44,9 @@ double mac_max_scaling_factor()
void set_miniaturizable(void * window)
{
CGFloat rFloat = 38/255.0;
CGFloat gFloat = 46/255.0;
CGFloat bFloat = 48/255.0;
CGFloat rFloat = 34/255.0;
CGFloat gFloat = 34/255.0;
CGFloat bFloat = 36/255.0;
[(NSView*) window window].titlebarAppearsTransparent = true;
[(NSView*) window window].backgroundColor = [NSColor colorWithCalibratedRed:rFloat green:gFloat blue:bFloat alpha:1.0];
[(NSView*) window window].styleMask |= NSMiniaturizableWindowMask;
@ -91,6 +92,12 @@ void WKWebView_evaluateJavaScript(void * web, wxString const & script, void (*ca
}
}];
}
void WKWebView_setTransparentBackground(void * web)
{
WKWebView * webView = (WKWebView*)web;
[webView layer].backgroundColor = [NSColor clearColor].CGColor;
}
void openFolderForFile(wxString const & file)
{
@ -104,7 +111,7 @@ void openFolderForFile(wxString const & file)
@end
/* textColor for NSTextField */
@implementation NSTextField (NSTextField_Extended)
@implementation NSTextField (textColor)
- (void)setTextColor2:(NSColor *)textColor
{
@ -129,6 +136,26 @@ void openFolderForFile(wxString const & file)
@end
/* drawsBackground for NSTextField */
@implementation NSTextField (drawsBackground)
- (instancetype)initWithFrame2:(NSRect)frameRect
{
[self initWithFrame2:frameRect];
self.drawsBackground = false;
return self;
}
+ (void) load
{
Method initWithFrame = class_getInstanceMethod([NSTextField class], @selector(initWithFrame:));
Method initWithFrame2 = class_getInstanceMethod([NSTextField class], @selector(initWithFrame2:));
method_exchangeImplementations(initWithFrame, initWithFrame2);
}
@end
/* textColor for NSButton */
@implementation NSButton (NSButton_Extended)

View file

@ -86,11 +86,15 @@ func_check_user_task_report NetworkAgent::check_user_task_report_ptr = n
func_get_user_print_info NetworkAgent::get_user_print_info_ptr = nullptr;
func_get_printer_firmware NetworkAgent::get_printer_firmware_ptr = nullptr;
func_get_task_plate_index NetworkAgent::get_task_plate_index_ptr = nullptr;
func_get_user_info NetworkAgent::get_user_info_ptr = nullptr;
func_get_slice_info NetworkAgent::get_slice_info_ptr = nullptr;
func_query_bind_status NetworkAgent::query_bind_status_ptr = nullptr;
func_modify_printer_name NetworkAgent::modify_printer_name_ptr = nullptr;
func_get_camera_url NetworkAgent::get_camera_url_ptr = nullptr;
func_start_pubilsh NetworkAgent::start_publish_ptr = nullptr;
func_get_profile_3mf NetworkAgent::get_profile_3mf_ptr = nullptr;
func_get_model_publish_url NetworkAgent::get_model_publish_url_ptr = nullptr;
func_get_model_mall_home_url NetworkAgent::get_model_mall_home_url_ptr = nullptr;
NetworkAgent::NetworkAgent()
@ -223,11 +227,15 @@ int NetworkAgent::initialize_network_module(bool using_backup)
get_user_print_info_ptr = reinterpret_cast<func_get_user_print_info>(get_network_function("bambu_network_get_user_print_info"));
get_printer_firmware_ptr = reinterpret_cast<func_get_printer_firmware>(get_network_function("bambu_network_get_printer_firmware"));
get_task_plate_index_ptr = reinterpret_cast<func_get_task_plate_index>(get_network_function("bambu_network_get_task_plate_index"));
get_user_info_ptr = reinterpret_cast<func_get_user_info>(get_network_function("bambu_network_get_user_info"));
get_slice_info_ptr = reinterpret_cast<func_get_slice_info>(get_network_function("bambu_network_get_slice_info"));
query_bind_status_ptr = reinterpret_cast<func_query_bind_status>(get_network_function("bambu_network_query_bind_status"));
modify_printer_name_ptr = reinterpret_cast<func_modify_printer_name>(get_network_function("bambu_network_modify_printer_name"));
get_camera_url_ptr = reinterpret_cast<func_get_camera_url>(get_network_function("bambu_network_get_camera_url"));
start_publish_ptr = reinterpret_cast<func_start_pubilsh>(get_network_function("bambu_network_start_publish"));
get_profile_3mf_ptr = reinterpret_cast<func_get_profile_3mf>(get_network_function("bambu_network_get_profile_3mf"));
get_model_publish_url_ptr = reinterpret_cast<func_get_model_publish_url>(get_network_function("bambu_network_get_model_publish_url"));
get_model_mall_home_url_ptr = reinterpret_cast<func_get_model_mall_home_url>(get_network_function("bambu_network_get_model_mall_home_url"));
return 0;
}
@ -314,11 +322,15 @@ int NetworkAgent::unload_network_module()
get_user_print_info_ptr = nullptr;
get_printer_firmware_ptr = nullptr;
get_task_plate_index_ptr = nullptr;
get_user_info_ptr = nullptr;
get_slice_info_ptr = nullptr;
query_bind_status_ptr = nullptr;
modify_printer_name_ptr = nullptr;
get_camera_url_ptr = nullptr;
start_publish_ptr = nullptr;
get_profile_3mf_ptr = nullptr;
get_model_publish_url_ptr = nullptr;
get_model_mall_home_url_ptr = nullptr;
return 0;
}
@ -993,6 +1005,17 @@ int NetworkAgent::get_task_plate_index(std::string task_id, int* plate_index)
return ret;
}
int NetworkAgent::get_user_info(int* identifier)
{
int ret = 0;
if (network_agent && get_user_info_ptr) {
ret = get_user_info_ptr(network_agent, identifier);
if (ret)
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(" error: network_agent=%1%, ret=%2%") % network_agent % ret;
}
return ret;
}
int NetworkAgent::get_slice_info(std::string project_id, std::string profile_id, int plate_index, std::string* slice_json)
{
int ret;
@ -1048,5 +1071,36 @@ int NetworkAgent::start_publish(PublishParams params, OnUpdateStatusFn update_fn
return ret;
}
int NetworkAgent::get_profile_3mf(BBLProfile* profile)
{
int ret = -1;
if (network_agent && get_profile_3mf_ptr) {
ret = get_profile_3mf_ptr(network_agent, profile);
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(" : network_agent=%1%, ret=%2%") % network_agent % ret;
}
return ret;
}
int NetworkAgent::get_model_publish_url(std::string* url)
{
int ret = 0;
if (network_agent && get_model_publish_url_ptr) {
ret = get_model_publish_url_ptr(network_agent, url);
if (ret)
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(" error: network_agent=%1%, ret=%2%") % network_agent % ret;
}
return ret;
}
int NetworkAgent::get_model_mall_home_url(std::string* url)
{
int ret = 0;
if (network_agent && get_model_publish_url_ptr) {
ret = get_model_mall_home_url_ptr(network_agent, url);
if (ret)
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(" error: network_agent=%1%, ret=%2%") % network_agent % ret;
}
return ret;
}
} //namespace

View file

@ -2,6 +2,7 @@
#define __NETWORK_Agent_HPP__
#include "bambu_networking.hpp"
#include "libslic3r/ProjectTask.hpp"
using namespace BBL;
@ -65,12 +66,15 @@ typedef int (*func_check_user_task_report)(void *agent, int* task_id, bool* prin
typedef int (*func_get_user_print_info)(void *agent, unsigned int* http_code, std::string* http_body);
typedef int (*func_get_printer_firmware)(void *agent, std::string dev_id, unsigned* http_code, std::string* http_body);
typedef int (*func_get_task_plate_index)(void *agent, std::string task_id, int* plate_index);
typedef int (*func_get_user_info)(void *agent, int* identifier);
typedef int (*func_get_slice_info)(void *agent, std::string project_id, std::string profile_id, int plate_index, std::string* slice_json);
typedef int (*func_query_bind_status)(void *agent, std::vector<std::string> query_list, unsigned int* http_code, std::string* http_body);
typedef int (*func_modify_printer_name)(void *agent, std::string dev_id, std::string dev_name);
typedef int (*func_get_camera_url)(void *agent, std::string dev_id, std::function<void(std::string)> callback);
typedef int (*func_start_pubilsh)(void *agent, PublishParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn, std::string* out);
typedef int (*func_get_profile_3mf)(void *agent, BBLProfile* profile);
typedef int (*func_get_model_publish_url)(void *agent, std::string* url);
typedef int (*func_get_model_mall_home_url)(void *agent, std::string* url);
//the NetworkAgent class
@ -145,11 +149,15 @@ public:
int get_user_print_info(unsigned int* http_code, std::string* http_body);
int get_printer_firmware(std::string dev_id, unsigned* http_code, std::string* http_body);
int get_task_plate_index(std::string task_id, int* plate_index);
int get_user_info(int* identifier);
int get_slice_info(std::string project_id, std::string profile_id, int plate_index, std::string* slice_json);
int query_bind_status(std::vector<std::string> query_list, unsigned int* http_code, std::string* http_body);
int modify_printer_name(std::string dev_id, std::string dev_name);
int get_camera_url(std::string dev_id, std::function<void(std::string)> callback);
int start_publish(PublishParams params, OnUpdateStatusFn update_fn, WasCancelledFn cancel_fn, std::string* out);
int get_profile_3mf(BBLProfile* profile);
int get_model_publish_url(std::string* url);
int get_model_mall_home_url(std::string* url);
private:
@ -214,11 +222,15 @@ private:
static func_get_user_print_info get_user_print_info_ptr;
static func_get_printer_firmware get_printer_firmware_ptr;
static func_get_task_plate_index get_task_plate_index_ptr;
static func_get_user_info get_user_info_ptr;
static func_get_slice_info get_slice_info_ptr;
static func_query_bind_status query_bind_status_ptr;
static func_modify_printer_name modify_printer_name_ptr;
static func_get_camera_url get_camera_url_ptr;
static func_start_pubilsh start_publish_ptr;
static func_get_profile_3mf get_profile_3mf_ptr;
static func_get_model_publish_url get_model_publish_url_ptr;
static func_get_model_mall_home_url get_model_mall_home_url_ptr;
};
}

View file

@ -1233,6 +1233,27 @@ void StackImpl::release_least_recently_used()
break;
#endif
} else {
// FIX: reduce_noisy_snapshots
if (m_snapshots.front().snapshot_data.snapshot_type == SnapshotType::EnteringGizmo) {
auto it_last = m_snapshots.begin() + 1;
if (it_last->snapshot_data.snapshot_type == SnapshotType::GizmoAction) {
auto it = m_snapshots.begin();
// Drop (it, it_last>
for (auto &kvp : m_objects)
// Drop products of <it + 1, it_last + 1>
mem_released += kvp.second->release_between_timestamps(it->timestamp, (it_last + 1)->timestamp);
m_snapshots.erase(it + 1, it_last + 1);
assert(current_memsize >= mem_released);
if (current_memsize >= mem_released)
current_memsize -= mem_released;
else
current_memsize = 0;
continue;
}
if (it_last->snapshot_data.snapshot_type != SnapshotType::LeavingGizmoWithAction &&
it_last->snapshot_data.snapshot_type != SnapshotType::LeavingGizmoNoAction)
break;
}
// Remove the first snapshot.
for (auto it = m_objects.begin(); it != m_objects.end();) {
mem_released += it->second->release_before_timestamp(m_snapshots[1].timestamp);
@ -1245,7 +1266,9 @@ void StackImpl::release_least_recently_used()
} else
++ it;
}
//FIXME update the "saved" snapshot time.
//FIXME update the "saved" snapshot time. DONE
if (m_snapshots.front().timestamp == m_saved_snapshot_time)
m_saved_snapshot_time = size_t(-1);
m_snapshots.erase(m_snapshots.begin());
}
assert(current_memsize >= mem_released);

View file

@ -32,11 +32,14 @@ namespace BBL {
#define BAMBU_NETWORK_ERR_INVALID_RESULT -23
#define BAMBU_NETWORK_ERR_FTP_UPLOAD_FAILED -24
#define BAMBU_NETWORK_ERR_FTP_LOGIN_DENIED -25
#define BAMBU_NETWORK_ERR_GET_MODEL_PUBLISH_PAGE -26
#define BAMBU_NETWORK_ERR_GET_MODEL_MALL_HOME_PAGE -27
#define BAMBU_NETWORK_ERR_GET_USER_INFO -28
#define BAMBU_NETWORK_LIBRARY "bambu_networking"
#define BAMBU_NETWORK_AGENT_NAME "bambu_network_agent"
#define BAMBU_NETWORK_AGENT_VERSION "01.03.01.02"
#define BAMBU_NETWORK_AGENT_VERSION "01.04.00.12"
//iot preset type strings