main.cpp (krename-4.0.9) | : | main.cpp (krename-4.90.90) | ||
---|---|---|---|---|
skipping to change at line 19 | skipping to change at line 19 | |||
/*************************************************************************** | /*************************************************************************** | |||
* * | * * | |||
* This program is free software; you can redistribute it and/or modify * | * 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 * | * it under the terms of the GNU General Public License as published by * | |||
* the Free Software Foundation; either version 2 of the License, or * | * the Free Software Foundation; either version 2 of the License, or * | |||
* (at your2192 option) any later version. * | * (at your2192 option) any later version. * | |||
* * | * * | |||
***************************************************************************/ | ***************************************************************************/ | |||
// Qt includes | // Qt includes | |||
#include <qrect.h> | #include <QRect> | |||
#include <qwidget.h> | #include <QWidget> | |||
// KDE includes | // KDE includes | |||
#include <kapplication.h> | ||||
#include <kaboutdata.h> | #include <kaboutdata.h> | |||
#include <kcmdlineargs.h> | ||||
#include <kconfig.h> | #include <kconfig.h> | |||
#include <kimageio.h> | ||||
#include <klocale.h> | ||||
#include <kmessagebox.h> | #include <kmessagebox.h> | |||
#include <klocalizedstring.h> | ||||
// Own includes | // Own includes | |||
#include "krenameimpl.h" | #include "krenameimpl.h" | |||
// OS includes | // OS includes | |||
#ifndef _WIN32 | #ifndef Q_OS_WIN | |||
#include <unistd.h> | #include <unistd.h> | |||
#endif // _WIN32 | #endif | |||
#include <sys/types.h> | #include <sys/types.h> | |||
#include <QApplication> | ||||
#include <KAboutData> | ||||
#include <KCrash> | ||||
#include <KLocalizedString> | ||||
#include <QCommandLineParser> | ||||
#include <QCommandLineOption> | ||||
#include "../config-krename.h" | #include "../config-krename.h" | |||
int main(int argc, char *argv[]) | int main(int argc, char *argv[]) | |||
{ | { | |||
KCmdLineOptions options; | KLocalizedString::setApplicationDomain("krename"); | |||
options.add( "+[file]", ki18n("file will be added to the list of files for r | QApplication app(argc, argv); | |||
enaming") ); | ||||
options.add( "r +[dir]", ki18n("add directory recursively") ); | KCrash::initialize(); | |||
options.add( "template +", ki18n("set a template") ); | ||||
options.add( "extension +", ki18n("set a template for the file extension") ) | KAboutData aboutData("krename", i18n("KRename"), VERSION); | |||
; | aboutData.setShortDescription(i18n( | |||
options.add( "use-plugin +", ki18n("enable a plugin for use") ); | "KRename is a batch file renamer which can | |||
options.add( "copy +[dir]", ki18n("copy files to directory or url") ); | rename a " | |||
options.add( "move +[dir]", ki18n("move files to directory or url") ); | "list of files based on a set of expressio | |||
options.add( "link +[dir]", ki18n("link files to directory or url") ); | ns.")); | |||
//options.add( "profile +[profile]", ki18n("load the profile named [profile] | aboutData.setOtherText(i18n( | |||
on startup") ); | "If you like KRename you may want to support it. | |||
options.add( "start", ki18n("start renaming immediately") ); | " | |||
options.add( "test", ki18n("start KRename's selftest (developers only)") ); | "Testing, bug fixes and feature requests are as w | |||
elcome " | ||||
"as financial support (everybody needs money ;). | ||||
See help files for details.")); | ||||
aboutData.setLicense(KAboutLicense::GPL_V3); | ||||
aboutData.setCopyrightStatement(i18n("(c) 2001-2012, Dominik Seichter\n")); | ||||
aboutData.setHomepage("http://www.krename.net"); | ||||
aboutData.addAuthor(i18n("Heiko Becker"), i18n("Current maintainer"), | ||||
"heirecka@exherbo.org"); | ||||
aboutData.addAuthor(i18n("Dominik Seichter"), i18n("Developer and former mai | ||||
ntainer"), "domseichter@web.de", | ||||
"http://www.krename.net"); | ||||
aboutData.addAuthor(i18n("Stefan \"Stonki\" Onken"), | ||||
i18n("Website, testing, very good ideas and keeping me c | ||||
oding!"), | ||||
"support@stonki.de", "http://www.stonki.de"); | ||||
aboutData.addCredit(i18n("Arpad Biro"), i18n("Helped to fix style guide issu | ||||
es and made improvements to user messages."), "biro.arpad@gmail.com"); | ||||
aboutData.addCredit(i18n("Trevor Semeniuk"), i18n("Thanks to him for creati | ||||
ng RedHat 7.x packages and some other help."), | ||||
"semeniuk@ee.ualberta.ca", "http://www.semeniuk.net"); | ||||
aboutData.addCredit(i18n("Groult Richard"), i18n("Fixed a bug with startIn | ||||
dex and added the BatchRenamer class\n" | ||||
"to his excellent image viewer showimg."), | ||||
"rgroult@jalix.org", "http://ric.jalix.org/"); | ||||
aboutData.addCredit(i18n("Michael Elvers"), i18n("Fixed a bug that caused k | ||||
rename not closing open files."), | ||||
"m_elvers@yahoo.com", "http://come.to/melvers"); | ||||
aboutData.addCredit(i18n("Andreas Pour"), i18n("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(i18n("Charles Samuels"), i18n("Thanks for noatun and the | ||||
ID3/Ogg Tag code is based on his noatun modules."), | ||||
"charles@kde.org", "http://noatun.kde.org/"); | ||||
aboutData.addCredit(i18n("Franz Schmid"), i18n("Gave me a good start into wr | ||||
iting plugins with his application scribus."), | ||||
"Franz.Schmid@altmuehlnet.de", "http://web2.altmuehlnet. | ||||
de/fschmid/index.html"); | ||||
aboutData.addCredit(i18n("Rolf Magnus"), i18n("Parts of the PNG support are | ||||
copied from his KFile plugin for png support."), | ||||
"ramagnus@kde.org"); | ||||
aboutData.addCredit(i18n("Michael v.Ostheim"), i18n("Created the Gentoo Ebui | ||||
ld scripts for Krename."), | ||||
"MvOstheim@web.de", "http://www.vonostheim.de"); | ||||
aboutData.addCredit(i18n("Brandon Low"), i18n("Some GCC 3.1 fixes for Gentoo | ||||
."), | ||||
"lostlogic@gentoo.org", "http://www.gentoo.org"); | ||||
aboutData.addCredit(i18n("Per Oyvind Karlsen"), i18n("Thanks for creating th | ||||
e Mandrake RPM"), | ||||
"peroyvind@delonic.no"); | ||||
aboutData.addCredit(i18n("Vincenzo Reale"), i18n("Italian translation"), "sm | ||||
art2128@baslug.org"); | ||||
aboutData.addCredit(i18n("Daniele Medri"), i18n("Italian translation work"), | ||||
"madrid@linuxmeeting.net"); | ||||
aboutData.addCredit(i18n("Stephan Johach"), i18n("Provided a gcc3.x namespac | ||||
e patch"), "lucardus@onlinehome.de"); | ||||
aboutData.addCredit(i18n("Michael Zugaro"), i18n("Provided the new preview a | ||||
nd move features") , "michael.zugaro@college-de-france.fr"); | ||||
aboutData.addCredit(i18n("Rene Gass"), i18n("Fixed problems with the spec fi | ||||
le and contributed rpms for every SuSE version you can imagine and is also the n | ||||
ew Gentoo maintainer for KRename"), "kde-package@gmx.de"); | ||||
aboutData.addCredit(i18n("Mark Ziegler"), i18n("Provided SuSE RPMs and very | ||||
good suggestions"), "mark.ziegler@rakekniven.de"); | ||||
aboutData.addCredit(i18n("Jose Rodriguez"), i18n("Contributed a Spanish tran | ||||
slation"), "chmpmi@eresmas.net"); | ||||
aboutData.addCredit(i18n("Steven P. Ulrick"), i18n("Provided a RedHat RPM an | ||||
d was big help in improving KRename"), "steve@afolkey2.net"); | ||||
aboutData.addCredit(i18n("UTUMI Hirosi"), i18n("Translated KRename to Japane | ||||
se"), "utuhiro@mx12.freecom.ne.jp"); | ||||
aboutData.addCredit(i18n("Nicolas Benoit"), i18n("Translated KRename into Fr | ||||
ench"), "nbenoit@tuxfamily.org"); | ||||
aboutData.addCredit(i18n("Krzysztof Pawlak"), i18n("Translated KRename into | ||||
Polish"), "jmnemonic@gazeta.pl"); | ||||
aboutData.addCredit(i18n("Ilya Ivkov"), i18n("Translated KRename into Russia | ||||
n"), "ilya-ivkov@yandex.ru"); | ||||
aboutData.addCredit(i18n("Asim Husanovic"), i18n("Translated KRename into Bo | ||||
snian"), "asim.h@megatel.ba"); | ||||
aboutData.addCredit(i18n("Michal Smoczyk"), i18n("Polish Translation"), "msm | ||||
oczyk@wp.pl"); | ||||
aboutData.addCredit(i18n("Pavel Fric"), i18n("Czech Translation"), "pavelfri | ||||
c@seznam.cz"); | ||||
aboutData.setTranslator(i18nc("NAME OF TRANSLATORS", "Your names"), | ||||
i18nc("EMAIL OF TRANSLATORS", "Your emails")); | ||||
aboutData.setDesktopFileName(QStringLiteral("org.kde.krename")); | ||||
KAboutData::setApplicationData(aboutData); | ||||
QCommandLineParser parser; | ||||
parser.addPositionalArgument(QLatin1String("files"), i18n("Files to be added | ||||
to the list to be renamed"), i18n("[files...]")); | ||||
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("r"), i18 | ||||
n("add folder recursively"), i18n("folder"))); | ||||
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("template | ||||
"), i18n("set a template"))); | ||||
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("extensio | ||||
n"), i18n("set a template for the file extension"))); | ||||
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("use-plug | ||||
in"), i18n("enable a plugin for use"))); | ||||
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("copy"), | ||||
i18n("copy files to folder or url"), i18n("path or url"))); | ||||
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("move"), | ||||
i18n("move files to folder or url"), i18n("path or url"))); | ||||
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("link"), | ||||
i18n("link files to folder or url"), i18n("path or url"))); | ||||
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("start"), | ||||
i18n("start renaming immediately"))); | ||||
parser.addOption(QCommandLineOption(QStringList() << QLatin1String("test"), | ||||
i18n("start KRename's selftest (developers only)"))); | ||||
// This option was never implemented in the KDE4 version: | // This option was never implemented in the KDE4 version: | |||
//options.add( "previewitems <num>", ki18n("only show <num> preview items") ); | //parser.addOption(QCommandLineOption(QStringList() << QLatin1String("previe witems"), i18n("only show <num> preview items"), QLatin1String("num"))); | |||
KAboutData aboutData( "krename", "krename", ki18n("KRename"), VERSION, ki18n | aboutData.setupCommandLine(&parser); | |||
( | parser.process(app); | |||
"<qt><p>KRename is a batch file renamer which can | aboutData.processCommandLine(&parser); | |||
rename a " | ||||
"list of files based on a set of expressions.</p>" | ||||
"<p>If you like KRename you may want to support it | ||||
. " | ||||
"Testing, bug fixes and feature requests are as we | ||||
lcome " | ||||
"as financial support (everybody needs money ;). S | ||||
ee help files for details.</p></qt>" ), | ||||
KAboutData::License_GPL, ki18n("KRename Build:" __DATE | ||||
__ " " __TIME__ ) | ||||
, ki18n("(c) 2001-2012, Dominik Seichter\n"), | ||||
"http://www.krename.net", "domseichter@web.de" ); | ||||
aboutData.addAuthor( ki18n("Dominik Seichter"), ki18n("developer and maintai | ||||
ner"), "domseichter@web.de", | ||||
"http://www.krename.net" ); | ||||
aboutData.addAuthor( ki18n("Stefan \"Stonki\" Onken"), | ||||
ki18n("Website, testing, very good ideas and keeping me | ||||
coding!"), | ||||
"support@stonki.de", "http://www.stonki.de" ); | ||||
aboutData.addCredit( ki18n("Arpad Biro"), ki18n("Helped to fix style guide i | ||||
ssues and made improvements to user messages."), "biro.arpad@gmail.com" ); | ||||
aboutData.addCredit( ki18n("Trevor Semeniuk"), ki18n("Thanks to him for cre | ||||
ating RedHat 7.x packages and some other help."), | ||||
"semeniuk@ee.ualberta.ca", "http://www.semeniuk.net" ); | ||||
aboutData.addCredit( ki18n("Groult Richard"), ki18n("Fixed a bug with star | ||||
tIndex and added the BatchRenamer class\n" | ||||
"to his excellent image vi | ||||
ewer showimg."), | ||||
"rgroult@jalix.org", "http://ric.jalix.org/" ); | ||||
aboutData.addCredit( ki18n("Michael Elvers"), ki18n("Fixed a bug that cause | ||||
d krename not closing open files."), | ||||
"m_elvers@yahoo.com", "http://come.to/melvers" ); | ||||
aboutData.addCredit( ki18n("Andreas Pour"), ki18n("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( ki18n("Charles Samuels"), ki18n("Thanks for noatun and | ||||
the ID3/Ogg Tag code is based on his noatun modules."), | ||||
"charles@kde.org", "http://noatun.kde.org/" ); | ||||
aboutData.addCredit( ki18n("Franz Schmid"), ki18n("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( ki18n("Rolf Magnus"), ki18n("Parts of the PNG support a | ||||
re copied from his KFile plugin for png support."), | ||||
"ramagnus@kde.org" ); | ||||
aboutData.addCredit( ki18n("Michael v.Ostheim"), ki18n("Created the Gentoo E | ||||
build scripts for Krename."), | ||||
"MvOstheim@web.de", "http://www.vonostheim.de" ); | ||||
aboutData.addCredit( ki18n("Brandon Low"), ki18n("Some GCC 3.1 fixes for Gen | ||||
too."), | ||||
"lostlogic@gentoo.org", "http://www.gentoo.org" ); | ||||
aboutData.addCredit( ki18n("Per Oyvind Karlsen"), ki18n("Thanks for creating | ||||
the Mandrake RPM"), | ||||
"peroyvind@delonic.no" ); | ||||
aboutData.addCredit( ki18n("Vincenzo Reale"), ki18n("Italian translation"), | ||||
"smart2128@baslug.org"); | ||||
aboutData.addCredit( ki18n("Daniele Medri"), ki18n("Italian translation work | ||||
"), "madrid@linuxmeeting.net" ); | ||||
aboutData.addCredit( ki18n("Stephan Johach"), ki18n("Provided a gcc3.x names | ||||
pace patch"), "lucardus@onlinehome.de" ); | ||||
aboutData.addCredit( ki18n("Michael Zugaro"), ki18n("Provided the new previe | ||||
w and move features") , "michael.zugaro@college-de-france.fr" ); | ||||
aboutData.addCredit( ki18n("Rene Gass"), ki18n("Fixed problems with the spec | ||||
file and contributed rpms for every SuSE version you can imagine and is also th | ||||
e new Gentoo maintainer for KRename"), "kde-package@gmx.de" ); | ||||
aboutData.addCredit( ki18n("Mark Ziegler"), ki18n("Provided SuSE RPMs and ve | ||||
ry good suggestions"), "mark.ziegler@rakekniven.de" ); | ||||
aboutData.addCredit( ki18n("Jose Rodriguez"), ki18n("Contributed a Spanish t | ||||
ranslation"), "chmpmi@eresmas.net" ); | ||||
aboutData.addCredit( ki18n("Steven P. Ulrick"), ki18n("Provided a RedHat RPM | ||||
and was big help in improving KRename"), "steve@afolkey2.net" ); | ||||
aboutData.addCredit( ki18n("UTUMI Hirosi"), ki18n("Translated KRename to Jap | ||||
anese"), "utuhiro@mx12.freecom.ne.jp" ); | ||||
aboutData.addCredit( ki18n("Nicolas Benoit"), ki18n("Translated KRename into | ||||
French"), "nbenoit@tuxfamily.org" ); | ||||
aboutData.addCredit( ki18n("Krzysztof Pawlak"), ki18n("Translated KRename in | ||||
to Polish"), "jmnemonic@gazeta.pl" ); | ||||
aboutData.addCredit( ki18n("Ilya Ivkov"), ki18n("Translated KRename into Rus | ||||
sian"), "ilya-ivkov@yandex.ru" ); | ||||
aboutData.addCredit( ki18n("Asim Husanovic"), ki18n("Translated KRename into | ||||
Bosnian"), "asim.h@megatel.ba" ); | ||||
aboutData.addCredit( ki18n("Michal Smoczyk"), ki18n("Polish Translation"), " | ||||
msmoczyk@wp.pl" ); | ||||
aboutData.addCredit( ki18n("Pavel Fric"), ki18n("Czech Translation"), "pavel | ||||
fric@seznam.cz" ); | ||||
aboutData.setTranslator(ki18nc("_: NAME OF TRANSLATORS", "Your names"), | ||||
ki18nc("_: EMAIL OF TRANSLATORS", "Your emails")); | ||||
KCmdLineArgs::init( argc, argv, &aboutData ); | ||||
KCmdLineArgs::addCmdLineOptions( options ); | ||||
KApplication a; | app.setQuitOnLastWindowClosed(true); | |||
a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) ); | ||||
QWidget* krename = KRenameImpl::launch( QRect( 0, 0, 0, 0 ), KRenameFile::Li st() ); | QWidget *krename = KRenameImpl::launch(QRect(0, 0, 0, 0), KRenameFile::List( ), &parser); | |||
#ifndef _WIN32 | #ifndef Q_OS_WIN | |||
/* Check if Krename | /* Check if Krename | |||
* was started from root! | * was started from root! | |||
*/ | */ | |||
unsigned int uid = geteuid(); | unsigned int uid = geteuid(); | |||
if( uid == 0 ) | if (uid == 0) | |||
KMessageBox::information( krename, i18n( | KMessageBox::information(krename, i18n( | |||
"<b>Krename was started from root!</b><br>" | "<b>Krename was started from root!</b><br>" | |||
"When started from root, Krename may damage your " | "When started from root, Krename may damage | |||
"system if you do not know exactly what you are " | your " | |||
"doing!" | "system if you do not know exactly what you | |||
), i18n("Error"), "KrenameRootWarning" ); | are " | |||
#endif // _WIN32 | "doing!" | |||
), i18n("Error"), "KrenameRootWarning"); | ||||
/* | #endif // Q_OS_WIN | |||
* Activate this warning message for unstable development releases. | ||||
*/ | /* | |||
/* KMessageBox::sorry( krename, i18n( | * Activate this warning message for unstable development releases. | |||
"<b>Warning !</b> This is a development release which may cause damage to yo | */ | |||
ur files!" | /* KMessageBox::sorry( krename, i18n( | |||
"<br>Make backups before using KRename." )); | "<b>Warning !</b> This is a development release which may cause damage t | |||
*/ | o your files!" | |||
return a.exec(); | "<br>Make backups before using KRename." )); | |||
*/ | ||||
return app.exec(); | ||||
} | } | |||
End of changes. 15 change blocks. | ||||
142 lines changed or deleted | 167 lines changed or added |