Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mumble-voip/mumble.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKissaki <kissaki@gmx.de>2013-06-16 01:31:11 +0400
committerKissaki <kissaki@gmx.de>2013-06-16 01:31:11 +0400
commitd74b5b04db4f24eadcbfd3aa86bd53779cbc8d97 (patch)
treefa875e1f44350c85f34f533603db08dbcf847abf /scripts
parentf92455b513f912b203865b1a841288a4c06b72f0 (diff)
IconSync.cpp: Move Icon creation script
* Move Icon creation script/program to the scripts folder. It is definitely not a test. * Introduce scripts/development folder for development scripts, in contrary to scripts/server for example.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/development/IconSync.cpp66
-rw-r--r--scripts/development/IconSync.pro9
2 files changed, 75 insertions, 0 deletions
diff --git a/scripts/development/IconSync.cpp b/scripts/development/IconSync.cpp
new file mode 100644
index 000000000..48815be46
--- /dev/null
+++ b/scripts/development/IconSync.cpp
@@ -0,0 +1,66 @@
+#include <QtCore>
+#include <QtNetwork>
+#include <QtGui>
+#include <QtSvg>
+
+void svg2png(const QString & svgpath, const QList<int> & sizes, QStringList & qslImages)
+{
+ QSvgRenderer svg(svgpath);
+ QImage original(512, 512, QImage::Format_ARGB32);
+ original.fill(Qt::transparent);
+
+ QPainter painter(&original);
+ painter.setRenderHint(QPainter::Antialiasing);
+ painter.setRenderHint(QPainter::TextAntialiasing);
+ painter.setRenderHint(QPainter::SmoothPixmapTransform);
+ painter.setRenderHint(QPainter::HighQualityAntialiasing);
+ svg.render(&painter);
+
+ foreach(int size, sizes) {
+ QImage img = original.scaled(size,size,Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
+ QString png = QDir::temp().absoluteFilePath(QString::fromLatin1("mumble.%1.png").arg(size));
+
+ QImageWriter qiw(png);
+ qiw.write(img);
+
+ qslImages << png;
+ }
+}
+
+int main(int argc, char **argv) {
+ QCoreApplication a(argc, argv);
+
+
+ QStringList qslImages;
+
+ QString svgSmallPath = QLatin1String("../../icons/mumble_small.svg");
+ QList<int> sizesSmall;
+ sizesSmall << 16;
+ sizesSmall << 24;
+ svg2png(svgSmallPath, sizesSmall, qslImages);
+
+ QLatin1String svgPath("../../icons/mumble.svg");
+ QList<int> sizes;
+ sizes << 32;
+ sizes << 48;
+ sizes << 64;
+ sizes << 96;
+ sizes << 128;
+ sizes << 256;
+ svg2png(svgPath, sizes, qslImages);
+
+
+ QStringList args;
+ args << qslImages;
+ args << QDir::current().absoluteFilePath("../../icons/mumble.ico");
+
+ qWarning() << args;
+
+ QProcess qp;
+ qp.setProcessChannelMode(QProcess::ForwardedChannels);
+ qp.start("/usr/bin/convert", args);
+ if (! qp.waitForFinished())
+ qWarning() << "No finish";
+ foreach(const QString &png, qslImages)
+ QDir::temp().remove(png);
+}
diff --git a/scripts/development/IconSync.pro b/scripts/development/IconSync.pro
new file mode 100644
index 000000000..0d2829bc1
--- /dev/null
+++ b/scripts/development/IconSync.pro
@@ -0,0 +1,9 @@
+include(../../compiler.pri)
+
+TEMPLATE = app
+CONFIG += qt thread warn_on debug console
+CONFIG -= app_bundle
+QT += network gui svg
+LANGUAGE = C++
+TARGET = IconSync
+SOURCES = IconSync.cpp