From d687255ef129e6547e08de9ae8a3674452556f42 Mon Sep 17 00:00:00 2001 From: Klaus Basan Date: Wed, 16 Mar 2016 23:00:00 +0100 Subject: [PATCH] Fixed typo and exit application when parsing fails --- src/blackcore/application.h | 2 +- src/blackcore/setupreader.cpp | 10 +++++----- src/blackcore/setupreader.h | 10 +++++----- src/swiftdata/main.cpp | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/blackcore/application.h b/src/blackcore/application.h index 75b0eb34b..dae9c61c4 100644 --- a/src/blackcore/application.h +++ b/src/blackcore/application.h @@ -48,7 +48,7 @@ namespace BlackCore * Also some standard swift cmd arguments do not need to be re-implemented for each swift application. * - The core facade (aka core runtime) is now part of the application. It can be started via cmd line arguments. * - Settings are loaded - * - Setup is loaded (load the so called bootsrap file) to find servers and other resources + * - Setup is loaded (load the so called bootstrap file) to find servers and other resources * - Update information (new swift versions etc.) are loaded * - If applicable VATSIM status data (where are the VATSIM files?) are loaded * - An end of lifetime can be specified, aka time bombing diff --git a/src/blackcore/setupreader.cpp b/src/blackcore/setupreader.cpp index 4760cb2e2..969a277a7 100644 --- a/src/blackcore/setupreader.cpp +++ b/src/blackcore/setupreader.cpp @@ -68,10 +68,10 @@ namespace BlackCore this->m_bootstrapUrls.clear(); // clean up previous values // web URL - if (!this->m_bootsrapUrlFileValue.isEmpty()) + if (!this->m_bootstrapUrlFileValue.isEmpty()) { // start with the one from cmd args - this->m_bootstrapUrls.push_front(CUrl(this->m_bootsrapUrlFileValue)); + this->m_bootstrapUrls.push_front(CUrl(this->m_bootstrapUrlFileValue)); } // if ever loaded add those URLs @@ -101,11 +101,11 @@ namespace BlackCore bool CSetupReader::parseCmdLineArguments() { - this->m_bootsrapUrlFileValue = CGlobalSetup::buildBootstrapFileUrl( + this->m_bootstrapUrlFileValue = CGlobalSetup::buildBootstrapFileUrl( sApp->getParserValue(this->m_cmdBootstrapUrl) ); this->m_bootstrapMode = stringToEnum(sApp->getParserValue(this->m_cmdBootstrapMode)); - QUrl url(this->m_bootsrapUrlFileValue); + QUrl url(this->m_bootstrapUrlFileValue); // check on local file if (url.isLocalFile()) @@ -194,7 +194,7 @@ namespace BlackCore // settings have changed on disk } - CSetupReader::BootsrapMode CSetupReader::stringToEnum(const QString &s) + CSetupReader::BootstrapMode CSetupReader::stringToEnum(const QString &s) { const QString bsm(s.toLower().trimmed()); if (bsm.startsWith("expl")) return Explicit; diff --git a/src/blackcore/setupreader.h b/src/blackcore/setupreader.h index ff9694dd7..8111c8ed2 100644 --- a/src/blackcore/setupreader.h +++ b/src/blackcore/setupreader.h @@ -107,7 +107,7 @@ namespace BlackCore private: //! Bootstrap mode - enum BootsrapMode + enum BootstrapMode { Default, Explicit, @@ -118,8 +118,8 @@ namespace BlackCore std::atomic m_setupSyncronized { false }; std::atomic m_updateInfoSyncronized { false }; QString m_localSetupFileValue; - QString m_bootsrapUrlFileValue; - BootsrapMode m_bootstrapMode; + QString m_bootstrapUrlFileValue; + BootstrapMode m_bootstrapMode; BlackMisc::Network::CFailoverUrlList m_bootstrapUrls; //!< location of setup files BlackMisc::Network::CFailoverUrlList m_updateInfoUrls; //!< location of info files BlackMisc::CData m_setup {this, &CSetupReader::ps_setupChanged}; //!< data cache setup @@ -128,7 +128,7 @@ namespace BlackCore QCommandLineOption m_cmdBootstrapUrl { { "url", "bootstrap-url", "bootstrapurl" }, - QCoreApplication::translate("application", "bootsrap URL, e.g. datastore.swift-project.org"), + QCoreApplication::translate("application", "bootstrap URL, e.g. datastore.swift-project.org"), "bootstrapurl" }; //!< bootstrap URL QCommandLineOption m_cmdBootstrapMode @@ -142,7 +142,7 @@ namespace BlackCore bool readLocalBootstrapFile(QString &fileName); //! Convert string to mode - static BootsrapMode stringToEnum(const QString &s); + static BootstrapMode stringToEnum(const QString &s); }; } // ns diff --git a/src/swiftdata/main.cpp b/src/swiftdata/main.cpp index 7d7eede72..8dc2bb6ed 100644 --- a/src/swiftdata/main.cpp +++ b/src/swiftdata/main.cpp @@ -31,7 +31,7 @@ int main(int argc, char *argv[]) Q_UNUSED(qa); CGuiApplication a("swift mapping tool", CIcons::swiftDatabase48()); a.useWebDataServices(BlackCore::CWebReaderFlags::AllSwiftDbReaders, BlackCore::CWebReaderFlags::FromDb); - a.start(); + if (!a.start()) { return EXIT_FAILURE; } CSwiftData w; w.show(); int r = a.exec();