1 #ifndef APPLICATION_UTILITIES_RESOURCES_H
2 #define APPLICATION_UTILITIES_RESOURCES_H
6 #include <QtContainerFwd>
9 #include <initializer_list>
11 QT_FORWARD_DECLARE_CLASS(QString)
12 QT_FORWARD_DECLARE_CLASS(QSettings)
13 #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
14 QT_FORWARD_DECLARE_CLASS(QStringList)
22 #define SET_QT_APPLICATION_INFO \
23 QCoreApplication::setOrganizationName(QStringLiteral(APP_AUTHOR)); \
24 QCoreApplication::setOrganizationDomain(QStringLiteral(APP_DOMAIN)); \
25 QCoreApplication::setApplicationName(QStringLiteral(APP_NAME)); \
26 QCoreApplication::setApplicationVersion(QStringLiteral(APP_VERSION)); \
27 ::QtUtilities::setupCommonQtApplicationAttributes()
32 #define LOAD_QT_TRANSLATIONS \
33 QtUtilities::TranslationFiles::loadQtTranslationFile(QT_TRANSLATION_FILES); \
34 QtUtilities::TranslationFiles::loadApplicationTranslationFile(QStringLiteral(PROJECT_CONFIG_NAME), APP_SPECIFIC_QT_TRANSLATION_FILES)
38 namespace QtUtilitiesResources {
44 namespace TranslationFiles {
53 const QString &configName,
const std::initializer_list<QString> &applicationNames,
const QString &localeName);
56 namespace ApplicationInstances {
58 #if defined(QT_UTILITIES_GUI_QTWIDGETS)
61 #if defined(QT_UTILITIES_GUI_QTWIDGETS) || defined(QT_UTILITIES_GUI_QTQUICK)
#define QT_UTILITIES_EXPORT
Marks the symbol to be exported by the qtutilities library.
QT_UTILITIES_EXPORT bool hasCoreApp()
Returns whether a QCoreApplication has been instantiated yet.
QT_UTILITIES_EXPORT void init()
Initiates the resources used and provided by this library.
QT_UTILITIES_EXPORT void cleanup()
Frees the resources used and provided by this library.
QT_UTILITIES_EXPORT void loadQtTranslationFile(std::initializer_list< QString > repositoryNames)
Loads and installs the appropriate Qt translation file for the current locale.
QT_UTILITIES_EXPORT void loadApplicationTranslationFile(const QString &configName, const QString &applicationName)
Loads and installs the appropriate application translation file for the current locale.
QT_UTILITIES_EXPORT QString & additionalTranslationFilePath()
Allows to set an additional search path for translation files.
QT_UTILITIES_EXPORT void setupCommonQtApplicationAttributes()
Sets Qt application attributes which are commonly used within my Qt applications.