mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 23:05:36 +08:00
Fixed typo and exit application when parsing fails
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -107,7 +107,7 @@ namespace BlackCore
|
||||
|
||||
private:
|
||||
//! Bootstrap mode
|
||||
enum BootsrapMode
|
||||
enum BootstrapMode
|
||||
{
|
||||
Default,
|
||||
Explicit,
|
||||
@@ -118,8 +118,8 @@ namespace BlackCore
|
||||
std::atomic<bool> m_setupSyncronized { false };
|
||||
std::atomic<bool> 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<BlackCore::Data::GlobalSetup> 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
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user