1 |
capela |
73 |
// main.cpp |
2 |
|
|
// |
3 |
|
|
/**************************************************************************** |
4 |
capela |
920 |
Copyright (C) 2004-2006, rncbc aka Rui Nuno Capela. All rights reserved. |
5 |
capela |
73 |
|
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 |
capela |
920 |
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 |
capela |
73 |
|
20 |
|
|
*****************************************************************************/ |
21 |
|
|
|
22 |
|
|
#include <qapplication.h> |
23 |
|
|
#include <qtextcodec.h> |
24 |
|
|
|
25 |
|
|
#include "qsamplerAbout.h" |
26 |
|
|
#include "qsamplerOptions.h" |
27 |
|
|
#include "qsamplerMainForm.h" |
28 |
|
|
|
29 |
|
|
//------------------------------------------------------------------------- |
30 |
|
|
// main - The main program trunk. |
31 |
|
|
// |
32 |
|
|
|
33 |
|
|
int main ( int argc, char **argv ) |
34 |
|
|
{ |
35 |
|
|
QApplication app(argc, argv); |
36 |
|
|
|
37 |
|
|
// Load translation support. |
38 |
|
|
QTranslator translator(0); |
39 |
|
|
QString sLocale = QTextCodec::locale(); |
40 |
|
|
if (sLocale != "C") { |
41 |
|
|
QString sLocName = "qsampler_" + sLocale; |
42 |
|
|
if (!translator.load(sLocName, ".")) { |
43 |
|
|
QString sLocPath = CONFIG_PREFIX "/share/locale"; |
44 |
|
|
if (!translator.load(sLocName, sLocPath)) |
45 |
|
|
fprintf(stderr, "Warning: no locale found: %s/%s.qm\n", sLocPath.latin1(), sLocName.latin1()); |
46 |
|
|
} |
47 |
|
|
app.installTranslator(&translator); |
48 |
|
|
} |
49 |
|
|
|
50 |
|
|
// Construct default settings; override with command line arguments. |
51 |
|
|
qsamplerOptions options; |
52 |
|
|
if (!options.parse_args(app.argc(), app.argv())) { |
53 |
|
|
app.quit(); |
54 |
|
|
return 1; |
55 |
|
|
} |
56 |
capela |
752 |
|
57 |
capela |
73 |
// Construct, setup and show the main form. |
58 |
|
|
qsamplerMainForm w; |
59 |
capela |
751 |
app.setMainWidget(&w); |
60 |
capela |
73 |
w.setup(&options); |
61 |
|
|
w.show(); |
62 |
|
|
|
63 |
|
|
// Register the quit signal/slot. |
64 |
capela |
751 |
// app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit())); |
65 |
capela |
73 |
|
66 |
|
|
return app.exec(); |
67 |
|
|
} |
68 |
|
|
|
69 |
|
|
// end of main.cpp |