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