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.
14 #include <QApplication>
15 #include <QStringList>
17 #include <QTextStream>
25 #include "xcrthemefx.h"
26 #include "xcrthemexp.h"
29 ///////////////////////////////////////////////////////////////////////////////
30 static XCursorTheme
*loadTheme (const QString
&fname
) {
33 if (fname
.endsWith(".CursorFX", Qt::CaseInsensitive
)) {
34 ct
= new XCursorThemeFX(fname
);
35 } else if (fname
.endsWith(".CurXPTheme", Qt::CaseInsensitive
)) {
36 ct
= new XCursorThemeXP(fname
);
39 if (ct
&& !ct
->count()) { delete ct
; ct
= 0; }
44 ///////////////////////////////////////////////////////////////////////////////
45 int main (int argc
, char *argv
[]) {
46 QTextCodec::setCodecForCStrings(QTextCodec::codecForName("koi8-r"));
47 QTextCodec::setCodecForLocale(QTextCodec::codecForName("koi8-r"));
49 QApplication
app(argc
, argv
);
51 bool doPack
= false, doRemove
= false;
53 while (argNo
< argc
) {
54 if (!strcmp(argv
[argNo
], "-p")) doPack
= true;
55 else if (!strcmp(argv
[argNo
], "-P")) doPack
= doRemove
= true;
61 fprintf(stderr
, "usage: %s [-p] [-P] file [file...]\n", argv
[0]);
67 while (argNo
< argc
) {
68 QString
fn(argv
[argNo
++]);
70 if (fi
.exists() && fi
.isReadable()) flist
<< fn
;
72 flist
.removeDuplicates();
74 foreach (const QString
&fn
, flist
) {
75 XCursorTheme
*ct
= loadTheme(fn
);
80 outFName
.truncate(outFName
.lastIndexOf('.'));
85 if (dd
.cd(outFName
)) {
90 if (!packXCursorTheme(outFName
+".tgz", dd
, outFName
, doRemove
)) {
91 fprintf(stderr
, "ERROR: can't pack theme %s!\n", outFName
.toLocal8Bit().constData());
93 printf("theme %s.tgz sucessfully created.\n", outFName
.toLocal8Bit().constData());