/[svn]/qsampler/trunk/src/main.cpp
ViewVC logotype

Diff of /qsampler/trunk/src/main.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 73 by capela, Mon May 10 13:20:00 2004 UTC revision 1558 by capela, Thu Dec 6 09:35:33 2007 UTC
# Line 1  Line 1 
1  // main.cpp  // main.cpp
2  //  //
3  /****************************************************************************  /****************************************************************************
4     Copyright (C) 2004, rncbc aka Rui Nuno Capela. All rights reserved.     Copyright (C) 2004-2007, rncbc aka Rui Nuno Capela. All rights reserved.
5       Copyright (C) 2007, Christian Schoenebeck
6    
7     This program is free software; you can redistribute it and/or     This program is free software; you can redistribute it and/or
8     modify it under the terms of the GNU General Public License     modify it under the terms of the GNU General Public License
# Line 13  Line 14 
14     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15     GNU General Public License for more details.     GNU General Public License for more details.
16    
17     You should have received a copy of the GNU General Public License     You should have received a copy of the GNU General Public License along
18     along with this program; if not, write to the Free Software     with this program; if not, write to the Free Software Foundation, Inc.,
19     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20    
21  *****************************************************************************/  *****************************************************************************/
22    
 #include <qapplication.h>  
 #include <qtextcodec.h>  
   
23  #include "qsamplerAbout.h"  #include "qsamplerAbout.h"
24  #include "qsamplerOptions.h"  #include "qsamplerOptions.h"
25  #include "qsamplerMainForm.h"  #include "qsamplerMainForm.h"
26    
27  #include "config.h"  #include <QApplication>
28    #include <QTranslator>
29    #include <QLocale>
30    
31    
32  //-------------------------------------------------------------------------  //-------------------------------------------------------------------------
33  // main - The main program trunk.  // main - The main program trunk.
# Line 34  Line 35 
35    
36  int main ( int argc, char **argv )  int main ( int argc, char **argv )
37  {  {
38      QApplication app(argc, argv);          QApplication app(argc, argv);
39    
40      // Load translation support.          // Load translation support.
41      QTranslator translator(0);          QTranslator translator(0);
42      QString sLocale = QTextCodec::locale();          QLocale loc;
43      if (sLocale != "C") {          if (loc.language() != QLocale::C) {
44          QString sLocName = "qsampler_" + sLocale;                  QString sLocName = "qsampler_" + loc.name();
45          if (!translator.load(sLocName, ".")) {                  if (!translator.load(sLocName, ".")) {
46              QString sLocPath = CONFIG_PREFIX "/share/locale";                          QString sLocPath = CONFIG_PREFIX "/share/locale";
47              if (!translator.load(sLocName, sLocPath))                          if (!translator.load(sLocName, sLocPath))
48                  fprintf(stderr, "Warning: no locale found: %s/%s.qm\n", sLocPath.latin1(), sLocName.latin1());                                  fprintf(stderr, "Warning: no locale found: %s/%s.qm\n",
49          }                                          sLocPath.toUtf8().constData(),
50          app.installTranslator(&translator);                                          sLocName.toUtf8().constData());
51      }                  }
52                    app.installTranslator(&translator);
53      // Construct default settings; override with command line arguments.          }
54      qsamplerOptions options;  
55      if (!options.parse_args(app.argc(), app.argv())) {          // Construct default settings; override with command line arguments.
56          app.quit();          QSampler::Options options;
57          return 1;          if (!options.parse_args(app.argc(), app.argv())) {
58      }                  app.quit();
59                        return 1;
60      // Construct, setup and show the main form.          }
61      qsamplerMainForm w;  
62      w.setup(&options);          // Construct, setup and show the main form.
63      w.show();          QSampler::MainForm w;
64            w.setup(&options);
65            w.show();
66    
67      // Register the quit signal/slot.          // Register the quit signal/slot.
68      app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()));          // app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()));
69    
70      return app.exec();          return app.exec();
71  }  }
72    
 // end of main.cpp  
73    
74    // end of main.cpp

Legend:
Removed from v.73  
changed lines
  Added in v.1558

  ViewVC Help
Powered by ViewVC