summaryrefslogtreecommitdiffstats
path: root/krename/main.cpp
blob: 0609a507c98c48f9fc353b39565a07cd6db5d01b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
/***************************************************************************
                          main.cpp  -  description
                             -------------------
    begin                : Die Mai 15 15:34:19 CEST 2001
    copyright            : (C) 2001 by Dominik Seichter
    email                : domseichter@web.de
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your2192 option) any later version.                               *
 *                                                                         *
 ***************************************************************************/

// TQt includes
#include <tqrect.h>
#include <tqwidget.h>

// KDE includes
#include <kapplication.h>
#include <kaboutapplication.h>
#include <kcmdlineargs.h>
#include <kconfig.h>
#include <kimageio.h>
#include <klocale.h>
#include <kmessagebox.h>

// Own includes
#include "wizard.h"
#include "tabs.h"
#include "krenameimpl.h"
#include "firststartdlg.h"

#ifdef HAVE_CONFIG_H
    #include <config.h>
#endif

// OS includes
#include <unistd.h>
#include <sys/types.h>

#ifndef VERSION
    #define VERSION "unknown"
#endif

KAboutData aboutData( "krename", I18N_NOOP("KRename"), VERSION, I18N_NOOP(
    "KRename is a batch file renamer which can rename a\n"
    "list of files based on a set of expressions.\n\n"
    "If you like KRename you may want to support it.\n"
    "Testing, bug fixes and feature request are as welcome\n"
    "as financial support (everybody needs money ;)\nSee help files for details.\n" ),
    KAboutData::License_GPL, "KRename Build:" __DATE__ " " __TIME__
    , "(c) 2001-2007, Dominik Seichter\n",
    "http://www.krename.net", "domseichter@web.de" );


static KCmdLineOptions options[] =
{
    { "+[file]", I18N_NOOP("file will be added to the list of files for renaming"), 0},
    { "r +[dir]", I18N_NOOP("add directory recursively"), 0 },
    { "template +", I18N_NOOP("set a template"), 0 },
    { "extension +", I18N_NOOP("set a template for the file extension"), 0 },
    { "use-plugin +", I18N_NOOP("enable a plugin for use"), 0 },
    { "copy +[dir]", I18N_NOOP("copy files to directory"), 0 },
    { "move +[dir]", I18N_NOOP("move files to directory"), 0 },
    { "profile +[profile]", I18N_NOOP("load the profile named [profile] on startup"), 0 },
    { "start", I18N_NOOP("start renaming immediately"), 0 },
    { "previewitems <num>",  I18N_NOOP("only show <num> preview items"), 0 },
    KCmdLineLastOption
};

int main(int argc, char *argv[])
{
    aboutData.addAuthor("Dominik Seichter", 0, "domseichter@web.de",
        "http://www.krename.net" );
    aboutData.addAuthor("Stefan \"Stonki\" Onken",
        I18N_NOOP("Website, testing, very good ideas and keeping me coding!"),
        "support@stonki.de", "http://www.stonki.de" );

    aboutData.addCredit("Trevor Semeniuk",  I18N_NOOP("Thanks to him for creating RedHat 7.x packages and some other help."),
                        "semeniuk@ee.ualberta.ca", "http://www.semeniuk.net" );
    aboutData.addCredit("Groult Richard",   I18N_NOOP("Fixed a bug with startIndex and added the BatchRenamer class\n"
                        "to his excellent image viewer showimg."),
                        "rgroult@jalix.org", "http://ric.jalix.org/" );
    aboutData.addCredit("Michael Elvers",  I18N_NOOP("Fixed a bug that caused krename not closing open files."),
                        "m_elvers@yahoo.com", "http://come.to/melvers" );
    aboutData.addCredit("Andreas Pour",  I18N_NOOP("Thanks for his great job at apps.kde.com and help with contributing krename to apps.kde.com."),
                        "pour@mieterra.com", "http://apps.kde.com" );
    aboutData.addCredit("Charles Samuels", I18N_NOOP("Thanks for noatun and the ID3/Ogg Tag code is based on his noatun modules."),
                        "charles@kde.org", "http://noatun.kde.org/" );
    aboutData.addCredit("Franz Schmid", I18N_NOOP("Gave me a good start into writing plugins with his application scribus."),
                        "Franz.Schmid@altmuehlnet.de", "http://web2.altmuehlnet.de/fschmid/index.html" );
    aboutData.addCredit("Rolf Magnus", I18N_NOOP("Parts of the PNG support are copied from his KFile plugin for png support."),
                        "ramagnus@kde.org" );
    aboutData.addCredit("Michael v.Ostheim", I18N_NOOP("Created the Gentoo Ebuild scripts for Krename."),
                        "MvOstheim@web.de", "http://www.vonostheim.de" );
    aboutData.addCredit("Brandon Low", I18N_NOOP("Some GCC 3.1 fixes for Gentoo."),
                        "lostlogic@gentoo.org", "http://www.gentoo.org" );
    aboutData.addCredit("Per �vind Karlsen", I18N_NOOP("Thanks for creating the Mandrake RPM"),
                        "peroyvind@delonic.no" );
    aboutData.addCredit("Daniele Medri", I18N_NOOP("Italian translation"), "madrid@linuxmeeting.net" );
    aboutData.addCredit("Stephan Johach", I18N_NOOP("Provided a gcc3.x namespace patch"), "lucardus@onlinehome.de" );
    aboutData.addCredit("Micha� Zugaro", I18N_NOOP("Provided the new preview and move features") , "michael.zugaro@college-de-france.fr" );
    aboutData.addCredit("Rene Gass", I18N_NOOP("Fixed problems with the spec file and contributed rpms for every SuSE version you can imagine and is also the new Gentoo maintainer for KRename"), "kde-package@gmx.de" );
    aboutData.addCredit("Mark Volkert", I18N_NOOP("Provided SuSE RPMs and very good suggestions"), "mark.volkert@rakekniven.de" );
    aboutData.addCredit("Jose Rodriguez", I18N_NOOP("Contributed a Spanish translation"), "chmpmi@eresmas.net" );
    aboutData.addCredit("Steven P. Ulrick", I18N_NOOP("Provided a RedHat RPM and was big help in improving KRename"), "steve@afolkey2.net" );
    aboutData.addCredit("UTUMI Hirosi", I18N_NOOP("Translated KRename to Japanese"), "utuhiro@mx12.freecom.ne.jp" );
    aboutData.addCredit("Nicolas Benoit", I18N_NOOP("Translated KRename into French"), "nbenoit@tuxfamily.org" );
    aboutData.addCredit("Krzysztof Pawlak", I18N_NOOP("Translated KRename into Polish"), "jmnemonic@gazeta.pl" );
    aboutData.addCredit("Ilya Ivkov", I18N_NOOP("Translated KRename into Russian"), "ilya-ivkov@yandex.ru" );    
    aboutData.addCredit("Asim Husanovic", I18N_NOOP("Translated KRename into Bosnian"), "asim.h@megatel.ba" );    

    KCmdLineArgs::init( argc, argv, &aboutData );
    KCmdLineArgs::addCmdLineOptions( options );

    KApplication a;
    a.connect( &a, TQT_SIGNAL( lastWindowClosed() ), &a, TQT_SLOT( quit() ) );

    KImageIO::registerFormats();

    TQWidget* krename = KRenameImpl::launch( TQRect( 0, 0, 0, 0 ), TQStringList() );

    /* Check if Krename
     * was started from root!
     */
    unsigned int uid = geteuid();
    if( uid == 0 )
        KMessageBox::information( krename, i18n(
            "<b>Krename was started from root!</b><br>"
            "When started from root, Krename may damage your "
            "system if you do not know exactly what you are "
            "doing!"
        ), i18n("Error"), "KrenameRootWarning" );

/*
 * Activate this warning message for unstable development releases.
 */
/*    KMessageBox::sorry( krename, i18n(
    "<b>Warning !</b> This is a development release which may cause damage to your files!"
    "<br>Make backups before using KRename." ));
*/
    return a.exec();
}