2016-07-04 23:26:48 +02:00
|
|
|
#ifndef APPLICATION_UTILITIES_RESOURCES_H
|
|
|
|
#define APPLICATION_UTILITIES_RESOURCES_H
|
2015-04-22 18:57:44 +02:00
|
|
|
|
2016-08-29 15:41:11 +02:00
|
|
|
#include "../global.h"
|
2015-04-22 18:57:44 +02:00
|
|
|
|
|
|
|
#include <QtGlobal>
|
|
|
|
|
2016-07-27 21:42:27 +02:00
|
|
|
#include <initializer_list>
|
|
|
|
|
2015-09-16 17:30:25 +02:00
|
|
|
QT_FORWARD_DECLARE_CLASS(QString)
|
|
|
|
QT_FORWARD_DECLARE_CLASS(QStringList)
|
|
|
|
QT_FORWARD_DECLARE_CLASS(QSettings)
|
2015-04-22 18:57:44 +02:00
|
|
|
|
2016-07-16 23:12:02 +02:00
|
|
|
/*!
|
|
|
|
* \brief Sets the application meta data in the QCoreApplication singleton.
|
|
|
|
*/
|
2017-05-01 03:16:25 +02:00
|
|
|
#define SET_QT_APPLICATION_INFO \
|
|
|
|
QCoreApplication::setOrganizationName(QStringLiteral(APP_AUTHOR)); \
|
|
|
|
QCoreApplication::setOrganizationDomain(QStringLiteral(APP_URL)); \
|
|
|
|
QCoreApplication::setApplicationName(QStringLiteral(APP_NAME)); \
|
|
|
|
QCoreApplication::setApplicationVersion(QStringLiteral(APP_VERSION)); \
|
2017-03-01 23:24:47 +01:00
|
|
|
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps, true)
|
2015-07-27 23:22:46 +02:00
|
|
|
|
2016-07-16 23:12:02 +02:00
|
|
|
/*!
|
2017-01-07 16:09:38 +01:00
|
|
|
* \brief Loads translations for Qt, other dependencies and the application.
|
2016-07-16 23:12:02 +02:00
|
|
|
*/
|
2017-05-01 03:16:25 +02:00
|
|
|
#define LOAD_QT_TRANSLATIONS \
|
|
|
|
TranslationFiles::loadQtTranslationFile(QT_TRANSLATION_FILES); \
|
2017-01-07 16:09:38 +01:00
|
|
|
TranslationFiles::loadApplicationTranslationFile(APP_SPECIFIC_QT_TRANSLATION_FILES)
|
2015-07-27 23:22:46 +02:00
|
|
|
|
2015-04-22 18:57:44 +02:00
|
|
|
namespace QtUtilitiesResources {
|
|
|
|
|
2016-08-29 15:41:11 +02:00
|
|
|
QT_UTILITIES_EXPORT void init();
|
|
|
|
QT_UTILITIES_EXPORT void cleanup();
|
2015-04-22 18:57:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace TranslationFiles {
|
|
|
|
|
2016-08-29 15:41:11 +02:00
|
|
|
QT_UTILITIES_EXPORT QString &additionalTranslationFilePath();
|
|
|
|
QT_UTILITIES_EXPORT void loadQtTranslationFile(std::initializer_list<QString> repositoryNames);
|
|
|
|
QT_UTILITIES_EXPORT void loadQtTranslationFile(std::initializer_list<QString> repositoryNames, const QString &localeName);
|
|
|
|
QT_UTILITIES_EXPORT void loadApplicationTranslationFile(const QString &applicationName);
|
|
|
|
QT_UTILITIES_EXPORT void loadApplicationTranslationFile(const QString &applicationName, const QString &localeName);
|
2017-01-07 16:09:38 +01:00
|
|
|
QT_UTILITIES_EXPORT void loadApplicationTranslationFile(const std::initializer_list<QString> &applicationNames);
|
|
|
|
QT_UTILITIES_EXPORT void loadApplicationTranslationFile(const std::initializer_list<QString> &applicationNames, const QString &localeName);
|
2015-04-22 18:57:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace ApplicationInstances {
|
|
|
|
|
2017-04-27 22:03:37 +02:00
|
|
|
#if defined(QT_UTILITIES_GUI_QTWIDGETS)
|
2016-08-29 15:41:11 +02:00
|
|
|
QT_UTILITIES_EXPORT bool hasWidgetsApp();
|
2015-04-22 18:57:44 +02:00
|
|
|
#endif
|
2017-04-27 22:03:37 +02:00
|
|
|
#if defined(QT_UTILITIES_GUI_QTWIDGETS) || defined(QT_UTILITIES_GUI_QTQUICK)
|
2016-08-29 15:41:11 +02:00
|
|
|
QT_UTILITIES_EXPORT bool hasGuiApp();
|
2015-04-22 18:57:44 +02:00
|
|
|
#endif
|
2016-08-29 15:41:11 +02:00
|
|
|
QT_UTILITIES_EXPORT bool hasCoreApp();
|
2015-04-22 18:57:44 +02:00
|
|
|
}
|
|
|
|
|
2015-09-16 17:30:25 +02:00
|
|
|
namespace ConfigFile {
|
|
|
|
|
2016-08-29 15:41:11 +02:00
|
|
|
QT_UTILITIES_EXPORT QString locateConfigFile(const QString &applicationName, const QString &fileName, const QSettings *settings = nullptr);
|
2015-09-16 17:30:25 +02:00
|
|
|
}
|
|
|
|
|
2016-07-04 23:26:48 +02:00
|
|
|
#endif // APPLICATION_UTILITIES_RESOURCES_H
|