コード例 #1
0
ファイル: main10.cpp プロジェクト: KDE/kdev-www
int main(int argc, char **argv)
{
    // Default start-up routine
    KAboutData about("kmditest", I18N_NOOP("KMDITest"), version, description,
                     KAboutData::License_GPL, "(C) 2004 Andrea Bergia", 0, 0, "*****@*****.**");
    about.addAuthor( "Andrea Bergia", 0, "*****@*****.**" );
    KCmdLineArgs::init(argc, argv, &about);
    KApplication app;
    
    // Read MDI mode
    KConfig *c = app.config();
    QString strMode = c->readEntry( "MDIMode", "ideal" );
    KMdi::MdiMode mode = KMdi::IDEAlMode;
    if ( strMode == "toplevel" ) {
        mode = KMdi::ToplevelMode;
    } else if ( strMode == "childframe" ) {
        mode = KMdi::ChildframeMode;
    } else if ( strMode == "tabpage" ) {
        mode = KMdi::TabPageMode;
    }
    
    // Create main window
    KMDITest *mainWin = new KMDITest( mode );
    app.setMainWidget( mainWin );
    mainWin->show();

    // mainWin has WDestructiveClose flag by default, so it will delete itself.
    return app.exec();
}
コード例 #2
0
int main(int argc, char *argv[])
{
#ifdef _WIN32
   /* KDiff3 can be used as replacement for the text-diff and merge tool provided by
      Clearcase. This is experimental and so far has only been tested under Windows.

      There are two ways to use KDiff3 with clearcase
      -  The file lib/mgrs/map contains the list of compare/merge tasks on one side and 
         the tool on the other. Originally this contains only clearcase tools, but you can
         edit this file and put kdiff3 there instead. (Recommended method)
      -  Exchange the original program with KDiff3: (Hackish, no fine control)
         1. In the Clearcase "bin"-directory rename "cleardiffmrg.exe" to "cleardiffmrg_orig.exe".
         2. Copy kdiff3.exe into that "bin"-directory and rename it to "cleardiffmrg.exe".
            (Also copy the other files that are needed by KDiff3 there.)
         Now when a file comparison or merge is done by Clearcase then of course KDiff3 will be
         run instead.
         If the commandline contains the option "-directory" then KDiff3 can't do it but will
         run "cleardiffmrg_orig.exe" instead.
   */

   // Write all args into a temporary file. Uncomment this for debugging purposes.
   /*
   FILE* f = fopen("c:\\t.txt","w");
   for(int i=0; i< argc; ++i)
      fprintf(f,"Arg %d: %s\n", i, argv[i]);

   // Call orig cleardiffmrg.exe to see what result it returns.
   int result=0;
   result = ::_spawnvp(_P_WAIT , "C:\\Programme\\Rational\\ClearCase\\bin\\cleardiffmrg.exe", argv );
   fprintf(f,"Result: %d\n", result );
   fclose(f);
   return result;
   */

   // KDiff3 can replace cleardiffmrg from clearcase. But not all functions.
   if ( isOptionUsed( "directory", argc,argv ) )
   {
      return ::_spawnvp(_P_WAIT , "cleardiffmrg_orig", argv );      
   }

#endif
   //QApplication::setColorSpec( QApplication::ManyColor ); // Grab all 216 colors

   KAboutData aboutData( "kdiff3", I18N_NOOP("KDiff3"),
      VERSION, description, KAboutData::License_GPL,
      "(c) 2002-2007 Joachim Eibl", 0, "http://kdiff3.sourceforge.net/", "joachim.eibl" "@" "gmx.de");
   aboutData.addAuthor("Joachim Eibl",0, "joachim.eibl" "@" "gmx.de");
   aboutData.addCredit("Eike Sauer", "Bugfixes, Debian package maintainer" );
   aboutData.addCredit("Sebastien Fricker", "Windows installer" );
   aboutData.addCredit("Stephan Binner", "i18n-help", "binner" "@" "kde.org" );
   aboutData.addCredit("Stefan Partheymueller", "Clipboard-patch" );
   aboutData.addCredit("David Faure", "KIO-Help", "faure" "@" "kde.org" );
   aboutData.addCredit("Bernd Gehrmann", "Class CvsIgnoreList from Cervisia" );
   aboutData.addCredit("Andre Woebbeking", "Class StringMatcher" );
   aboutData.addCredit("Michael Denio", "Directory Equality-Coloring patch");
   aboutData.addCredit("Manfred Koehler", "Fix for slow startup on Windows");
   aboutData.addCredit("Sergey Zorin", "Diff Ext for Windows");
   aboutData.addCredit("Paul Eggert, Mike Haertel, David Hayes, Richard Stallman, Len Tower", "GNU-Diffutils");
   aboutData.addCredit("Tino Boellsterling, Timothy Mee", "Intensive test, use and feedback");
   aboutData.addCredit("Michael Schmidt", "Mac support");

   aboutData.addCredit(I18N_NOOP("+ Many thanks to those who reported bugs and contributed ideas!"));

   KCmdLineArgs::init( argc, argv, &aboutData );
   std::vector<KCmdLineOptions> vOptions;
   QStringList ignorableOptions;
   initialiseCmdLineArgs(vOptions, ignorableOptions);

   KApplication app;

#ifdef KREPLACEMENTS_H
   QString locale;

   locale = app.config()->readEntry("Language", "Auto");
   int spacePos = locale.indexOf(' ');
   if (spacePos>0) locale = locale.left(spacePos);
   QTranslator kdiff3Translator( 0 );
   QTranslator qtTranslator( 0 );
   if (locale != "en_orig")
   {
      if ( locale == "Auto" || locale.isEmpty() )
         locale = locale = QLocale::system().name().left(2);
         
      QString translationDir = getTranslationDir();
      kdiff3Translator.load( QString("kdiff3_")+locale, translationDir );
      app.installTranslator( &kdiff3Translator );
      
      qtTranslator.load( QString("qt_")+locale, translationDir );
      app.installTranslator( &qtTranslator );
   }
#endif

  if (app.isRestored())
  {
     RESTORE(KDiff3Shell);
  }
  else
  {
     new KDiff3Shell();
  }

  int retVal = app.exec();
  return retVal;
}