2018-03-13 11:39:57 +00:00
|
|
|
#ifndef slic3r_PresetUpdate_hpp_
|
|
|
|
#define slic3r_PresetUpdate_hpp_
|
|
|
|
|
|
|
|
#include <memory>
|
2018-04-16 14:52:11 +00:00
|
|
|
#include <vector>
|
2018-03-13 11:39:57 +00:00
|
|
|
|
2019-02-18 12:54:20 +00:00
|
|
|
#include <wx/event.h>
|
|
|
|
|
2018-03-13 11:39:57 +00:00
|
|
|
namespace Slic3r {
|
|
|
|
|
|
|
|
|
|
|
|
class AppConfig;
|
|
|
|
class PresetBundle;
|
2019-12-05 12:05:36 +00:00
|
|
|
class Semver;
|
2018-03-13 11:39:57 +00:00
|
|
|
|
|
|
|
class PresetUpdater
|
|
|
|
{
|
|
|
|
public:
|
2018-09-20 23:33:41 +00:00
|
|
|
PresetUpdater();
|
2018-03-13 11:39:57 +00:00
|
|
|
PresetUpdater(PresetUpdater &&) = delete;
|
|
|
|
PresetUpdater(const PresetUpdater &) = delete;
|
|
|
|
PresetUpdater &operator=(PresetUpdater &&) = delete;
|
|
|
|
PresetUpdater &operator=(const PresetUpdater &) = delete;
|
|
|
|
~PresetUpdater();
|
|
|
|
|
2018-04-23 09:16:47 +00:00
|
|
|
// If either version check or config updating is enabled, get the appropriate data in the background and cache it.
|
2018-04-17 14:59:53 +00:00
|
|
|
void sync(PresetBundle *preset_bundle);
|
2018-04-23 09:16:47 +00:00
|
|
|
|
|
|
|
// If version check is enabled, check if chaced online slic3r version is newer, notify if so.
|
2018-04-17 14:59:53 +00:00
|
|
|
void slic3r_update_notify();
|
2018-04-23 09:16:47 +00:00
|
|
|
|
2019-05-17 15:35:15 +00:00
|
|
|
enum UpdateResult {
|
|
|
|
R_NOOP,
|
|
|
|
R_INCOMPAT_EXIT,
|
|
|
|
R_INCOMPAT_CONFIGURED,
|
|
|
|
R_UPDATE_INSTALLED,
|
|
|
|
R_UPDATE_REJECT,
|
2020-08-03 13:36:55 +00:00
|
|
|
R_UPDATE_NOTIFICATION
|
2019-05-17 15:35:15 +00:00
|
|
|
};
|
|
|
|
|
2018-04-23 09:16:47 +00:00
|
|
|
// If updating is enabled, check if updates are available in cache, if so, ask about installation.
|
2018-04-24 16:06:42 +00:00
|
|
|
// A false return value implies Slic3r should exit due to incompatibility of configuration.
|
2019-12-05 10:04:18 +00:00
|
|
|
// Providing old slic3r version upgrade profiles on upgrade of an application even in case
|
|
|
|
// that the config index installed from the Internet is equal to the index contained in the installation package.
|
2020-08-03 13:36:55 +00:00
|
|
|
// no_notification = force modal textbox, otherwise some cases only shows notification
|
|
|
|
UpdateResult config_update(const Semver &old_slic3r_version, bool no_notification) const;
|
2018-04-23 09:16:47 +00:00
|
|
|
|
|
|
|
// "Update" a list of bundles from resources (behaves like an online update).
|
2018-04-24 16:06:42 +00:00
|
|
|
void install_bundles_rsrc(std::vector<std::string> bundles, bool snapshot = true) const;
|
2020-08-03 13:36:55 +00:00
|
|
|
|
|
|
|
void on_update_notification_confirm();
|
2018-03-13 11:39:57 +00:00
|
|
|
private:
|
|
|
|
struct priv;
|
|
|
|
std::unique_ptr<priv> p;
|
|
|
|
};
|
|
|
|
|
2019-02-14 15:51:41 +00:00
|
|
|
wxDECLARE_EVENT(EVT_SLIC3R_VERSION_ONLINE, wxCommandEvent);
|
|
|
|
|
2018-03-13 11:39:57 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
#endif
|