FotoBox
main.cpp File Reference
#include "preferences.h"
#include <QApplication>
#include <QBitmap>
#include <QLibraryInfo>
#include <QPixmap>
#include <QSplashScreen>
#include <QTranslator>
+ Include dependency graph for main.cpp:

Go to the source code of this file.

Functions

auto main (int argc, char *argv[]) -> int
 main More...
 

Function Documentation

◆ main()

auto main ( int  argc,
char *  argv[] 
) -> int

main

Parameters
argcargument count
argvargument vector
Returns
int EXIT CODE

Definition at line 23 of file main.cpp.

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