MaemoRunConfigurationWidget::MaemoRunConfigurationWidget(
        MaemoRunConfiguration *runConfiguration, QWidget *parent)
    : QWidget(parent), m_runConfiguration(runConfiguration)
{
    QVBoxLayout *topLayout = new QVBoxLayout(this);
    topLayout->setMargin(0);
    QWidget *topWidget = new QWidget;
    topLayout->addWidget(topWidget);
    QVBoxLayout *mainLayout = new QVBoxLayout(topWidget);
    mainLayout->setMargin(0);
    m_remoteLinuxRunConfigWidget = new RemoteLinuxRunConfigurationWidget(runConfiguration, parent);
    mainLayout->addWidget(m_remoteLinuxRunConfigWidget);
    m_subWidget = new QWidget;
    mainLayout->addWidget(m_subWidget);
    QVBoxLayout *subLayout = new QVBoxLayout(m_subWidget);
    subLayout->setMargin(0);
    addMountWidgets(subLayout);
    connect(m_runConfiguration->target(), SIGNAL(kitChanged()), this, SLOT(updateMountWarning()));
    connect(m_runConfiguration->extraAspect<Debugger::DebuggerRunConfigurationAspect>(),
            SIGNAL(debuggersChanged()),
            SLOT(updateMountWarning()));
    updateMountWarning();

    Core::Id devId = ProjectExplorer::DeviceTypeKitInformation::deviceTypeId(runConfiguration->target()->kit());
    m_mountDetailsContainer->setVisible(MaddeDevice::allowsRemoteMounts(devId));

    connect(m_runConfiguration, SIGNAL(enabledChanged()),
            this, SLOT(runConfigurationEnabledChange()));
    runConfigurationEnabledChange();
}
void MaemoRunConfigurationWidget::handleDebuggingTypeChanged()
{
    m_runConfiguration->setUseCppDebugger(m_debugCppOnlyButton->isChecked()
        || m_debugCppAndQmlButton->isChecked());
    m_runConfiguration->setUseQmlDebugger(m_debugQmlOnlyButton->isChecked()
        || m_debugCppAndQmlButton->isChecked());
    updateMountWarning();
}
void MaemoRunConfigurationWidget::handleRemoteMountsChanged()
{
    const int mountCount
        = m_runConfiguration->remoteMounts()->validMountSpecificationCount();
    QString text;
    switch (mountCount) {
    case 0:
        text = tr("No local directories to be mounted on the device.");
        break;
    case 1:
        text = tr("One local directory to be mounted on the device.");
        break;
    default:
        //: Note: Only mountCount>1  will occur here as 0, 1 are handled above.
        text = tr("%n local directories to be mounted on the device.", 0, mountCount);
        break;
    }
    m_mountDetailsContainer->setSummaryText(QLatin1String("<b>") + text
        + QLatin1String("</b>"));
    updateMountWarning();
}
void MaemoRunConfigurationWidget::handleCurrentDeviceConfigChanged()
{
    m_devConfLabel->setText(MaemoGlobal::deviceConfigurationName(m_runConfiguration->deviceConfig()));
    updateMountWarning();
}