Configuration updates downloading

This commit is contained in:
Vojtech Kral 2018-04-13 15:08:58 +02:00
parent b49b59cbb2
commit 7dbb2ed6a3
12 changed files with 148 additions and 119 deletions

View file

@ -46,11 +46,15 @@ void AppConfig::set_defaults()
set("no_defaults", "1");
if (get("show_incompatible_presets").empty())
set("show_incompatible_presets", "0");
// Version check is enabled by default in the config, but it is not implemented yet. // XXX
if (get("version_check").empty())
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");
if (get("preset_update").empty())
set("preset_update", "1");
// Use OpenGL 1.1 even if OpenGL 2.0 is available. This is mainly to support some buggy Intel HD Graphics drivers.
// https://github.com/prusa3d/Slic3r/issues/233
if (get("use_legacy_opengl").empty())

View file

@ -86,9 +86,6 @@ ConfigSnapshotDialog::ConfigSnapshotDialog(const Config::SnapshotDB &snapshot_db
html->SetFonts(font.GetFaceName(), font.GetFaceName(), size);
html->SetBorders(2);
std::string text = generate_html_page(snapshot_db);
FILE *file = ::fopen("d:\\temp\\configsnapshotdialog.html", "wt");
fwrite(text.data(), 1, text.size(), file);
fclose(file);
html->SetPage(text.c_str());
vsizer->Add(html, 1, wxEXPAND | wxALIGN_LEFT | wxRIGHT | wxBOTTOM, 0);
html->Bind(wxEVT_HTML_LINK_CLICKED, &ConfigSnapshotDialog::onLinkClicked, this);

View file

@ -660,7 +660,8 @@ void ConfigWizard::priv::apply_config(AppConfig *app_config, PresetBundle *prese
app_config->set_vendors(appconfig_vendors);
app_config->set("version_check", page_update->version_check ? "1" : "0");
app_config->set("preset_update", page_update->preset_update ? "1" : "0");
app_config->reset_selections(); // XXX: only on "fresh start"?
app_config->reset_selections();
// ^ TODO: replace with appropriate printer selection
preset_bundle->load_presets(*app_config);
} else {
for (ConfigWizardPage *page = page_firmware; page != nullptr; page = page->page_next()) {

View file

@ -17,7 +17,6 @@
#include "libslic3r/PrintConfig.hpp"
#include "AppConfig.hpp"
#include "Preset.hpp"
// #include "PresetBundle.hpp"
#include "BedShapeDialog.hpp"
namespace fs = boost::filesystem;
@ -173,9 +172,8 @@ private:
struct ConfigWizard::priv
{
ConfigWizard *q;
AppConfig appconfig_vendors;
// PresetBundle bundle_vendors;
std::unordered_map<std::string, VendorProfile> vendors;
AppConfig appconfig_vendors; // TODO: use order-preserving container
std::unordered_map<std::string, VendorProfile> vendors; // TODO: just set?
std::unordered_map<std::string, fs::path> vendors_rsrc;
std::unique_ptr<DynamicPrintConfig> custom_config;