From 438b368be69fa922a4b3446d72ed65376935cddc Mon Sep 17 00:00:00 2001 From: vslg Date: Sat, 5 Sep 2020 15:09:44 -0300 Subject: [PATCH] Fix typos and improve code - Do not end log messages with '.' - Rephrase some messages - Do not use braces on case statement unless there is an assignment --- src/main.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index a05dc479..febcf3b5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -98,7 +98,7 @@ bool setLockFile(QString configPath) { QDir settingsFolder(configPath); if (! settingsFolder.mkpath(".")) { - qFatal("Could not create config file."); + qFatal("Could not create config directory"); exit(EXIT_FAILURE); } @@ -106,20 +106,18 @@ bool setLockFile(QString configPath) { lockFile->tryLock(0); switch (lockFile->error()) { - case QLockFile::NoError: { + case QLockFile::NoError: return true; - } case QLockFile::LockFailedError: { - qWarning("Opening already running Mirage instance."); + qWarning("Opening already running instance"); QFile showFile(settingsFolder.absoluteFilePath(".show")); showFile.open(QIODevice::WriteOnly); showFile.close(); return false; } - default: { - qFatal("Cannot create lock file: no permission or unknown error."); + default: + qFatal("Cannot create lock file: no permission or unknown error"); exit(EXIT_FAILURE); - } } } @@ -138,7 +136,7 @@ int main(int argc, char *argv[]) { QString settingsFolder( customConfigDir.isEmpty() ? QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) - + "/" + QCoreApplication::applicationName() : + + "/" + QApplication::applicationName() : customConfigDir ); @@ -183,7 +181,7 @@ int main(int argc, char *argv[]) { QQmlEngine engine; QQmlContext *objectContext = new QQmlContext(engine.rootContext()); - // For being able to use Qt.quit() in QML side + // To able to use Qt.quit() from QML side QObject::connect(&engine, &QQmlEngine::quit, &QApplication::quit); // Set the debugMode properties depending of if we're running in debug mode