| 101 | } |
| 102 | |
| 103 | bool 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 | |
| 126 | TouchCalibrationSettings getActive() { |
| 127 | auto lock = cacheMutex.asScopedLock(); |
nothing calls this directly
no test coverage detected