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: Mehdi Fekari <mfekari@rim.com>
Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
Reviewed-by: Nicolas Arnaud-Cormos <nicolas@kdab.com>
This commit is contained in:
Tobias Nätterlund
2013-02-12 11:42:11 +01:00
committed by Nicolas Arnaud-Cormos
parent ff8594fa60
commit 60bb956861
4 changed files with 30 additions and 31 deletions

View File

@@ -70,13 +70,7 @@ BlackBerryDeployConfiguration::BlackBerryDeployConfiguration(ProjectExplorer::Ta
void BlackBerryDeployConfiguration::ctor() void BlackBerryDeployConfiguration::ctor()
{ {
BlackBerryDeployInformation *info m_deployInformation = new BlackBerryDeployInformation(target());
= 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);
}
connect(target()->project(), SIGNAL(proFilesEvaluated()), this, SLOT(setupBarDescriptor()), Qt::UniqueConnection); connect(target()->project(), SIGNAL(proFilesEvaluated()), this, SLOT(setupBarDescriptor()), Qt::UniqueConnection);
@@ -157,9 +151,7 @@ BlackBerryDeployConfiguration::~BlackBerryDeployConfiguration()
BlackBerryDeployInformation *BlackBerryDeployConfiguration::deploymentInfo() const BlackBerryDeployInformation *BlackBerryDeployConfiguration::deploymentInfo() const
{ {
BlackBerryDeployInformation *info return m_deployInformation;
= qobject_cast<BlackBerryDeployInformation *>(target()->project()->namedSettings(QLatin1String(DEPLOYMENT_INFO_SETTING)).value<QObject *>());
return info;
} }
ProjectExplorer::NamedWidget *BlackBerryDeployConfiguration::createConfigWidget() ProjectExplorer::NamedWidget *BlackBerryDeployConfiguration::createConfigWidget()

View File

@@ -71,6 +71,8 @@ private slots:
private: private:
void ctor(); void ctor();
void addBarDescriptorToProject(const QString& barDescriptorPath); void addBarDescriptorToProject(const QString& barDescriptorPath);
BlackBerryDeployInformation *m_deployInformation;
}; };
} // namespace Internal } // namespace Internal

View File

@@ -32,6 +32,7 @@
#include "blackberrydeployconfiguration.h" #include "blackberrydeployconfiguration.h"
#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/target.h> #include <projectexplorer/target.h>
#include <qt4projectmanager/qt4project.h> #include <qt4projectmanager/qt4project.h>
#include <qt4projectmanager/qt4nodes.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"; const char PROFILE_KEY[] = "Qnx.BlackBerry.DeployInformation.ProFile";
} }
BlackBerryDeployInformation::BlackBerryDeployInformation(Qt4ProjectManager::Qt4Project *project) BlackBerryDeployInformation::BlackBerryDeployInformation(ProjectExplorer::Target *target)
: QAbstractTableModel(project) : QAbstractTableModel(target)
, m_project(project) , 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 int BlackBerryDeployInformation::rowCount(const QModelIndex &parent) const
@@ -211,7 +212,7 @@ void BlackBerryDeployInformation::updateModel()
beginResetModel(); beginResetModel();
QList<BarPackageDeployInformation> keep; QList<BarPackageDeployInformation> keep;
QList<Qt4ProjectManager::Qt4ProFileNode *> appNodes = m_project->applicationProFiles(); QList<Qt4ProjectManager::Qt4ProFileNode *> appNodes = project()->applicationProFiles();
foreach (Qt4ProjectManager::Qt4ProFileNode *node, appNodes) { foreach (Qt4ProjectManager::Qt4ProFileNode *node, appNodes) {
bool nodeFound = false; bool nodeFound = false;
for (int i = 0; i < m_deployInformation.size(); ++i) { for (int i = 0; i < m_deployInformation.size(); ++i) {
@@ -229,18 +230,17 @@ void BlackBerryDeployInformation::updateModel()
endResetModel(); endResetModel();
} }
Qt4ProjectManager::Qt4Project *BlackBerryDeployInformation::project() const
{
return static_cast<Qt4ProjectManager::Qt4Project *>(m_target->project());
}
void BlackBerryDeployInformation::initModel() void BlackBerryDeployInformation::initModel()
{ {
if (!m_deployInformation.isEmpty()) if (!m_deployInformation.isEmpty())
return; return;
ProjectExplorer::Target *target = m_project->activeTarget(); QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(m_target->kit());
if (!target
|| !target->activeDeployConfiguration()
|| !qobject_cast<BlackBerryDeployConfiguration *>(target->activeDeployConfiguration()))
return;
QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(target->kit());
if (!version || !version->isValid()) { if (!version || !version->isValid()) {
beginResetModel(); beginResetModel();
m_deployInformation.clear(); m_deployInformation.clear();
@@ -248,21 +248,21 @@ void BlackBerryDeployInformation::initModel()
return; 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. if (!rootNode || rootNode->parseInProgress()) // Can be null right after project creation by wizard.
return; return;
disconnect(m_project, SIGNAL(proFilesEvaluated()), this, SLOT(updateModel())); disconnect(project(), SIGNAL(proFilesEvaluated()), this, SLOT(updateModel()));
beginResetModel(); beginResetModel();
m_deployInformation.clear(); m_deployInformation.clear();
QList<Qt4ProjectManager::Qt4ProFileNode *> appNodes = m_project->applicationProFiles(); QList<Qt4ProjectManager::Qt4ProFileNode *> appNodes = project()->applicationProFiles();
foreach (Qt4ProjectManager::Qt4ProFileNode *node, appNodes) foreach (Qt4ProjectManager::Qt4ProFileNode *node, appNodes)
m_deployInformation << deployInformationFromNode(node); m_deployInformation << deployInformationFromNode(node);
endResetModel(); endResetModel();
connect(m_project, SIGNAL(proFilesEvaluated()), this, SLOT(updateModel())); connect(project(), SIGNAL(proFilesEvaluated()), this, SLOT(updateModel()));
} }
BarPackageDeployInformation BlackBerryDeployInformation::deployInformationFromNode(Qt4ProjectManager::Qt4ProFileNode *node) const BarPackageDeployInformation BlackBerryDeployInformation::deployInformationFromNode(Qt4ProjectManager::Qt4ProFileNode *node) const
@@ -271,9 +271,8 @@ BarPackageDeployInformation BlackBerryDeployInformation::deployInformationFromNo
QFileInfo fi(node->path()); QFileInfo fi(node->path());
const QString appDescriptorPath = QDir::toNativeSeparators(fi.absolutePath() + QLatin1String("/bar-descriptor.xml")); const QString appDescriptorPath = QDir::toNativeSeparators(fi.absolutePath() + QLatin1String("/bar-descriptor.xml"));
QString barPackagePath; QString buildDir = m_target->activeBuildConfiguration()->buildDirectory();
if (!ti.buildDir.isEmpty()) QString barPackagePath = QDir::toNativeSeparators(buildDir + QLatin1Char('/') + ti.target + QLatin1String(".bar"));
barPackagePath = QDir::toNativeSeparators(ti.buildDir + QLatin1Char('/') + ti.target + QLatin1String(".bar"));
return BarPackageDeployInformation(true, appDescriptorPath, barPackagePath, node->path()); return BarPackageDeployInformation(true, appDescriptorPath, barPackagePath, node->path());
} }

View File

@@ -33,6 +33,10 @@
#include <QAbstractTableModel> #include <QAbstractTableModel>
namespace ProjectExplorer {
class Target;
}
namespace Qt4ProjectManager { namespace Qt4ProjectManager {
class Qt4ProFileNode; class Qt4ProFileNode;
class Qt4Project; class Qt4Project;
@@ -61,7 +65,7 @@ class BlackBerryDeployInformation : public QAbstractTableModel
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit BlackBerryDeployInformation(Qt4ProjectManager::Qt4Project *project); explicit BlackBerryDeployInformation(ProjectExplorer::Target *target);
int rowCount(const QModelIndex &parent = QModelIndex()) const; int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const; int columnCount(const QModelIndex &parent = QModelIndex()) const;
@@ -89,10 +93,12 @@ private:
ColumnCount // Always have last ColumnCount // Always have last
}; };
Qt4ProjectManager::Qt4Project *project() const;
void initModel(); void initModel();
BarPackageDeployInformation deployInformationFromNode(Qt4ProjectManager::Qt4ProFileNode *node) const; BarPackageDeployInformation deployInformationFromNode(Qt4ProjectManager::Qt4ProFileNode *node) const;
Qt4ProjectManager::Qt4Project *m_project; ProjectExplorer::Target *m_target;
QList<BarPackageDeployInformation> m_deployInformation; QList<BarPackageDeployInformation> m_deployInformation;
}; };