/[qspeakers]/main.cpp
ViewVC logotype

Contents of /main.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 180 - (show annotations)
Mon May 15 12:55:27 2017 UTC (6 weeks, 2 days ago) by (unknown author)
File size: 1337 byte(s)
fix qt4 compilation and pre-increment version number
1 #include "mainwindow.h"
2 #include "importexport.h"
3 #include <QApplication>
4 #include <QTranslator>
5 #include <QLibraryInfo>
6 #include <QLocale>
7
8 #include "config.h"
9
10 int main(int argc, char *argv[])
11 {
12 QApplication a(argc, argv);
13 a.setOrganizationName("Herewe");
14 a.setOrganizationDomain("herewe");
15 a.setApplicationName("QSpeakers");
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 qspeakersTranslator.load(TARGET "_" + locale, DATADIR "/" TARGET "/locale");
26 a.installTranslator(&qspeakersTranslator);
27
28 if (argc > 1)
29 ImportExport::setSavePath(argv[argc - 1]);
30
31 MainWindow w; /* must be created _after_ setSavePath */
32
33 QString iconpath = QString(DATADIR "/pixmaps/" TARGET ".png");
34 #if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
35 if (QFileInfo::exists(iconpath))
36 #else
37 if ((QFileInfo(iconpath)).exists())
38 #endif
39 w.setWindowIcon(QIcon(iconpath));
40 else
41 w.setWindowIcon(QIcon(TARGET ".png"));
42
43 if (argc > 1)
44 w.setWindowFilePath(argv[argc - 1]);
45
46 w.show();
47
48 return a.exec();
49 }

  ViewVC Help
Powered by ViewVC 1.1.26