mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-22 02:12:13 +00:00
chore: UI Updates
This commit is contained in:
@@ -136,7 +136,6 @@ void PluginsConfigDialog::send_capabilities()
|
||||
nlohmann::json response;
|
||||
response["command"] = "list_capabilities";
|
||||
response["preset_type"] = static_cast<int>(m_type);
|
||||
response["title"] = into_u8(preset_type_title(m_type));
|
||||
response["preset_name"] = preset->name;
|
||||
response["data"] = PluginConfig::capabilities_payload(capabilities_in_use(m_type, *preset));
|
||||
|
||||
@@ -166,7 +165,6 @@ void PluginsConfigDialog::send_capability_config(const PluginCapabilityIdentifie
|
||||
|
||||
const EffectiveCapabilityConfig effective = m_service.get_effective_config(m_overrides, id);
|
||||
response["config"] = effective.config;
|
||||
response["source"] = plugin_config_source_to_string(effective.source);
|
||||
response["has_preset_override"] = effective.has_preset_override;
|
||||
response["has_base_config"] = effective.has_base_config;
|
||||
response["stored_plugin_version"] = effective.stored_plugin_version;
|
||||
|
||||
@@ -3094,6 +3094,17 @@ static bool cloud_media_is_image(const nlohmann::json& main_image)
|
||||
return lowered(get_json_string_field(main_image, "media_type")) == "image";
|
||||
}
|
||||
|
||||
// creator_display_name degrades to the creator's username and then to their raw user id when the
|
||||
// cloud cannot resolve a profile, so a bare id is dropped rather than shown: the author then falls
|
||||
// back to the one the plugin's own manifest declares (see apply_plugin_metadata_fallbacks).
|
||||
static std::string parse_cloud_author(const nlohmann::json& item)
|
||||
{
|
||||
std::string author = get_json_string_field(item, "creator_display_name");
|
||||
if (author.empty() || is_uuid(author))
|
||||
author = get_json_string_field(item, "creator_username");
|
||||
return is_uuid(author) ? std::string() : author;
|
||||
}
|
||||
|
||||
int OrcaCloudServiceAgent::fetch_subscribed_manifests_into_descriptors(std::vector<PluginDescriptor>& descriptors,
|
||||
std::vector<std::string>& not_found,
|
||||
std::vector<std::string>& unauthorized)
|
||||
@@ -3137,11 +3148,7 @@ int OrcaCloudServiceAgent::fetch_subscribed_manifests_into_descriptors(std::vect
|
||||
descriptor.plugin_key = uuid;
|
||||
// Cloud API "description" is intentionally not parsed: descriptions come only from the
|
||||
// plugin's Python header once installed. Cloud-only rows show a "View on OrcaCloud" link.
|
||||
descriptor.author = get_json_string_field(item, "author");
|
||||
if (descriptor.author.empty())
|
||||
descriptor.author = get_json_string_field(item, "creator_display_name");
|
||||
if (descriptor.author.empty())
|
||||
descriptor.author = get_json_string_field(item, "creator_username");
|
||||
descriptor.author = parse_cloud_author(item);
|
||||
descriptor.version = get_json_string_field(item, "version");
|
||||
descriptor.latest_version = descriptor.version;
|
||||
// Cloud "type" is cosmetic (see parse_cloud_display_types); real capability_types are
|
||||
@@ -3239,11 +3246,7 @@ int OrcaCloudServiceAgent::fetch_mine_manifests_into_descriptors(std::vector<Plu
|
||||
descriptor.plugin_key = uuid;
|
||||
// Cloud API "description" is intentionally not parsed: descriptions come only from the
|
||||
// plugin's Python header once installed. Cloud-only rows show a "View on OrcaCloud" link.
|
||||
descriptor.author = get_json_string_field(item, "author");
|
||||
if (descriptor.author.empty())
|
||||
descriptor.author = get_json_string_field(item, "creator_display_name");
|
||||
if (descriptor.author.empty())
|
||||
descriptor.author = get_json_string_field(item, "creator_username");
|
||||
descriptor.author = parse_cloud_author(item);
|
||||
descriptor.version = get_json_string_field(item, "version");
|
||||
descriptor.latest_version = descriptor.version;
|
||||
// Cloud "type" is cosmetic (see parse_cloud_display_types); real capability_types are
|
||||
|
||||
@@ -18,12 +18,6 @@ namespace Slic3r {
|
||||
|
||||
class PluginCapabilityInterface;
|
||||
|
||||
enum class PluginConfigSource {
|
||||
None,
|
||||
Base,
|
||||
Preset,
|
||||
};
|
||||
|
||||
/*
|
||||
Example config.json shape
|
||||
{
|
||||
|
||||
@@ -91,15 +91,6 @@ std::string serialize_plugin_overrides(const CapabilityConfigDocument& document)
|
||||
return document.empty() ? std::string() : document.serialize_entries().dump();
|
||||
}
|
||||
|
||||
std::string plugin_config_source_to_string(PluginConfigSource source)
|
||||
{
|
||||
switch (source) {
|
||||
case PluginConfigSource::Preset: return "preset";
|
||||
case PluginConfigSource::Base: return "base";
|
||||
default: return "none";
|
||||
}
|
||||
}
|
||||
|
||||
EffectiveCapabilityConfig PresetPluginConfigService::get_effective_config(const CapabilityConfigDocument& overrides,
|
||||
const PluginCapabilityIdentifier& id) const
|
||||
{
|
||||
@@ -112,14 +103,12 @@ EffectiveCapabilityConfig PresetPluginConfigService::get_effective_config(const
|
||||
|
||||
if (const auto entry = overrides.find(result.id)) {
|
||||
result.has_preset_override = true;
|
||||
result.source = PluginConfigSource::Preset;
|
||||
result.config = entry->cap_config;
|
||||
result.stored_plugin_version = entry->plugin_version;
|
||||
return result;
|
||||
}
|
||||
|
||||
if (result.has_base_config) {
|
||||
result.source = PluginConfigSource::Base;
|
||||
result.config = base.config;
|
||||
result.stored_plugin_version = base.plugin_version;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,6 @@ struct EffectiveCapabilityConfig
|
||||
{
|
||||
CapabilityConfigId id;
|
||||
nlohmann::json config = nlohmann::json::object();
|
||||
PluginConfigSource source = PluginConfigSource::None;
|
||||
|
||||
bool has_preset_override = false;
|
||||
bool has_base_config = false;
|
||||
@@ -46,8 +45,6 @@ struct MutationResult
|
||||
EffectiveCapabilityConfig effective;
|
||||
};
|
||||
|
||||
std::string plugin_config_source_to_string(PluginConfigSource source);
|
||||
|
||||
// Resolves a capability's effective config as `preset override -> base config -> none`, and mutates
|
||||
// the override layer. It works on a CapabilityConfigDocument the caller owns, never on a Preset and
|
||||
// never on the base config file, which keeps the two layers from writing to each other:
|
||||
|
||||
Reference in New Issue
Block a user