Exemple #1
0
void LinuxDeviceConfigurations::addConfiguration(const LinuxDeviceConfiguration::Ptr &devConfig)
{
    devConfig->m_internalId = m_nextId++;
    beginInsertRows(QModelIndex(), rowCount(), rowCount());
    if (!defaultDeviceConfig(devConfig->osType()))
        devConfig->m_isDefault = true;
    m_devConfigs << devConfig;
    endInsertRows();
}
Exemple #2
0
void LinuxDeviceConfigurations::addConfiguration(const LinuxDeviceConfiguration::Ptr &devConfig)
{
    // Ensure uniqueness of name.
    QString name = devConfig->name();
    if (hasConfig(name)) {
        const QString nameTemplate = name + QLatin1String(" (%1)");
        int suffix = 2;
        do
            name = nameTemplate.arg(QString::number(suffix++));
        while (hasConfig(name));
    }
    devConfig->setName(name);

    devConfig->setInternalId(m_nextId++);
    beginInsertRows(QModelIndex(), rowCount(), rowCount());
    if (!defaultDeviceConfig(devConfig->osType()))
        devConfig->setDefault(true);
    m_devConfigs << devConfig;
    endInsertRows();
}
Exemple #3
0
IDevice::Ptr GenericLinuxDeviceConfigurationWizard::device()
{
    Utils::SshConnectionParameters sshParams;
    sshParams.host = d->setupPage.hostName();
    sshParams.userName = d->setupPage.userName();
    sshParams.port = 22;
    sshParams.timeout = 10;
    sshParams.authenticationType = d->setupPage.authenticationType();
    if (sshParams.authenticationType == SshConnectionParameters::AuthenticationByPassword)
        sshParams.password = d->setupPage.password();
    else
        sshParams.privateKeyFile = d->setupPage.privateKeyFilePath();
    LinuxDeviceConfiguration::Ptr devConf = LinuxDeviceConfiguration::create(d->setupPage.configurationName(),
        QLatin1String(Constants::GenericLinuxOsType), LinuxDeviceConfiguration::Hardware);
    devConf->setFreePorts(Utils::PortList::fromString(QLatin1String("10000-10100")));
    devConf->setSshParameters(sshParams);
    LinuxDeviceTestDialog dlg(devConf, new GenericLinuxDeviceTester(this), this);
    dlg.exec();
    return devConf;
}
Exemple #4
0
void MaemoDeviceConfigurationsSettingsWidget::addConfig()
{
    const QList<ILinuxDeviceConfigurationFactory *> &factories
        = ExtensionSystem::PluginManager::instance()->getObjects<ILinuxDeviceConfigurationFactory>();

    if (factories.isEmpty()) // Can't happen, because this plugin provides the generic one.
        return;

    const ILinuxDeviceConfigurationFactory *factory;

    if (factories.count() == 1) {
        // Don't show dialog when there's nothing to choose from.
        // TODO: This is transitional. Remove it once the MADDE plugin exists.
        factory = factories.first();
    } else {
        LinuxDeviceFactorySelectionDialog d;
        if (d.exec() != QDialog::Accepted)
            return;
        factory = d.selectedFactory();
    }

    ILinuxDeviceConfigurationWizard *wizard = factory->createWizard();
    if (wizard->exec() != QDialog::Accepted)
        return;

    LinuxDeviceConfiguration::Ptr devConf = wizard->deviceConfiguration();
    QString name = devConf->name();
    if (m_devConfigs->hasConfig(name)) {
        const QString nameTemplate = name + QLatin1String(" (%1)");
        int suffix = 2;
        do
            name = nameTemplate.arg(QString::number(suffix++));
        while (m_devConfigs->hasConfig(name));
    }
    devConf->setName(name);
    m_devConfigs->addConfiguration(devConf);
    m_ui->removeConfigButton->setEnabled(true);
    m_ui->configurationComboBox->setCurrentIndex(m_ui->configurationComboBox->count()-1);

    delete wizard;
}