MCPcopy Create free account
hub / github.com/TactilityProject/Tactility / save

Function save

Tactility/Source/settings/TouchCalibrationSettings.cpp:103–124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

101}
102
103bool save(const TouchCalibrationSettings& settings) {
104 if (settings.enabled && !isValid(settings)) {
105 return false;
106 }
107
108 std::map<std::string, std::string> map;
109 map[SETTINGS_KEY_ENABLED] = settings.enabled ? "1" : "0";
110 map[SETTINGS_KEY_X_MIN] = std::to_string(settings.xMin);
111 map[SETTINGS_KEY_X_MAX] = std::to_string(settings.xMax);
112 map[SETTINGS_KEY_Y_MIN] = std::to_string(settings.yMin);
113 map[SETTINGS_KEY_Y_MAX] = std::to_string(settings.yMax);
114
115 if (!file::savePropertiesFile(SETTINGS_FILE, map)) {
116 return false;
117 }
118
119 auto lock = cacheMutex.asScopedLock();
120 lock.lock();
121 cachedSettings = settings;
122 cacheInitialized = true;
123 return true;
124}
125
126TouchCalibrationSettings getActive() {
127 auto lock = cacheMutex.asScopedLock();

Callers

nothing calls this directly

Calls 4

savePropertiesFileFunction · 0.85
asScopedLockMethod · 0.80
isValidFunction · 0.70
lockMethod · 0.45

Tested by

no test coverage detected