Commit 60bb9568 authored by Tobias Nätterlund's avatar Tobias Nätterlund Committed by Nicolas Arnaud-Cormos

QNX: Make the deploy information unique for each deploy configuration

Without this fix, the deploy information was shared between
configurations, causing e.g. BAR packages for a device to
be overwritten by BAR packages for the simulator.

Change-Id: I6b74ba355363060ef53dceac478f0aff0f60c38b
Reviewed-by: default avatarMehdi Fekari <mfekari@rim.com>
Reviewed-by: default avatarChristian Kandeler <christian.kandeler@digia.com>
Reviewed-by: Nicolas Arnaud-Cormos's avatarNicolas Arnaud-Cormos <nicolas@kdab.com>
parent ff8594fa
......@@ -70,13 +70,7 @@ BlackBerryDeployConfiguration::BlackBerryDeployConfiguration(ProjectExplorer::Ta
void BlackBerryDeployConfiguration::ctor()
{
BlackBerryDeployInformation *info
= qobject_cast<BlackBerryDeployInformation *>(target()->project()->namedSettings(QLatin1String(DEPLOYMENT_INFO_SETTING)).value<QObject *>());
if (!info) {
info = new BlackBerryDeployInformation(static_cast<Qt4ProjectManager::Qt4Project *>(target()->project()));
QVariant data = QVariant::fromValue(static_cast<QObject *>(info));
target()->project()->setNamedSettings(QLatin1String(DEPLOYMENT_INFO_SETTING), data);
}
m_deployInformation = new BlackBerryDeployInformation(target());
connect(target()->project(), SIGNAL(proFilesEvaluated()), this, SLOT(setupBarDescriptor()), Qt::UniqueConnection);
......@@ -157,9 +151,7 @@ BlackBerryDeployConfiguration::~BlackBerryDeployConfiguration()
BlackBerryDeployInformation *BlackBerryDeployConfiguration::deploymentInfo() const
{
BlackBerryDeployInformation *info
= qobject_cast<BlackBerryDeployInformation *>(target()->project()->namedSettings(QLatin1String(DEPLOYMENT_INFO_SETTING)).value<QObject *>());
return info;
return m_deployInformation;
}
ProjectExplorer::NamedWidget *BlackBerryDeployConfiguration::createConfigWidget()
......
......@@ -71,6 +71,8 @@ private slots:
private:
void ctor();
void addBarDescriptorToProject(const QString& barDescriptorPath);
BlackBerryDeployInformation *m_deployInformation;
};
} // namespace Internal
......
......@@ -32,6 +32,7 @@
#include "blackberrydeployconfiguration.h"
#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/target.h>
#include <qt4projectmanager/qt4project.h>
#include <qt4projectmanager/qt4nodes.h>
......@@ -51,11 +52,11 @@ const char PACKAGE_KEY[] = "Qnx.BlackBerry.DeployInformation.Package";
const char PROFILE_KEY[] = "Qnx.BlackBerry.DeployInformation.ProFile";
}
BlackBerryDeployInformation::BlackBerryDeployInformation(Qt4ProjectManager::Qt4Project *project)
: QAbstractTableModel(project)
, m_project(project)
BlackBerryDeployInformation::BlackBerryDeployInformation(ProjectExplorer::Target *target)
: QAbstractTableModel(target)
, m_target(target)
{
connect(m_project, SIGNAL(proFilesEvaluated()), this, SLOT(updateModel()));
connect(project(), SIGNAL(proFilesEvaluated()), this, SLOT(updateModel()));
}
int BlackBerryDeployInformation::rowCount(const QModelIndex &parent) const
......@@ -211,7 +212,7 @@ void BlackBerryDeployInformation::updateModel()
beginResetModel();
QList<BarPackageDeployInformation> keep;
QList<Qt4ProjectManager::Qt4ProFileNode *> appNodes = m_project->applicationProFiles();
QList<Qt4ProjectManager::Qt4ProFileNode *> appNodes = project()->applicationProFiles();
foreach (Qt4ProjectManager::Qt4ProFileNode *node, appNodes) {
bool nodeFound = false;
for (int i = 0; i < m_deployInformation.size(); ++i) {
......@@ -229,18 +230,17 @@ void BlackBerryDeployInformation::updateModel()
endResetModel();
}
Qt4ProjectManager::Qt4Project *BlackBerryDeployInformation::project() const
{
return static_cast<Qt4ProjectManager::Qt4Project *>(m_target->project());
}
void BlackBerryDeployInformation::initModel()
{
if (!m_deployInformation.isEmpty())
return;
ProjectExplorer::Target *target = m_project->activeTarget();
if (!target
|| !target->activeDeployConfiguration()
|| !qobject_cast<BlackBerryDeployConfiguration *>(target->activeDeployConfiguration()))
return;
QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(target->kit());
QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(m_target->kit());
if (!version || !version->isValid()) {
beginResetModel();
m_deployInformation.clear();
......@@ -248,21 +248,21 @@ void BlackBerryDeployInformation::initModel()
return;
}
const Qt4ProjectManager::Qt4ProFileNode *const rootNode = m_project->rootQt4ProjectNode();
const Qt4ProjectManager::Qt4ProFileNode *const rootNode = project()->rootQt4ProjectNode();
if (!rootNode || rootNode->parseInProgress()) // Can be null right after project creation by wizard.
return;
disconnect(m_project, SIGNAL(proFilesEvaluated()), this, SLOT(updateModel()));
disconnect(project(), SIGNAL(proFilesEvaluated()), this, SLOT(updateModel()));
beginResetModel();
m_deployInformation.clear();
QList<Qt4ProjectManager::Qt4ProFileNode *> appNodes = m_project->applicationProFiles();
QList<Qt4ProjectManager::Qt4ProFileNode *> appNodes = project()->applicationProFiles();
foreach (Qt4ProjectManager::Qt4ProFileNode *node, appNodes)
m_deployInformation << deployInformationFromNode(node);
endResetModel();
connect(m_project, SIGNAL(proFilesEvaluated()), this, SLOT(updateModel()));
connect(project(), SIGNAL(proFilesEvaluated()), this, SLOT(updateModel()));
}
BarPackageDeployInformation BlackBerryDeployInformation::deployInformationFromNode(Qt4ProjectManager::Qt4ProFileNode *node) const
......@@ -271,9 +271,8 @@ BarPackageDeployInformation BlackBerryDeployInformation::deployInformationFromNo
QFileInfo fi(node->path());
const QString appDescriptorPath = QDir::toNativeSeparators(fi.absolutePath() + QLatin1String("/bar-descriptor.xml"));
QString barPackagePath;
if (!ti.buildDir.isEmpty())
barPackagePath = QDir::toNativeSeparators(ti.buildDir + QLatin1Char('/') + ti.target + QLatin1String(".bar"));
QString buildDir = m_target->activeBuildConfiguration()->buildDirectory();
QString barPackagePath = QDir::toNativeSeparators(buildDir + QLatin1Char('/') + ti.target + QLatin1String(".bar"));
return BarPackageDeployInformation(true, appDescriptorPath, barPackagePath, node->path());
}
......@@ -33,6 +33,10 @@
#include <QAbstractTableModel>
namespace ProjectExplorer {
class Target;
}
namespace Qt4ProjectManager {
class Qt4ProFileNode;
class Qt4Project;
......@@ -61,7 +65,7 @@ class BlackBerryDeployInformation : public QAbstractTableModel
{
Q_OBJECT
public:
explicit BlackBerryDeployInformation(Qt4ProjectManager::Qt4Project *project);
explicit BlackBerryDeployInformation(ProjectExplorer::Target *target);
int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
......@@ -89,10 +93,12 @@ private:
ColumnCount // Always have last
};
Qt4ProjectManager::Qt4Project *project() const;
void initModel();
BarPackageDeployInformation deployInformationFromNode(Qt4ProjectManager::Qt4ProFileNode *node) const;
Qt4ProjectManager::Qt4Project *m_project;
ProjectExplorer::Target *m_target;
QList<BarPackageDeployInformation> m_deployInformation;
};
......
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