| 39 | } |
| 40 | |
| 41 | QString writeSvg(const QString &svg, const QString &resourcePath, const QString &themeName, const RecolorOptions &options) |
| 42 | { |
| 43 | const QString basePath = YACReader::getSettingsPath() + "/themes/" + themeName; |
| 44 | |
| 45 | QDir().mkpath(basePath); |
| 46 | |
| 47 | QString outFileName = options.fileName.isEmpty() ? QFileInfo(resourcePath).completeBaseName() : options.fileName; |
| 48 | if (!options.suffix.isEmpty()) { |
| 49 | outFileName += options.suffix; |
| 50 | } |
| 51 | outFileName += "." + QFileInfo(resourcePath).suffix(); |
| 52 | const QString outPath = basePath + "/" + outFileName; |
| 53 | |
| 54 | QFile out(outPath); |
| 55 | if (!out.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)) { |
| 56 | qWarning() << "Failed to write SVG:" << outPath; |
| 57 | return { }; |
| 58 | } |
| 59 | |
| 60 | out.write(svg.toUtf8()); |
| 61 | out.close(); |
| 62 | |
| 63 | return outPath; |
| 64 | } |
| 65 | |
| 66 | QString recolorSvgXML(QString &svg, |
| 67 | const QString &placeHolder, |
no test coverage detected