Browse Source

Add "checkAppUpdates" setting.

tags/v2.0.0
Andrew Belt 4 years ago
parent
commit
7a95b6829c
3 changed files with 14 additions and 4 deletions
  1. +1
    -0
      include/settings.hpp
  2. +6
    -4
      src/library.cpp
  3. +7
    -0
      src/settings.cpp

+ 1
- 0
include/settings.hpp View File

@@ -53,6 +53,7 @@ extern std::list<std::string> recentPatchPaths;
extern std::vector<NVGcolor> cableColors;
// pluginSlug -> moduleSlugs
extern std::map<std::string, std::set<std::string>> moduleWhitelist;
extern bool checkAppUpdates;

json_t* toJson();
void fromJson(json_t* rootJ);


+ 6
- 4
src/library.cpp View File

@@ -23,10 +23,12 @@ void init() {
if (settings::devMode)
return;

std::thread t([&]() {
queryAppUpdate();
});
t.detach();
if (settings::checkAppUpdates) {
std::thread t([&]() {
queryAppUpdate();
});
t.detach();
}

std::thread t2([&] {
queryUpdates();


+ 7
- 0
src/settings.cpp View File

@@ -50,6 +50,7 @@ std::vector<NVGcolor> cableColors = {
color::fromHexString("#8c1889ff"), // purple
};
std::map<std::string, std::set<std::string>> moduleWhitelist = {};
bool checkAppUpdates = true;


json_t* toJson() {
@@ -119,6 +120,8 @@ json_t* toJson() {
}
json_object_set_new(rootJ, "moduleWhitelist", moduleWhitelistJ);

json_object_set_new(rootJ, "checkAppUpdates", json_boolean(checkAppUpdates));

return rootJ;
}

@@ -242,6 +245,10 @@ void fromJson(json_t* rootJ) {
}
}
}

json_t* checkAppUpdatesJ = json_object_get(rootJ, "checkAppUpdates");
if (checkAppUpdatesJ)
checkAppUpdates = json_boolean_value(checkAppUpdatesJ);
}

void save(const std::string& path) {


Loading…
Cancel
Save