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
This commit is contained in:
vslg 2020-09-05 15:09:44 -03:00
parent 6f9d983e03
commit 438b368be6

View File

@ -98,7 +98,7 @@ bool setLockFile(QString configPath) {
QDir settingsFolder(configPath); QDir settingsFolder(configPath);
if (! settingsFolder.mkpath(".")) { if (! settingsFolder.mkpath(".")) {
qFatal("Could not create config file."); qFatal("Could not create config directory");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
@ -106,20 +106,18 @@ bool setLockFile(QString configPath) {
lockFile->tryLock(0); lockFile->tryLock(0);
switch (lockFile->error()) { switch (lockFile->error()) {
case QLockFile::NoError: { case QLockFile::NoError:
return true; return true;
}
case QLockFile::LockFailedError: { case QLockFile::LockFailedError: {
qWarning("Opening already running Mirage instance."); qWarning("Opening already running instance");
QFile showFile(settingsFolder.absoluteFilePath(".show")); QFile showFile(settingsFolder.absoluteFilePath(".show"));
showFile.open(QIODevice::WriteOnly); showFile.open(QIODevice::WriteOnly);
showFile.close(); showFile.close();
return false; return false;
} }
default: { default:
qFatal("Cannot create lock file: no permission or unknown error."); qFatal("Cannot create lock file: no permission or unknown error");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
}
} }
} }
@ -138,7 +136,7 @@ int main(int argc, char *argv[]) {
QString settingsFolder( QString settingsFolder(
customConfigDir.isEmpty() ? customConfigDir.isEmpty() ?
QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation)
+ "/" + QCoreApplication::applicationName() : + "/" + QApplication::applicationName() :
customConfigDir customConfigDir
); );
@ -183,7 +181,7 @@ int main(int argc, char *argv[]) {
QQmlEngine engine; QQmlEngine engine;
QQmlContext *objectContext = new QQmlContext(engine.rootContext()); 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); QObject::connect(&engine, &QQmlEngine::quit, &QApplication::quit);
// Set the debugMode properties depending of if we're running in debug mode // Set the debugMode properties depending of if we're running in debug mode