forked from qt-creator/qt-creator
Maemo: Use per-target device configuration model.
Now if you have e.g. a Meego target, only Meego device configurations are selectable in that target's deploy configuration. Naturally, now the "default" attribute of a device configuration is per Maemo version.
This commit is contained in:
@@ -37,6 +37,7 @@
|
|||||||
#include "maemodeploystepwidget.h"
|
#include "maemodeploystepwidget.h"
|
||||||
#include "maemoglobal.h"
|
#include "maemoglobal.h"
|
||||||
#include "maemopackagecreationstep.h"
|
#include "maemopackagecreationstep.h"
|
||||||
|
#include "maemopertargetdeviceconfigurationlistmodel.h"
|
||||||
#include "maemoremotemounter.h"
|
#include "maemoremotemounter.h"
|
||||||
#include "maemorunconfiguration.h"
|
#include "maemorunconfiguration.h"
|
||||||
#include "maemotoolchain.h"
|
#include "maemotoolchain.h"
|
||||||
@@ -113,7 +114,7 @@ void MaemoDeployStep::ctor()
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_state = Inactive;
|
m_state = Inactive;
|
||||||
m_deviceConfig = MaemoDeviceConfigurations::instance()->defaultDeviceConfig();
|
m_deviceConfig = maemotarget()->deviceConfigurationsModel()->defaultDeviceConfig();
|
||||||
m_needsInstall = false;
|
m_needsInstall = false;
|
||||||
m_sysrootInstaller = new QProcess(this);
|
m_sysrootInstaller = new QProcess(this);
|
||||||
connect(m_sysrootInstaller, SIGNAL(finished(int,QProcess::ExitStatus)),
|
connect(m_sysrootInstaller, SIGNAL(finished(int,QProcess::ExitStatus)),
|
||||||
@@ -136,7 +137,7 @@ void MaemoDeployStep::ctor()
|
|||||||
SLOT(handlePortsGathererError(QString)));
|
SLOT(handlePortsGathererError(QString)));
|
||||||
connect(m_portsGatherer, SIGNAL(portListReady()), this,
|
connect(m_portsGatherer, SIGNAL(portListReady()), this,
|
||||||
SLOT(handlePortListReady()));
|
SLOT(handlePortListReady()));
|
||||||
connect(MaemoDeviceConfigurations::instance(), SIGNAL(updated()),
|
connect(maemotarget()->deviceConfigurationsModel(), SIGNAL(updated()),
|
||||||
SLOT(handleDeviceConfigurationsUpdated()));
|
SLOT(handleDeviceConfigurationsUpdated()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -308,17 +309,13 @@ void MaemoDeployStep::handleDeviceConfigurationsUpdated()
|
|||||||
|
|
||||||
void MaemoDeployStep::setDeviceConfig(MaemoDeviceConfig::Id internalId)
|
void MaemoDeployStep::setDeviceConfig(MaemoDeviceConfig::Id internalId)
|
||||||
{
|
{
|
||||||
const MaemoDeviceConfigurations * const devConfs
|
m_deviceConfig = maemotarget()->deviceConfigurationsModel()->find(internalId);
|
||||||
= MaemoDeviceConfigurations::instance();
|
|
||||||
m_deviceConfig = devConfs->find(internalId);
|
|
||||||
if (!m_deviceConfig)
|
|
||||||
m_deviceConfig = devConfs->defaultDeviceConfig();
|
|
||||||
emit deviceConfigChanged();
|
emit deviceConfigChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaemoDeployStep::setDeviceConfig(int i)
|
void MaemoDeployStep::setDeviceConfig(int i)
|
||||||
{
|
{
|
||||||
m_deviceConfig = MaemoDeviceConfigurations::instance()->deviceAt(i);
|
m_deviceConfig = maemotarget()->deviceConfigurationsModel()->deviceAt(i);
|
||||||
emit deviceConfigChanged();
|
emit deviceConfigChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -77,6 +77,7 @@ public:
|
|||||||
|
|
||||||
virtual ~MaemoDeployStep();
|
virtual ~MaemoDeployStep();
|
||||||
QSharedPointer<const MaemoDeviceConfig> deviceConfig() const { return m_deviceConfig; }
|
QSharedPointer<const MaemoDeviceConfig> deviceConfig() const { return m_deviceConfig; }
|
||||||
|
const AbstractQt4MaemoTarget *maemotarget() const;
|
||||||
void setDeviceConfig(int i);
|
void setDeviceConfig(int i);
|
||||||
bool currentlyNeedsDeployment(const QString &host,
|
bool currentlyNeedsDeployment(const QString &host,
|
||||||
const MaemoDeployable &deployable) const;
|
const MaemoDeployable &deployable) const;
|
||||||
@@ -143,7 +144,6 @@ private:
|
|||||||
const MaemoPackageCreationStep *packagingStep() const;
|
const MaemoPackageCreationStep *packagingStep() const;
|
||||||
QString deployMountPoint() const;
|
QString deployMountPoint() const;
|
||||||
const AbstractMaemoToolChain *toolChain() const;
|
const AbstractMaemoToolChain *toolChain() const;
|
||||||
const AbstractQt4MaemoTarget *maemotarget() const;
|
|
||||||
void copyNextFileToDevice();
|
void copyNextFileToDevice();
|
||||||
void installToSysroot();
|
void installToSysroot();
|
||||||
QString uploadDir() const;
|
QString uploadDir() const;
|
||||||
|
|||||||
@@ -4,8 +4,11 @@
|
|||||||
#include "maemodeploystep.h"
|
#include "maemodeploystep.h"
|
||||||
#include "maemodeployablelistmodel.h"
|
#include "maemodeployablelistmodel.h"
|
||||||
#include "maemodeployables.h"
|
#include "maemodeployables.h"
|
||||||
|
#include "maemodeviceconfigurations.h"
|
||||||
#include "maemoglobal.h"
|
#include "maemoglobal.h"
|
||||||
|
#include "maemopertargetdeviceconfigurationlistmodel.h"
|
||||||
#include "maemorunconfiguration.h"
|
#include "maemorunconfiguration.h"
|
||||||
|
#include "qt4maemotarget.h"
|
||||||
|
|
||||||
#include <projectexplorer/buildconfiguration.h>
|
#include <projectexplorer/buildconfiguration.h>
|
||||||
#include <projectexplorer/target.h>
|
#include <projectexplorer/target.h>
|
||||||
@@ -49,7 +52,7 @@ MaemoDeployStepWidget::~MaemoDeployStepWidget()
|
|||||||
|
|
||||||
void MaemoDeployStepWidget::init()
|
void MaemoDeployStepWidget::init()
|
||||||
{
|
{
|
||||||
ui->deviceConfigComboBox->setModel(MaemoDeviceConfigurations::instance());
|
ui->deviceConfigComboBox->setModel(m_step->maemotarget()->deviceConfigurationsModel());
|
||||||
connect(m_step, SIGNAL(deviceConfigChanged()), SLOT(handleDeviceUpdate()));
|
connect(m_step, SIGNAL(deviceConfigChanged()), SLOT(handleDeviceUpdate()));
|
||||||
handleDeviceUpdate();
|
handleDeviceUpdate();
|
||||||
connect(ui->deviceConfigComboBox, SIGNAL(activated(int)), this,
|
connect(ui->deviceConfigComboBox, SIGNAL(activated(int)), this,
|
||||||
@@ -62,10 +65,11 @@ void MaemoDeployStepWidget::init()
|
|||||||
void MaemoDeployStepWidget::handleDeviceUpdate()
|
void MaemoDeployStepWidget::handleDeviceUpdate()
|
||||||
{
|
{
|
||||||
const MaemoDeviceConfig::ConstPtr &devConf = m_step->deviceConfig();
|
const MaemoDeviceConfig::ConstPtr &devConf = m_step->deviceConfig();
|
||||||
const MaemoDeviceConfigurations * const devConfigs
|
const MaemoDeviceConfig::Id internalId
|
||||||
= MaemoDeviceConfigurations::instance();
|
= MaemoDeviceConfigurations::instance()->internalId(devConf);
|
||||||
ui->deviceConfigComboBox->setCurrentIndex(
|
const int newIndex = m_step->maemotarget()->deviceConfigurationsModel()
|
||||||
devConfigs->indexForInternalId(devConfigs->internalId(devConf)));
|
->indexForInternalId(internalId);
|
||||||
|
ui->deviceConfigComboBox->setCurrentIndex(newIndex);
|
||||||
emit updateSummary();
|
emit updateSummary();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -453,7 +453,7 @@ void MaemoDeviceConfigurations::addEmulatorDeviceConfiguration(const QString &na
|
|||||||
void MaemoDeviceConfigurations::addConfiguration(const MaemoDeviceConfig::Ptr &devConfig)
|
void MaemoDeviceConfigurations::addConfiguration(const MaemoDeviceConfig::Ptr &devConfig)
|
||||||
{
|
{
|
||||||
beginInsertRows(QModelIndex(), rowCount(), rowCount());
|
beginInsertRows(QModelIndex(), rowCount(), rowCount());
|
||||||
if (m_devConfigs.isEmpty())
|
if (!defaultDeviceConfig(devConfig->osVersion()))
|
||||||
devConfig->m_isDefault = true;
|
devConfig->m_isDefault = true;
|
||||||
m_devConfigs << devConfig;
|
m_devConfigs << devConfig;
|
||||||
endInsertRows();
|
endInsertRows();
|
||||||
@@ -464,12 +464,18 @@ void MaemoDeviceConfigurations::removeConfiguration(int idx)
|
|||||||
Q_ASSERT(idx >= 0 && idx < rowCount());
|
Q_ASSERT(idx >= 0 && idx < rowCount());
|
||||||
beginRemoveRows(QModelIndex(), idx, idx);
|
beginRemoveRows(QModelIndex(), idx, idx);
|
||||||
const bool wasDefault = deviceAt(idx)->m_isDefault;
|
const bool wasDefault = deviceAt(idx)->m_isDefault;
|
||||||
|
const MaemoGlobal::MaemoVersion osVersion = deviceAt(idx)->osVersion();
|
||||||
m_devConfigs.removeAt(idx);
|
m_devConfigs.removeAt(idx);
|
||||||
endRemoveRows();
|
endRemoveRows();
|
||||||
if (wasDefault && !m_devConfigs.isEmpty()) {
|
if (wasDefault) {
|
||||||
m_devConfigs.first()->m_isDefault = true;
|
for (int i = 0; i < m_devConfigs.count(); ++i) {
|
||||||
const QModelIndex changedIndex = index(0, 0);
|
if (deviceAt(i)->osVersion() == osVersion) {
|
||||||
|
m_devConfigs.at(i)->m_isDefault = true;
|
||||||
|
const QModelIndex changedIndex = index(i, 0);
|
||||||
emit dataChanged(changedIndex, changedIndex);
|
emit dataChanged(changedIndex, changedIndex);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -497,12 +503,14 @@ void MaemoDeviceConfigurations::setPortsSpec(int i, const QString &portsSpec)
|
|||||||
void MaemoDeviceConfigurations::setDefaultDevice(int idx)
|
void MaemoDeviceConfigurations::setDefaultDevice(int idx)
|
||||||
{
|
{
|
||||||
Q_ASSERT(idx >= 0 && idx < rowCount());
|
Q_ASSERT(idx >= 0 && idx < rowCount());
|
||||||
if (m_devConfigs.at(idx)->m_isDefault)
|
const MaemoDeviceConfig::Ptr &devConf = m_devConfigs.at(idx);
|
||||||
|
if (devConf->m_isDefault)
|
||||||
return;
|
return;
|
||||||
QModelIndex oldDefaultIndex;
|
QModelIndex oldDefaultIndex;
|
||||||
for (int i = 0; i < m_devConfigs.count(); ++i) {
|
for (int i = 0; i < m_devConfigs.count(); ++i) {
|
||||||
const MaemoDeviceConfig::Ptr &oldDefaultDev = m_devConfigs.at(i);
|
const MaemoDeviceConfig::Ptr &oldDefaultDev = m_devConfigs.at(i);
|
||||||
if (oldDefaultDev->m_isDefault) {
|
if (oldDefaultDev->m_isDefault
|
||||||
|
&& oldDefaultDev->osVersion() == devConf->osVersion()) {
|
||||||
oldDefaultDev->m_isDefault = false;
|
oldDefaultDev->m_isDefault = false;
|
||||||
oldDefaultIndex = index(i, 0);
|
oldDefaultIndex = index(i, 0);
|
||||||
break;
|
break;
|
||||||
@@ -510,7 +518,7 @@ void MaemoDeviceConfigurations::setDefaultDevice(int idx)
|
|||||||
}
|
}
|
||||||
Q_ASSERT(oldDefaultIndex.isValid());
|
Q_ASSERT(oldDefaultIndex.isValid());
|
||||||
emit dataChanged(oldDefaultIndex, oldDefaultIndex);
|
emit dataChanged(oldDefaultIndex, oldDefaultIndex);
|
||||||
m_devConfigs.at(idx)->m_isDefault = true;
|
devConf->m_isDefault = true;
|
||||||
const QModelIndex newDefaultIndex = index(idx, 0);
|
const QModelIndex newDefaultIndex = index(idx, 0);
|
||||||
emit dataChanged(newDefaultIndex, newDefaultIndex);
|
emit dataChanged(newDefaultIndex, newDefaultIndex);
|
||||||
}
|
}
|
||||||
@@ -528,18 +536,17 @@ void MaemoDeviceConfigurations::load()
|
|||||||
m_defaultSshKeyFilePath = settings->value(DefaultKeyFilePathKey,
|
m_defaultSshKeyFilePath = settings->value(DefaultKeyFilePathKey,
|
||||||
MaemoDeviceConfig::defaultPrivateKeyFilePath()).toString();
|
MaemoDeviceConfig::defaultPrivateKeyFilePath()).toString();
|
||||||
int count = settings->beginReadArray(ConfigListKey);
|
int count = settings->beginReadArray(ConfigListKey);
|
||||||
bool hasDefault = false;
|
|
||||||
for (int i = 0; i < count; ++i) {
|
for (int i = 0; i < count; ++i) {
|
||||||
settings->setArrayIndex(i);
|
settings->setArrayIndex(i);
|
||||||
MaemoDeviceConfig::Ptr devConf
|
MaemoDeviceConfig::Ptr devConf
|
||||||
= MaemoDeviceConfig::create(*settings, m_nextId);
|
= MaemoDeviceConfig::create(*settings, m_nextId);
|
||||||
hasDefault |= devConf->m_isDefault;
|
|
||||||
m_devConfigs << devConf;
|
m_devConfigs << devConf;
|
||||||
}
|
}
|
||||||
settings->endArray();
|
settings->endArray();
|
||||||
settings->endGroup();
|
settings->endGroup();
|
||||||
if (!hasDefault && !m_devConfigs.isEmpty())
|
ensureDefaultExists(MaemoGlobal::Maemo5);
|
||||||
m_devConfigs.first()->m_isDefault = true;
|
ensureDefaultExists(MaemoGlobal::Maemo6);
|
||||||
|
ensureDefaultExists(MaemoGlobal::Meego);
|
||||||
}
|
}
|
||||||
|
|
||||||
MaemoDeviceConfig::ConstPtr MaemoDeviceConfigurations::deviceAt(int idx) const
|
MaemoDeviceConfig::ConstPtr MaemoDeviceConfigurations::deviceAt(int idx) const
|
||||||
@@ -562,13 +569,12 @@ MaemoDeviceConfig::ConstPtr MaemoDeviceConfigurations::find(MaemoDeviceConfig::I
|
|||||||
return index == -1 ? MaemoDeviceConfig::ConstPtr() : deviceAt(index);
|
return index == -1 ? MaemoDeviceConfig::ConstPtr() : deviceAt(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
MaemoDeviceConfig::ConstPtr MaemoDeviceConfigurations::defaultDeviceConfig() const
|
MaemoDeviceConfig::ConstPtr MaemoDeviceConfigurations::defaultDeviceConfig(const MaemoGlobal::MaemoVersion osVersion) const
|
||||||
{
|
{
|
||||||
foreach (const MaemoDeviceConfig::ConstPtr &devConf, m_devConfigs) {
|
foreach (const MaemoDeviceConfig::ConstPtr &devConf, m_devConfigs) {
|
||||||
if (devConf->m_isDefault)
|
if (devConf->m_isDefault && devConf->osVersion() == osVersion)
|
||||||
return devConf;
|
return devConf;
|
||||||
}
|
}
|
||||||
Q_ASSERT(m_devConfigs.isEmpty());
|
|
||||||
return MaemoDeviceConfig::ConstPtr();
|
return MaemoDeviceConfig::ConstPtr();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -586,6 +592,18 @@ MaemoDeviceConfig::Id MaemoDeviceConfigurations::internalId(MaemoDeviceConfig::C
|
|||||||
return devConf ? devConf->m_internalId : MaemoDeviceConfig::InvalidId;
|
return devConf ? devConf->m_internalId : MaemoDeviceConfig::InvalidId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MaemoDeviceConfigurations::ensureDefaultExists(MaemoGlobal::MaemoVersion osVersion)
|
||||||
|
{
|
||||||
|
if (!defaultDeviceConfig(osVersion)) {
|
||||||
|
foreach (const MaemoDeviceConfig::Ptr &devConf, m_devConfigs) {
|
||||||
|
if (devConf->osVersion() == osVersion) {
|
||||||
|
devConf->m_isDefault = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int MaemoDeviceConfigurations::rowCount(const QModelIndex &parent) const
|
int MaemoDeviceConfigurations::rowCount(const QModelIndex &parent) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(parent);
|
Q_UNUSED(parent);
|
||||||
@@ -598,8 +616,10 @@ QVariant MaemoDeviceConfigurations::data(const QModelIndex &index, int role) con
|
|||||||
return QVariant();
|
return QVariant();
|
||||||
const MaemoDeviceConfig::ConstPtr devConf = deviceAt(index.row());
|
const MaemoDeviceConfig::ConstPtr devConf = deviceAt(index.row());
|
||||||
QString name = devConf->name();
|
QString name = devConf->name();
|
||||||
if (devConf->m_isDefault)
|
if (devConf->m_isDefault) {
|
||||||
name += tr(" (default)");
|
name += QLatin1Char(' ') + tr("(default for %1)")
|
||||||
|
.arg(MaemoGlobal::maemoVersionToString(devConf->osVersion()));
|
||||||
|
}
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ public:
|
|||||||
MaemoGlobal::MaemoVersion osVersion() const { return m_osVersion; }
|
MaemoGlobal::MaemoVersion osVersion() const { return m_osVersion; }
|
||||||
DeviceType type() const { return m_type; }
|
DeviceType type() const { return m_type; }
|
||||||
QString portsSpec() const { return m_portsSpec; }
|
QString portsSpec() const { return m_portsSpec; }
|
||||||
|
Id internalId() const { return m_internalId; }
|
||||||
bool isDefault() const { return m_isDefault; }
|
bool isDefault() const { return m_isDefault; }
|
||||||
static QString portsRegExpr();
|
static QString portsRegExpr();
|
||||||
static QString defaultHost(DeviceType type);
|
static QString defaultHost(DeviceType type);
|
||||||
@@ -137,7 +138,7 @@ public:
|
|||||||
|
|
||||||
MaemoDeviceConfig::ConstPtr deviceAt(int index) const;
|
MaemoDeviceConfig::ConstPtr deviceAt(int index) const;
|
||||||
MaemoDeviceConfig::ConstPtr find(MaemoDeviceConfig::Id id) const;
|
MaemoDeviceConfig::ConstPtr find(MaemoDeviceConfig::Id id) const;
|
||||||
MaemoDeviceConfig::ConstPtr defaultDeviceConfig() const;
|
MaemoDeviceConfig::ConstPtr defaultDeviceConfig(const MaemoGlobal::MaemoVersion osVersion) const;
|
||||||
bool hasConfig(const QString &name) const;
|
bool hasConfig(const QString &name) const;
|
||||||
int indexForInternalId(MaemoDeviceConfig::Id internalId) const;
|
int indexForInternalId(MaemoDeviceConfig::Id internalId) const;
|
||||||
MaemoDeviceConfig::Id internalId(MaemoDeviceConfig::ConstPtr devConf) const;
|
MaemoDeviceConfig::Id internalId(MaemoDeviceConfig::ConstPtr devConf) const;
|
||||||
@@ -170,6 +171,7 @@ private:
|
|||||||
static void copy(const MaemoDeviceConfigurations *source,
|
static void copy(const MaemoDeviceConfigurations *source,
|
||||||
MaemoDeviceConfigurations *target, bool deep);
|
MaemoDeviceConfigurations *target, bool deep);
|
||||||
void addConfiguration(const MaemoDeviceConfig::Ptr &devConfig);
|
void addConfiguration(const MaemoDeviceConfig::Ptr &devConfig);
|
||||||
|
void ensureDefaultExists(MaemoGlobal::MaemoVersion osVersion);
|
||||||
|
|
||||||
static MaemoDeviceConfigurations *m_instance;
|
static MaemoDeviceConfigurations *m_instance;
|
||||||
MaemoDeviceConfig::Id m_nextId;
|
MaemoDeviceConfig::Id m_nextId;
|
||||||
|
|||||||
@@ -292,8 +292,8 @@ QStringList MaemoGlobal::targetArgs(const QtVersion *qtVersion, bool useTarget)
|
|||||||
QString MaemoGlobal::maemoVersionToString(MaemoVersion version)
|
QString MaemoGlobal::maemoVersionToString(MaemoVersion version)
|
||||||
{
|
{
|
||||||
switch (version) {
|
switch (version) {
|
||||||
case Maemo5: return QLatin1String("Maemo 5 (Fremantle)");
|
case Maemo5: return QLatin1String("Maemo 5/Fremantle");
|
||||||
case Maemo6: return QLatin1String("Maemo 6 (Harmattan)");
|
case Maemo6: return QLatin1String("Maemo 6/Harmattan");
|
||||||
case Meego: return QLatin1String("Meego");
|
case Meego: return QLatin1String("Meego");
|
||||||
}
|
}
|
||||||
Q_ASSERT(false);
|
Q_ASSERT(false);
|
||||||
|
|||||||
@@ -32,7 +32,6 @@
|
|||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
#include "maemopertargetdeviceconfigurationlistmodel.h"
|
#include "maemopertargetdeviceconfigurationlistmodel.h"
|
||||||
|
|
||||||
#include "maemodeviceconfigurations.h"
|
|
||||||
#include "qt4maemotarget.h"
|
#include "qt4maemotarget.h"
|
||||||
|
|
||||||
using namespace ProjectExplorer;
|
using namespace ProjectExplorer;
|
||||||
@@ -40,20 +39,20 @@ using namespace ProjectExplorer;
|
|||||||
namespace Qt4ProjectManager {
|
namespace Qt4ProjectManager {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
MaemoPerTargetDeviceConfigurationListModel::MaemoPerTargetDeviceConfigurationListModel(const Target *target,
|
MaemoPerTargetDeviceConfigurationListModel::MaemoPerTargetDeviceConfigurationListModel(Target *target)
|
||||||
QObject *parent) : QAbstractListModel(parent)
|
: QAbstractListModel(target)
|
||||||
{
|
{
|
||||||
if (qobject_cast<const Qt4Maemo5Target *>(target))
|
if (qobject_cast<Qt4Maemo5Target *>(target))
|
||||||
m_targetOsVersion = MaemoGlobal::Maemo5;
|
m_targetOsVersion = MaemoGlobal::Maemo5;
|
||||||
else if (qobject_cast<const Qt4HarmattanTarget *>(target))
|
else if (qobject_cast<Qt4HarmattanTarget *>(target))
|
||||||
m_targetOsVersion = MaemoGlobal::Maemo6;
|
m_targetOsVersion = MaemoGlobal::Maemo6;
|
||||||
else if (qobject_cast<const Qt4MeegoTarget *>(target))
|
else if (qobject_cast<Qt4MeegoTarget *>(target))
|
||||||
m_targetOsVersion = MaemoGlobal::Meego;
|
m_targetOsVersion = MaemoGlobal::Meego;
|
||||||
else
|
else
|
||||||
Q_ASSERT(false);
|
Q_ASSERT(false);
|
||||||
const MaemoDeviceConfigurations * const devConfs
|
const MaemoDeviceConfigurations * const devConfs
|
||||||
= MaemoDeviceConfigurations::instance();
|
= MaemoDeviceConfigurations::instance();
|
||||||
connect(devConfs, SIGNAL(modelReset), this, SIGNAL(modelReset()));
|
connect(devConfs, SIGNAL(modelReset()), this, SIGNAL(modelReset()));
|
||||||
connect(devConfs, SIGNAL(updated()), this, SIGNAL(updated()));
|
connect(devConfs, SIGNAL(updated()), this, SIGNAL(updated()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,23 +76,51 @@ QVariant MaemoPerTargetDeviceConfigurationListModel::data(const QModelIndex &ind
|
|||||||
{
|
{
|
||||||
if (!index.isValid() || index.row() >= rowCount() || role != Qt::DisplayRole)
|
if (!index.isValid() || index.row() >= rowCount() || role != Qt::DisplayRole)
|
||||||
return QVariant();
|
return QVariant();
|
||||||
|
const MaemoDeviceConfig::ConstPtr &devConf = deviceAt(index.row());
|
||||||
|
Q_ASSERT(devConf);
|
||||||
|
QString displayedName = devConf->name();
|
||||||
|
if (devConf->isDefault())
|
||||||
|
displayedName += QLatin1Char(' ') + tr("(default)");
|
||||||
|
return displayedName;
|
||||||
|
}
|
||||||
|
|
||||||
|
MaemoDeviceConfig::ConstPtr MaemoPerTargetDeviceConfigurationListModel::deviceAt(int idx) const
|
||||||
|
{
|
||||||
int currentRow = -1;
|
int currentRow = -1;
|
||||||
const MaemoDeviceConfigurations * const devConfs
|
const MaemoDeviceConfigurations * const devConfs
|
||||||
= MaemoDeviceConfigurations::instance();
|
= MaemoDeviceConfigurations::instance();
|
||||||
const int devConfsCount = devConfs->rowCount();
|
const int devConfsCount = devConfs->rowCount();
|
||||||
for (int i = 0; i < devConfsCount; ++i) {
|
for (int i = 0; i < devConfsCount; ++i) {
|
||||||
if (devConfs->deviceAt(i)->osVersion() == m_targetOsVersion) {
|
if (devConfs->deviceAt(i)->osVersion() == m_targetOsVersion) {
|
||||||
if (++currentRow == index.row()) {
|
if (++currentRow == idx)
|
||||||
const MaemoDeviceConfig::ConstPtr &devConf = devConfs->deviceAt(i);
|
return devConfs->deviceAt(i);
|
||||||
QString displayedName = devConf->name();
|
|
||||||
if (devConf->isDefault())
|
|
||||||
displayedName + QLatin1Char(' ') + tr("(default)");
|
|
||||||
return displayedName;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Q_ASSERT(false);
|
Q_ASSERT(false);
|
||||||
return QVariant();
|
return MaemoDeviceConfig::ConstPtr();
|
||||||
|
}
|
||||||
|
|
||||||
|
MaemoDeviceConfig::ConstPtr MaemoPerTargetDeviceConfigurationListModel::defaultDeviceConfig() const
|
||||||
|
{
|
||||||
|
return MaemoDeviceConfigurations::instance()->defaultDeviceConfig(m_targetOsVersion);
|
||||||
|
}
|
||||||
|
|
||||||
|
MaemoDeviceConfig::ConstPtr MaemoPerTargetDeviceConfigurationListModel::find(MaemoDeviceConfig::Id id) const
|
||||||
|
{
|
||||||
|
const MaemoDeviceConfig::ConstPtr &devConf
|
||||||
|
= MaemoDeviceConfigurations::instance()->find(id);
|
||||||
|
return devConf && devConf->osVersion() == m_targetOsVersion
|
||||||
|
? devConf : defaultDeviceConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
int MaemoPerTargetDeviceConfigurationListModel::indexForInternalId(MaemoDeviceConfig::Id id) const
|
||||||
|
{
|
||||||
|
const int count = rowCount();
|
||||||
|
for (int i = 0; i < count; ++i) {
|
||||||
|
if (deviceAt(i)->internalId() == id)
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -33,9 +33,11 @@
|
|||||||
#ifndef MAEMOPERTARGETDEVICECONFIGURATIONLISTMODEL_H
|
#ifndef MAEMOPERTARGETDEVICECONFIGURATIONLISTMODEL_H
|
||||||
#define MAEMOPERTARGETDEVICECONFIGURATIONLISTMODEL_H
|
#define MAEMOPERTARGETDEVICECONFIGURATIONLISTMODEL_H
|
||||||
|
|
||||||
|
#include "maemodeviceconfigurations.h"
|
||||||
#include "maemoglobal.h"
|
#include "maemoglobal.h"
|
||||||
|
|
||||||
#include <QtCore/QAbstractListModel>
|
#include <QtCore/QAbstractListModel>
|
||||||
|
#include <QtCore/QSharedPointer>
|
||||||
|
|
||||||
namespace ProjectExplorer { class Target; }
|
namespace ProjectExplorer { class Target; }
|
||||||
|
|
||||||
@@ -46,13 +48,17 @@ class MaemoPerTargetDeviceConfigurationListModel : public QAbstractListModel
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit MaemoPerTargetDeviceConfigurationListModel(const ProjectExplorer::Target *target,
|
explicit MaemoPerTargetDeviceConfigurationListModel(ProjectExplorer::Target *target);
|
||||||
QObject *parent = 0);
|
|
||||||
|
|
||||||
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||||||
virtual QVariant data(const QModelIndex &index,
|
virtual QVariant data(const QModelIndex &index,
|
||||||
int role = Qt::DisplayRole) const;
|
int role = Qt::DisplayRole) const;
|
||||||
|
|
||||||
|
QSharedPointer<const MaemoDeviceConfig> deviceAt(int idx) const;
|
||||||
|
QSharedPointer<const MaemoDeviceConfig> defaultDeviceConfig() const;
|
||||||
|
QSharedPointer<const MaemoDeviceConfig> find(MaemoDeviceConfig::Id id) const;
|
||||||
|
int indexForInternalId(MaemoDeviceConfig::Id id) const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void updated();
|
void updated();
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
|
|
||||||
#include "maemoglobal.h"
|
#include "maemoglobal.h"
|
||||||
#include "maemopackagecreationstep.h"
|
#include "maemopackagecreationstep.h"
|
||||||
|
#include "maemopertargetdeviceconfigurationlistmodel.h"
|
||||||
#include "maemorunconfiguration.h"
|
#include "maemorunconfiguration.h"
|
||||||
#include "qt4maemodeployconfiguration.h"
|
#include "qt4maemodeployconfiguration.h"
|
||||||
|
|
||||||
@@ -297,6 +298,12 @@ bool AbstractQt4MaemoTarget::initPackagingSettingsFromOtherTarget()
|
|||||||
return initAdditionalPackagingSettingsFromOtherTarget();
|
return initAdditionalPackagingSettingsFromOtherTarget();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AbstractQt4MaemoTarget::initDeviceConfigurationsModel()
|
||||||
|
{
|
||||||
|
m_deviceConfigurationsListModel
|
||||||
|
= new MaemoPerTargetDeviceConfigurationListModel(this);
|
||||||
|
}
|
||||||
|
|
||||||
void AbstractQt4MaemoTarget::raiseError(const QString &reason)
|
void AbstractQt4MaemoTarget::raiseError(const QString &reason)
|
||||||
{
|
{
|
||||||
QMessageBox::critical(0, tr("Error creating Maemo templates"), reason);
|
QMessageBox::critical(0, tr("Error creating Maemo templates"), reason);
|
||||||
@@ -989,6 +996,7 @@ Qt4Maemo5Target::Qt4Maemo5Target(Qt4Project *parent, const QString &id)
|
|||||||
: AbstractDebBasedQt4MaemoTarget(parent, id)
|
: AbstractDebBasedQt4MaemoTarget(parent, id)
|
||||||
{
|
{
|
||||||
setDisplayName(defaultDisplayName());
|
setDisplayName(defaultDisplayName());
|
||||||
|
initDeviceConfigurationsModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
Qt4Maemo5Target::~Qt4Maemo5Target() {}
|
Qt4Maemo5Target::~Qt4Maemo5Target() {}
|
||||||
@@ -1008,6 +1016,7 @@ Qt4HarmattanTarget::Qt4HarmattanTarget(Qt4Project *parent, const QString &id)
|
|||||||
: AbstractDebBasedQt4MaemoTarget(parent, id)
|
: AbstractDebBasedQt4MaemoTarget(parent, id)
|
||||||
{
|
{
|
||||||
setDisplayName(defaultDisplayName());
|
setDisplayName(defaultDisplayName());
|
||||||
|
initDeviceConfigurationsModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
Qt4HarmattanTarget::~Qt4HarmattanTarget() {}
|
Qt4HarmattanTarget::~Qt4HarmattanTarget() {}
|
||||||
@@ -1028,6 +1037,7 @@ Qt4MeegoTarget::Qt4MeegoTarget(Qt4Project *parent, const QString &id)
|
|||||||
: AbstractRpmBasedQt4MaemoTarget(parent, id)
|
: AbstractRpmBasedQt4MaemoTarget(parent, id)
|
||||||
{
|
{
|
||||||
setDisplayName(defaultDisplayName());
|
setDisplayName(defaultDisplayName());
|
||||||
|
initDeviceConfigurationsModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
Qt4MeegoTarget::~Qt4MeegoTarget() {}
|
Qt4MeegoTarget::~Qt4MeegoTarget() {}
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ QT_FORWARD_DECLARE_CLASS(QFileSystemWatcher)
|
|||||||
namespace Qt4ProjectManager {
|
namespace Qt4ProjectManager {
|
||||||
class Qt4Project;
|
class Qt4Project;
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
class MaemoPerTargetDeviceConfigurationListModel;
|
||||||
class Qt4MaemoDeployConfigurationFactory;
|
class Qt4MaemoDeployConfigurationFactory;
|
||||||
|
|
||||||
class AbstractQt4MaemoTarget : public Qt4BaseTarget
|
class AbstractQt4MaemoTarget : public Qt4BaseTarget
|
||||||
@@ -79,7 +80,12 @@ public:
|
|||||||
};
|
};
|
||||||
DebugArchitecture debugArchitecture() const;
|
DebugArchitecture debugArchitecture() const;
|
||||||
|
|
||||||
|
MaemoPerTargetDeviceConfigurationListModel *deviceConfigurationsModel() const {
|
||||||
|
return m_deviceConfigurationsListModel;
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void initDeviceConfigurationsModel();
|
||||||
void raiseError(const QString &reason);
|
void raiseError(const QString &reason);
|
||||||
QSharedPointer<QFile> openFile(const QString &filePath,
|
QSharedPointer<QFile> openFile(const QString &filePath,
|
||||||
QIODevice::OpenMode mode, QString *error) const;
|
QIODevice::OpenMode mode, QString *error) const;
|
||||||
@@ -106,6 +112,7 @@ private:
|
|||||||
|
|
||||||
Qt4BuildConfigurationFactory *m_buildConfigurationFactory;
|
Qt4BuildConfigurationFactory *m_buildConfigurationFactory;
|
||||||
Qt4MaemoDeployConfigurationFactory *m_deployConfigurationFactory;
|
Qt4MaemoDeployConfigurationFactory *m_deployConfigurationFactory;
|
||||||
|
MaemoPerTargetDeviceConfigurationListModel * m_deviceConfigurationsListModel;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user