* Add OrcaCloud sync platform and preset bundle sharing system Introduce OrcaCloud, a cloud sync platform for user presets, alongside a preset bundle system that enables sharing printer/filament/process profiles as local exportable bundles or subscribed cloud bundles. OrcaCloud platform: - Auth to Orca Cloud - Encrypted token storage (file-based or system keychain) - User preset sync with - Profile migration from default/bambu folders on first login - Homepage integration with entrance to cloud.orcaslicer.com Preset bundles: - Local bundle import/export with bundle_structure.json metadata - Subscribed cloud bundles with version-based update checking - Thread-safe concurrent bundle access with read-write mutex - Canonical bundle preset naming (_local/<id>/... and _subscribed/<id>/...) - Bundle presets are read-only; grouped under subheaders in combo boxes - PresetBundleDialog with auto-sync toggle, refresh, update notifications - Hyperlinked bundle names to cloud bundle pages Co-authored-by: Sabriel Koh <sabrielkcr@gmail.com> Co-authored-by: Derrick <derrick992110@gmail.com> Co-authored-by: Mykola Nahirnyi <mnahirnyi@amcbridge.com> Co-authored-by: Ian Chua <iancrb00@gmail.com> Co-authored-by: Draginraptor <draginraptor@gmail.com> Co-authored-by: ExPikaPaka <112851715+ExPikaPaka@users.noreply.github.com> Co-authored-by: Ian Bassi <ian.bassi@outlook.com> Co-authored-by: Ocraftyone <Ocraftyone@users.noreply.github.com> Co-authored-by: yw4z <ywsyildiz@gmail.com> Co-authored-by: peterm-m <101202951+peterm-m@users.noreply.github.com> * Fixed an issue on Windows it failed to login Orca Cloud with Google account
102 lines
3.0 KiB
C++
102 lines
3.0 KiB
C++
#ifndef slic3r_PresetBundleDialog_hpp_
|
|
#define slic3r_PresetBundleDialog_hpp_
|
|
|
|
#include "GUI.hpp"
|
|
#include "GUI_Utils.hpp"
|
|
#include "libslic3r/AppConfig.hpp"
|
|
#include <boost/thread/detail/thread.hpp>
|
|
#include <libslic3r/PresetBundle.hpp>
|
|
#include <memory>
|
|
#include <slic3r/GUI/GUI.hpp>
|
|
#include <string>
|
|
#include <unordered_map>
|
|
#include <wx/dataview.h>
|
|
#include <wx/event.h>
|
|
#include <wx/language.h>
|
|
#include <wx/string.h>
|
|
#include <wx/fswatcher.h>
|
|
#include <wx/webview.h>
|
|
namespace Slic3r { namespace GUI {
|
|
|
|
#define DESIGN_GRAY900_COLOR wxColour("#363636") // Label color
|
|
#define DESIGN_GRAY600_COLOR wxColour("#ACACAC") // Dimmed text color
|
|
|
|
#define DESIGN_WINDOW_SIZE wxSize(FromDIP(640), FromDIP(640))
|
|
#define DESIGN_TITLE_SIZE wxSize(FromDIP(280), -1)
|
|
#define DESIGN_COMBOBOX_SIZE wxSize(FromDIP(120), -1)
|
|
#define DESIGN_LARGE_COMBOBOX_SIZE wxSize(FromDIP(120), -1)
|
|
#define DESIGN_INPUT_SIZE wxSize(FromDIP(120), -1)
|
|
#define DESIGN_LEFT_MARGIN 25
|
|
#define VERTICAL_GAP_SIZE FromDIP(4)
|
|
class PresetBundleDialog : public Slic3r::GUI::DPIDialog
|
|
{
|
|
public:
|
|
PresetBundleDialog(wxWindow* parent,
|
|
wxWindowID id = wxID_ANY,
|
|
const wxString& title = wxT(""),
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
const wxSize& size = wxDefaultSize,
|
|
long style = wxSYSTEM_MENU | wxCAPTION | wxCLOSE_BOX | wxMAXIMIZE_BOX);
|
|
|
|
~PresetBundleDialog();
|
|
|
|
void create();
|
|
|
|
bool DeleteBundleById(const wxString& id);
|
|
bool UnsubscribeBundleById(const std::string& id);
|
|
|
|
bool seq_top_layer_only_changed() const { return m_seq_top_layer_only_changed; }
|
|
bool recreate_GUI() const { return m_recreate_GUI; }
|
|
void on_dpi_changed(const wxRect& suggested_rect) override;
|
|
|
|
// webview utilities
|
|
void load_url(wxString& url);
|
|
void ListBundles();
|
|
void OpenFolder(const std::string& id);
|
|
void DeleteBundle(const std::string& id);
|
|
void UnsubscribeBundle(const std::string& id);
|
|
void OpenBundleOnCloud(const std::string& id);
|
|
|
|
void OnPresetBundlePage();
|
|
|
|
// sends command to webview
|
|
void RunScript(const wxString& s);
|
|
|
|
// webview events
|
|
void OnScriptMessage(wxWebViewEvent& e);
|
|
|
|
void StartDialogWorker();
|
|
void StopDialogWorker();
|
|
|
|
void RefreshBundleMap();
|
|
|
|
bool CheckUpdateCloud();
|
|
|
|
void OnBundleUpdate(wxCommandEvent& evt);
|
|
|
|
// true if b>a
|
|
bool CompareVer(const std::string& a, const std::string& b);
|
|
|
|
protected:
|
|
wxFileSystemWatcher* m_watcher = nullptr;
|
|
|
|
void OnFSWatch(wxFileSystemWatcherEvent& e);
|
|
|
|
bool m_seq_top_layer_only_changed{false};
|
|
bool m_recreate_GUI{false};
|
|
|
|
// Webview
|
|
wxWebView* m_browser{nullptr};
|
|
std::unordered_map<std::string, BundleMetadata> bundle_copy;
|
|
|
|
boost::thread m_dialog_worker_thread;
|
|
std::shared_ptr<int> m_dialog_worker_token;
|
|
std::atomic<bool> m_check_update_pending{false};
|
|
std::atomic<bool> m_update_bundles{false};
|
|
|
|
private:
|
|
Slic3r::AppConfig* app_config;
|
|
};
|
|
|
|
}} // namespace Slic3r::GUI
|
|
#endif |