2013-01-09 09:23:37 -05:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
2013-01-31 17:02:30 +01:00
|
|
|
** Copyright (C) 2011 - 2013 Research In Motion
|
2013-01-09 09:23:37 -05:00
|
|
|
**
|
|
|
|
|
** Contact: Research In Motion (blackberry-qt@qnx.com)
|
|
|
|
|
** Contact: KDAB (info@kdab.com)
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator.
|
|
|
|
|
**
|
|
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and Digia. For licensing terms and
|
|
|
|
|
** conditions see http://qt.digia.com/licensing. For further information
|
|
|
|
|
** use the contact form at http://qt.digia.com/contact-us.
|
|
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
|
|
|
** General Public License version 2.1 as published by the Free Software
|
|
|
|
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
|
|
|
** packaging of this file. Please review the following information to
|
|
|
|
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
|
|
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
|
|
|
**
|
|
|
|
|
** In addition, as a special exception, Digia gives you certain additional
|
|
|
|
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
|
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include "blackberryconfiguration.h"
|
|
|
|
|
#include "blackberryqtversion.h"
|
2013-01-17 16:06:13 -02:00
|
|
|
#include "blackberrycertificate.h"
|
2013-01-09 09:23:37 -05:00
|
|
|
#include "qnxutils.h"
|
|
|
|
|
|
|
|
|
|
#include <coreplugin/icore.h>
|
|
|
|
|
|
|
|
|
|
#include <qtsupport/baseqtversion.h>
|
|
|
|
|
#include <qtsupport/qtversionmanager.h>
|
|
|
|
|
#include <qtsupport/qtkitinformation.h>
|
|
|
|
|
|
|
|
|
|
#include <projectexplorer/projectexplorerconstants.h>
|
|
|
|
|
#include <projectexplorer/kitmanager.h>
|
|
|
|
|
#include <projectexplorer/kitinformation.h>
|
|
|
|
|
#include <projectexplorer/gcctoolchain.h>
|
|
|
|
|
#include <projectexplorer/toolchainmanager.h>
|
|
|
|
|
|
|
|
|
|
#include <qt4projectmanager/qmakekitinformation.h>
|
|
|
|
|
|
|
|
|
|
#include <debugger/debuggerkitinformation.h>
|
|
|
|
|
|
|
|
|
|
#include <utils/persistentsettings.h>
|
|
|
|
|
#include <utils/hostosinfo.h>
|
|
|
|
|
|
|
|
|
|
#include <QFileInfo>
|
|
|
|
|
#include <QDir>
|
|
|
|
|
#include <QMessageBox>
|
|
|
|
|
|
|
|
|
|
namespace Qnx {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
const QLatin1String SettingsGroup("BlackBerryConfiguration");
|
|
|
|
|
const QLatin1String NDKLocationKey("NDKLocation");
|
2013-01-17 16:06:13 -02:00
|
|
|
const QLatin1String CertificateGroup("Certificates");
|
2013-01-09 09:23:37 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BlackBerryConfiguration::BlackBerryConfiguration(QObject *parent)
|
|
|
|
|
:QObject(parent)
|
|
|
|
|
{
|
2013-01-17 16:06:13 -02:00
|
|
|
loadSettings();
|
|
|
|
|
connect(Core::ICore::instance(), SIGNAL(saveSettingsRequested()), this, SLOT(saveSettings()));
|
2013-01-09 09:23:37 -05:00
|
|
|
}
|
|
|
|
|
|
2013-01-17 16:06:13 -02:00
|
|
|
bool BlackBerryConfiguration::setNdkPath(const QString &ndkPath)
|
2013-01-09 09:23:37 -05:00
|
|
|
{
|
|
|
|
|
if (ndkPath.isEmpty())
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
m_config.ndkPath = ndkPath;
|
2013-01-17 16:06:13 -02:00
|
|
|
|
|
|
|
|
return refresh();
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-01 15:09:10 +02:00
|
|
|
void BlackBerryConfiguration::setupNdkConfigPerQtVersion(const Utils::FileName &qmakePath, ProjectExplorer::GccToolChain *tc)
|
|
|
|
|
{
|
|
|
|
|
QtSupport::BaseQtVersion *qtVersion = createQtVersion(qmakePath);
|
|
|
|
|
ProjectExplorer::Kit *deviceKit = createKit(ArmLeV7, qtVersion, tc);
|
|
|
|
|
ProjectExplorer::Kit *simulatorKit = createKit(X86, qtVersion, tc);
|
|
|
|
|
if (qtVersion && tc && deviceKit && simulatorKit) {
|
|
|
|
|
if (!qtVersion->qtAbis().isEmpty())
|
|
|
|
|
tc->setTargetAbi(qtVersion->qtAbis().first());
|
|
|
|
|
// register
|
|
|
|
|
QtSupport::QtVersionManager::instance()->addVersion(qtVersion);
|
|
|
|
|
ProjectExplorer::ToolChainManager::instance()->registerToolChain(tc);
|
|
|
|
|
ProjectExplorer::KitManager::instance()->registerKit(deviceKit);
|
|
|
|
|
ProjectExplorer::KitManager::instance()->registerKit(simulatorKit);
|
|
|
|
|
|
|
|
|
|
emit updated();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-17 16:06:13 -02:00
|
|
|
bool BlackBerryConfiguration::refresh()
|
|
|
|
|
{
|
|
|
|
|
m_config.qnxEnv = QnxUtils::parseEnvironmentFile(QnxUtils::envFilePath(m_config.ndkPath));
|
2013-01-09 09:23:37 -05:00
|
|
|
|
|
|
|
|
QString ndkTarget = m_config.qnxEnv.value(QLatin1String("QNX_TARGET"));
|
|
|
|
|
QString sep = QString::fromLatin1("%1qnx6").arg(QDir::separator());
|
|
|
|
|
m_config.targetName = ndkTarget.split(sep).first().split(QDir::separator()).last();
|
|
|
|
|
|
2013-01-18 09:50:47 -05:00
|
|
|
if (QDir(ndkTarget).exists())
|
|
|
|
|
m_config.sysRoot = Utils::FileName::fromString(ndkTarget);
|
2013-01-09 09:23:37 -05:00
|
|
|
|
|
|
|
|
QString qnxHost = m_config.qnxEnv.value(QLatin1String("QNX_HOST"));
|
2013-07-01 15:09:10 +02:00
|
|
|
Utils::FileName qmake4Path = QnxUtils::executableWithExtension(Utils::FileName::fromString(qnxHost + QLatin1String("/usr/bin/qmake")));
|
|
|
|
|
Utils::FileName qmake5Path = QnxUtils::executableWithExtension(Utils::FileName::fromString(qnxHost + QLatin1String("/usr/bin/qt5/qmake")));
|
2013-01-09 09:23:37 -05:00
|
|
|
Utils::FileName gccPath = QnxUtils::executableWithExtension(Utils::FileName::fromString(qnxHost + QLatin1String("/usr/bin/qcc")));
|
|
|
|
|
Utils::FileName deviceGdbPath = QnxUtils::executableWithExtension(Utils::FileName::fromString(qnxHost + QLatin1String("/usr/bin/ntoarm-gdb")));
|
|
|
|
|
Utils::FileName simulatorGdbPath = QnxUtils::executableWithExtension(Utils::FileName::fromString(qnxHost + QLatin1String("/usr/bin/ntox86-gdb")));
|
|
|
|
|
|
2013-07-01 15:09:10 +02:00
|
|
|
if ((!qmake4Path.toFileInfo().exists() && !qmake5Path.toFileInfo().exists()) || !gccPath.toFileInfo().exists()
|
2013-01-09 09:23:37 -05:00
|
|
|
|| !deviceGdbPath.toFileInfo().exists() || !simulatorGdbPath.toFileInfo().exists() ) {
|
2013-02-12 09:35:55 +01:00
|
|
|
QString errorMessage = tr("The following errors occurred while setting up BB10 Configuration:");
|
2013-07-01 15:09:10 +02:00
|
|
|
if (!qmake4Path.toFileInfo().exists() && !qmake5Path.toFileInfo().exists())
|
2013-02-12 09:35:55 +01:00
|
|
|
errorMessage += QLatin1Char('\n') + tr("- No Qt version found.");
|
2013-01-09 09:23:37 -05:00
|
|
|
|
|
|
|
|
if (!gccPath.toFileInfo().exists())
|
2013-02-12 09:35:55 +01:00
|
|
|
errorMessage += QLatin1Char('\n') + tr("- No GCC compiler found.");
|
2013-01-09 09:23:37 -05:00
|
|
|
|
|
|
|
|
if (!deviceGdbPath.toFileInfo().exists())
|
2013-02-12 09:35:55 +01:00
|
|
|
errorMessage += QLatin1Char('\n') + tr("- No GDB debugger found for BB10 Device.");
|
2013-01-09 09:23:37 -05:00
|
|
|
|
|
|
|
|
if (!simulatorGdbPath.toFileInfo().exists())
|
2013-02-12 09:35:55 +01:00
|
|
|
errorMessage += QLatin1Char('\n') + tr("- No GDB debugger found for BB10 Simulator.");
|
2013-01-09 09:23:37 -05:00
|
|
|
|
2013-05-16 16:11:36 +02:00
|
|
|
QMessageBox::warning(0, tr("Cannot Set up BB10 Configuration"),
|
2013-01-09 09:23:37 -05:00
|
|
|
errorMessage, QMessageBox::Ok);
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-01 15:09:10 +02:00
|
|
|
if (qmake4Path.toFileInfo().exists())
|
|
|
|
|
m_config.qmake4BinaryFile = qmake4Path;
|
|
|
|
|
|
|
|
|
|
if (qmake5Path.toFileInfo().exists())
|
|
|
|
|
m_config.qmake5BinaryFile = qmake5Path;
|
|
|
|
|
|
2013-01-09 09:23:37 -05:00
|
|
|
m_config.gccCompiler = gccPath;
|
|
|
|
|
m_config.deviceDebuger = deviceGdbPath;
|
|
|
|
|
m_config.simulatorDebuger = simulatorGdbPath;
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-17 16:06:13 -02:00
|
|
|
void BlackBerryConfiguration::loadCertificates()
|
|
|
|
|
{
|
2013-05-28 15:17:20 +02:00
|
|
|
QSettings *settings = Core::ICore::settings();
|
2013-01-17 16:06:13 -02:00
|
|
|
|
|
|
|
|
settings->beginGroup(SettingsGroup);
|
|
|
|
|
settings->beginGroup(CertificateGroup);
|
|
|
|
|
|
2013-03-11 17:23:55 +01:00
|
|
|
foreach (const QString &certificateId, settings->childGroups()) {
|
2013-01-17 16:06:13 -02:00
|
|
|
settings->beginGroup(certificateId);
|
|
|
|
|
|
|
|
|
|
BlackBerryCertificate *cert =
|
|
|
|
|
new BlackBerryCertificate(settings->value(QLatin1String(Qnx::Constants::QNX_KEY_PATH)).toString(),
|
|
|
|
|
settings->value(QLatin1String(Qnx::Constants::QNX_KEY_AUTHOR)).toString());
|
|
|
|
|
cert->setParent(this);
|
|
|
|
|
|
|
|
|
|
if (settings->value(QLatin1String(Qnx::Constants::QNX_KEY_ACTIVE)).toBool())
|
|
|
|
|
m_config.activeCertificate = cert;
|
|
|
|
|
|
|
|
|
|
m_config.certificates << cert;
|
|
|
|
|
|
|
|
|
|
settings->endGroup();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
settings->endGroup();
|
|
|
|
|
settings->endGroup();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BlackBerryConfiguration::loadNdkSettings()
|
|
|
|
|
{
|
2013-05-28 15:17:20 +02:00
|
|
|
QSettings *settings = Core::ICore::settings();
|
2013-01-17 16:06:13 -02:00
|
|
|
|
|
|
|
|
settings->beginGroup(SettingsGroup);
|
|
|
|
|
setNdkPath(settings->value(NDKLocationKey).toString());
|
|
|
|
|
settings->endGroup();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BlackBerryConfiguration::saveCertificates()
|
|
|
|
|
{
|
2013-05-28 15:17:20 +02:00
|
|
|
QSettings *settings = Core::ICore::settings();
|
2013-01-17 16:06:13 -02:00
|
|
|
|
|
|
|
|
settings->beginGroup(SettingsGroup);
|
|
|
|
|
settings->beginGroup(CertificateGroup);
|
|
|
|
|
|
|
|
|
|
settings->remove(QString());
|
|
|
|
|
|
|
|
|
|
foreach (const BlackBerryCertificate *cert, m_config.certificates) {
|
|
|
|
|
settings->beginGroup(cert->id());
|
|
|
|
|
settings->setValue(QLatin1String(Qnx::Constants::QNX_KEY_PATH), cert->fileName());
|
|
|
|
|
settings->setValue(QLatin1String(Qnx::Constants::QNX_KEY_AUTHOR), cert->author());
|
|
|
|
|
|
|
|
|
|
if (cert == m_config.activeCertificate)
|
|
|
|
|
settings->setValue(QLatin1String(Qnx::Constants::QNX_KEY_ACTIVE), true);
|
|
|
|
|
|
|
|
|
|
settings->endGroup();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
settings->endGroup();
|
|
|
|
|
settings->endGroup();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BlackBerryConfiguration::saveNdkSettings()
|
|
|
|
|
{
|
|
|
|
|
if (m_config.ndkPath.isEmpty())
|
|
|
|
|
return;
|
|
|
|
|
|
2013-05-28 15:17:20 +02:00
|
|
|
QSettings *settings = Core::ICore::settings();
|
2013-01-17 16:06:13 -02:00
|
|
|
settings->beginGroup(SettingsGroup);
|
|
|
|
|
settings->setValue(NDKLocationKey, m_config.ndkPath);
|
|
|
|
|
settings->endGroup();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BlackBerryConfiguration::setupNdkConfiguration(const QString &ndkPath)
|
2013-01-09 09:23:37 -05:00
|
|
|
{
|
|
|
|
|
if (ndkPath.isEmpty())
|
|
|
|
|
return;
|
|
|
|
|
|
2013-01-17 16:06:13 -02:00
|
|
|
if (setNdkPath(ndkPath)) {
|
2013-01-09 09:23:37 -05:00
|
|
|
ProjectExplorer::GccToolChain *tc = createGccToolChain();
|
2013-07-01 15:09:10 +02:00
|
|
|
|
|
|
|
|
if (!m_config.qmake4BinaryFile.isEmpty())
|
|
|
|
|
setupNdkConfigPerQtVersion(m_config.qmake4BinaryFile, tc);
|
|
|
|
|
|
|
|
|
|
if (!m_config.qmake5BinaryFile.isEmpty())
|
|
|
|
|
setupNdkConfigPerQtVersion(m_config.qmake5BinaryFile, tc);
|
2013-01-09 09:23:37 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-17 16:06:13 -02:00
|
|
|
void BlackBerryConfiguration::cleanNdkConfiguration()
|
2013-01-09 09:23:37 -05:00
|
|
|
{
|
2013-07-01 15:09:10 +02:00
|
|
|
QtSupport::BaseQtVersion *qt4Version = QtSupport::QtVersionManager::instance()->qtVersionForQMakeBinary(m_config.qmake4BinaryFile);
|
|
|
|
|
QtSupport::BaseQtVersion *qt5Version = QtSupport::QtVersionManager::instance()->qtVersionForQMakeBinary(m_config.qmake5BinaryFile);
|
|
|
|
|
if (qt4Version || qt5Version) {
|
2013-01-09 09:23:37 -05:00
|
|
|
foreach (ProjectExplorer::Kit *kit, ProjectExplorer::KitManager::instance()->kits()) {
|
2013-07-01 15:09:10 +02:00
|
|
|
if (qt4Version && qt4Version == QtSupport::QtKitInformation::qtVersion(kit)) {
|
|
|
|
|
ProjectExplorer::KitManager::instance()->deregisterKit(kit);
|
|
|
|
|
} else if (qt5Version && qt5Version == QtSupport::QtKitInformation::qtVersion(kit)) {
|
2013-01-09 09:23:37 -05:00
|
|
|
ProjectExplorer::KitManager::instance()->deregisterKit(kit);
|
2013-07-01 15:09:10 +02:00
|
|
|
}
|
2013-01-09 09:23:37 -05:00
|
|
|
}
|
|
|
|
|
|
2013-07-01 15:09:10 +02:00
|
|
|
if (qt4Version)
|
|
|
|
|
QtSupport::QtVersionManager::instance()->removeVersion(qt4Version);
|
|
|
|
|
|
|
|
|
|
if (qt5Version)
|
|
|
|
|
QtSupport::QtVersionManager::instance()->removeVersion(qt5Version);
|
|
|
|
|
|
2013-01-09 09:23:37 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach (ProjectExplorer::ToolChain* tc, ProjectExplorer::ToolChainManager::instance()->toolChains()) {
|
|
|
|
|
if (tc->compilerCommand() == m_config.gccCompiler)
|
|
|
|
|
ProjectExplorer::ToolChainManager::instance()->deregisterToolChain(tc);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BlackBerryConfig conf;
|
2013-01-17 16:06:13 -02:00
|
|
|
conf.activeCertificate = m_config.activeCertificate;
|
|
|
|
|
conf.certificates = m_config.certificates;
|
2013-01-09 09:23:37 -05:00
|
|
|
m_config = conf;
|
|
|
|
|
emit updated();
|
|
|
|
|
|
2013-01-17 16:06:13 -02:00
|
|
|
clearNdkSettings();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BlackBerryConfiguration::syncCertificates(QList<BlackBerryCertificate*> certificates,
|
|
|
|
|
BlackBerryCertificate *activeCertificate)
|
|
|
|
|
{
|
|
|
|
|
m_config.activeCertificate = activeCertificate;
|
|
|
|
|
|
|
|
|
|
foreach (BlackBerryCertificate *cert, m_config.certificates) {
|
2013-04-12 17:09:11 -03:00
|
|
|
if (!certificates.contains(cert))
|
|
|
|
|
removeCertificate(cert);
|
2013-01-17 16:06:13 -02:00
|
|
|
}
|
|
|
|
|
|
2013-04-12 17:09:11 -03:00
|
|
|
foreach (BlackBerryCertificate *cert, certificates)
|
|
|
|
|
addCertificate(cert);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BlackBerryConfiguration::addCertificate(BlackBerryCertificate *certificate)
|
|
|
|
|
{
|
|
|
|
|
if (m_config.certificates.contains(certificate))
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (m_config.certificates.isEmpty())
|
|
|
|
|
m_config.activeCertificate = certificate;
|
|
|
|
|
|
|
|
|
|
certificate->setParent(this);
|
|
|
|
|
m_config.certificates << certificate;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void BlackBerryConfiguration::removeCertificate(BlackBerryCertificate *certificate)
|
|
|
|
|
{
|
|
|
|
|
if (m_config.activeCertificate == certificate)
|
|
|
|
|
m_config.activeCertificate = 0;
|
|
|
|
|
|
|
|
|
|
m_config.certificates.removeAll(certificate);
|
|
|
|
|
|
|
|
|
|
delete certificate;
|
2013-01-17 16:06:13 -02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QList<BlackBerryCertificate*> BlackBerryConfiguration::certificates() const
|
|
|
|
|
{
|
|
|
|
|
return m_config.certificates;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BlackBerryCertificate * BlackBerryConfiguration::activeCertificate()
|
|
|
|
|
{
|
|
|
|
|
return m_config.activeCertificate;
|
2013-01-09 09:23:37 -05:00
|
|
|
}
|
|
|
|
|
|
2013-07-01 15:09:10 +02:00
|
|
|
QtSupport::BaseQtVersion *BlackBerryConfiguration::createQtVersion(const Utils::FileName &qmakePath)
|
2013-01-09 09:23:37 -05:00
|
|
|
{
|
2013-07-01 15:09:10 +02:00
|
|
|
if (qmakePath.isEmpty())
|
2013-01-09 09:23:37 -05:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
QString cpuDir = m_config.qnxEnv.value(QLatin1String("CPUVARDIR"));
|
2013-07-01 15:09:10 +02:00
|
|
|
QtSupport::BaseQtVersion *version = QtSupport::QtVersionManager::instance()->qtVersionForQMakeBinary(qmakePath);
|
2013-01-09 09:23:37 -05:00
|
|
|
if (version) {
|
2013-01-29 14:59:37 +01:00
|
|
|
QMessageBox::warning(0, tr("Qt Version Already Known"),
|
2013-05-16 16:11:36 +02:00
|
|
|
tr("This Qt version was already registered."), QMessageBox::Ok);
|
2013-01-09 09:23:37 -05:00
|
|
|
return version;
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-01 15:09:10 +02:00
|
|
|
version = new BlackBerryQtVersion(QnxUtils::cpudirToArch(cpuDir), qmakePath, false, QString(), m_config.ndkPath);
|
2013-01-09 09:23:37 -05:00
|
|
|
if (!version) {
|
2013-05-16 16:11:36 +02:00
|
|
|
QMessageBox::warning(0, tr("Invalid Qt Version"),
|
|
|
|
|
tr("Unable to add BlackBerry Qt version."), QMessageBox::Ok);
|
2013-01-09 09:23:37 -05:00
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-01 15:09:10 +02:00
|
|
|
version->setDisplayName(QString::fromLatin1("Qt %1 BlackBerry 10 (%2)").arg(version->qtVersionString(), m_config.targetName));
|
2013-01-09 09:23:37 -05:00
|
|
|
|
|
|
|
|
return version;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ProjectExplorer::GccToolChain *BlackBerryConfiguration::createGccToolChain()
|
|
|
|
|
{
|
2013-07-01 15:09:10 +02:00
|
|
|
if ((m_config.qmake4BinaryFile.isEmpty() && m_config.qmake5BinaryFile.isEmpty()) || m_config.gccCompiler.isEmpty())
|
2013-01-09 09:23:37 -05:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
foreach (ProjectExplorer::ToolChain* tc, ProjectExplorer::ToolChainManager::instance()->toolChains()) {
|
|
|
|
|
if (tc->compilerCommand() == m_config.gccCompiler) {
|
2013-01-29 14:59:37 +01:00
|
|
|
QMessageBox::warning(0, tr("Compiler Already Known"),
|
2013-05-16 16:11:36 +02:00
|
|
|
tr("This compiler was already registered."), QMessageBox::Ok);
|
2013-01-09 09:23:37 -05:00
|
|
|
return dynamic_cast<ProjectExplorer::GccToolChain*>(tc);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ProjectExplorer::GccToolChain* tc = new ProjectExplorer::GccToolChain(QLatin1String(ProjectExplorer::Constants::GCC_TOOLCHAIN_ID), false);
|
|
|
|
|
tc->setDisplayName(QString::fromLatin1("GCC BlackBerry 10 (%1)").arg(m_config.targetName));
|
|
|
|
|
tc->setCompilerCommand(m_config.gccCompiler);
|
|
|
|
|
|
|
|
|
|
return tc;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ProjectExplorer::Kit *BlackBerryConfiguration::createKit(QnxArchitecture arch, QtSupport::BaseQtVersion *qtVersion, ProjectExplorer::GccToolChain *tc)
|
|
|
|
|
{
|
|
|
|
|
if (!qtVersion || !tc || m_config.targetName.isEmpty())
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
// Check if an identical kit already exists
|
|
|
|
|
foreach (ProjectExplorer::Kit *kit, ProjectExplorer::KitManager::instance()->kits())
|
|
|
|
|
{
|
|
|
|
|
if (QtSupport::QtKitInformation::qtVersion(kit) == qtVersion && ProjectExplorer::ToolChainKitInformation::toolChain(kit) == tc
|
|
|
|
|
&& ProjectExplorer::DeviceTypeKitInformation::deviceTypeId(kit) == Constants::QNX_BB_OS_TYPE
|
|
|
|
|
&& ProjectExplorer::SysRootKitInformation::sysRoot(kit) == m_config.sysRoot) {
|
|
|
|
|
if ((arch == X86 && Qt4ProjectManager::QmakeKitInformation::mkspec(kit).toString() == QString::fromLatin1("blackberry-x86-qcc")
|
|
|
|
|
&& Debugger::DebuggerKitInformation::debuggerCommand(kit) == m_config.simulatorDebuger)
|
|
|
|
|
|| (arch == ArmLeV7 && Debugger::DebuggerKitInformation::debuggerCommand(kit) == m_config.deviceDebuger)) {
|
2013-01-29 14:59:37 +01:00
|
|
|
QMessageBox::warning(0, tr("Kit Already Known"),
|
2013-05-16 16:11:36 +02:00
|
|
|
tr("This kit was already registered."), QMessageBox::Ok);
|
2013-01-09 09:23:37 -05:00
|
|
|
return kit;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ProjectExplorer::Kit *kit = new ProjectExplorer::Kit;
|
|
|
|
|
QtSupport::QtKitInformation::setQtVersion(kit, qtVersion);
|
|
|
|
|
ProjectExplorer::ToolChainKitInformation::setToolChain(kit, tc);
|
|
|
|
|
if (arch == X86) {
|
|
|
|
|
Debugger::DebuggerKitInformation::setDebuggerCommand(kit, m_config.simulatorDebuger);
|
|
|
|
|
Qt4ProjectManager::QmakeKitInformation::setMkspec(kit, Utils::FileName::fromString(QString::fromLatin1("blackberry-x86-qcc")));
|
|
|
|
|
// TODO: Check if the name already exists(?)
|
2013-07-01 15:09:10 +02:00
|
|
|
kit->setDisplayName(tr("BlackBerry 10 (%1 - %2) - Simulator").arg(qtVersion->qtVersionString(), m_config.targetName));
|
2013-01-09 09:23:37 -05:00
|
|
|
} else {
|
|
|
|
|
Debugger::DebuggerKitInformation::setDebuggerCommand(kit, m_config.deviceDebuger);
|
2013-07-01 15:09:10 +02:00
|
|
|
kit->setDisplayName(tr("BlackBerry 10 (%1 - %2)").arg(qtVersion->qtVersionString(), m_config.targetName));
|
2013-01-09 09:23:37 -05:00
|
|
|
}
|
|
|
|
|
|
2013-03-25 15:05:26 +01:00
|
|
|
kit->setIconPath(QLatin1String(Constants::QNX_BB_CATEGORY_ICON));
|
2013-01-09 09:23:37 -05:00
|
|
|
ProjectExplorer::DeviceTypeKitInformation::setDeviceTypeId(kit, Constants::QNX_BB_OS_TYPE);
|
|
|
|
|
ProjectExplorer::SysRootKitInformation::setSysRoot(kit, m_config.sysRoot);
|
|
|
|
|
|
|
|
|
|
return kit;
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-17 16:06:13 -02:00
|
|
|
void BlackBerryConfiguration::loadSettings()
|
2013-01-09 09:23:37 -05:00
|
|
|
{
|
2013-01-17 16:06:13 -02:00
|
|
|
loadNdkSettings();
|
|
|
|
|
loadCertificates();
|
2013-01-09 09:23:37 -05:00
|
|
|
}
|
|
|
|
|
|
2013-01-17 16:06:13 -02:00
|
|
|
void BlackBerryConfiguration::saveSettings()
|
2013-01-09 09:23:37 -05:00
|
|
|
{
|
2013-01-17 16:06:13 -02:00
|
|
|
saveNdkSettings();
|
|
|
|
|
saveCertificates();
|
2013-01-09 09:23:37 -05:00
|
|
|
}
|
|
|
|
|
|
2013-01-17 16:06:13 -02:00
|
|
|
void BlackBerryConfiguration::clearNdkSettings()
|
2013-01-09 09:23:37 -05:00
|
|
|
{
|
2013-05-28 15:17:20 +02:00
|
|
|
QSettings *settings = Core::ICore::settings();
|
2013-01-09 09:23:37 -05:00
|
|
|
settings->beginGroup(SettingsGroup);
|
|
|
|
|
settings->remove(NDKLocationKey);
|
|
|
|
|
settings->endGroup();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BlackBerryConfiguration &BlackBerryConfiguration::instance()
|
|
|
|
|
{
|
|
|
|
|
if (m_instance == 0)
|
|
|
|
|
m_instance = new BlackBerryConfiguration();
|
|
|
|
|
return *m_instance;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString BlackBerryConfiguration::ndkPath() const
|
|
|
|
|
{
|
|
|
|
|
return m_config.ndkPath;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString BlackBerryConfiguration::targetName() const
|
|
|
|
|
{
|
|
|
|
|
return m_config.targetName;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BlackBerryConfig BlackBerryConfiguration::config() const
|
|
|
|
|
{
|
|
|
|
|
return m_config;
|
|
|
|
|
}
|
|
|
|
|
|
2013-07-01 15:09:10 +02:00
|
|
|
Utils::FileName BlackBerryConfiguration::qmake4Path() const
|
|
|
|
|
{
|
|
|
|
|
return m_config.qmake4BinaryFile;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Utils::FileName BlackBerryConfiguration::qmake5Path() const
|
2013-01-09 09:23:37 -05:00
|
|
|
{
|
2013-07-01 15:09:10 +02:00
|
|
|
return m_config.qmake5BinaryFile;
|
2013-01-09 09:23:37 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Utils::FileName BlackBerryConfiguration::gccPath() const
|
|
|
|
|
{
|
|
|
|
|
return m_config.gccCompiler;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Utils::FileName BlackBerryConfiguration::deviceGdbPath() const
|
|
|
|
|
{
|
|
|
|
|
return m_config.deviceDebuger;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Utils::FileName BlackBerryConfiguration::simulatorGdbPath() const
|
|
|
|
|
{
|
|
|
|
|
return m_config.simulatorDebuger;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Utils::FileName BlackBerryConfiguration::sysRoot() const
|
|
|
|
|
{
|
|
|
|
|
return m_config.sysRoot;
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-17 16:06:13 -02:00
|
|
|
QString BlackBerryConfiguration::barsignerCskPath() const
|
|
|
|
|
{
|
2013-06-12 14:09:01 +02:00
|
|
|
return QnxUtils::dataDirPath() + QLatin1String("/barsigner.csk");
|
2013-01-17 16:06:13 -02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString BlackBerryConfiguration::barsignerDbPath() const
|
|
|
|
|
{
|
2013-06-12 14:09:01 +02:00
|
|
|
return QnxUtils::dataDirPath() + QLatin1String("/barsigner.db");
|
2013-01-17 16:06:13 -02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString BlackBerryConfiguration::defaultKeystorePath() const
|
|
|
|
|
{
|
2013-06-12 14:09:01 +02:00
|
|
|
return QnxUtils::dataDirPath() + QLatin1String("/author.p12");
|
2013-01-17 16:06:13 -02:00
|
|
|
}
|
|
|
|
|
|
2013-04-12 17:09:11 -03:00
|
|
|
QString BlackBerryConfiguration::defaultDebugTokenPath() const
|
|
|
|
|
{
|
2013-06-12 14:09:01 +02:00
|
|
|
return QnxUtils::dataDirPath() + QLatin1String("/debugtoken.bar");
|
2013-04-12 17:09:11 -03:00
|
|
|
}
|
|
|
|
|
|
2013-01-09 09:23:37 -05:00
|
|
|
// TODO: QnxUtils::parseEnvFile() and qnxEnv() to return Util::Enviroment instead(?)
|
|
|
|
|
QMultiMap<QString, QString> BlackBerryConfiguration::qnxEnv() const
|
|
|
|
|
{
|
|
|
|
|
return m_config.qnxEnv;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BlackBerryConfiguration* BlackBerryConfiguration::m_instance = 0;
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Qnx
|