MCPcopy Create free account
hub / github.com/comaps/comaps / BuildSkinImpl

Function BuildSkinImpl

qt/build_style/build_skins.cpp:127–171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

125}
126
127void BuildSkinImpl(QString const & styleDir, QString const & suffix, int size, QString const & outputDir)
128{
129 QString const symbolsDir = JoinPathQt({styleDir, "symbols"});
130
131 // Check symbols directory exists
132 if (!QDir(symbolsDir).exists())
133 throw std::runtime_error("Symbols directory does not exist");
134
135 // Caller ensures that output directory is clear
136 if (QDir(outputDir).exists())
137 throw std::runtime_error("Output directory is not clear");
138
139 // Create output skin directory
140 if (!QDir().mkpath(outputDir))
141 throw std::runtime_error("Cannot create output skin directory");
142
143 // Create symbolic link for symbols/png
144 QString const pngOriginDir = styleDir + suffix;
145 QString const pngDir = JoinPathQt({styleDir, "symbols", "png"});
146 QFile::remove(pngDir);
147 if (!QFile::link(pngOriginDir, pngDir))
148 throw std::runtime_error("Unable to create symbols/png link");
149 RAII const cleaner([=]() { QFile::remove(pngDir); });
150
151 QString const strSize = QString::number(size);
152 // Run the script.
153 (void)ExecProcess(GetSkinGeneratorPath(), {
154 "--symbolWidth",
155 strSize,
156 "--symbolHeight",
157 strSize,
158 "--symbolsDir",
159 symbolsDir,
160 "--skinName",
161 JoinPathQt({outputDir, "basic"}),
162 "--skinSuffix=",
163 });
164
165 // Check if files were created.
166 if (QFile(JoinPathQt({outputDir, "symbols.png"})).size() == 0 ||
167 QFile(JoinPathQt({outputDir, "symbols.sdf"})).size() == 0)
168 {
169 throw std::runtime_error("Skin files have not been created");
170 }
171}
172
173void BuildSkins(QString const & styleDir, QString const & outputDir)
174{

Callers 1

BuildSkinsFunction · 0.85

Calls 4

JoinPathQtFunction · 0.85
ExecProcessFunction · 0.85
GetSkinGeneratorPathFunction · 0.85
sizeMethod · 0.45

Tested by

no test coverage detected