KRename – powerful batch renamer
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

main.cpp 7.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. /***************************************************************************
  2. main.cpp - description
  3. -------------------
  4. begin : Die Mai 15 15:34:19 CEST 2001
  5. copyright : (C) 2001 by Dominik Seichter
  6. email : domseichter@web.de
  7. ***************************************************************************/
  8. /***************************************************************************
  9. * *
  10. * This program is free software; you can redistribute it and/or modify *
  11. * it under the terms of the GNU General Public License as published by *
  12. * the Free Software Foundation; either version 2 of the License, or *
  13. * (at your2192 option) any later version. *
  14. * *
  15. ***************************************************************************/
  16. // TQt includes
  17. #include <tqrect.h>
  18. #include <tqwidget.h>
  19. // KDE includes
  20. #include <tdeapplication.h>
  21. #include <tdeaboutapplication.h>
  22. #include <tdecmdlineargs.h>
  23. #include <tdeconfig.h>
  24. #include <kimageio.h>
  25. #include <tdelocale.h>
  26. #include <tdemessagebox.h>
  27. // Own includes
  28. #include "wizard.h"
  29. #include "tabs.h"
  30. #include "krenameimpl.h"
  31. #include "firststartdlg.h"
  32. #ifdef HAVE_CONFIG_H
  33. #include <config.h>
  34. #endif
  35. // OS includes
  36. #include <unistd.h>
  37. #include <sys/types.h>
  38. #ifndef VERSION
  39. #define VERSION "unknown"
  40. #endif
  41. TDEAboutData aboutData( "krename", I18N_NOOP("KRename"), VERSION, I18N_NOOP(
  42. "KRename is a batch file renamer which can rename a\n"
  43. "list of files based on a set of expressions.\n\n"
  44. "If you like KRename you may want to support it.\n"
  45. "Testing, bug fixes and feature request are as welcome\n"
  46. "as financial support (everybody needs money ;)\nSee help files for details.\n" ),
  47. TDEAboutData::License_GPL, "KRename Build:" __DATE__ " " __TIME__
  48. , "(c) 2001-2007, Dominik Seichter\n",
  49. "http://www.krename.net", "domseichter@web.de" );
  50. static TDECmdLineOptions options[] =
  51. {
  52. { "+[file]", I18N_NOOP("file will be added to the list of files for renaming"), 0},
  53. { "r +[dir]", I18N_NOOP("add directory recursively"), 0 },
  54. { "template +", I18N_NOOP("set a template"), 0 },
  55. { "extension +", I18N_NOOP("set a template for the file extension"), 0 },
  56. { "use-plugin +", I18N_NOOP("enable a plugin for use"), 0 },
  57. { "copy +[dir]", I18N_NOOP("copy files to directory"), 0 },
  58. { "move +[dir]", I18N_NOOP("move files to directory"), 0 },
  59. { "profile +[profile]", I18N_NOOP("load the profile named [profile] on startup"), 0 },
  60. { "start", I18N_NOOP("start renaming immediately"), 0 },
  61. { "previewitems <num>", I18N_NOOP("only show <num> preview items"), 0 },
  62. TDECmdLineLastOption
  63. };
  64. int main(int argc, char *argv[])
  65. {
  66. aboutData.addAuthor("Dominik Seichter", 0, "domseichter@web.de",
  67. "http://www.krename.net" );
  68. aboutData.addAuthor("Stefan \"Stonki\" Onken",
  69. I18N_NOOP("Website, testing, very good ideas and keeping me coding!"),
  70. "support@stonki.de", "http://www.stonki.de" );
  71. aboutData.addCredit("Trevor Semeniuk", I18N_NOOP("Thanks to him for creating RedHat 7.x packages and some other help."),
  72. "semeniuk@ee.ualberta.ca", "http://www.semeniuk.net" );
  73. aboutData.addCredit("Groult Richard", I18N_NOOP("Fixed a bug with startIndex and added the BatchRenamer class\n"
  74. "to his excellent image viewer showimg."),
  75. "rgroult@jalix.org", "http://ric.jalix.org/" );
  76. aboutData.addCredit("Michael Elvers", I18N_NOOP("Fixed a bug that caused krename not closing open files."),
  77. "m_elvers@yahoo.com", "http://come.to/melvers" );
  78. aboutData.addCredit("Andreas Pour", I18N_NOOP("Thanks for his great job at apps.kde.com and help with contributing krename to apps.kde.com."),
  79. "pour@mieterra.com", "http://apps.kde.com" );
  80. aboutData.addCredit("Charles Samuels", I18N_NOOP("Thanks for noatun and the ID3/Ogg Tag code is based on his noatun modules."),
  81. "charles@kde.org", "http://noatun.kde.org/" );
  82. aboutData.addCredit("Franz Schmid", I18N_NOOP("Gave me a good start into writing plugins with his application scribus."),
  83. "Franz.Schmid@altmuehlnet.de", "http://web2.altmuehlnet.de/fschmid/index.html" );
  84. aboutData.addCredit("Rolf Magnus", I18N_NOOP("Parts of the PNG support are copied from his KFile plugin for png support."),
  85. "ramagnus@kde.org" );
  86. aboutData.addCredit("Michael v.Ostheim", I18N_NOOP("Created the Gentoo Ebuild scripts for Krename."),
  87. "MvOstheim@web.de", "http://www.vonostheim.de" );
  88. aboutData.addCredit("Brandon Low", I18N_NOOP("Some GCC 3.1 fixes for Gentoo."),
  89. "lostlogic@gentoo.org", "http://www.gentoo.org" );
  90. aboutData.addCredit("Per �vind Karlsen", I18N_NOOP("Thanks for creating the Mandrake RPM"),
  91. "peroyvind@delonic.no" );
  92. aboutData.addCredit("Daniele Medri", I18N_NOOP("Italian translation"), "madrid@linuxmeeting.net" );
  93. aboutData.addCredit("Stephan Johach", I18N_NOOP("Provided a gcc3.x namespace patch"), "lucardus@onlinehome.de" );
  94. aboutData.addCredit("Micha� Zugaro", I18N_NOOP("Provided the new preview and move features") , "michael.zugaro@college-de-france.fr" );
  95. 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" );
  96. aboutData.addCredit("Mark Volkert", I18N_NOOP("Provided SuSE RPMs and very good suggestions"), "mark.volkert@rakekniven.de" );
  97. aboutData.addCredit("Jose Rodriguez", I18N_NOOP("Contributed a Spanish translation"), "chmpmi@eresmas.net" );
  98. aboutData.addCredit("Steven P. Ulrick", I18N_NOOP("Provided a RedHat RPM and was big help in improving KRename"), "steve@afolkey2.net" );
  99. aboutData.addCredit("UTUMI Hirosi", I18N_NOOP("Translated KRename to Japanese"), "utuhiro@mx12.freecom.ne.jp" );
  100. aboutData.addCredit("Nicolas Benoit", I18N_NOOP("Translated KRename into French"), "nbenoit@tuxfamily.org" );
  101. aboutData.addCredit("Krzysztof Pawlak", I18N_NOOP("Translated KRename into Polish"), "jmnemonic@gazeta.pl" );
  102. aboutData.addCredit("Ilya Ivkov", I18N_NOOP("Translated KRename into Russian"), "ilya-ivkov@yandex.ru" );
  103. aboutData.addCredit("Asim Husanovic", I18N_NOOP("Translated KRename into Bosnian"), "asim.h@megatel.ba" );
  104. TDECmdLineArgs::init( argc, argv, &aboutData );
  105. TDECmdLineArgs::addCmdLineOptions( options );
  106. TDEApplication a;
  107. a.connect( &a, TQT_SIGNAL( lastWindowClosed() ), &a, TQT_SLOT( quit() ) );
  108. KImageIO::registerFormats();
  109. TQWidget* krename = KRenameImpl::launch( TQRect( 0, 0, 0, 0 ), TQStringList() );
  110. /* Check if Krename
  111. * was started from root!
  112. */
  113. unsigned int uid = geteuid();
  114. if( uid == 0 )
  115. KMessageBox::information( krename, i18n(
  116. "<b>Krename was started from root!</b><br>"
  117. "When started from root, Krename may damage your "
  118. "system if you do not know exactly what you are "
  119. "doing!"
  120. ), i18n("Error"), "KrenameRootWarning" );
  121. /*
  122. * Activate this warning message for unstable development releases.
  123. */
  124. /* KMessageBox::sorry( krename, i18n(
  125. "<b>Warning !</b> This is a development release which may cause damage to your files!"
  126. "<br>Make backups before using KRename." ));
  127. */
  128. return a.exec();
  129. }