diff options
author | kh1 <karsten.heimrich@digia.com> | 2013-03-25 15:29:46 +0100 |
---|---|---|
committer | Karsten Heimrich <karsten.heimrich@digia.com> | 2013-03-25 22:01:54 +0100 |
commit | 1d63431abb0f46503768b3159a8f2e616b5f522a (patch) | |
tree | ec799b13925d8e0923d76c9c4bb2e01b3cceaa49 /src | |
parent | 083df53feb6e36cc954e1316af4445d776fb488a (diff) |
Throw if we can't load the requested UI file.
Change-Id: Iced4d4649a386a18efabe80dc094461e7b1b1a74
Reviewed-by: Niels Weber <niels.weber@digia.com>
Reviewed-by: Tim Jenssen <tim.jenssen@digia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/libs/installer/component.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/src/libs/installer/component.cpp b/src/libs/installer/component.cpp index 78d4eb68b..76c7d6ef3 100644 --- a/src/libs/installer/component.cpp +++ b/src/libs/installer/component.cpp @@ -455,7 +455,7 @@ void Component::loadTranslations(const QDir &directory, const QStringList &qms) QScopedPointer<QTranslator> translator(new QTranslator(this)); if (!translator->load(filename)) - throw Error(tr("Could not open the requested translation file at %1").arg(filename)); + throw Error(tr("Could not open the requested translation file '%1'.").arg(filename)); qApp->installTranslator(translator.take()); } } @@ -479,15 +479,23 @@ void Component::loadUserInterfaces(const QDir &directory, const QStringList &uis while (it.hasNext()) { QFile file(it.next()); if (!file.open(QIODevice::ReadOnly)) { - throw Error(tr("Could not open the requested UI file at %1: %2").arg(it.fileName(), + throw Error(tr("Could not open the requested UI file '%1'. Error: %2").arg(it.fileName(), file.errorString())); } static QUiLoader loader; loader.setTranslationEnabled(true); loader.setLanguageChangeEnabled(true); - QWidget *const w = loader.load(&file, MessageBoxHandler::currentBestSuitParent()); - d->m_userInterfaces.insert(w->objectName(), w); + QWidget *const widget = loader.load(&file, MessageBoxHandler::currentBestSuitParent()); + if (!widget) { + throw Error(tr("Could not load the requested UI file '%1'. Error: %2").arg(it.fileName(), +#if QT_VERSION < 0x050000 + tr("An error has occurred while reading the UI file."))); +#else + loader.errorString())); +#endif + } + d->m_userInterfaces.insert(widget->objectName(), widget); } } @@ -512,7 +520,7 @@ void Component::loadLicenses(const QString &directory, const QHash<QString, QVar qDebug("Unable to open translated license file. Using untranslated fallback."); file.setFileName(directory + fileName); if (!file.open(QIODevice::ReadOnly)) { - throw Error(tr("Could not open the requested license file at %1: %2").arg(fileName, + throw Error(tr("Could not open the requested license file '%1'. Error: %2").arg(fileName, file.errorString())); } } |