Files
qt-creator/src/plugins/qt4projectmanager/qt-maemo/maemodeploystepwidget.cpp
Christian Kandeler ea36611425 Maemo: Sanitize deployment step.
- Always use remote mounts for Fremantle.
- Always use SFTP for Harmattan.
- Never use SFTP deployment for non-packaging case (and get rid of
  the corresponding code).
- Fix the order of sub-steps.

Reviewed-by: kh1
2010-08-24 14:52:29 +02:00

104 lines
3.0 KiB
C++

#include "maemodeploystepwidget.h"
#include "ui_maemodeploystepwidget.h"
#include "maemodeploystep.h"
#include "maemodeployablelistmodel.h"
#include "maemodeployablelistwidget.h"
#include "maemodeployables.h"
#include "maemodeviceconfiglistmodel.h"
#include "maemorunconfiguration.h"
#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/target.h>
namespace Qt4ProjectManager {
namespace Internal {
MaemoDeployStepWidget::MaemoDeployStepWidget(MaemoDeployStep *step) :
ProjectExplorer::BuildStepConfigWidget(),
ui(new Ui::MaemoDeployStepWidget),
m_step(step)
{
ui->setupUi(this);
connect(m_step->deployables(), SIGNAL(modelsCreated()), this,
SLOT(handleModelsCreated()));
handleModelsCreated();
}
MaemoDeployStepWidget::~MaemoDeployStepWidget()
{
delete ui;
}
void MaemoDeployStepWidget::init()
{
handleDeviceConfigModelChanged();
connect(m_step->buildConfiguration()->target(),
SIGNAL(activeRunConfigurationChanged(ProjectExplorer::RunConfiguration*)),
this, SLOT(handleDeviceConfigModelChanged()));
connect(ui->deviceConfigComboBox, SIGNAL(activated(int)), this,
SLOT(setCurrentDeviceConfig(int)));
ui->deployToSysrootCheckBox->setChecked(m_step->isDeployToSysrootEnabled());
connect(ui->deployToSysrootCheckBox, SIGNAL(toggled(bool)), this,
SLOT(setDeployToSysroot(bool)));
handleDeviceConfigModelChanged();
}
void MaemoDeployStepWidget::handleDeviceConfigModelChanged()
{
const MaemoDeviceConfigListModel * const oldModel
= qobject_cast<MaemoDeviceConfigListModel *>(ui->deviceConfigComboBox->model());
if (oldModel)
disconnect(oldModel, 0, this, 0);
MaemoDeviceConfigListModel * const devModel = m_step->deviceConfigModel();
ui->deviceConfigComboBox->setModel(devModel);
connect(devModel, SIGNAL(currentChanged()), this,
SLOT(handleDeviceUpdate()));
connect(devModel, SIGNAL(modelReset()), this,
SLOT(handleDeviceUpdate()));
handleDeviceUpdate();
}
void MaemoDeployStepWidget::handleDeviceUpdate()
{
ui->deviceConfigComboBox->setCurrentIndex(m_step->deviceConfigModel()
->currentIndex());
emit updateSummary();
}
QString MaemoDeployStepWidget::summaryText() const
{
return tr("<b>Deploy to device</b>: ") + m_step->deviceConfig().name;
}
QString MaemoDeployStepWidget::displayName() const
{
return QString();
}
void MaemoDeployStepWidget::handleModelsCreated()
{
ui->tabWidget->clear();
for (int i = 0; i < m_step->deployables()->modelCount(); ++i) {
MaemoDeployableListModel * const model
= m_step->deployables()->modelAt(i);
ui->tabWidget->addTab(new MaemoDeployableListWidget(this, model),
model->projectName());
}
}
void MaemoDeployStepWidget::setCurrentDeviceConfig(int index)
{
m_step->deviceConfigModel()->setCurrentIndex(index);
}
void MaemoDeployStepWidget::setDeployToSysroot(bool doDeploy)
{
m_step->setDeployToSysrootEnabled(doDeploy);
}
} // namespace Internal
} // namespace Qt4ProjectManager