summaryrefslogtreecommitdiff
path: root/src/plugins/qnx/blackberrydeployconfiguration.cpp
diff options
context:
space:
mode:
authorTobias Nätterlund <tobias.naetterlund.qnx@kdab.com>2014-03-06 14:39:50 +0100
committerTobias Nätterlund <tobias.naetterlund@kdab.com>2014-03-14 06:52:22 +0100
commit8ee451b94a5aec8625a58e4df3450cdcba448d01 (patch)
tree27f719ee85c8ec21daa209bea530999254023558 /src/plugins/qnx/blackberrydeployconfiguration.cpp
parent3b786e7faf33e50e6a8b39975087c7939fe879d6 (diff)
downloadqt-creator-8ee451b94a5aec8625a58e4df3450cdcba448d01.tar.gz
BlackBerry: Do not add bar-descriptor.xml to .pro file
The bar-descriptor.xml file will no longer be added to the .pro file as OTHER_FILES, as it was not necessarily the file listed in the .pro file that was used for creating the package later on, as that is configured in the deployment settings. Instead, the file configured in the deployment settings is now added to the file project tree, and kept in sync if the user changes the file to use for deployment. Task-number: QTCREATORBUG-10054 Change-Id: I3068fedf8ea17f4e60131f9106b3844086d1552b Reviewed-by: David Kaspar <dkaspar@blackberry.com> Reviewed-by: Mehdi Fekari <mfekari@blackberry.com> Reviewed-by: Nicolas Arnaud-Cormos <nicolas@kdab.com>
Diffstat (limited to 'src/plugins/qnx/blackberrydeployconfiguration.cpp')
-rw-r--r--src/plugins/qnx/blackberrydeployconfiguration.cpp112
1 files changed, 1 insertions, 111 deletions
diff --git a/src/plugins/qnx/blackberrydeployconfiguration.cpp b/src/plugins/qnx/blackberrydeployconfiguration.cpp
index 8c4ab54aa4..3538db0985 100644
--- a/src/plugins/qnx/blackberrydeployconfiguration.cpp
+++ b/src/plugins/qnx/blackberrydeployconfiguration.cpp
@@ -32,28 +32,15 @@
#include "blackberrydeployconfiguration.h"
#include "qnxconstants.h"
+#include "bardescriptorfilenode.h"
#include "blackberrydeployconfigurationwidget.h"
#include "blackberrydeployinformation.h"
-#include <projectexplorer/kitinformation.h>
-#include <projectexplorer/target.h>
-#include <projectexplorer/projectexplorer.h>
-#include <qmakeprojectmanager/qmakenodes.h>
-#include <qmakeprojectmanager/qmakeproject.h>
-#include <qmakeprojectmanager/qmakebuildconfiguration.h>
-#include <qtsupport/qtkitinformation.h>
-#include <coreplugin/icore.h>
-#include <ssh/sshconnection.h>
-#include <utils/checkablemessagebox.h>
-
-#include <QMessageBox>
-
using namespace Qnx;
using namespace Qnx::Internal;
namespace {
const char DEPLOYMENT_INFO_KEY[] = "Qnx.BlackBerry.DeployInformation";
-const char BAR_DESC_SETUP[] = "Qnx.BlackBerry.DeployInformation.BarDescriptorSetup";
}
BlackBerryDeployConfiguration::BlackBerryDeployConfiguration(ProjectExplorer::Target *parent)
@@ -73,105 +60,10 @@ BlackBerryDeployConfiguration::BlackBerryDeployConfiguration(ProjectExplorer::Ta
void BlackBerryDeployConfiguration::ctor()
{
m_deployInformation = new BlackBerryDeployInformation(target());
- m_appBarDesciptorSetup = false;
-
- connect(target()->project(), SIGNAL(proFilesEvaluated()), this, SLOT(setupBarDescriptor()), Qt::UniqueConnection);
setDefaultDisplayName(tr("Deploy to BlackBerry Device"));
}
-void BlackBerryDeployConfiguration::setupBarDescriptor()
-{
- QmakeProjectManager::QmakeBuildConfiguration *bc = qobject_cast<QmakeProjectManager::QmakeBuildConfiguration *>(target()->activeBuildConfiguration());
- if (!bc || !target()->kit())
- return;
-
- Core::Id deviceType = ProjectExplorer::DeviceTypeKitInformation::deviceTypeId(target()->kit());
- QString projectName = target()->project()->displayName();
-
- QString targetName;
- QmakeProjectManager::QmakeProject *project = static_cast<QmakeProjectManager::QmakeProject *>(target()->project());
- foreach (QmakeProjectManager::QmakeProFileNode *node, project->applicationProFiles()) {
- QString target = node->targetInformation().target;
- if (!target.isEmpty()) {
- targetName = target;
- break;
- }
- }
-
- if (deviceType == Constants::QNX_BB_OS_TYPE) {
- const QLatin1String barDescriptorFileName("bar-descriptor.xml");
- Utils::FileName barDescriptorPath = Utils::FileName::fromString(target()->project()->projectDirectory()).appendPath(barDescriptorFileName);
- const QFile barDescriptorFile(barDescriptorPath.toString());
- if (barDescriptorFile.exists())
- return;
-
- if (m_appBarDesciptorSetup)
- return;
-
- QDialogButtonBox::StandardButton button = Utils::CheckableMessageBox::question(Core::ICore::mainWindow(),
- tr("Setup Application Descriptor File"),
- tr("You need to set up a BAR descriptor file to enable "
- "packaging.\nDo you want Qt Creator to generate it for your project (%1)?")
- .arg(target()->project()->projectFilePath()),
- tr("Do not ask again for this project"), &m_appBarDesciptorSetup);
-
- if (button == QDialogButtonBox::No)
- return;
-
- QString barDescriptorTemplate;
- QtSupport::QtVersionNumber qtVersion = QtSupport::QtKitInformation::qtVersion(target()->kit())->qtVersion();
- if (qtVersion >= QtSupport::QtVersionNumber(5, 0, 0))
- barDescriptorTemplate = Core::ICore::resourcePath()
- + QLatin1String("/templates/wizards/bb-qt5-bardescriptor/bar-descriptor.xml");
- else
- barDescriptorTemplate = Core::ICore::resourcePath()
- + QLatin1String("/templates/wizards/bb-bardescriptor/bar-descriptor.xml");
-
- Utils::FileReader reader;
- if (!reader.fetch(barDescriptorTemplate)) {
- QMessageBox::warning(Core::ICore::mainWindow(),
- tr("Cannot Set up Application Descriptor File"),
- tr("Reading the BAR descriptor template failed."),
- QMessageBox::Ok);
- return;
- }
-
- QString content = QString::fromUtf8(reader.data());
- content.replace(QLatin1String("PROJECTNAME"), projectName);
- content.replace(QLatin1String("PROJECTPATH"), targetName);
- content.replace(QLatin1String("ID"), QLatin1String("com.example.") + projectName);
-
- if (Utils::FileName::fromString(target()->project()->projectDirectory())
- .appendPath(QLatin1String("qml")).toFileInfo().exists())
- content.replace(QLatin1String("</qnx>"),
- QLatin1String(" <asset path=\"%SRC_DIR%/qml\">qml</asset>\n</qnx>"));
-
- Utils::FileSaver writer(barDescriptorFile.fileName(), QIODevice::WriteOnly);
- writer.write(content.toUtf8());
- if (!writer.finalize()) {
- QMessageBox::warning(Core::ICore::mainWindow(),
- tr("Cannot Set up Application Descriptor File"),
- tr("Writing the BAR descriptor file failed."),
- QMessageBox::Ok);
- return;
- }
-
- // Add the Bar Descriptor to the existing project
- if (target()->project()->rootProjectNode())
- addBarDescriptorToProject(barDescriptorPath.toString());
- }
-}
-
-void BlackBerryDeployConfiguration::addBarDescriptorToProject(const QString &barDesciptorPath)
-{
- if (barDesciptorPath.isEmpty())
- return;
-
- ProjectExplorer::ProjectExplorerPlugin::instance()
- ->addExistingFiles(target()->project()->rootProjectNode(), QStringList() << barDesciptorPath);
-}
-
BlackBerryDeployConfiguration::~BlackBerryDeployConfiguration()
{
}
@@ -190,7 +82,6 @@ QVariantMap BlackBerryDeployConfiguration::toMap() const
{
QVariantMap map(ProjectExplorer::DeployConfiguration::toMap());
map.insert(QLatin1String(DEPLOYMENT_INFO_KEY), deploymentInfo()->toMap());
- map.insert(QLatin1String(BAR_DESC_SETUP), m_appBarDesciptorSetup);
return map;
}
@@ -199,7 +90,6 @@ bool BlackBerryDeployConfiguration::fromMap(const QVariantMap &map)
if (!ProjectExplorer::DeployConfiguration::fromMap(map))
return false;
- m_appBarDesciptorSetup = map.value(QLatin1String(BAR_DESC_SETUP)).toBool();
QVariantMap deployInfoMap = map.value(QLatin1String(DEPLOYMENT_INFO_KEY)).toMap();
deploymentInfo()->fromMap(deployInfoMap);
return true;