| 1449 | } |
| 1450 | |
| 1451 | bool DocumentData::saveFromDataChecked() { |
| 1452 | const auto media = activeMediaView(); |
| 1453 | if (!media) { |
| 1454 | return false; |
| 1455 | } |
| 1456 | const auto bytes = media->bytes(); |
| 1457 | if (bytes.isEmpty()) { |
| 1458 | return false; |
| 1459 | } |
| 1460 | const auto path = DocumentFileNameForSave(this); |
| 1461 | if (path.isEmpty()) { |
| 1462 | return false; |
| 1463 | } |
| 1464 | auto file = QFile(path); |
| 1465 | if (!file.open(QIODevice::WriteOnly) |
| 1466 | || file.write(bytes) != bytes.size()) { |
| 1467 | return false; |
| 1468 | } |
| 1469 | file.close(); |
| 1470 | _location = Core::FileLocation(path); |
| 1471 | session().local().writeFileLocation(mediaKey(), _location); |
| 1472 | return true; |
| 1473 | } |
| 1474 | |
| 1475 | void DocumentData::refreshPossibleCoverThumbnail() { |
| 1476 | Expects(isSong()); |
nothing calls this directly
no test coverage detected