1727{
1728 if (!
p->enabled_config_update) {
return R_NOOP; }
1729
1730 auto updates =
p->get_config_updates(old_slic3r_version);
1731
1732 if (updates.updates.size() > 0) {
1733
1734 bool force_update = false;
1735 for (const auto& update : updates.updates) {
1736 force_update = (update.forced_update ? true : force_update);
1737 }
1738
1739
1740 if (force_update)
1741 {
1742 BOOST_LOG_TRIVIAL(info) <<
format(
"[Orca Updater]:Force updating will start, size %1% ", updates.updates.size());
1743 std::vector<std::string> bundles;
1744 for (const auto& update : updates.updates) {
1745 if (update.is_directory)
1746 continue;
1747 bundles.push_back(update.vendor);
1748 }
1749 bool ret =
p->perform_updates(std::move(updates));
1750 if (!ret) {
1751 BOOST_LOG_TRIVIAL(warning) <<
format(
"[Orca Updater]:perform_updates failed");
1753 }
1754
1756 if (!ret) {
1757 BOOST_LOG_TRIVIAL(warning) <<
format(
"[Orca Updater]:reload_configs_update_gui failed");
1759 }
1760 for(auto b : bundles){
1761 Semver cur_ver = GUI::wxGetApp().preset_bundle->get_vendor_profile_version(b);
1762 GUI::wxGetApp()
1763 .plater()
1764 ->get_notification_manager()
1767 Slic3r::format(
_u8L(
"Configuration package: %1% updated to %2%"), b, cur_ver.to_string()));
1768 }
1770 }
1771
1772
1774 p->set_waiting_updates(updates);
1776 }
1777 else {
1778 BOOST_LOG_TRIVIAL(info) <<
format(
"[Orca Updater]:Configuration package available. size %1%, need to confirm...",
p->waiting_updates.updates.size());
1779
1780 std::vector<GUI::MsgUpdateConfig::Update> updates_msg;
1781 for (const auto& update : updates.updates) {
1782 if (update.is_directory)
1783 continue;
1784 std::string changelog = update.change_log;
1785 updates_msg.emplace_back(update.vendor, update.version.config_version, update.descriptions, std::move(changelog));
1786 }
1787
1789
1790 const auto res = dlg.ShowModal();
1791 if (res == wxID_OK) {
1792 BOOST_LOG_TRIVIAL(debug) << "[Orca Updater]:selected yes to update";
1793 if (!
p->perform_updates(std::move(updates)) ||
1797 }
1798 else {
1799 BOOST_LOG_TRIVIAL(info) << "[Orca Updater]:selected no for updating";
1803 }
1804 }
1805
1806
1807 } else {
1808 BOOST_LOG_TRIVIAL(info) << "[Orca Updater]:No configuration updates available.";
1809 }
1810
1812}
@ ImportantNotificationLevel
Definition NotificationManager.hpp:222
@ FORCED_BEFORE_WIZARD
Definition PresetUpdater.hpp:50
@ SHOW_NOTIFICATION
Definition PresetUpdater.hpp:49
@ PresetUpdateAvailable
Definition NotificationManager.hpp:87
@ PresetUpdateFinished
Definition NotificationManager.hpp:88
static bool reload_configs_update_gui()
Definition PresetUpdater.cpp:1708
std::string format(const char *fmt, TArgs &&... args)
Definition format.hpp:45
#define _u8L(s)
Definition I18N.hpp:11