diff options
author | Vojtech Kral <vojtech@kral.hk> | 2018-12-18 20:40:35 +0300 |
---|---|---|
committer | Vojtech Kral <vojtech@kral.hk> | 2018-12-18 20:50:37 +0300 |
commit | ec9caae6227d8a151bd673d1e1214f197c803d1a (patch) | |
tree | eb9a33678bc63c28e9959bc46433a50ddf0a0e5a /src/slic3r/GUI/MsgDialog.cpp | |
parent | bb5caf2e08ca3be318501ff0580242e84d1e4355 (diff) |
Http & ErrorDialog: Improve error reporting
Diffstat (limited to 'src/slic3r/GUI/MsgDialog.cpp')
-rw-r--r-- | src/slic3r/GUI/MsgDialog.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/slic3r/GUI/MsgDialog.cpp b/src/slic3r/GUI/MsgDialog.cpp index ae7b40484..d6b8b438e 100644 --- a/src/slic3r/GUI/MsgDialog.cpp +++ b/src/slic3r/GUI/MsgDialog.cpp @@ -6,6 +6,7 @@ #include <wx/button.h> #include <wx/statbmp.h> #include <wx/scrolwin.h> +#include <wx/clipbrd.h> #include "libslic3r/libslic3r.h" #include "libslic3r/Utils.hpp" @@ -61,8 +62,11 @@ MsgDialog::~MsgDialog() {} // ErrorDialog -ErrorDialog::ErrorDialog(wxWindow *parent, const wxString &msg) : - MsgDialog(parent, _(L("Slic3r error")), _(L("Slic3r has encountered an error")), wxBitmap(from_u8(Slic3r::var("Slic3r_192px_grayscale.png")), wxBITMAP_TYPE_PNG)) +ErrorDialog::ErrorDialog(wxWindow *parent, const wxString &msg) + : MsgDialog(parent, _(L("Slic3r error")), _(L("Slic3r has encountered an error")), + wxBitmap(from_u8(Slic3r::var("Slic3r_192px_grayscale.png")), wxBITMAP_TYPE_PNG), + wxID_NONE) + , msg(msg) { auto *panel = new wxScrolledWindow(this); auto *p_sizer = new wxBoxSizer(wxVERTICAL); @@ -77,6 +81,20 @@ ErrorDialog::ErrorDialog(wxWindow *parent, const wxString &msg) : content_sizer->Add(panel, 1, wxEXPAND); + auto *btn_copy = new wxButton(this, wxID_ANY, _(L("Copy to clipboard"))); + btn_copy->Bind(wxEVT_BUTTON, [this](wxCommandEvent& event) { + if (wxTheClipboard->Open()) { + wxTheClipboard->SetData(new wxTextDataObject(this->msg)); // Note: the clipboard takes ownership of the pointer + wxTheClipboard->Close(); + } + }); + + auto *btn_ok = new wxButton(this, wxID_OK); + btn_ok->SetFocus(); + + btn_sizer->Add(btn_copy, 0, wxRIGHT, HORIZ_SPACING); + btn_sizer->Add(btn_ok); + SetMaxSize(wxSize(-1, CONTENT_MAX_HEIGHT)); Fit(); } |