Commit 3a4baff5 authored by ck's avatar ck
Browse files

Maemo: Run configuration gets device from deploy step.

parent 3c10fc18
......@@ -278,14 +278,6 @@ MaemoDeviceConfig MaemoDeployStep::deviceConfig() const
return deviceConfigModel()->current();
}
MaemoDeviceConfigListModel *MaemoDeployStep::deviceConfigModel() const
{
const MaemoRunConfiguration * const rc =
qobject_cast<const MaemoRunConfiguration *>(buildConfiguration()
->target()->activeRunConfiguration());
return rc ? rc->deviceConfigModel() : m_deviceConfigModel;
}
void MaemoDeployStep::start()
{
#ifdef DEPLOY_VIA_MOUNT
......
......@@ -78,7 +78,7 @@ public:
virtual ~MaemoDeployStep();
MaemoDeviceConfig deviceConfig() const;
MaemoDeviceConfigListModel *deviceConfigModel() const;
MaemoDeviceConfigListModel *deviceConfigModel() const { return m_deviceConfigModel; }
bool currentlyNeedsDeployment(const QString &host,
const MaemoDeployable &deployable) const;
void setDeployed(const QString &host, const MaemoDeployable &deployable);
......
......@@ -87,15 +87,13 @@ MaemoRunConfiguration::MaemoRunConfiguration(Qt4Target *parent,
void MaemoRunConfiguration::init()
{
m_devConfigModel = new MaemoDeviceConfigListModel(this);
m_remoteMounts = new MaemoRemoteMountsModel(this);
setDisplayName(QFileInfo(m_proFilePath).completeBaseName());
updateDeviceConfigurations();
connect(m_devConfigModel, SIGNAL(currentChanged()), this,
SLOT(updateDeviceConfigurations()));
connect(m_devConfigModel, SIGNAL(modelReset()), this,
SLOT(updateDeviceConfigurations()));
connect(target(),
SIGNAL(activeDeployConfigurationChanged(ProjectExplorer::DeployConfiguration*)),
this, SLOT(handleDeployConfigChanged()));
handleDeployConfigChanged();
connect(qt4Target()->qt4Project(),
SIGNAL(proFileUpdated(Qt4ProjectManager::Internal::Qt4ProFileNode*)),
......@@ -150,7 +148,6 @@ QVariantMap MaemoRunConfiguration::toMap() const
map.insert(BaseEnvironmentBaseKey, m_baseEnvironmentBase);
map.insert(UserEnvironmentChangesKey,
ProjectExplorer::EnvironmentItem::toStringList(m_userEnvironmentChanges));
map.unite(m_devConfigModel->toMap());
map.unite(m_remoteMounts->toMap());
return map;
}
......@@ -169,7 +166,6 @@ bool MaemoRunConfiguration::fromMap(const QVariantMap &map)
.toStringList());
m_baseEnvironmentBase = static_cast<BaseEnvironmentBase> (map.value(BaseEnvironmentBaseKey,
SystemEnvironmentBase).toInt());
m_devConfigModel->fromMap(map);
m_remoteMounts->fromMap(map);
return true;
......@@ -177,12 +173,7 @@ bool MaemoRunConfiguration::fromMap(const QVariantMap &map)
MaemoDeviceConfig MaemoRunConfiguration::deviceConfig() const
{
return m_devConfigModel->current();
}
MaemoDeviceConfigListModel *MaemoRunConfiguration::deviceConfigModel() const
{
return m_devConfigModel;
return deployStep()->deviceConfigModel()->current();
}
const MaemoToolChain *MaemoRunConfiguration::toolchain() const
......@@ -301,6 +292,30 @@ void MaemoRunConfiguration::updateDeviceConfigurations()
emit deviceConfigurationChanged(target());
}
void MaemoRunConfiguration::handleDeployConfigChanged()
{
const QList<DeployConfiguration *> &deployConfigs
= target()->deployConfigurations();
DeployConfiguration * const activeDeployConf
= target()->activeDeployConfiguration();
for (int i = 0; i < deployConfigs.count(); ++i) {
MaemoDeployStep * const step
= MaemoGlobal::buildStep<MaemoDeployStep>(deployConfigs.at(i));
MaemoDeviceConfigListModel * const devConfigModel
= step->deviceConfigModel();
if (deployConfigs.at(i) == activeDeployConf) {
connect(devConfigModel, SIGNAL(currentChanged()), this,
SLOT(updateDeviceConfigurations()));
connect(devConfigModel, SIGNAL(modelReset()), this,
SLOT(updateDeviceConfigurations()));
} else {
disconnect(devConfigModel, 0, this,
SLOT(updateDeviceConfigurations()));
}
}
updateDeviceConfigurations();
}
QString MaemoRunConfiguration::baseEnvironmentText() const
{
if (m_baseEnvironmentBase == CleanEnvironmentBase)
......
......@@ -92,7 +92,6 @@ public:
const QStringList arguments() const;
void setArguments(const QStringList &args);
MaemoDeviceConfig deviceConfig() const;
MaemoDeviceConfigListModel *deviceConfigModel() const;
MaemoPortList freePorts() const;
bool useRemoteGdb() const { return m_useRemoteGdb; }
void setUseRemoteGdb(bool useRemoteGdb) { m_useRemoteGdb = useRemoteGdb; }
......@@ -132,6 +131,7 @@ protected:
private slots:
void proFileUpdate(Qt4ProjectManager::Internal::Qt4ProFileNode *pro);
void updateDeviceConfigurations();
void handleDeployConfigChanged();
private:
void init();
......@@ -139,7 +139,6 @@ private:
private:
QString m_proFilePath;
mutable QString m_gdbPath;
MaemoDeviceConfigListModel *m_devConfigModel;
MaemoRemoteMountsModel *m_remoteMounts;
QStringList m_arguments;
bool m_useRemoteGdb;
......
......@@ -78,7 +78,8 @@ MaemoRunConfigurationWidget::MaemoRunConfigurationWidget(
addDebuggingWidgets(mainLayout);
addMountWidgets(mainLayout);
addEnvironmentWidgets(mainLayout);
connect(m_runConfiguration->deviceConfigModel(), SIGNAL(currentChanged()),
connect(m_runConfiguration,
SIGNAL(deviceConfigurationChanged(ProjectExplorer::Target*)),
this, SLOT(handleCurrentDeviceConfigChanged()));
handleCurrentDeviceConfigChanged();
}
......@@ -93,11 +94,9 @@ void MaemoRunConfigurationWidget::addGenericWidgets(QVBoxLayout *mainLayout)
QWidget *devConfWidget = new QWidget;
QHBoxLayout *devConfLayout = new QHBoxLayout(devConfWidget);
m_devConfBox = new QComboBox;
m_devConfBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);
m_devConfBox->setModel(m_runConfiguration->deviceConfigModel());
m_devConfLabel = new QLabel;
devConfLayout->setMargin(0);
devConfLayout->addWidget(m_devConfBox);
devConfLayout->addWidget(m_devConfLabel);
QLabel *addDevConfLabel= new QLabel(tr("<a href=\"%1\">Manage device configurations</a>")
.arg(QLatin1String("deviceconfig")));
addDevConfLabel->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
......@@ -125,8 +124,6 @@ void MaemoRunConfigurationWidget::addGenericWidgets(QVBoxLayout *mainLayout)
SLOT(configNameEdited(QString)));
connect(m_argsLineEdit, SIGNAL(textEdited(QString)), this,
SLOT(argumentsEdited(QString)));
connect(m_devConfBox, SIGNAL(activated(int)), this,
SLOT(setCurrentDeviceConfig(int)));
connect(m_runConfiguration, SIGNAL(targetInformationChanged()), this,
SLOT(updateTargetInformation()));
connect(m_runConfiguration->deployStep()->deployables(),
......@@ -278,16 +275,10 @@ void MaemoRunConfigurationWidget::showSettingsDialog(const QString &link)
void MaemoRunConfigurationWidget::handleCurrentDeviceConfigChanged()
{
m_devConfBox->setCurrentIndex(m_runConfiguration->deviceConfigModel()
->currentIndex());
m_devConfLabel->setText(m_runConfiguration->deviceConfig().name);
updateMountWarning();
}
void MaemoRunConfigurationWidget::setCurrentDeviceConfig(int index)
{
m_runConfiguration->deviceConfigModel()->setCurrentIndex(index);
}
void MaemoRunConfigurationWidget::enableOrDisableRemoveMountSpecButton()
{
const QModelIndexList selectedRows
......
......@@ -74,7 +74,6 @@ private slots:
void showSettingsDialog(const QString &link);
void updateTargetInformation();
void handleCurrentDeviceConfigChanged();
void setCurrentDeviceConfig(int index);
void addMount();
void removeMount();
void changeLocalMountDir(const QModelIndex &index);
......@@ -101,7 +100,7 @@ private:
QLineEdit *m_argsLineEdit;
QLabel *m_localExecutableLabel;
QLabel *m_remoteExecutableLabel;
QComboBox *m_devConfBox;
QLabel *m_devConfLabel;
QLabel *m_mountWarningLabel;
QTableView *m_mountView;
QToolButton *m_removeMountButton;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment