/[qspeakers]/branches/qtcharts/main.cpp
ViewVC logotype

Contents of /branches/qtcharts/main.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 279 - (show annotations)
Mon Oct 26 15:07:27 2020 UTC (7 months, 2 weeks ago) by ben
File size: 2048 byte(s)
Fix revision displqy
1 #include "mainwindow.h"
2 #include "importexport.h"
3 #include <QApplication>
4 #include <QTranslator>
5 #include <QLibraryInfo>
6 #include <QLocale>
7 #include "config.h"
8
9 int main(int argc, char *argv[])
10 {
11 QApplication a(argc, argv);
12 a.setOrganizationName("Herewe");
13 a.setOrganizationDomain("herewe");
14 a.setApplicationName("QSpeakers");
15 a.setApplicationVersion(VERSION " (" REVISION ")");
16
17 QString locale = QLocale::system().name();
18 QTranslator qtTranslator;
19 qtTranslator.load("qt_" + locale,
20 QLibraryInfo::location(QLibraryInfo::TranslationsPath));
21 a.installTranslator(&qtTranslator);
22
23 QTranslator qspeakersTranslator;
24 if (!qspeakersTranslator.load(TARGET "_" + locale, "locale"))
25 #ifdef __mswin
26 qspeakersTranslator.load(TARGET "_" + locale, QCoreApplication::applicationDirPath() + QDir::separator() + "locale");
27 #else
28 qspeakersTranslator.load(TARGET "_" + locale, DATADIR "/" TARGET "/locale");
29 #endif
30 a.installTranslator(&qspeakersTranslator);
31
32
33 QCommandLineParser parser;
34 parser.setApplicationDescription("Loudspeaker enclosure computation program.");
35 parser.addHelpOption();
36 parser.addVersionOption();
37 parser.addPositionalArgument("project", QCoreApplication::translate("main", "Project file to work on."));
38
39 parser.process(a);
40 const QStringList args = parser.positionalArguments();
41
42 if (args.length() > 0)
43 ImportExport::setSavePath(args.at(0));
44
45 MainWindow w; /* must be created _after_ setSavePath */
46 #ifdef __mswin
47 QString iconpath = QCoreApplication::applicationDirPath() + QDir::separator() + TARGET + ".png";
48 #else
49 QString iconpath = QString(DATADIR "/pixmaps/" TARGET ".png");
50 #endif
51 #if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
52 if (QFileInfo::exists(iconpath))
53 #else
54 if ((QFileInfo(iconpath)).exists())
55 #endif
56 w.setWindowIcon(QIcon(iconpath));
57 else
58 w.setWindowIcon(QIcon(TARGET ".png"));
59
60 if (argc > 1)
61 w.setWindowFilePath(argv[argc - 1]);
62
63 w.show();
64
65 return a.exec();
66 }

  ViewVC Help
Powered by ViewVC 1.1.26