1 |
// main.cpp |
// main.cpp |
2 |
// |
// |
3 |
/**************************************************************************** |
/**************************************************************************** |
4 |
Copyright (C) 2004-2006, rncbc aka Rui Nuno Capela. All rights reserved. |
Copyright (C) 2004-2007, rncbc aka Rui Nuno Capela. All rights reserved. |
5 |
|
Copyright (C) 2007, Christian Schoenebeck |
6 |
|
|
7 |
This program is free software; you can redistribute it and/or |
This program is free software; you can redistribute it and/or |
8 |
modify it under the terms of the GNU General Public License |
modify it under the terms of the GNU General Public License |
20 |
|
|
21 |
*****************************************************************************/ |
*****************************************************************************/ |
22 |
|
|
23 |
#include <qapplication.h> |
#include <QApplication> |
24 |
#include <qtextcodec.h> |
#include <QTextCodec> |
25 |
|
#include <QTranslator> |
26 |
|
|
27 |
#include "qsamplerAbout.h" |
#include "qsamplerAbout.h" |
28 |
#include "qsamplerOptions.h" |
#include "qsamplerOptions.h" |
38 |
|
|
39 |
// Load translation support. |
// Load translation support. |
40 |
QTranslator translator(0); |
QTranslator translator(0); |
41 |
QString sLocale = QTextCodec::locale(); |
QString sLocale = QTextCodec::codecForLocale()->name(); |
42 |
if (sLocale != "C") { |
if (sLocale != "C") { //TODO: not sure if "C" locale name exists in Qt4 |
43 |
QString sLocName = "qsampler_" + sLocale; |
QString sLocName = "qsampler_" + sLocale; |
44 |
if (!translator.load(sLocName, ".")) { |
if (!translator.load(sLocName, ".")) { |
45 |
QString sLocPath = CONFIG_PREFIX "/share/locale"; |
QString sLocPath = CONFIG_PREFIX "/share/locale"; |
46 |
if (!translator.load(sLocName, sLocPath)) |
if (!translator.load(sLocName, sLocPath)) |
47 |
fprintf(stderr, "Warning: no locale found: %s/%s.qm\n", sLocPath.latin1(), sLocName.latin1()); |
fprintf(stderr, "Warning: no locale found: %s/%s.qm\n", sLocPath.toLatin1().data(), sLocName.toLatin1().data()); |
48 |
} |
} |
49 |
app.installTranslator(&translator); |
app.installTranslator(&translator); |
50 |
} |
} |
57 |
} |
} |
58 |
|
|
59 |
// Construct, setup and show the main form. |
// Construct, setup and show the main form. |
60 |
qsamplerMainForm w; |
QSampler::MainForm w; |
61 |
app.setMainWidget(&w); |
app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit())); |
62 |
w.setup(&options); |
w.setup(&options); |
63 |
w.show(); |
w.show(); |
64 |
|
|
68 |
return app.exec(); |
return app.exec(); |
69 |
} |
} |
70 |
|
|
71 |
|
|
72 |
// end of main.cpp |
// end of main.cpp |