MCPcopy Create free account
hub / github.com/ckaiser/Lightscreen / optimize

Method optimize

tools/screenshot.cpp:168–194  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

166}
167
168void Screenshot::optimize()
169{
170 QProcess *process = new QProcess(this);
171
172 // Delete the QProcess once it's done.
173 connect(process, SIGNAL(finished(int, QProcess::ExitStatus)), this , SLOT(optimizationDone()));
174 connect(process, SIGNAL(finished(int, QProcess::ExitStatus)), process, SLOT(deleteLater()));
175
176 QString optiPNG;
177
178#ifdef Q_OS_UNIX
179 optiPNG = "optipng";
180#else
181 optiPNG = qApp->applicationDirPath() % QDir::separator() % "optipng.exe";
182#endif
183
184 if (!QFile::exists(optiPNG)) {
185 emit optimizationDone();
186 }
187
188 process->start(optiPNG, QStringList() << mOptions.fileName);
189
190 if (process->state() == QProcess::NotRunning) {
191 emit optimizationDone();
192 process->deleteLater();
193 }
194}
195
196void Screenshot::optimizationDone()
197{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected