| 295 | } |
| 296 | |
| 297 | bool CliRemoteController::addPresetRule(const QString &keyValue) const |
| 298 | { |
| 299 | #ifdef USE_PULSEAUDIO |
| 300 | Log::error("This feature is only supported in the PipeWire version of JamesDSP"); |
| 301 | return false; |
| 302 | #endif |
| 303 | |
| 304 | QStringList split = keyValue.split("=", Qt::SkipEmptyParts); |
| 305 | if(split.count() < 2) { |
| 306 | Log::error("Invalid format. Expected input format: deviceId=presetName or deviceId:routeId=presetName"); |
| 307 | return false; |
| 308 | } |
| 309 | |
| 310 | QString deviceIdWithRoute = split.at(0); |
| 311 | QString preset = keyValue.mid(keyValue.indexOf('=') + 1); |
| 312 | |
| 313 | QString deviceId; |
| 314 | QString routeId; |
| 315 | |
| 316 | if(!parseDeviceAndRoute(deviceIdWithRoute, deviceId, routeId)) |
| 317 | return false; |
| 318 | |
| 319 | if(checkConnectionAndLog()) { |
| 320 | auto reply = service->setPresetRule(deviceId, deviceId, routeId, routeId, preset); |
| 321 | return handleVoidReply(reply); |
| 322 | } |
| 323 | |
| 324 | PresetManager::instance().addRule(PresetRule(deviceId, routeId, preset)); |
| 325 | return true; |
| 326 | } |
| 327 | |
| 328 | bool CliRemoteController::deletePresetRule(const QString &deviceIdWithRoute) const |
| 329 | { |
nothing calls this directly
no test coverage detected