Browse Source

Move skipLoadOnLaunch to settings namespace

tags/v1.0.0
Andrew Belt 5 years ago
parent
commit
669f00640f
4 changed files with 7 additions and 7 deletions
  1. +0
    -2
      include/context.hpp
  2. +1
    -0
      include/settings.hpp
  3. +3
    -3
      src/main.cpp
  4. +3
    -2
      src/settings.cpp

+ 0
- 2
include/context.hpp View File

@@ -19,8 +19,6 @@ struct Context {
Scene *scene = NULL;
Engine *engine = NULL;
Window *window = NULL;

bool skipLoadOnLaunch = false;
};




+ 1
- 0
include/settings.hpp View File

@@ -16,6 +16,7 @@ extern float wireTension;
extern bool powerMeter;
extern bool lockModules;
extern bool checkVersion;
extern bool skipLoadOnLaunch;


} // namespace settings


+ 3
- 3
src/main.cpp View File

@@ -88,10 +88,10 @@ int main(int argc, char *argv[]) {

if (patchFile.empty()) {
// To prevent launch crashes, if Rack crashes between now and 15 seconds from now, the "skipAutosaveOnLaunch" property will remain in settings.json, so that in the next launch, the broken autosave will not be loaded.
bool oldSkipLoadOnLaunch = context()->skipLoadOnLaunch;
context()->skipLoadOnLaunch = true;
bool oldSkipLoadOnLaunch = settings::skipLoadOnLaunch;
settings::skipLoadOnLaunch = true;
settings::save(asset::user("settings.json"));
context()->skipLoadOnLaunch = false;
settings::skipLoadOnLaunch = false;
if (oldSkipLoadOnLaunch && osdialog_message(OSDIALOG_INFO, OSDIALOG_YES_NO, "Rack has recovered from a crash, possibly caused by a faulty module in your patch. Clear your patch and start over?")) {
context()->scene->rackWidget->lastPath = "";
}


+ 3
- 2
src/settings.cpp View File

@@ -57,7 +57,7 @@ static json_t *settingsToJson() {
json_object_set_new(rootJ, "lastPath", lastPathJ);

// skipLoadOnLaunch
if (context()->skipLoadOnLaunch) {
if (skipLoadOnLaunch) {
json_object_set_new(rootJ, "skipLoadOnLaunch", json_true());
}

@@ -130,7 +130,7 @@ static void settingsFromJson(json_t *rootJ) {
// skipLoadOnLaunch
json_t *skipLoadOnLaunchJ = json_object_get(rootJ, "skipLoadOnLaunch");
if (skipLoadOnLaunchJ)
context()->skipLoadOnLaunch = json_boolean_value(skipLoadOnLaunchJ);
skipLoadOnLaunch = json_boolean_value(skipLoadOnLaunchJ);

// moduleBrowser
json_t *moduleBrowserJ = json_object_get(rootJ, "moduleBrowser");
@@ -189,6 +189,7 @@ float wireTension = 0.5;
bool powerMeter = false;
bool lockModules = false;
bool checkVersion = true;
bool skipLoadOnLaunch = false;


} // namespace settings


Loading…
Cancel
Save