diff options
author | Arttu Tarkiainen <arttu.tarkiainen@qt.io> | 2022-12-28 15:17:05 +0200 |
---|---|---|
committer | Arttu Tarkiainen <arttu.tarkiainen@qt.io> | 2022-12-29 13:12:09 +0200 |
commit | 1793bdb094b68b7ad38cedb7ff887517ce5a5f10 (patch) | |
tree | 3b854b12e7f283f25992cbf7ac7eb96e6a94c744 /src/libs | |
parent | bf27a46ee888d0f09066c4be683f343b9d85a7f9 (diff) |
Suggest clearing the local cache if loading of meta files fail
In case the UI files or licenses associated with a component cannot be
loaded, one reason may be because the installer was forcibly interrupted
previously and the cache was left in an inconsistent state.
Add a hint about clearing the local cache, so that the files will be
downloaded again as part of the metadata archive for repository (or
component, in case of split metadata format).
Task-number: QTIFW-2883
Change-Id: Ie76365bdc5792a91471cc60037f4375617534fe4
Reviewed-by: Katja Marttila <katja.marttila@qt.io>
Diffstat (limited to 'src/libs')
-rw-r--r-- | src/libs/installer/component.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/libs/installer/component.cpp b/src/libs/installer/component.cpp index 914164571..78cbba79f 100644 --- a/src/libs/installer/component.cpp +++ b/src/libs/installer/component.cpp @@ -74,6 +74,9 @@ static const QLatin1String scCheckable("Checkable"); static const QLatin1String scExpandedByDefault("ExpandedByDefault"); static const QLatin1String scUnstable("Unstable"); +static const char *scClearCacheHint = QT_TR_NOOP( + "Clearing the cache directory and restarting the application may solve this."); + /*! \enum QInstaller::Component::UnstableError @@ -700,8 +703,8 @@ void Component::loadUserInterfaces(const QDir &directory, const QStringList &uis while (it.hasNext()) { QFile file(it.next()); if (!file.open(QIODevice::ReadOnly)) { - throw Error(tr("Cannot open the requested UI file \"%1\": %2").arg( - it.fileName(), file.errorString())); + throw Error(tr("Cannot open the requested UI file \"%1\": %2.\n\n%3").arg( + it.fileName(), file.errorString(), tr(scClearCacheHint))); } static QUiLoader loader; @@ -709,8 +712,8 @@ void Component::loadUserInterfaces(const QDir &directory, const QStringList &uis loader.setLanguageChangeEnabled(true); QWidget *const widget = loader.load(&file, 0); if (!widget) { - throw Error(tr("Cannot load the requested UI file \"%1\": %2").arg( - it.fileName(), loader.errorString())); + throw Error(tr("Cannot load the requested UI file \"%1\": %2.\n\n%3").arg( + it.fileName(), loader.errorString(), tr(scClearCacheHint))); } d->scriptEngine()->newQObject(widget); d->m_userInterfaces.insert(widget->objectName(), widget); @@ -755,8 +758,8 @@ void Component::loadLicenses(const QString &directory, const QHash<QString, QVar QFile file(fileInfo.filePath()); if (!file.open(QIODevice::ReadOnly)) { - throw Error(tr("Cannot open the requested license file \"%1\": %2").arg( - file.fileName(), file.errorString())); + throw Error(tr("Cannot open the requested license file \"%1\": %2.\n\n%3").arg( + file.fileName(), file.errorString(), tr(scClearCacheHint))); } QTextStream stream(&file); stream.setCodec("UTF-8"); |