2018-07-08 12:32:48 +00:00
|
|
|
#ifndef slic3r_PrintHostSendDialog_hpp_
|
|
|
|
#define slic3r_PrintHostSendDialog_hpp_
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <boost/filesystem/path.hpp>
|
|
|
|
|
|
|
|
#include <wx/string.h>
|
|
|
|
#include <wx/event.h>
|
2018-12-14 14:27:34 +00:00
|
|
|
#include <wx/dialog.h>
|
2018-07-08 12:32:48 +00:00
|
|
|
|
2018-12-14 14:27:34 +00:00
|
|
|
#include "GUI.hpp"
|
|
|
|
#include "GUI_Utils.hpp"
|
|
|
|
#include "MsgDialog.hpp"
|
|
|
|
#include "../Utils/PrintHost.hpp"
|
2018-07-08 12:32:48 +00:00
|
|
|
|
2018-12-20 10:50:08 +00:00
|
|
|
class wxButton;
|
2018-12-14 14:27:34 +00:00
|
|
|
class wxTextCtrl;
|
|
|
|
class wxCheckBox;
|
|
|
|
class wxDataViewListCtrl;
|
2018-07-08 12:32:48 +00:00
|
|
|
|
2018-12-20 10:50:08 +00:00
|
|
|
|
2018-07-08 12:32:48 +00:00
|
|
|
namespace Slic3r {
|
|
|
|
|
2018-12-14 14:27:34 +00:00
|
|
|
struct PrintHostJob;
|
|
|
|
|
|
|
|
namespace GUI {
|
|
|
|
|
2018-12-11 09:33:11 +00:00
|
|
|
|
2018-07-08 12:32:48 +00:00
|
|
|
class PrintHostSendDialog : public GUI::MsgDialog
|
|
|
|
{
|
2018-12-11 09:33:11 +00:00
|
|
|
public:
|
2019-03-04 15:50:43 +00:00
|
|
|
PrintHostSendDialog(const boost::filesystem::path &path, bool can_start_print);
|
2018-12-11 09:33:11 +00:00
|
|
|
boost::filesystem::path filename() const;
|
|
|
|
bool start_print() const;
|
|
|
|
|
2019-02-18 13:03:02 +00:00
|
|
|
virtual void EndModal(int ret) override;
|
2018-07-08 12:32:48 +00:00
|
|
|
private:
|
2018-12-11 09:33:11 +00:00
|
|
|
wxTextCtrl *txt_filename;
|
|
|
|
wxCheckBox *box_print;
|
|
|
|
};
|
|
|
|
|
2018-07-08 12:32:48 +00:00
|
|
|
|
2019-04-23 14:33:06 +00:00
|
|
|
class PrintHostQueueDialog : public DPIDialog
|
2018-12-11 09:33:11 +00:00
|
|
|
{
|
2018-07-08 12:32:48 +00:00
|
|
|
public:
|
2018-12-14 14:27:34 +00:00
|
|
|
class Event : public wxEvent
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
size_t job_id;
|
|
|
|
int progress = 0; // in percent
|
|
|
|
wxString error;
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
virtual wxEvent *Clone() const;
|
|
|
|
};
|
2018-12-11 09:33:11 +00:00
|
|
|
|
2018-12-14 14:27:34 +00:00
|
|
|
|
|
|
|
PrintHostQueueDialog(wxWindow *parent);
|
|
|
|
|
|
|
|
void append_job(const PrintHostJob &job);
|
2019-04-23 14:33:06 +00:00
|
|
|
|
|
|
|
protected:
|
2019-04-25 13:06:44 +00:00
|
|
|
void on_dpi_changed(const wxRect &suggested_rect) override;
|
2019-04-23 14:33:06 +00:00
|
|
|
|
2018-12-11 09:33:11 +00:00
|
|
|
private:
|
2018-12-20 10:50:08 +00:00
|
|
|
enum Column {
|
|
|
|
COL_ID,
|
|
|
|
COL_PROGRESS,
|
|
|
|
COL_STATUS,
|
|
|
|
COL_HOST,
|
|
|
|
COL_FILENAME,
|
|
|
|
COL_ERRORMSG,
|
|
|
|
};
|
|
|
|
|
|
|
|
enum JobState {
|
|
|
|
ST_NEW,
|
|
|
|
ST_PROGRESS,
|
|
|
|
ST_ERROR,
|
|
|
|
ST_CANCELLING,
|
|
|
|
ST_CANCELLED,
|
|
|
|
ST_COMPLETED,
|
|
|
|
};
|
|
|
|
|
2019-04-25 13:06:44 +00:00
|
|
|
enum { HEIGHT = 60, WIDTH = 30, SPACING = 5 };
|
|
|
|
|
2018-12-20 10:50:08 +00:00
|
|
|
wxButton *btn_cancel;
|
|
|
|
wxButton *btn_error;
|
2018-12-14 14:27:34 +00:00
|
|
|
wxDataViewListCtrl *job_list;
|
|
|
|
// Note: EventGuard prevents delivery of progress evts to a freed PrintHostQueueDialog
|
|
|
|
EventGuard on_progress_evt;
|
|
|
|
EventGuard on_error_evt;
|
2018-12-20 12:36:49 +00:00
|
|
|
EventGuard on_cancel_evt;
|
2018-12-14 14:27:34 +00:00
|
|
|
|
2018-12-20 10:50:08 +00:00
|
|
|
JobState get_state(int idx);
|
|
|
|
void set_state(int idx, JobState);
|
|
|
|
void on_list_select();
|
2018-12-14 14:27:34 +00:00
|
|
|
void on_progress(Event&);
|
|
|
|
void on_error(Event&);
|
2018-12-20 12:36:49 +00:00
|
|
|
void on_cancel(Event&);
|
2018-07-08 12:32:48 +00:00
|
|
|
};
|
|
|
|
|
2018-12-14 14:27:34 +00:00
|
|
|
wxDECLARE_EVENT(EVT_PRINTHOST_PROGRESS, PrintHostQueueDialog::Event);
|
|
|
|
wxDECLARE_EVENT(EVT_PRINTHOST_ERROR, PrintHostQueueDialog::Event);
|
2018-12-20 12:36:49 +00:00
|
|
|
wxDECLARE_EVENT(EVT_PRINTHOST_CANCEL, PrintHostQueueDialog::Event);
|
2018-12-14 14:27:34 +00:00
|
|
|
|
2018-12-11 09:33:11 +00:00
|
|
|
|
2018-12-14 14:27:34 +00:00
|
|
|
}}
|
2018-07-08 12:32:48 +00:00
|
|
|
|
|
|
|
#endif
|