1 |
capela |
73 |
// main.cpp |
2 |
|
|
// |
3 |
|
|
/**************************************************************************** |
4 |
|
|
Copyright (C) 2004, 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 |
17 |
|
|
along with this program; if not, write to the Free Software |
18 |
|
|
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
19 |
|
|
|
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 |
|
|
#include "config.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 |
|
|
QString sLocale = QTextCodec::locale(); |
42 |
|
|
if (sLocale != "C") { |
43 |
|
|
QString sLocName = "qsampler_" + sLocale; |
44 |
|
|
if (!translator.load(sLocName, ".")) { |
45 |
|
|
QString sLocPath = CONFIG_PREFIX "/share/locale"; |
46 |
|
|
if (!translator.load(sLocName, sLocPath)) |
47 |
|
|
fprintf(stderr, "Warning: no locale found: %s/%s.qm\n", sLocPath.latin1(), sLocName.latin1()); |
48 |
|
|
} |
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 |
|
|
|
59 |
|
|
// Construct, setup and show the main form. |
60 |
|
|
qsamplerMainForm w; |
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 |
71 |
|
|
|