|
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- #pragma once
- #include <jansson.h>
-
- #include <common.hpp>
-
-
- namespace rack {
-
-
- struct PatchManager {
- struct Internal;
- Internal* internal;
-
- /** The currently loaded patch file path */
- std::string path;
- /** Path to autosave dir */
- std::string autosavePath;
- /** Path to user template patch */
- std::string templatePath;
- /** Path to factory template patch */
- std::string factoryTemplatePath;
- /** Append to this while loading/saving a patch to display messages to the user after success. */
- std::string warningLog;
-
- PatchManager();
- ~PatchManager();
- void launch(std::string pathArg);
- /** Clears the patch. */
- void clear();
- /** Saves the patch and nothing else. */
- void save(std::string path);
- void saveDialog();
- void saveAsDialog();
- void saveTemplateDialog();
- void saveAutosave();
- void cleanAutosave();
- /** Loads a patch and nothing else.
- Returns whether the patch was loaded successfully.
- */
- void load(std::string path);
- /** Loads the template patch. */
- void loadTemplate();
- void loadTemplateDialog();
- bool hasAutosave();
- void loadAutosave();
- /** Loads a patch, sets the current path, and updates the recent patches. */
- void loadAction(std::string path);
- void loadDialog();
- void loadPathDialog(std::string path);
- /** Asks the user to reload the current patch. */
- void revertDialog();
- void pushRecentPath(std::string path);
- /** Disconnects all cables. */
- void disconnectDialog();
-
- json_t* toJson();
- void fromJson(json_t* rootJ);
- void log(std::string msg);
- };
-
-
- } // namespace rack
|