* Allow using BBL's device tab when 3rd party print host is used * Add option to open SimplyPrint panel in device tab after uploading * Fix default print host for prusa connect * Do not set api key in device view when SimplyPrint is used * Sending 3mf file to SimplyPrint when using BBL printers * Fix file extension when uploading 3mf * Prepare for large file uploading * Implement chunk upload * Fix file uploading exceeding content size * Fix wrong field type * Add `temp=true` to all chunk upload calls * Add macro to enable test api * Merge branch 'main' into dev/simplyprint-improve * Fix another missing `temp=true` * Add delete token * Try fixing build error on *nix systems * Merge branch 'main' into dev/simplyprint-improve * Merge branch 'main' into dev/simplyprint-improve * Merge remote-tracking branch 'remote/main' into dev/simplyprint-improve # Conflicts: # src/slic3r/GUI/BackgroundSlicingProcess.cpp * Move the `bbl_use_print_host_webui` option to print host dialog. Also make it a derived option of `print_host_webui` instead. * Merge branch 'main' into dev/simplyprint-improve # Conflicts: # src/slic3r/GUI/MainFrame.cpp # src/slic3r/GUI/Plater.cpp * Merge branch 'main' into dev/simplyprint-improve # Conflicts: # src/slic3r/GUI/Plater.cpp * Use a more generic option instead of SimplyPrint specific * Merge branch 'main' into dev/simplyprint-improve * Merge branch 'main' into dev/simplyprint-improve
141 lines
3.8 KiB
C++
141 lines
3.8 KiB
C++
#ifndef slic3r_PrintHostSendDialog_hpp_
|
|
#define slic3r_PrintHostSendDialog_hpp_
|
|
|
|
#include <set>
|
|
#include <string>
|
|
#include <boost/filesystem/path.hpp>
|
|
|
|
#include <wx/string.h>
|
|
#include <wx/event.h>
|
|
#include <wx/dialog.h>
|
|
|
|
#include "GUI_Utils.hpp"
|
|
#include "MsgDialog.hpp"
|
|
#include "../Utils/PrintHost.hpp"
|
|
|
|
class wxButton;
|
|
class wxTextCtrl;
|
|
class wxChoice;
|
|
class wxComboBox;
|
|
class wxDataViewListCtrl;
|
|
|
|
namespace Slic3r {
|
|
|
|
namespace GUI {
|
|
|
|
class PrintHostSendDialog : public GUI::MsgDialog
|
|
{
|
|
public:
|
|
PrintHostSendDialog(const boost::filesystem::path &path, PrintHostPostUploadActions post_actions, const wxArrayString& groups, const wxArrayString& storage_paths, const wxArrayString& storage_names, bool switch_to_device_tab);
|
|
boost::filesystem::path filename() const;
|
|
PrintHostPostUploadAction post_action() const;
|
|
std::string group() const;
|
|
std::string storage() const;
|
|
bool switch_to_device_tab() const {return m_switch_to_device_tab;}
|
|
|
|
virtual void EndModal(int ret) override;
|
|
private:
|
|
wxTextCtrl *txt_filename;
|
|
wxComboBox *combo_groups;
|
|
wxComboBox* combo_storage;
|
|
PrintHostPostUploadAction post_upload_action;
|
|
wxString m_valid_suffix;
|
|
wxString m_preselected_storage;
|
|
wxArrayString m_paths;
|
|
bool m_switch_to_device_tab;
|
|
};
|
|
|
|
|
|
class PrintHostQueueDialog : public DPIDialog
|
|
{
|
|
public:
|
|
class Event : public wxEvent
|
|
{
|
|
public:
|
|
size_t job_id;
|
|
int progress = 0; // in percent
|
|
wxString tag;
|
|
wxString status;
|
|
|
|
Event(wxEventType eventType, int winid, size_t job_id);
|
|
Event(wxEventType eventType, int winid, size_t job_id, int progress);
|
|
Event(wxEventType eventType, int winid, size_t job_id, wxString error);
|
|
Event(wxEventType eventType, int winid, size_t job_id, wxString tag, wxString status);
|
|
|
|
virtual wxEvent *Clone() const;
|
|
};
|
|
|
|
|
|
PrintHostQueueDialog(wxWindow *parent);
|
|
|
|
void append_job(const PrintHostJob &job);
|
|
void get_active_jobs(std::vector<std::pair<std::string, std::string>>& ret);
|
|
|
|
virtual bool Show(bool show = true) override
|
|
{
|
|
if(!show)
|
|
save_user_data(UDT_SIZE | UDT_POSITION | UDT_COLS);
|
|
return DPIDialog::Show(show);
|
|
}
|
|
protected:
|
|
void on_dpi_changed(const wxRect &suggested_rect) override;
|
|
void on_sys_color_changed() override;
|
|
|
|
private:
|
|
enum Column {
|
|
COL_ID,
|
|
COL_PROGRESS,
|
|
COL_STATUS,
|
|
COL_HOST,
|
|
COL_SIZE,
|
|
COL_FILENAME,
|
|
COL_ERRORMSG
|
|
};
|
|
|
|
enum JobState {
|
|
ST_NEW,
|
|
ST_PROGRESS,
|
|
ST_ERROR,
|
|
ST_CANCELLING,
|
|
ST_CANCELLED,
|
|
ST_COMPLETED,
|
|
};
|
|
|
|
enum { HEIGHT = 60, WIDTH = 30, SPACING = 5 };
|
|
|
|
enum UserDataType{
|
|
UDT_SIZE = 1,
|
|
UDT_POSITION = 2,
|
|
UDT_COLS = 4
|
|
};
|
|
|
|
wxButton *btn_cancel;
|
|
wxButton *btn_error;
|
|
wxDataViewListCtrl *job_list;
|
|
// Note: EventGuard prevents delivery of progress evts to a freed PrintHostQueueDialog
|
|
EventGuard on_progress_evt;
|
|
EventGuard on_error_evt;
|
|
EventGuard on_cancel_evt;
|
|
EventGuard on_info_evt;
|
|
|
|
JobState get_state(int idx);
|
|
void set_state(int idx, JobState);
|
|
void on_list_select();
|
|
void on_progress(Event&);
|
|
void on_error(Event&);
|
|
void on_cancel(Event&);
|
|
void on_info(Event&);
|
|
// This vector keep adress and filename of uploads. It is used when checking for running uploads during exit.
|
|
std::vector<std::pair<std::string, std::string>> upload_names;
|
|
void save_user_data(int);
|
|
bool load_user_data(int, std::vector<int>&);
|
|
};
|
|
|
|
wxDECLARE_EVENT(EVT_PRINTHOST_PROGRESS, PrintHostQueueDialog::Event);
|
|
wxDECLARE_EVENT(EVT_PRINTHOST_ERROR, PrintHostQueueDialog::Event);
|
|
wxDECLARE_EVENT(EVT_PRINTHOST_CANCEL, PrintHostQueueDialog::Event);
|
|
wxDECLARE_EVENT(EVT_PRINTHOST_INFO, PrintHostQueueDialog::Event);
|
|
}}
|
|
|
|
#endif
|