Add a notification when catalog refresh fails
This commit is contained in:
parent
81df48b858
commit
ee5b49668a
3 changed files with 31 additions and 2 deletions
|
@ -43,12 +43,26 @@ LauncherPackageDelegate::~LauncherPackageDelegate()
|
|||
|
||||
void LauncherPackageDelegate::catalogRefreshed(simgear::pkg::CatalogRef aCatalog, simgear::pkg::Delegate::StatusCode aReason)
|
||||
{
|
||||
auto nc = LauncherNotificationsController::instance();
|
||||
|
||||
if (aCatalog) {
|
||||
// if catalog download / write to disk failed, show a notification
|
||||
if ((aReason == Delegate::FAIL_EXTRACT) ||
|
||||
(aReason == Delegate::FAIL_DOWNLOAD) ||
|
||||
(aReason == Delegate::FAIL_FILESYSTEM) ||
|
||||
(aReason == Delegate::FAIL_VALIDATION)) {
|
||||
QJSValue args = nc->jsEngine()->newObject();
|
||||
args.setProperty("catalogUri", QString::fromStdString(aCatalog->url()));
|
||||
nc->postNotification("catalog-refresh-failed",
|
||||
QUrl{"qrc:///qml/CatalogRefreshFailedNotification.qml"},
|
||||
args);
|
||||
}
|
||||
}
|
||||
|
||||
if ((aReason != Delegate::STATUS_REFRESHED) || !aCatalog) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto nc = LauncherNotificationsController::instance();
|
||||
|
||||
if (aCatalog->migratedFrom() != simgear::pkg::CatalogRef{}) {
|
||||
QJSValue args = nc->jsEngine()->newObject();
|
||||
|
||||
|
|
14
src/GUI/qml/CatalogRefreshFailedNotification.qml
Normal file
14
src/GUI/qml/CatalogRefreshFailedNotification.qml
Normal file
|
@ -0,0 +1,14 @@
|
|||
import QtQuick 2.4
|
||||
import "."
|
||||
|
||||
Text {
|
||||
signal dismiss();
|
||||
|
||||
readonly property string failUri: _notifications.argsForIndex(model.index).catalogUri
|
||||
|
||||
text: qsTr("The catalog at '%1' failed to download and validate correctly. All aircraft it provides will be unavailable.").arg(failUri)
|
||||
|
||||
wrapMode: Text.WordWrap
|
||||
font.pixelSize: Style.subHeadingFontPixelSize
|
||||
color: "white"
|
||||
}
|
|
@ -148,6 +148,7 @@
|
|||
<file>qml/ScrollToBottomHint.qml</file>
|
||||
<file>qml/GettingStartedTipLayer.qml</file>
|
||||
<file>qml/GettingStartedTipDisplay.qml</file>
|
||||
<file>qml/CatalogRefreshFailedNotification.qml</file>
|
||||
</qresource>
|
||||
<qresource prefix="/preview">
|
||||
<file alias="close-icon">assets/preview-close.png</file>
|
||||
|
|
Loading…
Add table
Reference in a new issue