mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-18 03:15:34 +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.
|
* 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.
|
* - The core facade (aka core runtime) is now part of the application. It can be started via cmd line arguments.
|
||||||
* - Settings are loaded
|
* - 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
|
* - Update information (new swift versions etc.) are loaded
|
||||||
* - If applicable VATSIM status data (where are the VATSIM files?) are loaded
|
* - If applicable VATSIM status data (where are the VATSIM files?) are loaded
|
||||||
* - An end of lifetime can be specified, aka time bombing
|
* - An end of lifetime can be specified, aka time bombing
|
||||||
|
|||||||
@@ -68,10 +68,10 @@ namespace BlackCore
|
|||||||
this->m_bootstrapUrls.clear(); // clean up previous values
|
this->m_bootstrapUrls.clear(); // clean up previous values
|
||||||
|
|
||||||
// web URL
|
// web URL
|
||||||
if (!this->m_bootsrapUrlFileValue.isEmpty())
|
if (!this->m_bootstrapUrlFileValue.isEmpty())
|
||||||
{
|
{
|
||||||
// start with the one from cmd args
|
// 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
|
// if ever loaded add those URLs
|
||||||
@@ -101,11 +101,11 @@ namespace BlackCore
|
|||||||
|
|
||||||
bool CSetupReader::parseCmdLineArguments()
|
bool CSetupReader::parseCmdLineArguments()
|
||||||
{
|
{
|
||||||
this->m_bootsrapUrlFileValue = CGlobalSetup::buildBootstrapFileUrl(
|
this->m_bootstrapUrlFileValue = CGlobalSetup::buildBootstrapFileUrl(
|
||||||
sApp->getParserValue(this->m_cmdBootstrapUrl)
|
sApp->getParserValue(this->m_cmdBootstrapUrl)
|
||||||
);
|
);
|
||||||
this->m_bootstrapMode = stringToEnum(sApp->getParserValue(this->m_cmdBootstrapMode));
|
this->m_bootstrapMode = stringToEnum(sApp->getParserValue(this->m_cmdBootstrapMode));
|
||||||
QUrl url(this->m_bootsrapUrlFileValue);
|
QUrl url(this->m_bootstrapUrlFileValue);
|
||||||
|
|
||||||
// check on local file
|
// check on local file
|
||||||
if (url.isLocalFile())
|
if (url.isLocalFile())
|
||||||
@@ -194,7 +194,7 @@ namespace BlackCore
|
|||||||
// settings have changed on disk
|
// 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());
|
const QString bsm(s.toLower().trimmed());
|
||||||
if (bsm.startsWith("expl")) return Explicit;
|
if (bsm.startsWith("expl")) return Explicit;
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ namespace BlackCore
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
//! Bootstrap mode
|
//! Bootstrap mode
|
||||||
enum BootsrapMode
|
enum BootstrapMode
|
||||||
{
|
{
|
||||||
Default,
|
Default,
|
||||||
Explicit,
|
Explicit,
|
||||||
@@ -118,8 +118,8 @@ namespace BlackCore
|
|||||||
std::atomic<bool> m_setupSyncronized { false };
|
std::atomic<bool> m_setupSyncronized { false };
|
||||||
std::atomic<bool> m_updateInfoSyncronized { false };
|
std::atomic<bool> m_updateInfoSyncronized { false };
|
||||||
QString m_localSetupFileValue;
|
QString m_localSetupFileValue;
|
||||||
QString m_bootsrapUrlFileValue;
|
QString m_bootstrapUrlFileValue;
|
||||||
BootsrapMode m_bootstrapMode;
|
BootstrapMode m_bootstrapMode;
|
||||||
BlackMisc::Network::CFailoverUrlList m_bootstrapUrls; //!< location of setup files
|
BlackMisc::Network::CFailoverUrlList m_bootstrapUrls; //!< location of setup files
|
||||||
BlackMisc::Network::CFailoverUrlList m_updateInfoUrls; //!< location of info files
|
BlackMisc::Network::CFailoverUrlList m_updateInfoUrls; //!< location of info files
|
||||||
BlackMisc::CData<BlackCore::Data::GlobalSetup> m_setup {this, &CSetupReader::ps_setupChanged}; //!< data cache setup
|
BlackMisc::CData<BlackCore::Data::GlobalSetup> m_setup {this, &CSetupReader::ps_setupChanged}; //!< data cache setup
|
||||||
@@ -128,7 +128,7 @@ namespace BlackCore
|
|||||||
QCommandLineOption m_cmdBootstrapUrl
|
QCommandLineOption m_cmdBootstrapUrl
|
||||||
{
|
{
|
||||||
{ "url", "bootstrap-url", "bootstrapurl" },
|
{ "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"
|
"bootstrapurl"
|
||||||
}; //!< bootstrap URL
|
}; //!< bootstrap URL
|
||||||
QCommandLineOption m_cmdBootstrapMode
|
QCommandLineOption m_cmdBootstrapMode
|
||||||
@@ -142,7 +142,7 @@ namespace BlackCore
|
|||||||
bool readLocalBootstrapFile(QString &fileName);
|
bool readLocalBootstrapFile(QString &fileName);
|
||||||
|
|
||||||
//! Convert string to mode
|
//! Convert string to mode
|
||||||
static BootsrapMode stringToEnum(const QString &s);
|
static BootstrapMode stringToEnum(const QString &s);
|
||||||
};
|
};
|
||||||
} // ns
|
} // ns
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ int main(int argc, char *argv[])
|
|||||||
Q_UNUSED(qa);
|
Q_UNUSED(qa);
|
||||||
CGuiApplication a("swift mapping tool", CIcons::swiftDatabase48());
|
CGuiApplication a("swift mapping tool", CIcons::swiftDatabase48());
|
||||||
a.useWebDataServices(BlackCore::CWebReaderFlags::AllSwiftDbReaders, BlackCore::CWebReaderFlags::FromDb);
|
a.useWebDataServices(BlackCore::CWebReaderFlags::AllSwiftDbReaders, BlackCore::CWebReaderFlags::FromDb);
|
||||||
a.start();
|
if (!a.start()) { return EXIT_FAILURE; }
|
||||||
CSwiftData w;
|
CSwiftData w;
|
||||||
w.show();
|
w.show();
|
||||||
int r = a.exec();
|
int r = a.exec();
|
||||||
|
|||||||
Reference in New Issue
Block a user