summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/qnx/blackberrydeployconfiguration.cpp20
-rw-r--r--src/plugins/qnx/blackberrydeployconfiguration.h4
-rw-r--r--src/plugins/qnx/blackberrydeployinformation.cpp111
-rw-r--r--src/plugins/qnx/blackberrydeployinformation.h9
4 files changed, 129 insertions, 15 deletions
diff --git a/src/plugins/qnx/blackberrydeployconfiguration.cpp b/src/plugins/qnx/blackberrydeployconfiguration.cpp
index 4f6e6a7a09..d849bbaec3 100644
--- a/src/plugins/qnx/blackberrydeployconfiguration.cpp
+++ b/src/plugins/qnx/blackberrydeployconfiguration.cpp
@@ -45,7 +45,8 @@ using namespace Qnx;
using namespace Qnx::Internal;
namespace {
-const char DEPLOYMENT_INFO_SETTING[] = "QNX.BlackBerry.DeploymentInfo";
+const char DEPLOYMENT_INFO_SETTING[] = "Qnx.BlackBerry.DeploymentInfo";
+const char DEPLOYMENT_INFO_KEY[] = "Qnx.BlackBerry.DeployInformation";
}
BlackBerryDeployConfiguration::BlackBerryDeployConfiguration(ProjectExplorer::Target *parent)
@@ -109,6 +110,23 @@ QString BlackBerryDeployConfiguration::deviceName() const
return device->displayName();
}
+QVariantMap BlackBerryDeployConfiguration::toMap() const
+{
+ QVariantMap map(ProjectExplorer::DeployConfiguration::toMap());
+ map.insert(QLatin1String(DEPLOYMENT_INFO_KEY), deploymentInfo()->toMap());
+ return map;
+}
+
+bool BlackBerryDeployConfiguration::fromMap(const QVariantMap &map)
+{
+ if (!ProjectExplorer::DeployConfiguration::fromMap(map))
+ return false;
+
+ QVariantMap deployInfoMap = map.value(QLatin1String(DEPLOYMENT_INFO_KEY)).toMap();
+ deploymentInfo()->fromMap(deployInfoMap);
+ return true;
+}
+
ProjectExplorer::DeployConfigurationWidget *BlackBerryDeployConfiguration::configurationWidget() const
{
return new BlackBerryDeployConfigurationWidget;
diff --git a/src/plugins/qnx/blackberrydeployconfiguration.h b/src/plugins/qnx/blackberrydeployconfiguration.h
index 1e9c772dbb..725374dcb6 100644
--- a/src/plugins/qnx/blackberrydeployconfiguration.h
+++ b/src/plugins/qnx/blackberrydeployconfiguration.h
@@ -62,9 +62,13 @@ public:
QString password() const;
QString deviceName() const;
+ QVariantMap toMap() const;
+
protected:
BlackBerryDeployConfiguration(ProjectExplorer::Target *parent, BlackBerryDeployConfiguration *source);
+ bool fromMap(const QVariantMap &map);
+
private:
void ctor();
};
diff --git a/src/plugins/qnx/blackberrydeployinformation.cpp b/src/plugins/qnx/blackberrydeployinformation.cpp
index 0706bf555e..c65fc7c535 100644
--- a/src/plugins/qnx/blackberrydeployinformation.cpp
+++ b/src/plugins/qnx/blackberrydeployinformation.cpp
@@ -41,11 +41,21 @@
using namespace Qnx;
using namespace Qnx::Internal;
+namespace {
+const char COUNT_KEY[] = "Qnx.BlackBerry.DeployInformationCount";
+const char DEPLOYINFO_KEY[] = "Qnx.BlackBerry.DeployInformation.%1";
+
+const char ENABLED_KEY[] = "Qnx.BlackBerry.DeployInformation.Enabled";
+const char APPDESCRIPTOR_KEY[] = "Qnx.BlackBerry.DeployInformation.AppDescriptor";
+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)
{
- connect(m_project, SIGNAL(proFilesEvaluated()), this, SLOT(initModel()));
+ connect(m_project, SIGNAL(proFilesEvaluated()), this, SLOT(updateModel()));
}
int BlackBerryDeployInformation::rowCount(const QModelIndex &parent) const
@@ -152,8 +162,78 @@ QList<BarPackageDeployInformation> BlackBerryDeployInformation::enabledPackages(
return result;
}
+QVariantMap BlackBerryDeployInformation::toMap() const
+{
+ QVariantMap outerMap;
+ outerMap[QLatin1String(COUNT_KEY)] = m_deployInformation.size();
+
+ for (int i = 0; i < m_deployInformation.size(); ++i) {
+ const BarPackageDeployInformation &deployInfo = m_deployInformation[i];
+
+ QVariantMap deployInfoMap;
+ deployInfoMap[QLatin1String(ENABLED_KEY)] = deployInfo.enabled;
+ deployInfoMap[QLatin1String(APPDESCRIPTOR_KEY)] = deployInfo.appDescriptorPath;
+ deployInfoMap[QLatin1String(PACKAGE_KEY)] = deployInfo.packagePath;
+ deployInfoMap[QLatin1String(PROFILE_KEY)] = deployInfo.proFilePath;
+
+ outerMap[QString::fromLatin1(DEPLOYINFO_KEY).arg(i)] = deployInfoMap;
+ }
+
+ return outerMap;
+}
+
+void BlackBerryDeployInformation::fromMap(const QVariantMap &map)
+{
+ beginResetModel();
+ m_deployInformation.clear();
+
+ int count = map.value(QLatin1String(COUNT_KEY)).toInt();
+ for (int i = 0; i < count; ++i) {
+ QVariantMap innerMap = map.value(QString::fromLatin1(DEPLOYINFO_KEY).arg(i)).toMap();
+
+ const bool enabled = innerMap.value(QLatin1String(ENABLED_KEY)).toBool();
+ const QString appDescriptorPath = innerMap.value(QLatin1String(APPDESCRIPTOR_KEY)).toString();
+ const QString packagePath = innerMap.value(QLatin1String(PACKAGE_KEY)).toString();
+ const QString proFilePath = innerMap.value(QLatin1String(PROFILE_KEY)).toString();
+
+ m_deployInformation << BarPackageDeployInformation(enabled, appDescriptorPath, packagePath, proFilePath);
+ }
+
+ endResetModel();
+}
+
+void BlackBerryDeployInformation::updateModel()
+{
+ if (m_deployInformation.isEmpty()) {
+ initModel();
+ return;
+ }
+
+ beginResetModel();
+ QList<BarPackageDeployInformation> keep;
+ QList<Qt4ProjectManager::Qt4ProFileNode *> appNodes = m_project->applicationProFiles();
+ foreach (Qt4ProjectManager::Qt4ProFileNode *node, appNodes) {
+ bool nodeFound = false;
+ for (int i = 0; i < m_deployInformation.size(); ++i) {
+ if (m_deployInformation[i].proFilePath == node->path()) {
+ keep << m_deployInformation[i];
+ nodeFound = true;
+ break;
+ }
+ }
+
+ if (!nodeFound)
+ keep << deployInformationFromNode(node);
+ }
+ m_deployInformation = keep;
+ endResetModel();
+}
+
void BlackBerryDeployInformation::initModel()
{
+ if (!m_deployInformation.isEmpty())
+ return;
+
ProjectExplorer::Target *target = m_project->activeTarget();
if (!target
|| !target->activeDeployConfiguration()
@@ -172,23 +252,28 @@ void BlackBerryDeployInformation::initModel()
if (!rootNode || rootNode->parseInProgress()) // Can be null right after project creation by wizard.
return;
- disconnect(m_project, SIGNAL(proFilesEvaluated()), this, SLOT(initModel()));
+ disconnect(m_project, SIGNAL(proFilesEvaluated()), this, SLOT(updateModel()));
+
beginResetModel();
m_deployInformation.clear();
QList<Qt4ProjectManager::Qt4ProFileNode *> appNodes = m_project->applicationProFiles();
- foreach (Qt4ProjectManager::Qt4ProFileNode *node, appNodes) {
- Qt4ProjectManager::TargetInformation ti = node->targetInformation();
+ foreach (Qt4ProjectManager::Qt4ProFileNode *node, appNodes)
+ m_deployInformation << deployInformationFromNode(node);
- 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"));
+ endResetModel();
+ connect(m_project, SIGNAL(proFilesEvaluated()), this, SLOT(updateModel()));
+}
- m_deployInformation << BarPackageDeployInformation(true, appDescriptorPath, barPackagePath, node->path());
- }
+BarPackageDeployInformation BlackBerryDeployInformation::deployInformationFromNode(Qt4ProjectManager::Qt4ProFileNode *node) const
+{
+ Qt4ProjectManager::TargetInformation ti = node->targetInformation();
- endResetModel();
- connect(m_project, SIGNAL(proFilesEvaluated()), SLOT(initModel()));
+ 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"));
+
+ return BarPackageDeployInformation(true, appDescriptorPath, barPackagePath, node->path());
}
diff --git a/src/plugins/qnx/blackberrydeployinformation.h b/src/plugins/qnx/blackberrydeployinformation.h
index 36d6e80ac9..3bf53e9dc4 100644
--- a/src/plugins/qnx/blackberrydeployinformation.h
+++ b/src/plugins/qnx/blackberrydeployinformation.h
@@ -34,6 +34,7 @@
#include <QAbstractTableModel>
namespace Qt4ProjectManager {
+class Qt4ProFileNode;
class Qt4Project;
}
@@ -74,8 +75,11 @@ public:
QList<BarPackageDeployInformation> enabledPackages() const;
+ QVariantMap toMap() const;
+ void fromMap(const QVariantMap &map);
+
private slots:
- void initModel();
+ void updateModel();
private:
enum Columns {
@@ -85,6 +89,9 @@ private:
ColumnCount // Always have last
};
+ void initModel();
+ BarPackageDeployInformation deployInformationFromNode(Qt4ProjectManager::Qt4ProFileNode *node) const;
+
Qt4ProjectManager::Qt4Project *m_project;
QList<BarPackageDeployInformation> m_deployInformation;