REALLY removed .gitignore %-)
[xcurtheme.git] / tools / cursorFXconvert / main.cpp
blob6b04816ee456fa4bafc8c5f5783445bbc95d4869
1 /* coded by Ketmar // Vampire Avalon (psyc://ketmar.no-ip.org/~Ketmar)
3 * This program is free software. It comes without any warranty, to
4 * the extent permitted by applicable law. You can redistribute it
5 * and/or modify it under the terms of the Do What The Fuck You Want
6 * To Public License, Version 2, as published by Sam Hocevar. See
7 * http://sam.zoy.org/wtfpl/COPYING for more details.
8 */
9 #include <QDebug>
10 //#include <QtCore>
12 #include "main.h"
14 #include <QApplication>
15 #include <QStringList>
16 #include <QTextCodec>
17 #include <QTextStream>
19 #include <QDir>
22 #include "xcrimg.h"
23 #include "xcrxcur.h"
24 #include "xcrtheme.h"
25 #include "xcrthemefx.h"
28 ///////////////////////////////////////////////////////////////////////////////
29 int main (int argc, char *argv[]) {
30 //QTextCodec::setCodecForCStrings(QTextCodec::codecForName("koi8-r"));
31 //QTextCodec::setCodecForLocale(QTextCodec::codecForName("koi8-r"));
32 QApplication app(argc, argv);
34 //QString inFName("Hand.CursorFX");
35 QString inFName("Intoxica.CursorFX");
36 if (argc > 1) inFName = argv[1];
38 XCursorThemeFX *ct = new XCursorThemeFX(inFName);
40 if (ct->count()) {
41 QString outFName(inFName);
42 if (argc > 2) outFName = argv[2];
43 else {
44 int slashPos = outFName.lastIndexOf('/');
45 if (slashPos >= 0) outFName.remove(0, slashPos);
46 if (outFName.endsWith(".CursorFX", Qt::CaseInsensitive)) outFName.chop(9);
47 else outFName += ".xcur";
50 QDir dd(".");
51 dd.mkdir(outFName);
52 dd.cd(outFName);
53 ct->writeToDir(dd);
54 dd.cd("..");
56 if (!packXCursorTheme(outFName+".tgz", dd, outFName, true)) {
57 fprintf(stderr, "ERROR: can't pack theme!\n");
58 } else {
59 printf("theme tarball sucessfully created.\n");
61 } else {
62 fprintf(stderr, "ERROR: can't load theme!\n");
65 delete ct;
67 return 0;