In AboutDialog added "Copy Version Info" button (FR #4990)

This commit is contained in:
YuSanka 2020-12-07 19:04:09 +01:00
parent 7e3d8c3142
commit acd1782910
2 changed files with 14 additions and 0 deletions

View File

@ -297,6 +297,11 @@ AboutDialog::AboutDialog()
auto copy_rights_btn = new wxButton(this, m_copy_rights_btn_id, _L("Portions copyright")+dots); auto copy_rights_btn = new wxButton(this, m_copy_rights_btn_id, _L("Portions copyright")+dots);
buttons->Insert(0, copy_rights_btn, 0, wxLEFT, 5); buttons->Insert(0, copy_rights_btn, 0, wxLEFT, 5);
copy_rights_btn->Bind(wxEVT_BUTTON, &AboutDialog::onCopyrightBtn, this); copy_rights_btn->Bind(wxEVT_BUTTON, &AboutDialog::onCopyrightBtn, this);
m_copy_version_btn_id = NewControlId();
auto copy_version_btn = new wxButton(this, m_copy_version_btn_id, _L("Copy Version Info"));
buttons->Insert(1, copy_version_btn, 0, wxLEFT, 5);
copy_version_btn->Bind(wxEVT_BUTTON, &AboutDialog::onCopyToClipboard, this);
this->SetEscapeId(wxID_CLOSE); this->SetEscapeId(wxID_CLOSE);
this->Bind(wxEVT_BUTTON, &AboutDialog::onCloseDialog, this, wxID_CLOSE); this->Bind(wxEVT_BUTTON, &AboutDialog::onCloseDialog, this, wxID_CLOSE);
@ -348,5 +353,12 @@ void AboutDialog::onCopyrightBtn(wxEvent &)
dlg.ShowModal(); dlg.ShowModal();
} }
void AboutDialog::onCopyToClipboard(wxEvent&)
{
wxTheClipboard->Open();
wxTheClipboard->SetData(new wxTextDataObject(_L("Version") + " " + std::string(SLIC3R_VERSION)));
wxTheClipboard->Close();
}
} // namespace GUI } // namespace GUI
} // namespace Slic3r } // namespace Slic3r

View File

@ -60,6 +60,7 @@ class AboutDialog : public DPIDialog
wxHtmlWindow* m_html; wxHtmlWindow* m_html;
wxStaticBitmap* m_logo; wxStaticBitmap* m_logo;
int m_copy_rights_btn_id { wxID_ANY }; int m_copy_rights_btn_id { wxID_ANY };
int m_copy_version_btn_id { wxID_ANY };
public: public:
AboutDialog(); AboutDialog();
@ -70,6 +71,7 @@ private:
void onLinkClicked(wxHtmlLinkEvent &event); void onLinkClicked(wxHtmlLinkEvent &event);
void onCloseDialog(wxEvent &); void onCloseDialog(wxEvent &);
void onCopyrightBtn(wxEvent &); void onCopyrightBtn(wxEvent &);
void onCopyToClipboard(wxEvent&);
}; };
} // namespace GUI } // namespace GUI