Update details

This commit is contained in:
sunsets
2023-11-01 15:39:44 +08:00
parent 3cbf2d3318
commit d8dc67aea0
3 changed files with 43 additions and 14 deletions

View File

@@ -55,11 +55,14 @@ MsgDialog::MsgDialog(wxWindow *parent, const wxString &title, const wxString &he
rightsizer->Add(content_sizer, 1, wxEXPAND); rightsizer->Add(content_sizer, 1, wxEXPAND);
btn_sizer->AddStretchSpacer(); btn_sizer->AddStretchSpacer();
//B44
logo = new wxStaticBitmap(this, wxID_ANY, bitmap.IsOk() ? bitmap : wxNullBitmap); logo = new wxStaticBitmap(this, wxID_ANY, bitmap.IsOk() ? bitmap : wxNullBitmap);
if (style == 4) {
topsizer->Add(logo, 0, wxALL, BORDER); topsizer->Add(rightsizer, 1, wxLEFT | wxTOP | wxRIGHT | wxEXPAND, BORDER);
topsizer->Add(rightsizer, 1, wxTOP | wxBOTTOM | wxRIGHT | wxEXPAND, BORDER); } else {
topsizer->Add(logo, 0, wxALL, BORDER);
topsizer->Add(rightsizer, 1, wxTOP | wxBOTTOM | wxRIGHT | wxEXPAND, BORDER);
}
main_sizer->Add(topsizer, 1, wxEXPAND); main_sizer->Add(topsizer, 1, wxEXPAND);
main_sizer->Add(new StaticLine(this), 0, wxEXPAND | wxLEFT | wxRIGHT, HORIZ_SPACING); main_sizer->Add(new StaticLine(this), 0, wxEXPAND | wxLEFT | wxRIGHT, HORIZ_SPACING);
main_sizer->Add(btn_sizer, 0, wxALL | wxEXPAND, VERT_SPACING); main_sizer->Add(btn_sizer, 0, wxALL | wxEXPAND, VERT_SPACING);
@@ -107,7 +110,10 @@ void MsgDialog::apply_style(long style)
std::string icon_name = style & wxICON_WARNING ? "exclamation" : std::string icon_name = style & wxICON_WARNING ? "exclamation" :
style & wxICON_INFORMATION ? "info" : style & wxICON_INFORMATION ? "info" :
style & wxICON_QUESTION ? "question" : "QIDISlicer"; style & wxICON_QUESTION ? "question" : "QIDISlicer";
logo->SetBitmap(*get_bmp_bundle(icon_name, 64)); //B44
if (style != 4) {
logo->SetBitmap(*get_bmp_bundle(icon_name, 64));
}
} }
void MsgDialog::finalize() void MsgDialog::finalize()

View File

@@ -24,6 +24,10 @@
#include "wxExtensions.hpp" #include "wxExtensions.hpp"
#include "format.hpp" #include "format.hpp"
//B44
#include "Widgets/WebView.hpp"
namespace Slic3r { namespace Slic3r {
namespace GUI { namespace GUI {
@@ -97,12 +101,14 @@ bool MsgUpdateSlic3r::disable_version_check() const
AppUpdateAvailableDialog::AppUpdateAvailableDialog(const Semver& ver_current, const Semver& ver_online, bool from_user) AppUpdateAvailableDialog::AppUpdateAvailableDialog(const Semver& ver_current, const Semver& ver_online, bool from_user)
: MsgDialog(nullptr, _(L("App Update available")), wxString::Format(_(L("New version of %s is available.\nDo you wish to download it?")), SLIC3R_APP_NAME)) : MsgDialog(nullptr, _(L("App Update available")), wxString::Format(_(L("New version of %s is available.\nDo you wish to download it?")), SLIC3R_APP_NAME))
{ {
auto* versions = new wxFlexGridSizer(1, 0, VERT_SPACING); //B44
versions->Add(new wxStaticText(this, wxID_ANY, _(L("Current version:")))); m_vebview_release_note = CreateTipView(this);
versions->Add(new wxStaticText(this, wxID_ANY, ver_current.to_string())); m_vebview_release_note->SetBackgroundColour(wxColour(0x00, 0x00, 0x00));
versions->Add(new wxStaticText(this, wxID_ANY, _(L("New version:")))); m_vebview_release_note->SetSize(wxSize(FromDIP(800), FromDIP(430)));
versions->Add(new wxStaticText(this, wxID_ANY, ver_online.to_string())); m_vebview_release_note->SetMinSize(wxSize(FromDIP(800), FromDIP(430)));
content_sizer->Add(versions); m_vebview_release_note->LoadURL(from_u8("https://github.com/QIDITECH/QIDISlicer/releases/tag/V" + ver_online.to_string()));
content_sizer->Add(m_vebview_release_note, 1, wxEXPAND);
content_sizer->AddSpacer(VERT_SPACING); content_sizer->AddSpacer(VERT_SPACING);
if(!from_user) { if(!from_user) {
@@ -110,9 +116,8 @@ AppUpdateAvailableDialog::AppUpdateAvailableDialog(const Semver& ver_current, co
content_sizer->Add(cbox); content_sizer->Add(cbox);
} }
content_sizer->AddSpacer(VERT_SPACING); content_sizer->AddSpacer(VERT_SPACING);
AUAD_size = wxSize(850, 500);
AUAD_size = content_sizer->GetSize(); content_sizer->SetMinSize(AppUpdateAvailableDialog::AUAD_size);
add_button(wxID_CANCEL); add_button(wxID_CANCEL);
@@ -126,6 +131,15 @@ AppUpdateAvailableDialog::AppUpdateAvailableDialog(const Semver& ver_current, co
AppUpdateAvailableDialog::~AppUpdateAvailableDialog() {} AppUpdateAvailableDialog::~AppUpdateAvailableDialog() {}
//B44
wxWebView *AppUpdateAvailableDialog::CreateTipView(wxWindow *parent)
{
wxWebView *tipView = WebView::CreateWebView(parent, "");
return tipView;
}
bool AppUpdateAvailableDialog::disable_version_check() const bool AppUpdateAvailableDialog::disable_version_check() const
{ {
if (!cbox) if (!cbox)

View File

@@ -11,6 +11,10 @@
#include "libslic3r/Semver.hpp" #include "libslic3r/Semver.hpp"
#include "MsgDialog.hpp" #include "MsgDialog.hpp"
//B44
#include <wx/webview.h>
class wxBoxSizer; class wxBoxSizer;
class wxCheckBox; class wxCheckBox;
@@ -49,6 +53,11 @@ public:
AppUpdateAvailableDialog& operator=(const AppUpdateAvailableDialog&) = delete; AppUpdateAvailableDialog& operator=(const AppUpdateAvailableDialog&) = delete;
virtual ~AppUpdateAvailableDialog(); virtual ~AppUpdateAvailableDialog();
// B44
wxWebView *CreateTipView(wxWindow *parent);
wxWebView *m_vebview_release_note{nullptr};
// Tells whether the user checked the "don't bother me again" checkbox // Tells whether the user checked the "don't bother me again" checkbox
bool disable_version_check() const; bool disable_version_check() const;
static wxSize AUAD_size; static wxSize AUAD_size;