Fixed misc. things for bootstrap file/reader

* added help URL
* added swift map URL
* fixed typo for crash report server
* added more failover servers
This commit is contained in:
Klaus Basan
2017-04-12 04:49:08 +02:00
committed by Mathew Sutcliffe
parent b13eb16d51
commit f2d89bf56c
5 changed files with 78 additions and 13 deletions

View File

@@ -1,5 +1,5 @@
{
"crashreportServerUrl": {
"crashReportServerUrl": {
"url": "http://crashreports.swift-project.org/crash_upload"
},
"dbDebugFlag": false,
@@ -17,12 +17,28 @@
"url": "http://swift-project.org/"
}]
},
"onlineHelpUrls": {
"containerbase": [{
"url": "http://help.swift-project.org"
}]
},
"mapUrls": {
"containerbase": [{
"url": "http://map.swift-project.org"
}]
},
"sharedUrls": {
"containerbase": [{
"url": "https://datastore.swift-project.org/shared"
},
{
"url": "https://vatsim-germany.org:50443/datastore/shared"
},
{
"url": "http://www.siliconmind.de/datastore/shared"
},
{
"url": "http://swift-project.org/datastore/shared"
}]
},
"timestampMSecsSinceEpoch": 1476907647000,

View File

@@ -30,7 +30,10 @@ namespace BlackCore
CGlobalSetup::CGlobalSetup() :
ITimestampBased(0),
m_dbRootDirectoryUrl("https://datastore.swift-project.org/"), m_vatsimBookingsUrl("http://vatbook.euroutepro.com/xml2.php"),
m_vatsimMetarsUrls( {"http://metar.vatsim.net/metar.php"}), m_vatsimStatusFileUrls({ "https://status.vatsim.net" }), m_vatsimDataFileUrls({ "http://info.vroute.net/vatsim-data.txt" }), m_sharedUrls({"https://datastore.swift-project.org/shared", "https://vatsim-germany.org:50443/datastore/shared"}), m_newsUrls(QStringList({ "http://swift-project.org/" }))
m_vatsimMetarsUrls( {"http://metar.vatsim.net/metar.php"}), m_vatsimStatusFileUrls({ "https://status.vatsim.net" }),
m_vatsimDataFileUrls({ "http://info.vroute.net/vatsim-data.txt" }), m_sharedUrls({"https://datastore.swift-project.org/shared", "https://vatsim-germany.org:50443/datastore/shared"}),
m_newsUrls(QStringList({ "http://swift-project.org/" })), m_onlineHelpUrls(QStringList({ "help.swift-project.org/" })),
m_mapUrls(QStringList({ "map.swift-project.org/" }))
{ }
CUrl CGlobalSetup::getDbIcaoReaderUrl() const
@@ -65,7 +68,9 @@ namespace BlackCore
CUrl CGlobalSetup::getHelpPageUrl() const
{
return getDbRootDirectoryUrl().withAppendedPath("/page/index.php");
const CUrlList urls(this->m_onlineHelpUrls);
const CUrl url = urls.getRandomWorkingUrl();
return url;
}
CUrl CGlobalSetup::getLegalDirectoryUrl() const
@@ -85,7 +90,7 @@ namespace BlackCore
if (!m_dbDebugFlag) { return false; }
// further checks could go here
bool f = isDevelopment();
const bool f = isDevelopment();
return f;
}
@@ -203,6 +208,12 @@ namespace BlackCore
% "News URLs: "
% getSwiftLatestNewsUrls().toQString(i18n)
% separator
% "Help URLs: "
% getOnlineHelpUrls().toQString(i18n)
% separator
% "swift map URLs: "
% getSwiftMapUrls().toQString(i18n)
% separator
% "DB root directory: "
% getDbRootDirectoryUrl().toQString(i18n)
@@ -249,7 +260,7 @@ namespace BlackCore
if (index.isMyself()) { return CVariant::from(*this); }
if (ITimestampBased::canHandleIndex(index)) { return ITimestampBased::propertyByIndex(index); }
ColumnIndex i = index.frontCasted<ColumnIndex>();
const ColumnIndex i = index.frontCasted<ColumnIndex>();
switch (i)
{
case IndexDbRootDirectory:
@@ -276,6 +287,12 @@ namespace BlackCore
return CVariant::fromValue(this->getSwiftDbDataFileLocationUrls());
case IndexSharedUrls:
return CVariant::fromValue(this->m_sharedUrls);
case IndexNewsUrls:
return CVariant::fromValue(this->m_newsUrls);
case IndexSwiftMapUrls:
return CVariant::fromValue(this->m_mapUrls);
case IndexOnlineHelpUrls:
return CVariant::fromValue(this->m_onlineHelpUrls);
case IndexCrashReportServerUrl:
return CVariant::fromValue(this->m_crashReportServerUrl);
case IndexWasLoaded:
@@ -294,7 +311,7 @@ namespace BlackCore
return;
}
ColumnIndex i = index.frontCasted<ColumnIndex>();
const ColumnIndex i = index.frontCasted<ColumnIndex>();
switch (i)
{
case IndexDbRootDirectory:
@@ -320,6 +337,15 @@ namespace BlackCore
case IndexSharedUrls:
this->m_sharedUrls = variant.value<CUrlList>();
break;
case IndexNewsUrls:
this->m_newsUrls = variant.value<CUrlList>();
break;
case IndexOnlineHelpUrls:
this->m_onlineHelpUrls = variant.value<CUrlList>();
break;
case IndexSwiftMapUrls:
this->m_mapUrls = variant.value<CUrlList>();
break;
case IndexCrashReportServerUrl:
this->m_crashReportServerUrl = variant.value<CUrl>();
break;
@@ -334,7 +360,7 @@ namespace BlackCore
const QString &CGlobalSetup::versionString()
{
// This not the current swift version, but the schema version
// This is not the current swift version, but the schema version
static const QString v("0.7.0");
return v;
}

View File

@@ -49,7 +49,10 @@ namespace BlackCore
IndexVatsimMetars,
IndexVatsimData,
IndexSwiftDbFiles,
IndexSwiftMapUrls,
IndexBootstrapFileUrls,
IndexNewsUrls,
IndexOnlineHelpUrls,
IndexCrashReportServerUrl,
IndexUpdateInfo,
IndexWasLoaded,
@@ -140,13 +143,19 @@ namespace BlackCore
//! Locations of swift DB news
const BlackMisc::Network::CUrlList &getSwiftLatestNewsUrls() const { return m_newsUrls; }
//! Online help URLs
const BlackMisc::Network::CUrlList &getOnlineHelpUrls() const { return m_onlineHelpUrls; }
//! swift map URLs
const BlackMisc::Network::CUrlList &getSwiftMapUrls() const { return m_mapUrls; }
//! FSD test servers
const BlackMisc::Network::CServerList &getFsdTestServers() const { return m_fsdTestServers; }
//! FSD test servers plus hardcoded
BlackMisc::Network::CServerList getFsdTestServersPlusHardcodedServers() const;
//! Productive settings?
//! Is server a development server?
bool isDevelopment() const { return m_development; }
//! Productive settings?
@@ -189,6 +198,8 @@ namespace BlackCore
BlackMisc::Network::CUrlList m_vatsimDataFileUrls; //!< Overall VATSIM data file / merely for bootstrapping the first time
BlackMisc::Network::CUrlList m_sharedUrls; //!< where we can obtain shared info files such as bootstrap, ..
BlackMisc::Network::CUrlList m_newsUrls; //!< where we can obtain latest news
BlackMisc::Network::CUrlList m_onlineHelpUrls; //!< online help URLs
BlackMisc::Network::CUrlList m_mapUrls; //!< swift map URLs
BlackMisc::Network::CServerList m_fsdTestServers; //!< FSD test servers
// transient members, to be switched on/off via GUI or set from reader
@@ -208,6 +219,8 @@ namespace BlackCore
BLACK_METAMEMBER(vatsimMetarsUrls),
BLACK_METAMEMBER(sharedUrls),
BLACK_METAMEMBER(newsUrls),
BLACK_METAMEMBER(onlineHelpUrls),
BLACK_METAMEMBER(mapUrls),
BLACK_METAMEMBER(fsdTestServers),
BLACK_METAMEMBER(development),
BLACK_METAMEMBER(dbDebugFlag, BlackMisc::DisabledForJson)

View File

@@ -262,7 +262,7 @@ namespace BlackCore
{
if (fileName.isEmpty()) { return CStatusMessage(this).error("No file name for local bootstrap file"); }
QString fn;
QFile file(fileName);
const QFile file(fileName);
if (!file.exists())
{
// relative name?
@@ -277,7 +277,7 @@ namespace BlackCore
fn = fileName;
}
QString content(CFileUtils::readFileToString(fn));
const QString content(CFileUtils::readFileToString(fn));
if (content.isEmpty()) { return CStatusMessage(this).error("File '%1' not existing or empty") << fn; }
try

View File

@@ -50,6 +50,7 @@
using namespace BlackConfig;
using namespace BlackMisc;
using namespace BlackMisc::Db;
using namespace BlackMisc::Network;
using namespace BlackGui::Components;
using namespace BlackCore::Data;
@@ -384,6 +385,7 @@ namespace BlackGui
}
});
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
Q_UNUSED(c);
}
void CGuiApplication::addMenuForStyleSheets(QMenu &menu)
@@ -395,6 +397,7 @@ namespace BlackGui
this->reloadStyleSheets();
});
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
Q_UNUSED(c);
}
void CGuiApplication::addMenuFile(QMenu &menu)
@@ -421,6 +424,7 @@ namespace BlackGui
this->gracefulShutdown();
});
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
Q_UNUSED(c);
}
void CGuiApplication::addMenuInternals(QMenu &menu)
@@ -429,14 +433,16 @@ namespace BlackGui
QAction *a = sm->addAction("JSON bootstrap");
bool c = connect(a, &QAction::triggered, this, [a, this]()
{
this->displayTextInConsole(this->getGlobalSetup().toJsonString());
const CGlobalSetup s = this->getGlobalSetup();
this->displayTextInConsole(s.toJsonString());
});
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
a = sm->addAction("JSON distribution info");
a = sm->addAction("JSON distributions (info only)");
c = connect(a, &QAction::triggered, this, [a, this]()
{
this->displayTextInConsole(this->getDistributionInfo().toJsonString());
const CDistributionList d = this->getDistributionInfo();
this->displayTextInConsole(d.toJsonString());
});
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
@@ -460,6 +466,7 @@ namespace BlackGui
this->displayTextInConsole(this->getInfoString("\n"));
});
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
Q_UNUSED(c);
}
void CGuiApplication::addMenuWindow(QMenu &menu)
@@ -504,6 +511,7 @@ namespace BlackGui
}
});
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
Q_UNUSED(c);
}
void CGuiApplication::addMenuHelp(QMenu &menu)
@@ -513,12 +521,14 @@ namespace BlackGui
const CGlobalSetup gs = this->getGlobalSetup();
const CUrl helpPage = gs.getHelpPageUrl();
if (helpPage.isEmpty()) { return; }
QAction *a = menu.addAction(w->style()->standardIcon(QStyle::SP_TitleBarContextHelpButton), "Online help");
bool c = connect(a, &QAction::triggered, this, [helpPage]()
{
QDesktopServices::openUrl(helpPage);
});
Q_ASSERT_X(c, Q_FUNC_INFO, "Connect failed");
Q_UNUSED(c);
}
const CStyleSheetUtility &CGuiApplication::getStyleSheetUtility() const