BambuStudio/src/slic3r/GUI/ReleaseNote.cpp

94 lines
3.5 KiB
C++
Raw Normal View History

#include "ReleaseNote.hpp"
#include "I18N.hpp"
#include "libslic3r/Utils.hpp"
#include "libslic3r/Thread.hpp"
#include "GUI.hpp"
#include "GUI_App.hpp"
#include "GUI_Preview.hpp"
#include "MainFrame.hpp"
#include "format.hpp"
#include "Widgets/ProgressDialog.hpp"
#include "Widgets/RoundedRectangle.hpp"
#include "Widgets/StaticBox.hpp"
#include <wx/progdlg.h>
#include <wx/clipbrd.h>
#include <wx/dcgraph.h>
#include <miniz.h>
#include <algorithm>
#include "Plater.hpp"
#include "BitmapCache.hpp"
namespace Slic3r { namespace GUI {
ReleaseNoteDialog::ReleaseNoteDialog(Plater *plater /*= nullptr*/)
: DPIDialog(static_cast<wxWindow *>(wxGetApp().mainframe), wxID_ANY, _L("Release Note"), wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX)
{
std::string icon_path = (boost::format("%1%/images/BambuStudioTitle.ico") % resources_dir()).str();
SetIcon(wxIcon(encode_path(icon_path.c_str()), wxBITMAP_TYPE_ICO));
SetBackgroundColour(*wxWHITE);
wxBoxSizer *m_sizer_main = new wxBoxSizer(wxVERTICAL);
auto m_line_top = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(-1, 1));
m_line_top->SetBackgroundColour(wxColour(166, 169, 170));
m_sizer_main->Add(m_line_top, 0, wxEXPAND, 0);
m_sizer_main->Add(0, 0, 0, wxTOP, FromDIP(30));
wxBoxSizer *m_sizer_body = new wxBoxSizer(wxHORIZONTAL);
m_sizer_body->Add(0, 0, 0, wxLEFT, FromDIP(38));
auto sm = create_scaled_bitmap("BambuStudio", nullptr, 70);
auto brand = new wxStaticBitmap(this, wxID_ANY, sm, wxDefaultPosition, wxSize(FromDIP(70), FromDIP(70)));
m_sizer_body->Add(brand, 0, wxALL, 0);
m_sizer_body->Add(0, 0, 0, wxRIGHT, FromDIP(25));
wxBoxSizer *m_sizer_right = new wxBoxSizer(wxVERTICAL);
m_text_up_info = new wxStaticText(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0);
m_text_up_info->SetFont(::Label::Head_14);
m_text_up_info->SetForegroundColour(wxColour(0x26, 0x2E, 0x30));
m_text_up_info->Wrap(-1);
m_sizer_right->Add(m_text_up_info, 0, 0, 0);
m_sizer_right->Add(0, 0, 1, wxTOP, FromDIP(15));
m_scrollwindw_release_note = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxSize(FromDIP(560), FromDIP(430)));
m_scrollwindw_release_note->SetScrollRate(5, 5);
m_scrollwindw_release_note->SetBackgroundColour(wxColour(0xF8, 0xF8, 0xF8));
m_scrollwindw_release_note->SetMaxSize(wxSize(FromDIP(560), FromDIP(430)));
m_sizer_right->Add(m_scrollwindw_release_note, 0, wxEXPAND | wxRIGHT, FromDIP(20));
m_sizer_body->Add(m_sizer_right, 1, wxBOTTOM | wxEXPAND, FromDIP(30));
m_sizer_main->Add(m_sizer_body, 0, wxEXPAND, 0);
SetSizer(m_sizer_main);
Layout();
m_sizer_main->Fit(this);
Centre(wxBOTH);
}
ReleaseNoteDialog::~ReleaseNoteDialog() {}
void ReleaseNoteDialog::on_dpi_changed(const wxRect &suggested_rect)
{
}
void ReleaseNoteDialog::update_release_note(std::string release_note, std::string version)
{
m_text_up_info->SetLabel(wxString::Format("version %s update information :", version));
wxBoxSizer * sizer_text_release_note = new wxBoxSizer(wxVERTICAL);
auto m_staticText_release_note = new wxStaticText(m_scrollwindw_release_note, wxID_ANY, release_note, wxDefaultPosition, wxDefaultSize, 0);
m_staticText_release_note->Wrap(FromDIP(430));
sizer_text_release_note->Add(m_staticText_release_note, 0, wxALL, 5);
m_scrollwindw_release_note->SetSizer(sizer_text_release_note);
m_scrollwindw_release_note->Layout();
}
}} // namespace Slic3r::GUI