MCPcopy Create free account
hub / github.com/YACReader/yacreader / writeSvg

Function writeSvg

common/themes/icon_utils.cpp:41–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39}
40
41QString 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
66QString recolorSvgXML(QString &svg,
67 const QString &placeHolder,

Callers 1

recoloredSvgToThemeFileFunction · 0.85

Calls 4

isEmptyMethod · 0.80
writeMethod · 0.80
openMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected