Launcher: fix feedback adding default catalog
When adding the default catalog from the aircraft browse tab, the list on the add-ons page didn’t refresh correctly.
This commit is contained in:
parent
8c371cf3bb
commit
f78d644a61
5 changed files with 37 additions and 10 deletions
|
@ -295,7 +295,7 @@ void AddOnsController::officialCatalogAction(QString s)
|
|||
QSettings settings;
|
||||
settings.setValue("hide-official-catalog-message", true);
|
||||
} else if (s == "add-official") {
|
||||
m_catalogs->installDefaultCatalog();
|
||||
m_catalogs->installDefaultCatalog(false);
|
||||
}
|
||||
|
||||
emit showNoOfficialHangarChanged();
|
||||
|
|
|
@ -198,12 +198,16 @@ void CatalogListModel::refreshCatalog(int index)
|
|||
m_catalogs.at(static_cast<size_t>(index))->refresh();
|
||||
}
|
||||
|
||||
void CatalogListModel::installDefaultCatalog()
|
||||
void CatalogListModel::installDefaultCatalog(bool showAddFeedback)
|
||||
{
|
||||
FGHTTPClient* http = globals->get_subsystem<FGHTTPClient>();
|
||||
m_newlyAddedCatalog = Catalog::createFromUrl(m_packageRoot, http->getDefaultCatalogUrl());
|
||||
auto cat = Catalog::createFromUrl(m_packageRoot, http->getDefaultCatalogUrl());
|
||||
if (showAddFeedback) {
|
||||
cat = m_newlyAddedCatalog;
|
||||
emit isAddingCatalogChanged();
|
||||
emit statusOfAddingCatalogChanged();
|
||||
}
|
||||
|
||||
resetData();
|
||||
}
|
||||
|
||||
|
@ -316,7 +320,7 @@ CatalogListModel::CatalogStatus CatalogListModel::translateStatusForCatalog(Cata
|
|||
case Delegate::FAIL_DOWNLOAD: return NetworkError;
|
||||
case Delegate::STATUS_IN_PROGRESS: return Refreshing;
|
||||
case Delegate::FAIL_NOT_FOUND: return NotFoundOnServer;
|
||||
case Delegate::FAIL_VERSION: return IncomaptbleVersion;
|
||||
case Delegate::FAIL_VERSION: return IncompatibleVersion;
|
||||
case Delegate::FAIL_HTTP_FORBIDDEN: return HTTPForbidden;
|
||||
case Delegate::FAIL_VALIDATION: return InvalidData;
|
||||
default:
|
||||
|
|
|
@ -68,7 +68,7 @@ public:
|
|||
|
||||
Q_INVOKABLE void refreshCatalog(int index);
|
||||
|
||||
Q_INVOKABLE void installDefaultCatalog();
|
||||
Q_INVOKABLE void installDefaultCatalog(bool showAddFeedback);
|
||||
|
||||
// returns the index of the new catalog
|
||||
Q_INVOKABLE void addCatalogByUrl(QUrl url);
|
||||
|
@ -85,7 +85,7 @@ public:
|
|||
Refreshing,
|
||||
NetworkError,
|
||||
NotFoundOnServer,
|
||||
IncomaptbleVersion,
|
||||
IncompatibleVersion,
|
||||
HTTPForbidden,
|
||||
InvalidData,
|
||||
UnknownError,
|
||||
|
|
|
@ -77,12 +77,25 @@ Item {
|
|||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
id: bottomDivider
|
||||
height: Style.margin
|
||||
width: parent.width
|
||||
|
||||
Rectangle {
|
||||
color: Style.frameColor
|
||||
height: 1
|
||||
width: parent.width - Style.strutSize
|
||||
anchors.centerIn: parent
|
||||
}
|
||||
}
|
||||
|
||||
ClickableText {
|
||||
visible: !_addOns.isOfficialHangarRegistered && !addCatalogPanel.isActive
|
||||
anchors { left: parent.left; right: parent.right; margins: Style.margin }
|
||||
text : qsTr("The official FlightGear aircraft hangar is not set up. To add it, click here.");
|
||||
onClicked: {
|
||||
_addOns.catalogs.installDefaultCatalog()
|
||||
_addOns.catalogs.installDefaultCatalog(true)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -76,14 +76,24 @@ Item {
|
|||
}
|
||||
|
||||
StyledText {
|
||||
id: normalDescription
|
||||
visible: model.status === CatalogListModel.Ok
|
||||
width: parent.width
|
||||
text: model.description
|
||||
wrapMode: Text.WordWrap
|
||||
}
|
||||
|
||||
StyledText {
|
||||
id: badVersionDescription
|
||||
visible: model.status === CatalogListModel.IncompatibleVersion
|
||||
width: parent.width
|
||||
wrapMode: Text.WordWrap
|
||||
text: qsTr("This hangar is not compatible with this version of FlightGear")
|
||||
}
|
||||
|
||||
ClickableText {
|
||||
visible: model.status !== CatalogListModel.Ok
|
||||
id: errorDescription
|
||||
visible: (model.status !== CatalogListModel.Ok) && (model.status !== CatalogListModel.IncompatibleVersion)
|
||||
width: parent.width
|
||||
wrapMode: Text.WordWrap
|
||||
text: qsTr("This hangar is currently disabled due to a problem. " +
|
||||
|
|
Loading…
Add table
Reference in a new issue