20 |
|
|
21 |
*****************************************************************************/ |
*****************************************************************************/ |
22 |
|
|
|
#include <QApplication> |
|
|
#include <QTextCodec> |
|
|
#include <QTranslator> |
|
|
|
|
23 |
#include "qsamplerAbout.h" |
#include "qsamplerAbout.h" |
24 |
#include "qsamplerOptions.h" |
#include "qsamplerOptions.h" |
25 |
#include "qsamplerMainForm.h" |
#include "qsamplerMainForm.h" |
26 |
|
|
27 |
|
#include <QApplication> |
28 |
|
#include <QTranslator> |
29 |
|
#include <QLocale> |
30 |
|
|
31 |
|
|
32 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
33 |
// main - The main program trunk. |
// main - The main program trunk. |
34 |
// |
// |
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::codecForLocale()->name(); |
QLocale loc; |
43 |
if (sLocale != "C") { //TODO: not sure if "C" locale name exists in Qt4 |
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.toLatin1().data(), sLocName.toLatin1().data()); |
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(); |
qsamplerOptions 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 |
QSampler::MainForm w; |
|
62 |
app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit())); |
// Construct, setup and show the main form. |
63 |
w.setup(&options); |
QSampler::MainForm w; |
64 |
w.show(); |
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 |
|
|
73 |
|
|