mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-08-04 16:52:29 +00:00
Make the Latest and installed version labels dynamic
This commit is contained in:
@@ -885,6 +885,24 @@ std::vector<NetworkLibraryVersionInfo> get_all_available_versions()
|
||||
NetworkLibraryVersionInfo::from_discovered(full, full, ""));
|
||||
}
|
||||
|
||||
// Final pass: record what is actually present on disk, and put the "(Latest)"
|
||||
// label on the truly highest full version in the list - an OTA-installed build
|
||||
// can be newer than the newest whitelisted entry. get_latest_network_version()
|
||||
// intentionally keeps returning the static whitelist default, which drives the
|
||||
// download and update-check decisions.
|
||||
size_t highest = result.size();
|
||||
for (size_t i = 0; i < result.size(); ++i) {
|
||||
auto& info = result[i];
|
||||
info.is_installed = info.is_discovered ||
|
||||
BBLNetworkPlugin::versioned_library_exists(info.version);
|
||||
info.is_latest = false;
|
||||
if (info.suffix.empty() &&
|
||||
(highest == result.size() || info.version > result[highest].version))
|
||||
highest = i;
|
||||
}
|
||||
if (highest < result.size())
|
||||
result[highest].is_latest = true;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -386,6 +386,8 @@ struct NetworkLibraryVersionInfo {
|
||||
bool is_latest;
|
||||
std::string warning;
|
||||
bool is_discovered;
|
||||
// Whether the versioned library file for this entry is present on disk.
|
||||
bool is_installed = false;
|
||||
|
||||
static NetworkLibraryVersionInfo from_static(const NetworkLibraryVersion& v) {
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user