[build] Only build companion/simulator resources files once. (#4670)
* [build] Only build companion/simulator resources files once and include in common lib; Consolidate/cosmetics. * [build] Fix "missing" translation resource files with some builds (since last commit); move resource file declarations to after app init as recommended; fix name of Qt translation file since v5.3 (this still only works on some systems with Qt installed and on the build machine).
This commit is contained in:
committed by
Bertrand Songis
parent
4faf323aed
commit
919e8eb962
@@ -73,16 +73,17 @@ void sharedHelpText(QTextStream &stream)
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
Q_INIT_RESOURCE(companion);
|
||||
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
|
||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
#endif
|
||||
|
||||
QApplication app(argc, argv);
|
||||
app.setApplicationName(APP_SIMULATOR);
|
||||
app.setOrganizationName(COMPANY);
|
||||
app.setOrganizationDomain(COMPANY_DOMAIN);
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
|
||||
app.setAttribute(Qt::AA_EnableHighDpiScaling);
|
||||
#endif
|
||||
|
||||
Q_INIT_RESOURCE(companion);
|
||||
Q_INIT_RESOURCE(translations);
|
||||
|
||||
if (AppDebugMessageHandler::instance())
|
||||
AppDebugMessageHandler::instance()->installAppMessageHandler();
|
||||
@@ -96,7 +97,12 @@ int main(int argc, char *argv[])
|
||||
QTranslator companionTranslator;
|
||||
companionTranslator.load(":/companion_" + g.locale());
|
||||
QTranslator qtTranslator;
|
||||
qtTranslator.load((QString)"qt_" + g.locale().left(2), QLibraryInfo::location(QLibraryInfo::TranslationsPath));
|
||||
#if (QT_VERSION >= QT_VERSION_CHECK(5, 3, 0))
|
||||
QString qtfile = "qtbase_";
|
||||
#else
|
||||
QString qtfile = "qt_";
|
||||
#endif
|
||||
qtTranslator.load(qtfile + g.locale().left(2), QLibraryInfo::location(QLibraryInfo::TranslationsPath));
|
||||
app.installTranslator(&companionTranslator);
|
||||
app.installTranslator(&qtTranslator);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user