mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-23 10:52:15 +00:00
Add Microsoft Store MSIX package build (#14142)
* docs: add MSIX Store build design spec * docs: update MSIX spec (PFN deep link, .drc, Associate tab) and add implementation plan * ci: add MSIX logo asset generator and generated assets * ci: fix MSIX asset rendering edge bleed (PixelOffsetMode) and make output order deterministic * ci: add MSIX AppxManifest template * ci: add MSIX packaging script * ci: make build_msix.ps1 stage-only exit dot-source safe * ci: build MSIX Store package in Windows job * ci: run MSIX pack after existing Windows uploads and keep it out of release downloads * feat: add MSIX packaged-context detection helpers * fix: resolve MSIX package APIs dynamically to keep Win7 loadable * feat: suppress self-update in MSIX Store build * feat: suppress runtime file associations in MSIX Store build * feat: keep version check in MSIX build, point update dialog at the Store The update check is notification-only (OrcaSlicer never auto-downloads), so the Store build keeps checking for new versions instead of skipping the check. What changes when packaged is the new-version dialog: the Download button is hidden, the info text asks the user to update from the Microsoft Store, and the hyperlink / wxID_YES action opens the Store product page instead of the GitHub release page. * docs: align spec verification plan with Store-redirect updater behavior * feat: default MSIX identity to the reserved Partner Center values * feat: render MSIX logos full-bleed from the gradient-circle SVG * feat: point update dialog Download button at the Store in MSIX builds * feat: link Associate tab to Windows Default Apps settings in MSIX builds * docs: align spec with review-driven logo, dialog and Associate-tab changes * clearn up
This commit is contained in:
@@ -2859,7 +2859,11 @@ bool GUI_App::on_init_inner()
|
||||
switch (dialog.ShowModal())
|
||||
{
|
||||
case wxID_YES:
|
||||
wxLaunchDefaultBrowser(version_info.url);
|
||||
// Store builds get updates from the Microsoft Store, not the GitHub release page.
|
||||
if (is_running_in_msix())
|
||||
open_ms_store_product_page();
|
||||
else
|
||||
wxLaunchDefaultBrowser(version_info.url);
|
||||
break;
|
||||
case wxID_NO:
|
||||
break;
|
||||
@@ -9112,6 +9116,10 @@ static bool del_win_registry(HKEY hkeyHive, const wchar_t *pszVar, const wchar_t
|
||||
void GUI_App::associate_files(std::wstring extend)
|
||||
{
|
||||
#ifdef WIN32
|
||||
// MSIX: shell integration is declared in the package manifest; registry
|
||||
// writes from a packaged process are virtualized and invisible to the shell.
|
||||
if (is_running_in_msix())
|
||||
return;
|
||||
wchar_t app_path[MAX_PATH];
|
||||
::GetModuleFileNameW(nullptr, app_path, sizeof(app_path));
|
||||
|
||||
@@ -9137,6 +9145,8 @@ void GUI_App::associate_files(std::wstring extend)
|
||||
void GUI_App::disassociate_files(std::wstring extend)
|
||||
{
|
||||
#ifdef WIN32
|
||||
if (is_running_in_msix())
|
||||
return;
|
||||
wchar_t app_path[MAX_PATH];
|
||||
::GetModuleFileNameW(nullptr, app_path, sizeof(app_path));
|
||||
|
||||
@@ -9188,6 +9198,8 @@ bool GUI_App::check_url_association(std::wstring url_prefix, std::wstring& reg_b
|
||||
void GUI_App::associate_url(std::wstring url_prefix)
|
||||
{
|
||||
#ifdef WIN32
|
||||
if (is_running_in_msix())
|
||||
return;
|
||||
boost::filesystem::path binary_path(boost::filesystem::canonical(boost::dll::program_location()));
|
||||
wxString wbinary = from_path(binary_path);
|
||||
BOOST_LOG_TRIVIAL(info) << "Downloader registration: Path of binary: " << wbinary.ToUTF8().data();
|
||||
@@ -9213,6 +9225,8 @@ void GUI_App::associate_url(std::wstring url_prefix)
|
||||
void GUI_App::disassociate_url(std::wstring url_prefix)
|
||||
{
|
||||
#ifdef WIN32
|
||||
if (is_running_in_msix())
|
||||
return;
|
||||
wxRegKey key_full(wxRegKey::HKCU, "Software\\Classes\\" + url_prefix + "\\shell\\open\\command");
|
||||
if (!key_full.Exists()) {
|
||||
return;
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <wx/font.h>
|
||||
#include <wx/fontutil.h>
|
||||
#include <wx/display.h>
|
||||
#include <wx/utils.h>
|
||||
|
||||
#include "libslic3r/Config.hpp"
|
||||
|
||||
@@ -171,6 +172,42 @@ template<class F> typename F::FN winapi_get_function(const wchar_t *dll, const c
|
||||
}
|
||||
#endif
|
||||
|
||||
bool is_running_in_msix()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
// The package identity APIs are Win8+ - resolved dynamically so the exe still loads on Win7
|
||||
// (same treatment as the DPI APIs below). Null-buffer probe: returns ERROR_INSUFFICIENT_BUFFER
|
||||
// when packaged, APPMODEL_ERROR_NO_PACKAGE when running unpackaged.
|
||||
struct GetCurrentPackageFullName_t { typedef LONG (WINAPI *FN)(UINT32 *length, PWSTR full_name); };
|
||||
static const bool packaged = []() {
|
||||
auto fn = winapi_get_function<GetCurrentPackageFullName_t>(L"Kernel32.dll", "GetCurrentPackageFullName");
|
||||
UINT32 length = 0;
|
||||
return fn != nullptr && fn(&length, nullptr) != APPMODEL_ERROR_NO_PACKAGE;
|
||||
}();
|
||||
return packaged;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
void open_ms_store_product_page()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
struct GetCurrentPackageFamilyName_t { typedef LONG (WINAPI *FN)(UINT32 *length, PWSTR family_name); };
|
||||
static auto fn = winapi_get_function<GetCurrentPackageFamilyName_t>(L"Kernel32.dll", "GetCurrentPackageFamilyName");
|
||||
if (fn == nullptr)
|
||||
return;
|
||||
UINT32 length = 0;
|
||||
if (fn(&length, nullptr) != ERROR_INSUFFICIENT_BUFFER)
|
||||
return;
|
||||
std::wstring family_name(length, L'\0');
|
||||
if (fn(&length, family_name.data()) != ERROR_SUCCESS)
|
||||
return;
|
||||
family_name.resize(length > 0 ? length - 1 : 0); // drop the terminating null
|
||||
wxLaunchDefaultBrowser(wxString(L"ms-windows-store://pdp/?PFN=") + family_name.c_str());
|
||||
#endif
|
||||
}
|
||||
|
||||
// If called with nullptr, a DPI for the primary monitor is returned.
|
||||
int get_dpi_for_window(const wxWindow *window)
|
||||
{
|
||||
|
||||
@@ -67,6 +67,10 @@ wxDECLARE_EVENT(EVT_VOLUME_DETACHED, VolumeDetachedEvent);
|
||||
|
||||
wxTopLevelWindow* find_toplevel_parent(wxWindow *window);
|
||||
wxString format_nozzle_diameter(float diameter);
|
||||
// True when running inside an MSIX package (Microsoft Store build); always false on non-Windows.
|
||||
bool is_running_in_msix();
|
||||
// Opens the Microsoft Store product page for the current package. No-op when not packaged.
|
||||
void open_ms_store_product_page();
|
||||
|
||||
void on_window_geometry(wxTopLevelWindow *tlw, std::function<void()> callback);
|
||||
|
||||
|
||||
@@ -1846,6 +1846,26 @@ void PreferencesDialog::create_items()
|
||||
//// ASSOCIATE TAB
|
||||
/////////////////////////////////////
|
||||
#ifdef _WIN32
|
||||
// MSIX: associations are declared in the package manifest and defaults are
|
||||
// managed by Windows Settings; the runtime registry toggles below cannot work.
|
||||
// Show a minimal page that sends the user to Windows' Default Apps settings instead.
|
||||
if (is_running_in_msix()) {
|
||||
m_pref_tabs->AppendItem(_L("Associate"));
|
||||
f_sizers.push_back(new wxFlexGridSizer(1, 1, v_gap, 0));
|
||||
g_sizer = f_sizers.back();
|
||||
g_sizer->AddGrowableCol(0, 1);
|
||||
|
||||
g_sizer->Add(create_item_title(_L("Associate files to OrcaSlicer")), 1, wxEXPAND);
|
||||
|
||||
auto item_open_default_apps = create_item_button(
|
||||
_L("File associations for the Microsoft Store version are managed by Windows Settings."),
|
||||
_L("Open Windows Default Apps Settings"), "", "",
|
||||
[]() { wxLaunchDefaultBrowser("ms-settings:defaultapps"); });
|
||||
g_sizer->Add(item_open_default_apps);
|
||||
|
||||
g_sizer->AddSpacer(FromDIP(10));
|
||||
sizer_page->Add(g_sizer, 0, wxEXPAND);
|
||||
} else {
|
||||
m_pref_tabs->AppendItem(_L("Associate"));
|
||||
f_sizers.push_back(new wxFlexGridSizer(1, 1, v_gap, 0));
|
||||
g_sizer = f_sizers.back();
|
||||
@@ -1880,6 +1900,7 @@ void PreferencesDialog::create_items()
|
||||
|
||||
g_sizer->AddSpacer(FromDIP(10));
|
||||
sizer_page->Add(g_sizer, 0, wxEXPAND);
|
||||
}
|
||||
#endif // _WIN32
|
||||
|
||||
//////////////////////////
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include "libslic3r/Thread.hpp"
|
||||
#include "GUI.hpp"
|
||||
#include "GUI_App.hpp"
|
||||
#include "GUI_Utils.hpp"
|
||||
#include "GUI_Preview.hpp"
|
||||
#include "MainFrame.hpp"
|
||||
#include "format.hpp"
|
||||
@@ -252,7 +253,9 @@ UpdateVersionDialog::UpdateVersionDialog(wxWindow *parent)
|
||||
m_text_up_info = new Label(this, Label::Head_14, wxEmptyString, LB_AUTO_WRAP);
|
||||
m_text_up_info->SetForegroundColour(wxColour(0x26, 0x2E, 0x30));
|
||||
|
||||
auto github_link = new HyperLink(this, _L("Check on Github"), "", LB_AUTO_WRAP);
|
||||
// Store builds get updates from the Microsoft Store: wxID_YES opens the Store
|
||||
// product page there (see the EVT_SLIC3R_VERSION_ONLINE handler) instead of GitHub.
|
||||
auto github_link = new HyperLink(this, is_running_in_msix() ? _L("Check on Microsoft Store") : _L("Check on Github"), "", LB_AUTO_WRAP);
|
||||
github_link->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) {
|
||||
EndModal(wxID_YES);
|
||||
});
|
||||
@@ -302,7 +305,7 @@ UpdateVersionDialog::UpdateVersionDialog(wxWindow *parent)
|
||||
|
||||
auto sizer_button = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
m_button_download = new Button(this, _L("Download"));
|
||||
m_button_download = new Button(this, is_running_in_msix() ? _L("Open Microsoft Store") : _L("Download"));
|
||||
m_button_download->SetStyle(ButtonStyle::Confirm, ButtonType::Choice);
|
||||
|
||||
m_button_download->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) {
|
||||
@@ -479,7 +482,10 @@ void UpdateVersionDialog::update_version_info(wxString release_note, wxString ve
|
||||
// else {
|
||||
//m_simplebook_release_note->SetMaxSize(wxSize(FromDIP(560), FromDIP(430)));
|
||||
m_simplebook_release_note->SetSelection(1);
|
||||
m_text_up_info->SetLabel(wxString::Format(_L("Click to download new version in default browser: %s"), version));
|
||||
if (is_running_in_msix())
|
||||
m_text_up_info->SetLabel(wxString::Format(_L("New version available: %s. Please update OrcaSlicer from the Microsoft Store."), version));
|
||||
else
|
||||
m_text_up_info->SetLabel(wxString::Format(_L("Click to download new version in default browser: %s"), version));
|
||||
auto data_buf_in = release_note.utf8_str();
|
||||
auto bg_color = StateColor::darkModeColorFor(wxColour("#FFFFFF")).GetAsString();
|
||||
auto fg_color = StateColor::darkModeColorFor(wxColour("#262E30")).GetAsString();
|
||||
|
||||
Reference in New Issue
Block a user