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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1461 - (show annotations) (download)
Sun Oct 28 23:30:36 2007 UTC (16 years, 5 months ago) by schoenebeck
File size: 2450 byte(s)
* started to port QSampler to Qt4 (NOTE: this version is yet broken, use
  the latest tarball release 0.1.5 until the Qt4 port is completed)

1 // main.cpp
2 //
3 /****************************************************************************
4 Copyright (C) 2004-2007, rncbc aka Rui Nuno Capela. All rights reserved.
5
6 This program is free software; you can redistribute it and/or
7 modify it under the terms of the GNU General Public License
8 as published by the Free Software Foundation; either version 2
9 of the License, or (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License along
17 with this program; if not, write to the Free Software Foundation, Inc.,
18 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19
20 *****************************************************************************/
21
22 #include <QApplication>
23 #include <QTextCodec>
24 #include <QTranslator>
25
26 #include "qsamplerAbout.h"
27 #include "qsamplerOptions.h"
28 #include "qsamplerMainForm.h"
29
30 //-------------------------------------------------------------------------
31 // main - The main program trunk.
32 //
33
34 int main ( int argc, char **argv )
35 {
36 QApplication app(argc, argv);
37
38 // Load translation support.
39 QTranslator translator(0);
40 QString sLocale = QTextCodec::codecForLocale()->name();
41 if (sLocale != "C") { //TODO: not sure if "C" locale name exists in Qt4
42 QString sLocName = "qsampler_" + sLocale;
43 if (!translator.load(sLocName, ".")) {
44 QString sLocPath = CONFIG_PREFIX "/share/locale";
45 if (!translator.load(sLocName, sLocPath))
46 fprintf(stderr, "Warning: no locale found: %s/%s.qm\n", sLocPath.toLatin1().data(), sLocName.toLatin1().data());
47 }
48 app.installTranslator(&translator);
49 }
50
51 // Construct default settings; override with command line arguments.
52 qsamplerOptions options;
53 if (!options.parse_args(app.argc(), app.argv())) {
54 app.quit();
55 return 1;
56 }
57
58 // Construct, setup and show the main form.
59 QSampler::MainForm w;
60 app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()));
61 w.setup(&options);
62 w.show();
63
64 // Register the quit signal/slot.
65 // app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()));
66
67 return app.exec();
68 }
69
70 // end of main.cpp

  ViewVC Help
Powered by ViewVC