From acd178291034e0046517ebdadefcfaa6f3ae658b Mon Sep 17 00:00:00 2001 From: YuSanka Date: Mon, 7 Dec 2020 19:04:09 +0100 Subject: [PATCH] In AboutDialog added "Copy Version Info" button (FR #4990) --- src/slic3r/GUI/AboutDialog.cpp | 12 ++++++++++++ src/slic3r/GUI/AboutDialog.hpp | 2 ++ 2 files changed, 14 insertions(+) diff --git a/src/slic3r/GUI/AboutDialog.cpp b/src/slic3r/GUI/AboutDialog.cpp index 4ded4ec926..e320dedfd8 100644 --- a/src/slic3r/GUI/AboutDialog.cpp +++ b/src/slic3r/GUI/AboutDialog.cpp @@ -297,6 +297,11 @@ AboutDialog::AboutDialog() 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); 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->Bind(wxEVT_BUTTON, &AboutDialog::onCloseDialog, this, wxID_CLOSE); @@ -348,5 +353,12 @@ void AboutDialog::onCopyrightBtn(wxEvent &) dlg.ShowModal(); } +void AboutDialog::onCopyToClipboard(wxEvent&) +{ + wxTheClipboard->Open(); + wxTheClipboard->SetData(new wxTextDataObject(_L("Version") + " " + std::string(SLIC3R_VERSION))); + wxTheClipboard->Close(); +} + } // namespace GUI } // namespace Slic3r diff --git a/src/slic3r/GUI/AboutDialog.hpp b/src/slic3r/GUI/AboutDialog.hpp index f1e26fde41..8774d8ce8b 100644 --- a/src/slic3r/GUI/AboutDialog.hpp +++ b/src/slic3r/GUI/AboutDialog.hpp @@ -60,6 +60,7 @@ class AboutDialog : public DPIDialog wxHtmlWindow* m_html; wxStaticBitmap* m_logo; int m_copy_rights_btn_id { wxID_ANY }; + int m_copy_version_btn_id { wxID_ANY }; public: AboutDialog(); @@ -70,6 +71,7 @@ private: void onLinkClicked(wxHtmlLinkEvent &event); void onCloseDialog(wxEvent &); void onCopyrightBtn(wxEvent &); + void onCopyToClipboard(wxEvent&); }; } // namespace GUI