diff --git a/src/slic3r/GUI/Jobs/PrintJob.cpp b/src/slic3r/GUI/Jobs/PrintJob.cpp index f3d6e5325..9231047fb 100644 --- a/src/slic3r/GUI/Jobs/PrintJob.cpp +++ b/src/slic3r/GUI/Jobs/PrintJob.cpp @@ -12,26 +12,26 @@ namespace Slic3r { namespace GUI { -static wxString check_gcode_failed_str = _L("Abnormal print file data. Please slice again."); -static wxString printjob_cancel_str = _L("Task canceled."); -static wxString timeout_to_upload_str = _L("Upload task timed out. Please check the network status and try again."); -static wxString failed_in_cloud_service_str = _L("Cloud service connection failed. Please try again."); -static wxString file_is_not_exists_str = _L("Print file not found. please slice again."); -static wxString file_over_size_str = _L("The print file exceeds the maximum allowable size (1GB). Please simplify the model and slice again."); -static wxString print_canceled_str = _L("Task canceled."); -static wxString send_print_failed_str = _L("Failed to send the print job. Please try again."); -static wxString upload_ftp_failed_str = _L("Failed to upload file to ftp. Please try again."); -static wxString print_signed_str = _L("Your software is not signed, and some printing functions have been restricted. Please use the officially signed software version."); +#define CHECK_GCODE_FAILED_STR _L("Abnormal print file data. Please slice again.") +#define PRINTJOB_CANCEL_STR _L("Task canceled.") +#define TIMEOUT_TO_UPLOAD_STR _L("Upload task timed out. Please check the network status and try again.") +#define FAILED_IN_CLOUD_SERVICE_STR _L("Cloud service connection failed. Please try again.") +#define FILE_IS_NOT_EXISTS_STR _L("Print file not found. please slice again.") +#define FILE_OVER_SIZE_STR _L("The print file exceeds the maximum allowable size (1GB). Please simplify the model and slice again.") +#define PRINT_CANCELED_STR _L("Task canceled.") +#define SEND_PRINT_FAILED_STR _L("Failed to send the print job. Please try again.") +#define UPLOAD_FTP_FAILED_STR _L("Failed to upload file to ftp. Please try again.") +#define PRINT_SIGNED_STR _L("Your software is not signed, and some printing functions have been restricted. Please use the officially signed software version.") -static wxString desc_network_error = _L("Check the current status of the bambu server by clicking on the link above."); -static wxString desc_file_too_large = _L("The size of the print file is too large. Please adjust the file size and try again."); -static wxString desc_fail_not_exist = _L("Print file not found, Please slice it again and send it for printing."); -static wxString desc_upload_ftp_failed = _L("Failed to upload print file to FTP. Please check the network status and try again."); +#define DESC_NETWORK_ERROR _L("Check the current status of the bambu server by clicking on the link above.") +#define DESC_FILE_TOO_LARGE _L("The size of the print file is too large. Please adjust the file size and try again.") +#define DESC_FAIL_NOT_EXIST _L("Print file not found, Please slice it again and send it for printing.") +#define DESC_UPLOAD_FTP_FAILED _L("Failed to upload print file to FTP. Please check the network status and try again.") -static wxString sending_over_lan_str = _L("Sending print job over LAN"); -static wxString sending_over_cloud_str = _L("Sending print job through cloud service"); +#define SENDING_OVER_LAN_STR _L("Sending print job over LAN") +#define SENDING_OVER_CLOUD_STR _L("Sending print job through cloud service") -static wxString wait_sending_finish = _L("Print task sending times out."); +#define wait_sending_finish _L("Print task sending times out.") //static wxString desc_wait_sending_finish = _L("The printer timed out while receiving a print job. Please check if the network is functioning properly and send the print again."); //static wxString desc_wait_sending_finish = _L("The printer timed out while receiving a print job. Please check if the network is functioning properly."); @@ -173,12 +173,12 @@ void PrintJob::process() /* check gcode is valid */ if (!plate->is_valid_gcode_file() && m_print_type == "from_normal") { - update_status(curr_percent, check_gcode_failed_str); + update_status(curr_percent, CHECK_GCODE_FAILED_STR); return; } if (was_canceled()) { - update_status(curr_percent, printjob_cancel_str); + update_status(curr_percent, PRINTJOB_CANCEL_STR); return; } } @@ -451,13 +451,13 @@ void PrintJob::process() //get errors if (code > 100 || code < 0 || stage == BBL::SendingPrintJobStage::PrintingStageERROR) { if (code == BAMBU_NETWORK_ERR_PRINT_WR_FILE_OVER_SIZE || code == BAMBU_NETWORK_ERR_PRINT_SP_FILE_OVER_SIZE) { - m_plater->update_print_error_info(code, desc_file_too_large.ToStdString(), info); + m_plater->update_print_error_info(code, DESC_FILE_TOO_LARGE.ToStdString(), info); }else if (code == BAMBU_NETWORK_ERR_PRINT_WR_FILE_NOT_EXIST || code == BAMBU_NETWORK_ERR_PRINT_SP_FILE_NOT_EXIST){ - m_plater->update_print_error_info(code, desc_fail_not_exist.ToStdString(), info); + m_plater->update_print_error_info(code, DESC_FAIL_NOT_EXIST.ToStdString(), info); }else if (code == BAMBU_NETWORK_ERR_PRINT_LP_UPLOAD_FTP_FAILED || code == BAMBU_NETWORK_ERR_PRINT_SG_UPLOAD_FTP_FAILED) { - m_plater->update_print_error_info(code, desc_upload_ftp_failed.ToStdString(), info); + m_plater->update_print_error_info(code, DESC_UPLOAD_FTP_FAILED.ToStdString(), info); }else { - m_plater->update_print_error_info(code, desc_network_error.ToStdString(), info); + m_plater->update_print_error_info(code, DESC_NETWORK_ERROR.ToStdString(), info); } } else { @@ -610,22 +610,22 @@ void PrintJob::process() msg_text = _L("Retrieving printer information, please try again later."); } else if (result == BAMBU_NETWORK_ERR_PRINT_WR_FILE_NOT_EXIST || result == BAMBU_NETWORK_ERR_PRINT_SP_FILE_NOT_EXIST) { - msg_text = file_is_not_exists_str; + msg_text = FILE_IS_NOT_EXISTS_STR; } else if (result == BAMBU_NETWORK_ERR_PRINT_SP_FILE_OVER_SIZE || result == BAMBU_NETWORK_ERR_PRINT_WR_FILE_OVER_SIZE) { - msg_text = file_over_size_str; + msg_text = FILE_OVER_SIZE_STR; } else if (result == BAMBU_NETWORK_ERR_PRINT_WR_CHECK_MD5_FAILED || result == BAMBU_NETWORK_ERR_PRINT_SP_CHECK_MD5_FAILED) { - msg_text = failed_in_cloud_service_str; + msg_text = FAILED_IN_CLOUD_SERVICE_STR; } else if (result == BAMBU_NETWORK_ERR_PRINT_WR_GET_NOTIFICATION_TIMEOUT || result == BAMBU_NETWORK_ERR_PRINT_SP_GET_NOTIFICATION_TIMEOUT) { - msg_text = timeout_to_upload_str; + msg_text = TIMEOUT_TO_UPLOAD_STR; } else if (result == BAMBU_NETWORK_ERR_PRINT_LP_UPLOAD_FTP_FAILED || result == BAMBU_NETWORK_ERR_PRINT_SG_UPLOAD_FTP_FAILED) { - msg_text = upload_ftp_failed_str; + msg_text = UPLOAD_FTP_FAILED_STR; } else if (result == BAMBU_NETWORK_ERR_CANCELED) { - msg_text = print_canceled_str; + msg_text = PRINT_CANCELED_STR; this->update_status(0, msg_text); } else if (result == BAMBU_NETWORK_SIGNED_ERROR) { - msg_text = print_signed_str; + msg_text = PRINT_SIGNED_STR; } else { - msg_text = send_print_failed_str; + msg_text = SEND_PRINT_FAILED_STR; } if (result != BAMBU_NETWORK_ERR_CANCELED) { diff --git a/src/slic3r/GUI/Jobs/SendJob.cpp b/src/slic3r/GUI/Jobs/SendJob.cpp index 1c1658db6..e4d1c59d1 100644 --- a/src/slic3r/GUI/Jobs/SendJob.cpp +++ b/src/slic3r/GUI/Jobs/SendJob.cpp @@ -9,23 +9,23 @@ namespace Slic3r { namespace GUI { -static wxString check_gcode_failed_str = _L("Abnormal print file data. Please slice again."); -static wxString printjob_cancel_str = _L("Task canceled."); -static wxString timeout_to_upload_str = _L("Upload task timed out. Please check the network status and try again."); -static wxString failed_in_cloud_service_str = _L("Cloud service connection failed. Please try again."); -static wxString file_is_not_exists_str = _L("Print file not found. please slice again."); -static wxString file_over_size_str = _L("The print file exceeds the maximum allowable size (1GB). Please simplify the model and slice again."); -static wxString print_canceled_str = _L("Task canceled."); -static wxString send_print_failed_str = _L("Failed to send the print job. Please try again."); -static wxString upload_ftp_failed_str = _L("Failed to upload file to ftp. Please try again."); +#define CHECK_GCODE_FAILED_STR _L("Abnormal print file data. Please slice again.") +#define PRINTJOB_CANCEL_STR _L("Task canceled.") +#define TIMEOUT_TO_UPLOAD_STR _L("Upload task timed out. Please check the network status and try again.") +#define FAILED_IN_CLOUD_SERVICE_STR _L("Cloud service connection failed. Please try again.") +#define FILE_IS_NOT_EXISTS_STR _L("Print file not found. please slice again.") +#define FILE_OVER_SIZE_STR _L("The print file exceeds the maximum allowable size (1GB). Please simplify the model and slice again.") +#define PRINT_CANCELED_STR _L("Task canceled.") +#define SEND_PRINT_FAILED_STR _L("Failed to send the print job. Please try again.") +#define UPLOAD_FTP_FAILED_STR _L("Failed to upload file to ftp. Please try again.") -static wxString desc_network_error = _L("Check the current status of the bambu server by clicking on the link above."); -static wxString desc_file_too_large = _L("The size of the print file is too large. Please adjust the file size and try again."); -static wxString desc_fail_not_exist = _L("Print file not found, Please slice it again and send it for printing."); -static wxString desc_upload_ftp_failed = _L("Failed to upload print file to FTP. Please check the network status and try again."); +#define DESC_NETWORK_ERROR _L("Check the current status of the bambu server by clicking on the link above.") +#define DESC_FILE_TOO_LARGE _L("The size of the print file is too large. Please adjust the file size and try again.") +#define DESC_FAIL_NOT_EXIST _L("Print file not found, Please slice it again and send it for printing.") +#define DESC_UPLOAD_FTP_FAILED _L("Failed to upload print file to FTP. Please check the network status and try again.") -static wxString sending_over_lan_str = _L("Sending print job over LAN"); -static wxString sending_over_cloud_str = _L("Sending print job through cloud service"); +#define SENDING_OVER_LAN_STR _L("Sending print job over LAN") +#define SENDING_OVER_CLOUD_STR _L("Sending print job through cloud service") SendJob::SendJob(std::shared_ptr pri, Plater* plater, std::string dev_id) : PlaterJob{ std::move(pri), plater }, @@ -180,19 +180,19 @@ void SendJob::process() } if (plate == nullptr) { BOOST_LOG_TRIVIAL(error) << "can not find plate with valid gcode file when sending to print, plate_index="<< job_data.plate_idx; - update_status(curr_percent, check_gcode_failed_str); + update_status(curr_percent, CHECK_GCODE_FAILED_STR); return; } } /* check gcode is valid */ if (!plate->is_valid_gcode_file()) { - update_status(curr_percent, check_gcode_failed_str); + update_status(curr_percent, CHECK_GCODE_FAILED_STR); return; } if (was_canceled()) { - update_status(curr_percent, printjob_cancel_str); + update_status(curr_percent, PRINTJOB_CANCEL_STR); return; } @@ -277,16 +277,16 @@ void SendJob::process() //get errors if (code > 100 || code < 0 || stage == BBL::SendingPrintJobStage::PrintingStageERROR) { if (code == BAMBU_NETWORK_ERR_PRINT_WR_FILE_OVER_SIZE || code == BAMBU_NETWORK_ERR_PRINT_SP_FILE_OVER_SIZE) { - m_plater->update_print_error_info(code, desc_file_too_large.ToStdString(), info); + m_plater->update_print_error_info(code, DESC_FILE_TOO_LARGE.ToStdString(), info); } else if (code == BAMBU_NETWORK_ERR_PRINT_WR_FILE_NOT_EXIST || code == BAMBU_NETWORK_ERR_PRINT_SP_FILE_NOT_EXIST) { - m_plater->update_print_error_info(code, desc_fail_not_exist.ToStdString(), info); + m_plater->update_print_error_info(code, DESC_FAIL_NOT_EXIST.ToStdString(), info); } else if (code == BAMBU_NETWORK_ERR_PRINT_LP_UPLOAD_FTP_FAILED || code == BAMBU_NETWORK_ERR_PRINT_SG_UPLOAD_FTP_FAILED) { - m_plater->update_print_error_info(code, desc_upload_ftp_failed.ToStdString(), info); + m_plater->update_print_error_info(code, DESC_UPLOAD_FTP_FAILED.ToStdString(), info); } else { - m_plater->update_print_error_info(code, desc_network_error.ToStdString(), info); + m_plater->update_print_error_info(code, DESC_NETWORK_ERROR.ToStdString(), info); } } else { @@ -341,7 +341,7 @@ void SendJob::process() } if (was_canceled()) { - update_status(curr_percent, printjob_cancel_str); + update_status(curr_percent, PRINTJOB_CANCEL_STR); return; } @@ -349,25 +349,25 @@ void SendJob::process() curr_percent = -1; if (result == BAMBU_NETWORK_ERR_PRINT_WR_FILE_NOT_EXIST || result == BAMBU_NETWORK_ERR_PRINT_SP_FILE_NOT_EXIST) { - msg_text = file_is_not_exists_str; + msg_text = FILE_IS_NOT_EXISTS_STR; } else if (result == BAMBU_NETWORK_ERR_PRINT_SP_FILE_OVER_SIZE || result == BAMBU_NETWORK_ERR_PRINT_WR_FILE_OVER_SIZE) { - msg_text = file_over_size_str; + msg_text = FILE_OVER_SIZE_STR; } else if (result == BAMBU_NETWORK_ERR_PRINT_WR_CHECK_MD5_FAILED || result == BAMBU_NETWORK_ERR_PRINT_SP_CHECK_MD5_FAILED) { - msg_text = failed_in_cloud_service_str; + msg_text = FAILED_IN_CLOUD_SERVICE_STR; } else if (result == BAMBU_NETWORK_ERR_PRINT_WR_GET_NOTIFICATION_TIMEOUT || result == BAMBU_NETWORK_ERR_PRINT_SP_GET_NOTIFICATION_TIMEOUT) { - msg_text = timeout_to_upload_str; + msg_text = TIMEOUT_TO_UPLOAD_STR; } else if (result == BAMBU_NETWORK_ERR_PRINT_LP_UPLOAD_FTP_FAILED || result == BAMBU_NETWORK_ERR_PRINT_SG_UPLOAD_FTP_FAILED) { - msg_text = upload_ftp_failed_str; + msg_text = UPLOAD_FTP_FAILED_STR; } else if (result == BAMBU_NETWORK_ERR_CANCELED) { - msg_text = print_canceled_str; + msg_text = PRINT_CANCELED_STR; } else { - msg_text = send_print_failed_str; + msg_text = SEND_PRINT_FAILED_STR; } if (result != BAMBU_NETWORK_ERR_CANCELED) {