<commit_before>#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()
{
#ifdef DEPLOY_VIA_MOUNT
    ui->mountPortSpinBox->setValue(m_step->mountPort());
    connect(ui->mountPortSpinBox, SIGNAL(valueChanged(int)), this,
        SLOT(handleMountPortEdited(int)));
#else
    ui->mountPortLabel->hide();
    ui->mountPortSpinBox->hide();
#endif
    handleDeviceConfigModelChanged();
    connect(m_step->buildConfiguration()->target(),
        SIGNAL(activeRunConfigurationChanged(ProjectExplorer::RunConfiguration*)),
        this, SLOT(handleDeviceConfigModelChanged()));
    connect(ui->deviceConfigComboBox, SIGNAL(activated(int)), this,
        SLOT(setCurrentDeviceConfig(int)));
}

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::handleMountPortEdited(int newPort)
{
#ifdef DEPLOY_VIA_MOUNT
    m_step->setMountPort(newPort);
#endif
}

} // namespace Internal
} // namespace Qt4ProjectManager
<commit_msg>Fix gcc warning<commit_after>#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()
{
#ifdef DEPLOY_VIA_MOUNT
    ui->mountPortSpinBox->setValue(m_step->mountPort());
    connect(ui->mountPortSpinBox, SIGNAL(valueChanged(int)), this,
        SLOT(handleMountPortEdited(int)));
#else
    ui->mountPortLabel->hide();
    ui->mountPortSpinBox->hide();
#endif
    handleDeviceConfigModelChanged();
    connect(m_step->buildConfiguration()->target(),
        SIGNAL(activeRunConfigurationChanged(ProjectExplorer::RunConfiguration*)),
        this, SLOT(handleDeviceConfigModelChanged()));
    connect(ui->deviceConfigComboBox, SIGNAL(activated(int)), this,
        SLOT(setCurrentDeviceConfig(int)));
}

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::handleMountPortEdited(int newPort)
{
#ifdef DEPLOY_VIA_MOUNT
    m_step->setMountPort(newPort);
#else
    Q_UNUSED(newPort);
#endif
}

} // namespace Internal
} // namespace Qt4ProjectManager

{'fraction_non_alphanumeric': 0.13094677343382008, 'fraction_numerical': 0.0015701051970482022, 'mean_word_length': 5.453900709219858, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 83, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6100375', 'n_tokens_mistral': 2062, 'n_tokens_neox': 1979, 'n_words': 286}