-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.cpp
55 lines (45 loc) · 1.61 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include "liquidmainwindow.h"
#include <QApplication>
#include <QTranslator>
#include <QLibraryInfo>
#include <QFileInfo>
#include <QCommandLineParser>
#include "config.h"
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
a.setOrganizationName("Herewe");
a.setOrganizationDomain("Servebeer");
a.setApplicationName("QLiquidSFZ");
a.setApplicationVersion(VERSION " (" REVISION ")");
QString locale = QLocale::system().name();
QTranslator qtTranslator;
qtTranslator.load("qt_" + locale,
QLibraryInfo::location(QLibraryInfo::TranslationsPath));
a.installTranslator(&qtTranslator);
QTranslator qliquidsfzTranslator;
if (!qliquidsfzTranslator.load(TARGET "_" + locale, "locale"))
qliquidsfzTranslator.load(TARGET "_" + locale, DATADIR "/" TARGET "/locale" );
a.installTranslator(&qliquidsfzTranslator);
QCommandLineParser parser;
parser.setApplicationDescription("Simple LiquidSFZ synthesizer GUI.");
parser.addHelpOption();
parser.addVersionOption();
parser.addPositionalArgument("sfz", QCoreApplication::translate("main", "SFZ file to load."));
parser.process(a);
const QStringList args = parser.positionalArguments();
LiquidMainWindow w;
QString iconpath = QString(DATADIR "/pixmaps/" TARGET ".png");
#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
if (QFileInfo::exists(iconpath))
#else
if ((QFileInfo(iconpath)).exists())
#endif
w.setWindowIcon(QIcon(iconpath));
else
w.setWindowIcon(QIcon(TARGET ".png"));
w.show();
if (args.length() > 0)
w.loadFile(args.at(0));
return a.exec();
}