FotoBox
main.cpp
Go to the documentation of this file.
1 /* main.cpp
2  *
3  * Copyright (c) 2016 Thomas Kais
4  *
5  * This file is subject to the terms and conditions defined in
6  * file 'COPYING', which is part of this source code package.
7  */
8 #include "preferences.h"
9 
10 #include <QApplication>
11 #include <QBitmap>
12 #include <QLibraryInfo>
13 #include <QPixmap>
14 #include <QSplashScreen>
15 #include <QTranslator>
16 
23 auto main(int argc, char *argv[]) -> int
24 {
25  QApplication app(argc, argv);
26 
27  //splash screen FotoBox logo
28  QPixmap pixmap(QStringLiteral(":/resources/logo"));
29  QSplashScreen splash(pixmap, Qt::WindowStaysOnTopHint | Qt::X11BypassWindowManagerHint);
30  //Linux: fix issue with transparent png
31  splash.setMask(pixmap.mask());
32  splash.show();
33 
34  //set application information
35  QApplication::setOrganizationName(QStringLiteral("Thomas Kais"));
36  QApplication::setApplicationName(QStringLiteral("FotoBox"));
37  QApplication::setApplicationVersion(QStringLiteral("1.4.0"));
38 
39  QTranslator qtTranslator;
40  QTranslator appTranslator;
41  //Qt Translation
42  if (qtTranslator.load(QLocale(), QStringLiteral("qt"), QStringLiteral("_"),
43 #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
44  QLibraryInfo::path(QLibraryInfo::TranslationsPath
45 #else
46  QLibraryInfo::location(QLibraryInfo::TranslationsPath
47 #endif
48  ))) {
49  QApplication::installTranslator(&qtTranslator);
50  }
51  //app Translation: German or English (=default language)
52  bool result = false;
53  if (QLocale::system().language() == QLocale::German) {
54  result = appTranslator.load(QStringLiteral(":/resources/translation_de"));
55  } else {
56  result = appTranslator.load(QStringLiteral(":/resources/translation_en"));
57  }
58  if (result) {
59  QApplication::installTranslator(&appTranslator);
60  }
61 
62  //show preferences dialog and close splashscreen
63  auto *dialog = new FotoBox::Preferences;
64  splash.finish(dialog);
65  dialog->show();
66 
67  return QApplication::exec();
68 }
Preference class to change and store the application settings.
Definition: preferences.h:26
auto main(int argc, char *argv[]) -> int
main
Definition: main.cpp:23