annotate kdiff3/src/main.cpp @ 57:023fbd76c1e3

Translating some strings to french
author friseb123
date Sat, 31 Jan 2004 14:25:47 +0000
parents 32d5cbf9db71
children 8af4bb9d9a5a
rev   line source
joachim99@8 1 /***************************************************************************
joachim99@8 2 main.cpp - Where everything starts.
joachim99@8 3 -------------------
joachim99@8 4 begin : Don Jul 11 12:31:29 CEST 2002
joachim99@8 5 copyright : (C) 2002 by Joachim Eibl
joachim99@8 6 email : joachim.eibl@gmx.de
joachim99@8 7 ***************************************************************************/
joachim99@8 8
joachim99@8 9 /***************************************************************************
joachim99@8 10 * *
joachim99@8 11 * This program is free software; you can redistribute it and/or modify *
joachim99@8 12 * it under the terms of the GNU General Public License as published by *
joachim99@8 13 * the Free Software Foundation; either version 2 of the License, or *
joachim99@8 14 * (at your option) any later version. *
joachim99@8 15 * *
joachim99@8 16 ***************************************************************************/
joachim99@8 17
joachim99@8 18 #include <kcmdlineargs.h>
joachim99@8 19 #include <kaboutdata.h>
joachim99@8 20 #include <klocale.h>
joachim99@40 21 #include "kdiff3_shell.h"
friseb123@16 22 #include "version.h"
joachim99@53 23 #include <qtextcodec.h>
joachim99@8 24
joachim99@8 25
joachim99@8 26 static const char *description =
joachim99@8 27 I18N_NOOP("Text Diff and Merge Tool");
joachim99@8 28
joachim99@8 29 static KCmdLineOptions options[] =
joachim99@8 30 {
joachim99@8 31 { "m", 0, 0 },
joachim99@8 32 { "merge", I18N_NOOP("Merge the input."), 0 },
joachim99@8 33 { "b", 0, 0 },
joachim99@8 34 { "base file", I18N_NOOP("Explicit base file. For compatibility with certain tools."), 0 },
joachim99@8 35 { "o", 0, 0 },
joachim99@8 36 { "output file", I18N_NOOP("Output file. Implies -m. E.g.: -o newfile.txt"), 0 },
joachim99@8 37 { "out file", I18N_NOOP("Output file, again. (For compatibility with certain tools.)"), 0 },
joachim99@8 38 { "auto", I18N_NOOP("No GUI if all conflicts are auto-solvable. (Needs -o file)"), 0 },
joachim99@8 39 { "qall", I18N_NOOP("Don't solve conflicts automatically. (For compatibility...)"), 0 },
joachim99@8 40 { "fname alias", I18N_NOOP("Visible name replacement. Supply this once for every input."), 0 },
joachim99@8 41 #ifdef _WIN32
joachim99@8 42 { "query", I18N_NOOP("For compatibility with certain tools."), 0 },
joachim99@8 43 #endif
joachim99@8 44 { "+[File1]", I18N_NOOP("file1 to open (base, if not specified via --base)"), 0 },
joachim99@8 45 { "+[File2]", I18N_NOOP("file2 to open"), 0 },
joachim99@8 46 { "+[File3]", I18N_NOOP("file3 to open"), 0 },
joachim99@8 47 { 0, 0, 0 }
joachim99@8 48 };
joachim99@8 49
joachim99@8 50
joachim99@8 51 #ifdef _WIN32
joachim99@8 52 #include <process.h>
joachim99@8 53 // This command checks the comm
joachim99@8 54 static bool isOptionUsed(const QString& s, int argc, char* argv[])
joachim99@8 55 {
joachim99@8 56 for(int j=0; j<argc; ++j )
joachim99@8 57 {
joachim99@8 58 if( "-"+s == argv[j] || "--"+s==argv[j] )
joachim99@8 59 {
joachim99@8 60 return true;
joachim99@8 61 }
joachim99@8 62 }
joachim99@8 63 return false;
joachim99@8 64 }
joachim99@8 65 #endif
joachim99@8 66
joachim99@8 67 int main(int argc, char *argv[])
joachim99@8 68 {
joachim99@8 69 #ifdef _WIN32
joachim99@8 70 /* KDiff3 can be used as replacement for the text-diff and merge tool provided by
joachim99@8 71 Clearcase. This is experimental and so far has only been tested under Windows.
joachim99@8 72
joachim99@8 73 The installation is very simple:
joachim99@8 74 1. In the Clearcase "bin"-directory rename "cleardiffmrg.exe" to "cleardiffmrg_orig.exe".
joachim99@8 75 2. Copy kdiff3.exe into that "bin"-directory and rename it to "cleardiffmrg.exe".
joachim99@8 76 (Also copy the other files that are needed by KDiff3 there.)
joachim99@8 77
joachim99@8 78 Now when a file comparison or merge is done by Clearcase then of course KDiff3 will be
joachim99@8 79 run instead.
joachim99@8 80 If the commandline contains the option "-directory" then KDiff3 can't do it but will
joachim99@8 81 run "cleardiffmrg_orig.exe" instead.
joachim99@8 82 */
joachim99@8 83
joachim99@8 84 /* // Write all args into a temporary file. Uncomment this for debugging purposes.
joachim99@8 85 FILE* f = fopen("c:\\t.txt","w");
joachim99@8 86 for(int i=0; i< argc; ++i)
joachim99@8 87 fprintf(f,"Arg %d: %s\n", i, argv[i]);
joachim99@8 88 fclose(f);
joachim99@8 89 */
joachim99@8 90
joachim99@8 91 // KDiff3 can replace cleardiffmrg from clearcase. But not all functions.
joachim99@8 92 if ( isOptionUsed( "directory", argc,argv ) )
joachim99@8 93 {
joachim99@8 94 return ::_spawnvp(_P_WAIT , "cleardiffmrg_orig", argv );
joachim99@8 95 }
joachim99@8 96 #endif
joachim99@8 97 QApplication::setColorSpec( QApplication::ManyColor ); // Grab all 216 colors
joachim99@8 98
joachim99@8 99 KAboutData aboutData( "kdiff3", I18N_NOOP("KDiff3"),
joachim99@8 100 VERSION, description, KAboutData::License_GPL,
joachim99@53 101 "(c) 2002-2004 Joachim Eibl", 0, "http://kdiff3.sourceforge.net/", "joachim.eibl@gmx.de");
joachim99@8 102 aboutData.addAuthor("Joachim Eibl",0, "joachim.eibl@gmx.de");
joachim99@8 103 KCmdLineArgs::init( argc, argv, &aboutData );
joachim99@8 104 KCmdLineArgs::addCmdLineOptions( options ); // Add our own options.
joachim99@8 105
joachim99@53 106 KApplication app;
joachim99@53 107 #ifdef KREPLACEMENTS_H
joachim99@53 108 QString translationDir = getTranslationDir();
joachim99@53 109 QTranslator kdiff3Translator( 0 );
joachim99@53 110 kdiff3Translator.load( QString("kdiff3_")+QTextCodec::locale(), translationDir );
joachim99@53 111 app.installTranslator( &kdiff3Translator );
joachim99@53 112
joachim99@53 113 QTranslator qtTranslator( 0 );
joachim99@53 114 qtTranslator.load( QString("qt_")+QTextCodec::locale(), translationDir );
joachim99@53 115 app.installTranslator( &qtTranslator );
joachim99@53 116 #endif
joachim99@8 117
joachim99@8 118 if (app.isRestored())
joachim99@8 119 {
joachim99@8 120 RESTORE(KDiff3Shell);
joachim99@8 121 }
joachim99@8 122 else
joachim99@8 123 {
joachim99@8 124 new KDiff3Shell();
joachim99@8 125 }
joachim99@8 126
joachim99@8 127 return app.exec();
joachim99@8 128 }
joachim99@53 129
joachim99@53 130 // Suppress warning with --enable-final
joachim99@53 131 #undef VERSION