MCPcopy Create free account
hub / github.com/deskflow/deskflow / getOptionValue

Method getOptionValue

src/lib/server/Config.cpp:1263–1325  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1261}
1262
1263std::string Config::getOptionValue(OptionID id, OptionValue value)
1264{
1265 if (id == kOptionHalfDuplexCapsLock || id == kOptionHalfDuplexNumLock || id == kOptionHalfDuplexScrollLock ||
1266 id == kOptionScreenSwitchNeedsShift || id == kOptionScreenSwitchNeedsControl ||
1267 id == kOptionScreenSwitchNeedsAlt || id == kOptionXTestXineramaUnaware || id == kOptionRelativeMouseMoves ||
1268 id == kOptionWin32KeepForeground || id == kOptionScreenPreserveFocus || id == kOptionClipboardSharing ||
1269 id == kOptionClipboardSharingSize) {
1270 return (value != 0) ? "true" : "false";
1271 }
1272 if (id == kOptionModifierMapForShift || id == kOptionModifierMapForControl || id == kOptionModifierMapForAlt ||
1273 id == kOptionModifierMapForAltGr || id == kOptionModifierMapForMeta || id == kOptionModifierMapForSuper) {
1274 switch (value) {
1275 case kKeyModifierIDShift:
1276 return "shift";
1277
1278 case kKeyModifierIDControl:
1279 return "ctrl";
1280
1281 case kKeyModifierIDAlt:
1282 return "alt";
1283
1284 case kKeyModifierIDAltGr:
1285 return "altgr";
1286
1287 case kKeyModifierIDMeta:
1288 return "meta";
1289
1290 case kKeyModifierIDSuper:
1291 return "super";
1292
1293 default:
1294 return "none";
1295 }
1296 }
1297 if (id == kOptionHeartbeat || id == kOptionScreenSwitchCornerSize || id == kOptionScreenSwitchDelay ||
1298 id == kOptionScreenSwitchTwoTap) {
1299 return deskflow::string::sprintf("%d", value);
1300 }
1301 if (id == kOptionScreenSwitchCorners) {
1302 std::string result("none");
1303 if ((value & s_topLeftCornerMask) != 0) {
1304 result += " +top-left";
1305 }
1306 if ((value & s_topRightCornerMask) != 0) {
1307 result += " +top-right";
1308 }
1309 if ((value & s_bottomLeftCornerMask) != 0) {
1310 result += " +bottom-left";
1311 }
1312 if ((value & s_bottomRightCornerMask) != 0) {
1313 result += " +bottom-right";
1314 }
1315 return result;
1316 }
1317 if (id == kOptionProtocol) {
1318 const auto enumValue = networkProtocolFromInt(value);
1319 if (enumValue == NetworkProtocol::Unknown)
1320 throw InvalidProtocolException();

Callers

nothing calls this directly

Calls 4

sprintfFunction · 0.85
networkProtocolFromIntFunction · 0.85
networkProtocolToOptionFunction · 0.85

Tested by

no test coverage detected