Commit b41edc05 authored by El Mehdi Fekari's avatar El Mehdi Fekari Committed by Mehdi Fekari

Qnx: Update bar-descriptor Qt environment if not matching the Qt bundle mode

If the user removes a bar-descriptor and adds it again, the Qt environments
need to be checked since the default values
are not necessary matching the Qt bundle mode
in the deployment settings.

Change-Id: I9f1e2699322d9868a29596da74e54d4323ea4e37
Reviewed-by: default avatarDavid Kaspar <dkaspar@blackberry.com>
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
parent 2b1ec795
......@@ -242,11 +242,15 @@ bool BarDescriptorFileNodeManager::createBarDescriptor(ProjectExplorer::Project
return false;
}
// Check if the Qt environment matches the Qt bundle mode in the deployment step
updateBarDescriptor(barDescriptorPath, project->activeTarget(), true);
return true;
}
void BarDescriptorFileNodeManager::updateBarDescriptor(const QString &barDescriptorPath,
ProjectExplorer::Target *target)
ProjectExplorer::Target *target,
bool skipConfirmation)
{
BarDescriptorDocument doc;
QString errorString;
......@@ -258,7 +262,6 @@ void BarDescriptorFileNodeManager::updateBarDescriptor(const QString &barDescrip
QList<Utils::EnvironmentItem> envItems =
doc.value(BarDescriptorDocument::env).value<QList<Utils::EnvironmentItem> >();
Utils::Environment env(Utils::EnvironmentItem::toStringList(envItems), Utils::OsTypeOtherUnix);
BlackBerryQtVersion *qtVersion =
dynamic_cast<BlackBerryQtVersion *>(QtSupport::QtKitInformation::qtVersion(target->kit()));
......@@ -270,7 +273,8 @@ void BarDescriptorFileNodeManager::updateBarDescriptor(const QString &barDescrip
BlackBerryCreatePackageStep *createPackageStep = dynamic_cast<BlackBerryCreatePackageStep *>(step);
if (createPackageStep) {
createPackageStep->doUpdateAppDescriptorFile(barDescriptorPath,
BlackBerryCreatePackageStep::EditMode::QtEnvironment);
BlackBerryCreatePackageStep::EditMode::QtEnvironment,
skipConfirmation);
}
}
}
......
......@@ -65,7 +65,8 @@ private:
void updateBarDescriptorNodes(ProjectExplorer::Project *project, bool attemptCreate);
bool createBarDescriptor(ProjectExplorer::Project *project, const QString &barDescriptorPath,
ProjectExplorer::ProjectNode *projectNode);
void updateBarDescriptor(const QString &barDescriptorPath, ProjectExplorer::Target *target);
void updateBarDescriptor(const QString &barDescriptorPath, ProjectExplorer::Target *target,
bool skipConfirmation = false);
void removeBarDescriptorNodes(ProjectExplorer::Project *project);
void removeBarDescriptorNodes(ProjectExplorer::ProjectNode *parent);
......
......@@ -426,7 +426,9 @@ void BlackBerryCreatePackageStep::updateAppDescriptorFile()
doUpdateAppDescriptorFile(info.appDescriptorPath(), EditMode::QtEnvironment);
}
bool BlackBerryCreatePackageStep::doUpdateAppDescriptorFile(const QString &appDescriptorPath, QFlags<EditMode> types)
bool BlackBerryCreatePackageStep::doUpdateAppDescriptorFile(const QString &appDescriptorPath,
QFlags<EditMode> types,
bool skipConfirmation)
{
Core::FileChangeBlocker fb(appDescriptorPath);
BarDescriptorDocument doc;
......@@ -502,25 +504,27 @@ bool BlackBerryCreatePackageStep::doUpdateAppDescriptorFile(const QString &appDe
}
if (environmentUpdated) {
QString confirmationText = tr("In order to link to the correct Qt library specified in the deployment settings "
"Qt Creator needs to update the Qt environment variables "
"in the BAR application file as follows:\n\n"
"<env var=\"LD_LIBRARY_PATH\" value=\"%1\"/>\n"
"<env var=\"QT_PLUGIN_PATH\" value=\"%2\"/>\n"
"<env var=\"QML_IMPORT_PATH\" value=\"%3\"/>\n")
.arg(env.value(QLatin1String("LD_LIBRARY_PATH")),
env.value(QLatin1String("QT_PLUGIN_PATH")),
env.value(QLatin1String("QML_IMPORT_PATH")));
if (isQt5)
confirmationText.append(QString::fromLatin1("<env var=\"QML2_IMPORT_PATH\" value=\"%1\"/>\n")
.arg(env.value(QLatin1String("QML2_IMPORT_PATH"))));
confirmationText.append(tr("\nDo you want to update it?"));
QMessageBox::StandardButton answer =
QMessageBox::question(Core::ICore::mainWindow(), tr("Confirmation"),
confirmationText,
QMessageBox::Yes | QMessageBox::No);
QMessageBox::StandardButton answer = QMessageBox::Yes;
if (!skipConfirmation) {
QString confirmationText = tr("In order to link to the correct Qt library specified in the deployment settings "
"Qt Creator needs to update the Qt environment variables "
"in the BAR application file as follows:\n\n"
"<env var=\"LD_LIBRARY_PATH\" value=\"%1\"/>\n"
"<env var=\"QT_PLUGIN_PATH\" value=\"%2\"/>\n"
"<env var=\"QML_IMPORT_PATH\" value=\"%3\"/>\n")
.arg(env.value(QLatin1String("LD_LIBRARY_PATH")),
env.value(QLatin1String("QT_PLUGIN_PATH")),
env.value(QLatin1String("QML_IMPORT_PATH")));
if (isQt5)
confirmationText.append(QString::fromLatin1("<env var=\"QML2_IMPORT_PATH\" value=\"%1\"/>\n")
.arg(env.value(QLatin1String("QML2_IMPORT_PATH"))));
confirmationText.append(tr("\nDo you want to update it?"));
answer = QMessageBox::question(Core::ICore::mainWindow(), tr("Confirmation"),
confirmationText,
QMessageBox::Yes | QMessageBox::No);
}
if (answer == QMessageBox::Yes) {
QVariant envVar;
......
......@@ -106,7 +106,8 @@ private:
void ctor();
bool doUpdateAppDescriptorFile(const QString &appDescriptorPath,
QFlags<EditMode> types);
QFlags<EditMode> types,
bool skipConfirmation = false);
QString fullDeployedQtLibraryPath() const;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment