code cleanup: QLatin1Literal is deprecated in Qt 5.14

Simply replace it with QLatin1String. There is a tiny performance penalty,
but none of that code would care.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2020-01-26 16:49:42 -08:00
parent df9164f7e5
commit 2268b6b212
2 changed files with 8 additions and 8 deletions

View file

@ -76,9 +76,9 @@ void init_qt_late()
qtTranslator = new QTranslator; qtTranslator = new QTranslator;
QString translationLocation; QString translationLocation;
#if defined(Q_OS_ANDROID) #if defined(Q_OS_ANDROID)
translationLocation = QLatin1Literal("assets:/translations"); translationLocation = QLatin1String("assets:/translations");
#elif defined(Q_OS_IOS) #elif defined(Q_OS_IOS)
translationLocation = QLatin1Literal(":/"); translationLocation = QLatin1String(":/");
#else #else
translationLocation = QLibraryInfo::location(QLibraryInfo::TranslationsPath); translationLocation = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
#endif #endif

View file

@ -53,8 +53,8 @@
QMLManager *QMLManager::m_instance = NULL; QMLManager *QMLManager::m_instance = NULL;
bool noCloudToCloud = false; bool noCloudToCloud = false;
#define RED_FONT QLatin1Literal("<font color=\"red\">") #define RED_FONT QLatin1String("<font color=\"red\">")
#define END_FONT QLatin1Literal("</font>") #define END_FONT QLatin1String("</font>")
extern "C" void showErrorFromC(char *buf) extern "C" void showErrorFromC(char *buf)
{ {
@ -276,9 +276,9 @@ void QMLManager::applicationStateChanged(Qt::ApplicationState state)
} }
stateText.prepend("AppState changed to "); stateText.prepend("AppState changed to ");
stateText.append(" with "); stateText.append(" with ");
stateText.append((alreadySaving ? QLatin1Literal("") : QLatin1Literal("no ")) + QLatin1Literal("save ongoing")); stateText.append((alreadySaving ? QLatin1String("") : QLatin1String("no ")) + QLatin1String("save ongoing"));
stateText.append(" and "); stateText.append(" and ");
stateText.append((unsaved_changes() ? QLatin1Literal("") : QLatin1Literal("no ")) + QLatin1Literal("unsaved changes")); stateText.append((unsaved_changes() ? QLatin1String("") : QLatin1String("no ")) + QLatin1String("unsaved changes"));
appendTextToLog(stateText); appendTextToLog(stateText);
if (!alreadySaving && state == Qt::ApplicationInactive && unsaved_changes()) { if (!alreadySaving && state == Qt::ApplicationInactive && unsaved_changes()) {
@ -1663,14 +1663,14 @@ void QMLManager::setVerboseEnabled(bool verboseMode)
void QMLManager::syncLoadFromCloud() void QMLManager::syncLoadFromCloud()
{ {
QSettings s; QSettings s;
QString cloudMarker = QLatin1Literal("loadFromCloud") + QString(prefs.cloud_storage_email); QString cloudMarker = QLatin1String("loadFromCloud") + QString(prefs.cloud_storage_email);
m_loadFromCloud = s.contains(cloudMarker) && s.value(cloudMarker).toBool(); m_loadFromCloud = s.contains(cloudMarker) && s.value(cloudMarker).toBool();
} }
void QMLManager::setLoadFromCloud(bool done) void QMLManager::setLoadFromCloud(bool done)
{ {
QSettings s; QSettings s;
QString cloudMarker = QLatin1Literal("loadFromCloud") + QString(prefs.cloud_storage_email); QString cloudMarker = QLatin1String("loadFromCloud") + QString(prefs.cloud_storage_email);
s.setValue(cloudMarker, done); s.setValue(cloudMarker, done);
m_loadFromCloud = done; m_loadFromCloud = done;
emit loadFromCloudChanged(); emit loadFromCloudChanged();