mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-23 16:51:21 -06:00
PresetUpdater: Notify about Slic3r updates
This commit is contained in:
parent
6286c9ee7c
commit
df03b8e4e8
11 changed files with 119 additions and 87 deletions
|
|
@ -51,7 +51,7 @@ void AppConfig::set_defaults()
|
|||
set("version_check", "1");
|
||||
// TODO: proper URL
|
||||
if (get("version_check_url").empty())
|
||||
set("version_check_url", "https://gist.githubusercontent.com/vojtechkral/4d8fd4a3b8699a01ec892c264178461c/raw/e9187c3e15ceaf1a90f29b7c43cf3ccc746140f0/slic3rPE.version");
|
||||
set("version_check_url", "https://gist.githubusercontent.com/vojtechkral/4d8fd4a3b8699a01ec892c264178461c/raw/2f05a64db19e45a7f8fe2cedeff555d544af679b/slic3rPE.version");
|
||||
if (get("preset_update").empty())
|
||||
set("preset_update", "1");
|
||||
|
||||
|
|
@ -230,33 +230,6 @@ void AppConfig::reset_selections()
|
|||
}
|
||||
}
|
||||
|
||||
bool AppConfig::version_check_enabled() const
|
||||
{
|
||||
return get("version_check") == "1";
|
||||
}
|
||||
|
||||
bool AppConfig::slic3r_update_avail() const
|
||||
{
|
||||
// FIXME: Update with Semver
|
||||
// TODO: probably need to move semver to libslic3r
|
||||
return version_check_enabled() && get("version_online") != SLIC3R_VERSION;
|
||||
}
|
||||
|
||||
Semver AppConfig::get_slic3r_version() const
|
||||
{
|
||||
auto res = Semver::parse(get("version"));
|
||||
if (! res) {
|
||||
throw std::runtime_error(std::string("Could not parse Slic3r version string in application config."));
|
||||
} else {
|
||||
return *res;
|
||||
}
|
||||
}
|
||||
|
||||
void AppConfig::set_slic3r_version(const Semver &version)
|
||||
{
|
||||
set("version", version.to_string());
|
||||
}
|
||||
|
||||
std::string AppConfig::config_path()
|
||||
{
|
||||
return (boost::filesystem::path(Slic3r::data_dir()) / "slic3r.ini").make_preferred().string();
|
||||
|
|
|
|||
|
|
@ -90,12 +90,6 @@ public:
|
|||
// the first non-default preset when called.
|
||||
void reset_selections();
|
||||
|
||||
// Whether the Slic3r version available online differs from this one
|
||||
bool version_check_enabled() const;
|
||||
bool slic3r_update_avail() const;
|
||||
Semver get_slic3r_version() const;
|
||||
void set_slic3r_version(const Semver &version);
|
||||
|
||||
// Get the default config path from Slic3r::data_dir().
|
||||
static std::string config_path();
|
||||
|
||||
|
|
|
|||
|
|
@ -721,7 +721,7 @@ void ConfigWizard::priv::apply_config(AppConfig *app_config, PresetBundle *prese
|
|||
install_bundles.emplace_back(vendor_rsrc.second);
|
||||
}
|
||||
if (install_bundles.size() > 0) {
|
||||
updater->install_bundles_rsrc(app_config, std::move(install_bundles));
|
||||
updater->install_bundles_rsrc(std::move(install_bundles));
|
||||
}
|
||||
|
||||
app_config->set_vendors(appconfig_vendors);
|
||||
|
|
|
|||
|
|
@ -695,19 +695,6 @@ static void flatten_configbundle_hierarchy(boost::property_tree::ptree &tree)
|
|||
flatten_configbundle_hierarchy(tree, "printer");
|
||||
}
|
||||
|
||||
// Load a config bundle file, into presets and store the loaded presets into separate files
|
||||
// of the local configuration directory.
|
||||
void PresetBundle::install_vendor_configbundle(const std::string &src_path0)
|
||||
{
|
||||
boost::filesystem::path src_path(src_path0);
|
||||
install_vendor_configbundle(src_path);
|
||||
}
|
||||
|
||||
void PresetBundle::install_vendor_configbundle(const boost::filesystem::path &src_path)
|
||||
{
|
||||
boost::filesystem::copy_file(src_path, (boost::filesystem::path(data_dir()) / "vendor" / src_path.filename()).make_preferred(), boost::filesystem::copy_option::overwrite_if_exists);
|
||||
}
|
||||
|
||||
// Load a config bundle file, into presets and store the loaded presets into separate files
|
||||
// of the local configuration directory.
|
||||
size_t PresetBundle::load_configbundle(const std::string &path, unsigned int flags)
|
||||
|
|
|
|||
|
|
@ -92,10 +92,6 @@ public:
|
|||
// Load the config bundle, store it to the user profile directory by default.
|
||||
size_t load_configbundle(const std::string &path, unsigned int flags = LOAD_CFGBNDLE_SAVE);
|
||||
|
||||
// Install the Vendor specific config bundle into user's directory.
|
||||
void install_vendor_configbundle(const std::string &src_path);
|
||||
static void install_vendor_configbundle(const boost::filesystem::path &src_path);
|
||||
|
||||
// Export a config bundle file containing all the presets and the names of the active presets.
|
||||
void export_configbundle(const std::string &path); // , const DynamicPrintConfig &settings);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue