mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-13 17:58:03 -06:00
Upload changes
PrusaLink: Use PUT or POST based on information read during test connection (upload-by-put). If put - do additional GET for storage_list and let user to choose where to upload or show name if only 1 is possible. Allow PrusaLink for MK2.5 and MK2.5S. PrusaConnect: New host type PrusaConnect inherited from PrusaLink class with filled host address, disabled http diggest. After upload read header information - status message and pass it to notification and Printhost upload dialog via events, this message can be shown as warning notification and is recieved in localized lang. Pass accept-language shortcut in upload header. 3 option to upload. (upload, to queue, to print) Upload Notification: Showing status text, changes in text, not showing close button, Completed state on special call (not 100%) and other design changes. Right panel: Open URL button.
This commit is contained in:
parent
13deee3c8f
commit
9df97e004d
20 changed files with 1530 additions and 204 deletions
|
@ -52,6 +52,7 @@ PrintHost* PrintHost::get_print_host(DynamicPrintConfig *config)
|
|||
case htAstroBox: return new AstroBox(config);
|
||||
case htRepetier: return new Repetier(config);
|
||||
case htPrusaLink: return new PrusaLink(config);
|
||||
case htPrusaConnect: return new PrusaConnect(config);
|
||||
case htMKS: return new MKS(config);
|
||||
default: return nullptr;
|
||||
}
|
||||
|
@ -93,10 +94,13 @@ struct PrintHostJobQueue::priv
|
|||
void emit_progress(int progress);
|
||||
void emit_error(wxString error);
|
||||
void emit_cancel(size_t id);
|
||||
void emit_info(wxString tag, wxString status);
|
||||
void start_bg_thread();
|
||||
void stop_bg_thread();
|
||||
void bg_thread_main();
|
||||
void progress_fn(Http::Progress progress, bool &cancel);
|
||||
void error_fn(wxString error);
|
||||
void info_fn(wxString tag, wxString status);
|
||||
void remove_source(const fs::path &path);
|
||||
void remove_source();
|
||||
void perform_job(PrintHostJob the_job);
|
||||
|
@ -125,6 +129,12 @@ void PrintHostJobQueue::priv::emit_error(wxString error)
|
|||
wxQueueEvent(queue_dialog, evt);
|
||||
}
|
||||
|
||||
void PrintHostJobQueue::priv::emit_info(wxString tag, wxString status)
|
||||
{
|
||||
auto evt = new PrintHostQueueDialog::Event(GUI::EVT_PRINTHOST_INFO, queue_dialog->GetId(), job_id, std::move(tag), std::move(status));
|
||||
wxQueueEvent(queue_dialog, evt);
|
||||
}
|
||||
|
||||
void PrintHostJobQueue::priv::emit_cancel(size_t id)
|
||||
{
|
||||
auto evt = new PrintHostQueueDialog::Event(GUI::EVT_PRINTHOST_CANCEL, queue_dialog->GetId(), id);
|
||||
|
@ -233,6 +243,40 @@ void PrintHostJobQueue::priv::progress_fn(Http::Progress progress, bool &cancel)
|
|||
}
|
||||
}
|
||||
|
||||
void PrintHostJobQueue::priv::error_fn(wxString error)
|
||||
{
|
||||
// check if transfer was not canceled before error occured - than do not show the error
|
||||
bool do_emit_err = true;
|
||||
if (channel_cancels.size_hint() > 0) {
|
||||
// Lock both queues
|
||||
auto cancels = channel_cancels.lock_rw();
|
||||
auto jobs = channel_jobs.lock_rw();
|
||||
|
||||
for (size_t cancel_id : *cancels) {
|
||||
if (cancel_id == job_id) {
|
||||
do_emit_err = false;
|
||||
emit_cancel(job_id);
|
||||
}
|
||||
else if (cancel_id > job_id) {
|
||||
const size_t idx = cancel_id - job_id - 1;
|
||||
if (idx < jobs->size()) {
|
||||
jobs->at(idx).cancelled = true;
|
||||
BOOST_LOG_TRIVIAL(debug) << boost::format("PrintHostJobQueue: Job id %1% cancelled") % cancel_id;
|
||||
emit_cancel(cancel_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
cancels->clear();
|
||||
}
|
||||
if (do_emit_err)
|
||||
emit_error(std::move(error));
|
||||
}
|
||||
|
||||
void PrintHostJobQueue::priv::info_fn(wxString tag, wxString status)
|
||||
{
|
||||
emit_info(tag, status);
|
||||
}
|
||||
|
||||
void PrintHostJobQueue::priv::remove_source(const fs::path &path)
|
||||
{
|
||||
if (! path.empty()) {
|
||||
|
@ -255,10 +299,9 @@ void PrintHostJobQueue::priv::perform_job(PrintHostJob the_job)
|
|||
emit_progress(0); // Indicate the upload is starting
|
||||
|
||||
bool success = the_job.printhost->upload(std::move(the_job.upload_data),
|
||||
[this](Http::Progress progress, bool &cancel) { this->progress_fn(std::move(progress), cancel); },
|
||||
[this](wxString error) {
|
||||
emit_error(std::move(error));
|
||||
}
|
||||
[this](Http::Progress progress, bool &cancel) { this->progress_fn(std::move(progress), cancel); },
|
||||
[this](wxString error) { this->error_fn(std::move(error)); },
|
||||
[this](wxString tag, wxString host) { this->info_fn(std::move(tag), std::move(host)); }
|
||||
);
|
||||
|
||||
if (success) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue