1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-07 03:22:33 +01:00

Add qm load check to fix nodiscard warning

This commit is contained in:
Elias Steurer 2021-11-12 15:05:50 +01:00
parent 77daa040bb
commit a84c5bd527

View File

@ -267,8 +267,12 @@ bool Settings::retranslateUI()
QString langCode = fixLanguageCode(QVariant::fromValue(language()).toString());
QFile tsFile;
if (tsFile.exists(":/translations/ScreenPlay_" + langCode + ".qm")) {
m_translator.load(":/translations/ScreenPlay_" + langCode + ".qm");
const QString qmPath = ":/translations/ScreenPlay_" + langCode + ".qm";
if (tsFile.exists(qmPath)) {
if (!m_translator.load(qmPath)) {
qWarning() << "Unable to load translation file: " << qmPath;
return false;
}
auto* app = static_cast<QApplication*>(QApplication::instance());
app->installTranslator(&m_translator);
emit requestRetranslation();