mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-06-13 23:43:03 +00:00
feature update the preset check rule. and set the weak update dialog isn't modal.
This commit is contained in:
@@ -2516,24 +2516,16 @@ bool GUI_App::on_init_inner()
|
||||
skip_this_version = false;
|
||||
}
|
||||
}
|
||||
if (!skip_this_version
|
||||
|| evt.GetInt() != 0) {
|
||||
UpdateVersionDialog dialog(this->mainframe);
|
||||
if (!skip_this_version || evt.GetInt() != 0) {
|
||||
wxString extmsg = wxString::FromUTF8(version_info.description);
|
||||
dialog.update_version_info(extmsg, version_info.version_str);
|
||||
m_updateDialog->update_version_info(extmsg, version_info.version_str);
|
||||
if (evt.GetInt() != 0) {
|
||||
dialog.m_button_skip_version->Hide();
|
||||
}
|
||||
switch (dialog.ShowModal())
|
||||
{
|
||||
case wxID_YES:
|
||||
wxLaunchDefaultBrowser(version_info.url);
|
||||
break;
|
||||
case wxID_NO:
|
||||
break;
|
||||
default:
|
||||
;
|
||||
m_updateDialog->m_button_skip_version->Hide();
|
||||
}
|
||||
m_updateDialog->Raise();
|
||||
m_updateDialog->Show();
|
||||
m_updateDialog->setUrl(version_info.url);
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -2669,6 +2661,13 @@ bool GUI_App::on_init_inner()
|
||||
|
||||
BOOST_LOG_TRIVIAL(info) << "create the main window";
|
||||
mainframe = new MainFrame();
|
||||
m_updateDialog = new UpdateVersionDialog(mainframe);
|
||||
m_updateDialog->Hide();
|
||||
m_updateDialog->Bind(EVT_DOWN_URL_PACK, [this](wxCommandEvent& event) {
|
||||
auto downloadUlr = m_updateDialog->getUrl();
|
||||
wxLaunchDefaultBrowser(downloadUlr);
|
||||
});
|
||||
|
||||
// hide settings tabs after first Layout
|
||||
if (is_editor()) {
|
||||
mainframe->select_tab(size_t(0));
|
||||
@@ -4859,7 +4858,6 @@ void GUI_App::check_new_version_sf(bool show_tips, bool by_user)
|
||||
return;
|
||||
}
|
||||
|
||||
//if (true)
|
||||
if (isForceUpgrade)
|
||||
{
|
||||
wxGetApp().app_config->set_bool("force_upgrade", version_info.force_upgrade);
|
||||
|
||||
@@ -57,7 +57,13 @@ class wxBookCtrlBase;
|
||||
class Notebook;
|
||||
struct wxLanguageInfo;
|
||||
|
||||
namespace Slic3r {
|
||||
namespace GUI {
|
||||
class UpdateVersionDialog;
|
||||
};
|
||||
};
|
||||
|
||||
// namespace Slice3rnamespace GUI::Slice3rnamespace GUI
|
||||
namespace Slic3r {
|
||||
|
||||
class AppConfig;
|
||||
@@ -719,6 +725,7 @@ private:
|
||||
PresetUpdater* preset_updater{ nullptr };
|
||||
MainFrame* mainframe{ nullptr };
|
||||
Plater* plater_{ nullptr };
|
||||
UpdateVersionDialog* m_updateDialog{nullptr};
|
||||
|
||||
PresetUpdater* get_preset_updater() { return preset_updater; }
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ wxDEFINE_EVENT(EVT_UPDATE_NOZZLE, wxCommandEvent);
|
||||
wxDEFINE_EVENT(EVT_JUMP_TO_HMS, wxCommandEvent);
|
||||
wxDEFINE_EVENT(EVT_JUMP_TO_LIVEVIEW, wxCommandEvent);
|
||||
wxDEFINE_EVENT(EVT_UPDATE_TEXT_MSG, wxCommandEvent);
|
||||
wxDEFINE_EVENT(EVT_DOWN_URL_PACK, wxCommandEvent);
|
||||
|
||||
ReleaseNoteDialog::ReleaseNoteDialog(Plater *plater /*= nullptr*/)
|
||||
: DPIDialog(static_cast<wxWindow *>(wxGetApp().mainframe), wxID_ANY, _L("Release Note"), wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX)
|
||||
@@ -333,7 +334,13 @@ UpdateVersionDialog::UpdateVersionDialog(wxWindow *parent)
|
||||
m_button_download->SetCursor(wxCURSOR_HAND);
|
||||
|
||||
m_button_download->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) {
|
||||
EndModal(wxID_YES);
|
||||
wxCommandEvent event(EVT_DOWN_URL_PACK);
|
||||
|
||||
wxPostEvent(this, event);
|
||||
if (isModal)
|
||||
EndModal(wxID_NO);
|
||||
else
|
||||
Close();
|
||||
});
|
||||
|
||||
m_button_skip_version = new Button(this, _L("Skip this Version"));
|
||||
@@ -347,7 +354,10 @@ UpdateVersionDialog::UpdateVersionDialog(wxWindow *parent)
|
||||
|
||||
m_button_skip_version->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) {
|
||||
wxGetApp().set_skip_version(true);
|
||||
EndModal(wxID_NO);
|
||||
if (isModal)
|
||||
EndModal(wxID_NO);
|
||||
else
|
||||
Close();
|
||||
});
|
||||
|
||||
m_cb_stable_only = new CheckBox(this);
|
||||
@@ -377,7 +387,11 @@ UpdateVersionDialog::UpdateVersionDialog(wxWindow *parent)
|
||||
m_button_cancel->SetCursor(wxCURSOR_HAND);
|
||||
|
||||
m_button_cancel->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) {
|
||||
EndModal(wxID_NO);
|
||||
if (isModal)
|
||||
EndModal(wxID_NO);
|
||||
else
|
||||
Close();
|
||||
|
||||
});
|
||||
|
||||
m_sizer_main->Add(m_line_top, 0, wxEXPAND | wxBOTTOM, 0);
|
||||
|
||||
@@ -51,6 +51,7 @@ wxDECLARE_EVENT(EVT_LOAD_VAMS_TRAY, wxCommandEvent);
|
||||
wxDECLARE_EVENT(EVT_JUMP_TO_HMS, wxCommandEvent);
|
||||
wxDECLARE_EVENT(EVT_JUMP_TO_LIVEVIEW, wxCommandEvent);
|
||||
wxDECLARE_EVENT(EVT_UPDATE_TEXT_MSG, wxCommandEvent);
|
||||
wxDECLARE_EVENT(EVT_DOWN_URL_PACK, wxCommandEvent);
|
||||
|
||||
class ReleaseNoteDialog : public DPIDialog
|
||||
{
|
||||
@@ -95,6 +96,10 @@ public:
|
||||
void update_version_info(wxString release_note, wxString version);
|
||||
std::vector<std::string> splitWithStl(std::string str, std::string pattern);
|
||||
|
||||
void setDialogMode(bool mode) { isModal = mode; }
|
||||
std::string getUrl() { return m_url; }
|
||||
void setUrl(const std::string downloadUrl) { m_url = downloadUrl; }
|
||||
std::string m_url{""};
|
||||
wxStaticBitmap* m_brand{nullptr};
|
||||
Label * m_text_up_info{nullptr};
|
||||
wxWebView* m_vebview_release_note{nullptr};
|
||||
@@ -108,6 +113,7 @@ public:
|
||||
Button* m_button_download;
|
||||
Button* m_button_cancel;
|
||||
std::string url_line;
|
||||
bool isModal = true;
|
||||
};
|
||||
|
||||
class SecondaryCheckDialog : public DPIFrame
|
||||
|
||||
@@ -1428,8 +1428,7 @@ Updates PresetUpdater::priv::get_config_updates(const Semver &old_slic3r_version
|
||||
}
|
||||
}
|
||||
|
||||
bool version_match = ((vendor_ver.maj() == cache_ver.maj()) && (vendor_ver.min() == cache_ver.min()));
|
||||
if (version_match && (vendor_ver < cache_ver)) {
|
||||
if (vendor_ver < cache_ver) {
|
||||
|
||||
Semver min_ver = get_min_version_from_json(file_path);
|
||||
Semver soft_ver = Semver(std::string(Snapmaker_VERSION));
|
||||
|
||||
Reference in New Issue
Block a user