forked from qt-creator/qt-creator
Maemo: Use device configuration wizard.
Needs patch choosers instead of line edits.
This commit is contained in:
@@ -216,12 +216,6 @@ QString MaemoPortList::toString() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
MaemoDeviceConfig::Ptr MaemoDeviceConfig::create(const QString &name,
|
|
||||||
MaemoGlobal::MaemoVersion osVersion, DeviceType type, Id &nextId)
|
|
||||||
{
|
|
||||||
return Ptr(new MaemoDeviceConfig(name, osVersion, type, nextId));
|
|
||||||
}
|
|
||||||
|
|
||||||
MaemoDeviceConfig::Ptr MaemoDeviceConfig::create(const QSettings &settings,
|
MaemoDeviceConfig::Ptr MaemoDeviceConfig::create(const QSettings &settings,
|
||||||
Id &nextId)
|
Id &nextId)
|
||||||
{
|
{
|
||||||
@@ -233,9 +227,31 @@ MaemoDeviceConfig::Ptr MaemoDeviceConfig::create(const ConstPtr &other)
|
|||||||
return Ptr(new MaemoDeviceConfig(other));
|
return Ptr(new MaemoDeviceConfig(other));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MaemoDeviceConfig::Ptr MaemoDeviceConfig::createHardwareConfig(const QString &name,
|
||||||
|
MaemoGlobal::MaemoVersion osVersion, const QString &hostName,
|
||||||
|
const QString privateKeyFilePath, Id &nextId)
|
||||||
|
{
|
||||||
|
Core::SshConnectionParameters sshParams(Core::SshConnectionParameters::NoProxy);
|
||||||
|
sshParams.authType = Core::SshConnectionParameters::AuthByKey;
|
||||||
|
sshParams.host = hostName;
|
||||||
|
sshParams.privateKeyFile = privateKeyFilePath;
|
||||||
|
return Ptr(new MaemoDeviceConfig(name, osVersion, Physical, sshParams, nextId));
|
||||||
|
}
|
||||||
|
|
||||||
|
MaemoDeviceConfig::Ptr MaemoDeviceConfig::createEmulatorConfig(const QString &name,
|
||||||
|
MaemoGlobal::MaemoVersion osVersion, Id &nextId)
|
||||||
|
{
|
||||||
|
Core::SshConnectionParameters sshParams(Core::SshConnectionParameters::NoProxy);
|
||||||
|
sshParams.authType = Core::SshConnectionParameters::AuthByPwd;
|
||||||
|
sshParams.host = defaultHost(Simulator);
|
||||||
|
sshParams.pwd = defaultQemuPassword(osVersion);
|
||||||
|
return Ptr(new MaemoDeviceConfig(name, osVersion, Simulator, sshParams, nextId));
|
||||||
|
}
|
||||||
|
|
||||||
MaemoDeviceConfig::MaemoDeviceConfig(const QString &name,
|
MaemoDeviceConfig::MaemoDeviceConfig(const QString &name,
|
||||||
MaemoGlobal::MaemoVersion osVersion, DeviceType devType, Id &nextId)
|
MaemoGlobal::MaemoVersion osVersion, DeviceType devType,
|
||||||
: m_sshParameters(Core::SshConnectionParameters::NoProxy),
|
const Core::SshConnectionParameters &sshParams, Id &nextId)
|
||||||
|
: m_sshParameters(sshParams),
|
||||||
m_name(name),
|
m_name(name),
|
||||||
m_osVersion(osVersion),
|
m_osVersion(osVersion),
|
||||||
m_type(devType),
|
m_type(devType),
|
||||||
@@ -243,12 +259,8 @@ MaemoDeviceConfig::MaemoDeviceConfig(const QString &name,
|
|||||||
m_isDefault(false),
|
m_isDefault(false),
|
||||||
m_internalId(nextId++)
|
m_internalId(nextId++)
|
||||||
{
|
{
|
||||||
m_sshParameters.host = defaultHost(m_type);
|
|
||||||
m_sshParameters.port = defaultSshPort(m_type);
|
m_sshParameters.port = defaultSshPort(m_type);
|
||||||
m_sshParameters.uname = defaultUser(m_osVersion);
|
m_sshParameters.uname = defaultUser(m_osVersion);
|
||||||
m_sshParameters.authType = DefaultAuthType;
|
|
||||||
m_sshParameters.privateKeyFile
|
|
||||||
= MaemoDeviceConfigurations::instance()->defaultSshKeyFilePath();
|
|
||||||
m_sshParameters.timeout = DefaultTimeout;
|
m_sshParameters.timeout = DefaultTimeout;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -328,6 +340,20 @@ QString MaemoDeviceConfig::defaultUser(MaemoGlobal::MaemoVersion osVersion)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString MaemoDeviceConfig::defaultQemuPassword(MaemoGlobal::MaemoVersion osVersion)
|
||||||
|
{
|
||||||
|
switch (osVersion) {
|
||||||
|
case MaemoGlobal::Maemo5:
|
||||||
|
case MaemoGlobal::Maemo6:
|
||||||
|
return QString();
|
||||||
|
case MaemoGlobal::Meego:
|
||||||
|
return QLatin1String("meego");
|
||||||
|
default:
|
||||||
|
Q_ASSERT(false);
|
||||||
|
return QString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
MaemoPortList MaemoDeviceConfig::freePorts() const
|
MaemoPortList MaemoDeviceConfig::freePorts() const
|
||||||
{
|
{
|
||||||
return PortsSpecParser(m_portsSpec).parse();
|
return PortsSpecParser(m_portsSpec).parse();
|
||||||
@@ -390,7 +416,6 @@ void MaemoDeviceConfigurations::copy(const MaemoDeviceConfigurations *source,
|
|||||||
}
|
}
|
||||||
target->m_defaultSshKeyFilePath = source->m_defaultSshKeyFilePath;
|
target->m_defaultSshKeyFilePath = source->m_defaultSshKeyFilePath;
|
||||||
target->m_nextId = source->m_nextId;
|
target->m_nextId = source->m_nextId;
|
||||||
target->initShadowDevConfs();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaemoDeviceConfigurations::save()
|
void MaemoDeviceConfigurations::save()
|
||||||
@@ -408,45 +433,29 @@ void MaemoDeviceConfigurations::save()
|
|||||||
settings->endGroup();
|
settings->endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaemoDeviceConfigurations::initShadowDevConfs()
|
void MaemoDeviceConfigurations::addHardwareDeviceConfiguration(const QString &name,
|
||||||
|
MaemoGlobal::MaemoVersion osVersion, const QString &hostName,
|
||||||
|
const QString privateKeyFilePath)
|
||||||
{
|
{
|
||||||
m_shadowDevConfigs.clear();
|
const MaemoDeviceConfig::Ptr &devConf = MaemoDeviceConfig::createHardwareConfig(name,
|
||||||
for (int i = 0; i < m_devConfigs.count(); ++i)
|
osVersion, hostName, privateKeyFilePath, m_nextId);
|
||||||
m_shadowDevConfigs.push_back(MaemoDeviceConfig::Ptr());
|
addConfiguration(devConf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaemoDeviceConfigurations::setupShadowDevConf(int idx)
|
void MaemoDeviceConfigurations::addEmulatorDeviceConfiguration(const QString &name,
|
||||||
|
MaemoGlobal::MaemoVersion osVersion)
|
||||||
{
|
{
|
||||||
MaemoDeviceConfig::Ptr shadowConf = m_shadowDevConfigs.at(idx);
|
const MaemoDeviceConfig::Ptr &devConf
|
||||||
if (shadowConf)
|
= MaemoDeviceConfig::createEmulatorConfig(name, osVersion, m_nextId);
|
||||||
return;
|
addConfiguration(devConf);
|
||||||
|
|
||||||
const MaemoDeviceConfig::Ptr devConf = m_devConfigs.at(idx);
|
|
||||||
const MaemoDeviceConfig::DeviceType shadowType
|
|
||||||
= devConf->type() == MaemoDeviceConfig::Physical
|
|
||||||
? MaemoDeviceConfig::Simulator : MaemoDeviceConfig::Physical;
|
|
||||||
shadowConf = MaemoDeviceConfig::create(devConf->name(),
|
|
||||||
devConf->osVersion(), shadowType, m_nextId);
|
|
||||||
shadowConf->m_sshParameters.authType = devConf->m_sshParameters.authType;
|
|
||||||
shadowConf->m_sshParameters.timeout = devConf->m_sshParameters.timeout;
|
|
||||||
shadowConf->m_sshParameters.pwd = devConf->m_sshParameters.pwd;
|
|
||||||
shadowConf->m_sshParameters.privateKeyFile
|
|
||||||
= devConf->m_sshParameters.privateKeyFile;
|
|
||||||
shadowConf->m_isDefault = devConf->m_isDefault;
|
|
||||||
shadowConf->m_internalId = devConf->m_internalId;
|
|
||||||
m_shadowDevConfigs[idx] = shadowConf;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaemoDeviceConfigurations::addConfiguration(const QString &name,
|
void MaemoDeviceConfigurations::addConfiguration(const MaemoDeviceConfig::Ptr &devConfig)
|
||||||
MaemoGlobal::MaemoVersion osVersion, MaemoDeviceConfig::DeviceType type)
|
|
||||||
{
|
{
|
||||||
beginInsertRows(QModelIndex(), rowCount(), rowCount());
|
beginInsertRows(QModelIndex(), rowCount(), rowCount());
|
||||||
const MaemoDeviceConfig::Ptr devConf
|
|
||||||
= MaemoDeviceConfig::create(name, osVersion, type, m_nextId);
|
|
||||||
if (m_devConfigs.isEmpty())
|
if (m_devConfigs.isEmpty())
|
||||||
devConf->m_isDefault = true;
|
devConfig->m_isDefault = true;
|
||||||
m_devConfigs << devConf;
|
m_devConfigs << devConfig;
|
||||||
m_shadowDevConfigs << MaemoDeviceConfig::Ptr();
|
|
||||||
endInsertRows();
|
endInsertRows();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -456,7 +465,6 @@ void MaemoDeviceConfigurations::removeConfiguration(int idx)
|
|||||||
beginRemoveRows(QModelIndex(), idx, idx);
|
beginRemoveRows(QModelIndex(), idx, idx);
|
||||||
const bool wasDefault = deviceAt(idx)->m_isDefault;
|
const bool wasDefault = deviceAt(idx)->m_isDefault;
|
||||||
m_devConfigs.removeAt(idx);
|
m_devConfigs.removeAt(idx);
|
||||||
m_shadowDevConfigs.removeAt(idx);
|
|
||||||
endRemoveRows();
|
endRemoveRows();
|
||||||
if (wasDefault && !m_devConfigs.isEmpty()) {
|
if (wasDefault && !m_devConfigs.isEmpty()) {
|
||||||
m_devConfigs.first()->m_isDefault = true;
|
m_devConfigs.first()->m_isDefault = true;
|
||||||
@@ -469,24 +477,10 @@ void MaemoDeviceConfigurations::setConfigurationName(int i, const QString &name)
|
|||||||
{
|
{
|
||||||
Q_ASSERT(i >= 0 && i < rowCount());
|
Q_ASSERT(i >= 0 && i < rowCount());
|
||||||
m_devConfigs.at(i)->m_name = name;
|
m_devConfigs.at(i)->m_name = name;
|
||||||
const MaemoDeviceConfig::Ptr shadowConfig = m_shadowDevConfigs.at(i);
|
|
||||||
if (shadowConfig)
|
|
||||||
shadowConfig->m_name = name;
|
|
||||||
const QModelIndex changedIndex = index(i, 0);
|
const QModelIndex changedIndex = index(i, 0);
|
||||||
emit dataChanged(changedIndex, changedIndex);
|
emit dataChanged(changedIndex, changedIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaemoDeviceConfigurations::setDeviceType(int i,
|
|
||||||
const MaemoDeviceConfig::DeviceType type)
|
|
||||||
{
|
|
||||||
Q_ASSERT(i >= 0 && i < rowCount());
|
|
||||||
MaemoDeviceConfig::Ptr ¤t = m_devConfigs[i];
|
|
||||||
if (current->type() == type)
|
|
||||||
return;
|
|
||||||
setupShadowDevConf(i);
|
|
||||||
std::swap(current, m_shadowDevConfigs[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MaemoDeviceConfigurations::setSshParameters(int i,
|
void MaemoDeviceConfigurations::setSshParameters(int i,
|
||||||
const Core::SshConnectionParameters ¶ms)
|
const Core::SshConnectionParameters ¶ms)
|
||||||
{
|
{
|
||||||
@@ -544,7 +538,6 @@ void MaemoDeviceConfigurations::load()
|
|||||||
}
|
}
|
||||||
settings->endArray();
|
settings->endArray();
|
||||||
settings->endGroup();
|
settings->endGroup();
|
||||||
initShadowDevConfs();
|
|
||||||
if (!hasDefault && !m_devConfigs.isEmpty())
|
if (!hasDefault && !m_devConfigs.isEmpty())
|
||||||
m_devConfigs.first()->m_isDefault = true;
|
m_devConfigs.first()->m_isDefault = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,6 +88,7 @@ public:
|
|||||||
static QString defaultPrivateKeyFilePath();
|
static QString defaultPrivateKeyFilePath();
|
||||||
static QString defaultUser(MaemoGlobal::MaemoVersion osVersion);
|
static QString defaultUser(MaemoGlobal::MaemoVersion osVersion);
|
||||||
static int defaultSshPort(DeviceType type);
|
static int defaultSshPort(DeviceType type);
|
||||||
|
static QString defaultQemuPassword(MaemoGlobal::MaemoVersion osVersion);
|
||||||
|
|
||||||
static const Id InvalidId;
|
static const Id InvalidId;
|
||||||
|
|
||||||
@@ -95,15 +96,19 @@ private:
|
|||||||
typedef QSharedPointer<MaemoDeviceConfig> Ptr;
|
typedef QSharedPointer<MaemoDeviceConfig> Ptr;
|
||||||
|
|
||||||
MaemoDeviceConfig(const QString &name, MaemoGlobal::MaemoVersion osVersion,
|
MaemoDeviceConfig(const QString &name, MaemoGlobal::MaemoVersion osVersion,
|
||||||
DeviceType type, Id &nextId);
|
DeviceType type, const Core::SshConnectionParameters &sshParams,
|
||||||
|
Id &nextId);
|
||||||
MaemoDeviceConfig(const QSettings &settings, Id &nextId);
|
MaemoDeviceConfig(const QSettings &settings, Id &nextId);
|
||||||
MaemoDeviceConfig(const ConstPtr &other);
|
MaemoDeviceConfig(const ConstPtr &other);
|
||||||
|
|
||||||
MaemoDeviceConfig(const MaemoDeviceConfig &);
|
MaemoDeviceConfig(const MaemoDeviceConfig &);
|
||||||
MaemoDeviceConfig &operator=(const MaemoDeviceConfig &);
|
MaemoDeviceConfig &operator=(const MaemoDeviceConfig &);
|
||||||
|
|
||||||
static Ptr create(const QString &name, MaemoGlobal::MaemoVersion osVersion,
|
static Ptr createHardwareConfig(const QString &name,
|
||||||
DeviceType type, Id &nextId);
|
MaemoGlobal::MaemoVersion osVersion, const QString &hostName,
|
||||||
|
const QString privateKeyFilePath, Id &nextId);
|
||||||
|
static Ptr createEmulatorConfig(const QString &name,
|
||||||
|
MaemoGlobal::MaemoVersion osVersion, Id &nextId);
|
||||||
static Ptr create(const QSettings &settings, Id &nextId);
|
static Ptr create(const QSettings &settings, Id &nextId);
|
||||||
static Ptr create(const ConstPtr &other);
|
static Ptr create(const ConstPtr &other);
|
||||||
|
|
||||||
@@ -140,12 +145,13 @@ public:
|
|||||||
void setDefaultSshKeyFilePath(const QString &path) { m_defaultSshKeyFilePath = path; }
|
void setDefaultSshKeyFilePath(const QString &path) { m_defaultSshKeyFilePath = path; }
|
||||||
QString defaultSshKeyFilePath() const { return m_defaultSshKeyFilePath; }
|
QString defaultSshKeyFilePath() const { return m_defaultSshKeyFilePath; }
|
||||||
|
|
||||||
void addConfiguration(const QString &name,
|
void addHardwareDeviceConfiguration(const QString &name,
|
||||||
MaemoGlobal::MaemoVersion osVersion,
|
MaemoGlobal::MaemoVersion osVersion, const QString &hostName,
|
||||||
MaemoDeviceConfig::DeviceType type);
|
const QString privateKeyFilePath);
|
||||||
|
void addEmulatorDeviceConfiguration(const QString &name,
|
||||||
|
MaemoGlobal::MaemoVersion osVersion);
|
||||||
void removeConfiguration(int index);
|
void removeConfiguration(int index);
|
||||||
void setConfigurationName(int i, const QString &name);
|
void setConfigurationName(int i, const QString &name);
|
||||||
void setDeviceType(int i, const MaemoDeviceConfig::DeviceType type);
|
|
||||||
void setSshParameters(int i, const Core::SshConnectionParameters ¶ms);
|
void setSshParameters(int i, const Core::SshConnectionParameters ¶ms);
|
||||||
void setPortsSpec(int i, const QString &portsSpec);
|
void setPortsSpec(int i, const QString &portsSpec);
|
||||||
void setDefaultDevice(int index);
|
void setDefaultDevice(int index);
|
||||||
@@ -161,15 +167,13 @@ private:
|
|||||||
MaemoDeviceConfigurations(QObject *parent);
|
MaemoDeviceConfigurations(QObject *parent);
|
||||||
void load();
|
void load();
|
||||||
void save();
|
void save();
|
||||||
void initShadowDevConfs();
|
|
||||||
static void copy(const MaemoDeviceConfigurations *source,
|
static void copy(const MaemoDeviceConfigurations *source,
|
||||||
MaemoDeviceConfigurations *target, bool deep);
|
MaemoDeviceConfigurations *target, bool deep);
|
||||||
void setupShadowDevConf(int index);
|
void addConfiguration(const MaemoDeviceConfig::Ptr &devConfig);
|
||||||
|
|
||||||
static MaemoDeviceConfigurations *m_instance;
|
static MaemoDeviceConfigurations *m_instance;
|
||||||
MaemoDeviceConfig::Id m_nextId;
|
MaemoDeviceConfig::Id m_nextId;
|
||||||
QList<MaemoDeviceConfig::Ptr> m_devConfigs;
|
QList<MaemoDeviceConfig::Ptr> m_devConfigs;
|
||||||
QList<MaemoDeviceConfig::Ptr> m_shadowDevConfigs;
|
|
||||||
QString m_defaultSshKeyFilePath;
|
QString m_defaultSshKeyFilePath;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,7 @@
|
|||||||
#include "ui_maemodeviceconfigurationssettingswidget.h"
|
#include "ui_maemodeviceconfigurationssettingswidget.h"
|
||||||
|
|
||||||
#include "maemoconfigtestdialog.h"
|
#include "maemoconfigtestdialog.h"
|
||||||
|
#include "maemodeviceconfigwizard.h"
|
||||||
#include "maemodeviceconfigurations.h"
|
#include "maemodeviceconfigurations.h"
|
||||||
#include "maemokeydeployer.h"
|
#include "maemokeydeployer.h"
|
||||||
#include "maemoremoteprocessesdialog.h"
|
#include "maemoremoteprocessesdialog.h"
|
||||||
@@ -175,21 +176,13 @@ void MaemoDeviceConfigurationsSettingsWidget::initGui()
|
|||||||
|
|
||||||
void MaemoDeviceConfigurationsSettingsWidget::addConfig()
|
void MaemoDeviceConfigurationsSettingsWidget::addConfig()
|
||||||
{
|
{
|
||||||
const QString prefix = tr("New Device Configuration %1", "Standard "
|
MaemoDeviceConfigWizard wizard(m_devConfigs.data(), this);
|
||||||
"Configuration name with number");
|
if (wizard.exec() == QDialog::Accepted) {
|
||||||
int suffix = 1;
|
wizard.createDeviceConfig();
|
||||||
QString newName;
|
m_ui->removeConfigButton->setEnabled(true);
|
||||||
bool isUnique = false;
|
m_ui->configurationComboBox->setCurrentIndex(m_ui->configurationComboBox->count()-1);
|
||||||
do {
|
testConfig();
|
||||||
newName = prefix.arg(QString::number(suffix++));
|
}
|
||||||
isUnique = !m_devConfigs->hasConfig(newName);
|
|
||||||
} while (!isUnique);
|
|
||||||
|
|
||||||
m_devConfigs->addConfiguration(newName, MaemoGlobal::Maemo5,
|
|
||||||
MaemoDeviceConfig::Physical);
|
|
||||||
m_ui->removeConfigButton->setEnabled(true);
|
|
||||||
m_ui->configurationComboBox->setCurrentIndex(m_ui->configurationComboBox->count()-1);
|
|
||||||
m_ui->configurationComboBox->setFocus();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaemoDeviceConfigurationsSettingsWidget::deleteConfig()
|
void MaemoDeviceConfigurationsSettingsWidget::deleteConfig()
|
||||||
@@ -269,7 +262,7 @@ void MaemoDeviceConfigurationsSettingsWidget::deviceTypeChanged()
|
|||||||
const MaemoDeviceConfig::DeviceType devType
|
const MaemoDeviceConfig::DeviceType devType
|
||||||
= m_ui->deviceButton->isChecked()
|
= m_ui->deviceButton->isChecked()
|
||||||
? MaemoDeviceConfig::Physical : MaemoDeviceConfig::Simulator;
|
? MaemoDeviceConfig::Physical : MaemoDeviceConfig::Simulator;
|
||||||
m_devConfigs->setDeviceType(currentIndex(), devType);
|
//m_devConfigs->setDeviceType(currentIndex(), devType);
|
||||||
fillInValues();
|
fillInValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -469,8 +469,10 @@ public:
|
|||||||
|
|
||||||
struct MaemoDeviceConfigWizardPrivate
|
struct MaemoDeviceConfigWizardPrivate
|
||||||
{
|
{
|
||||||
MaemoDeviceConfigWizardPrivate(QWidget *parent)
|
MaemoDeviceConfigWizardPrivate(MaemoDeviceConfigurations *devConfigs,
|
||||||
: startPage(parent),
|
QWidget *parent)
|
||||||
|
: devConfigs(devConfigs),
|
||||||
|
startPage(parent),
|
||||||
previousKeySetupPage(parent),
|
previousKeySetupPage(parent),
|
||||||
reuseKeysCheckPage(parent),
|
reuseKeysCheckPage(parent),
|
||||||
keyCreationPage(parent),
|
keyCreationPage(parent),
|
||||||
@@ -480,6 +482,7 @@ struct MaemoDeviceConfigWizardPrivate
|
|||||||
}
|
}
|
||||||
|
|
||||||
WizardData wizardData;
|
WizardData wizardData;
|
||||||
|
MaemoDeviceConfigurations * const devConfigs;
|
||||||
MaemoDeviceConfigWizardStartPage startPage;
|
MaemoDeviceConfigWizardStartPage startPage;
|
||||||
MaemoDeviceConfigWizardPreviousKeySetupCheckPage previousKeySetupPage;
|
MaemoDeviceConfigWizardPreviousKeySetupCheckPage previousKeySetupPage;
|
||||||
MaemoDeviceConfigWizardReuseKeysCheckPage reuseKeysCheckPage;
|
MaemoDeviceConfigWizardReuseKeysCheckPage reuseKeysCheckPage;
|
||||||
@@ -489,8 +492,10 @@ struct MaemoDeviceConfigWizardPrivate
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
MaemoDeviceConfigWizard::MaemoDeviceConfigWizard(QWidget *parent) :
|
MaemoDeviceConfigWizard::MaemoDeviceConfigWizard(MaemoDeviceConfigurations *devConfigs,
|
||||||
QWizard(parent), d(new MaemoDeviceConfigWizardPrivate(this))
|
QWidget *parent)
|
||||||
|
: QWizard(parent),
|
||||||
|
d(new MaemoDeviceConfigWizardPrivate(devConfigs, this))
|
||||||
{
|
{
|
||||||
setWindowTitle(tr("New Device Configuration Setup"));
|
setWindowTitle(tr("New Device Configuration Setup"));
|
||||||
setPage(StartPageId, &d->startPage);
|
setPage(StartPageId, &d->startPage);
|
||||||
@@ -504,6 +509,27 @@ MaemoDeviceConfigWizard::MaemoDeviceConfigWizard(QWidget *parent) :
|
|||||||
|
|
||||||
MaemoDeviceConfigWizard::~MaemoDeviceConfigWizard() {}
|
MaemoDeviceConfigWizard::~MaemoDeviceConfigWizard() {}
|
||||||
|
|
||||||
|
void MaemoDeviceConfigWizard::createDeviceConfig()
|
||||||
|
{
|
||||||
|
QString name = d->wizardData.configName;
|
||||||
|
if (d->devConfigs->hasConfig(name)) {
|
||||||
|
const QString nameTemplate = name + QLatin1String(" (%1)");
|
||||||
|
int suffix = 2;
|
||||||
|
do
|
||||||
|
name = nameTemplate.arg(QString::number(suffix++));
|
||||||
|
while (d->devConfigs->hasConfig(name));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (d->wizardData.deviceType == MaemoDeviceConfig::Physical) {
|
||||||
|
d->devConfigs->addHardwareDeviceConfiguration(name,
|
||||||
|
d->wizardData.maemoVersion, d->wizardData.hostName,
|
||||||
|
d->wizardData.privateKeyFilePath);
|
||||||
|
} else {
|
||||||
|
d->devConfigs->addEmulatorDeviceConfiguration(name,
|
||||||
|
d->wizardData.maemoVersion);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int MaemoDeviceConfigWizard::nextId() const
|
int MaemoDeviceConfigWizard::nextId() const
|
||||||
{
|
{
|
||||||
switch (currentId()) {
|
switch (currentId()) {
|
||||||
@@ -516,7 +542,6 @@ int MaemoDeviceConfigWizard::nextId() const
|
|||||||
d->wizardData.hostName = d->startPage.hostName();
|
d->wizardData.hostName = d->startPage.hostName();
|
||||||
|
|
||||||
if (d->wizardData.deviceType == MaemoDeviceConfig::Simulator) {
|
if (d->wizardData.deviceType == MaemoDeviceConfig::Simulator) {
|
||||||
// TODO: insert default MADDE key file paths
|
|
||||||
return FinalPageId;
|
return FinalPageId;
|
||||||
} else {
|
} else {
|
||||||
return PreviousKeySetupCheckPageId;
|
return PreviousKeySetupCheckPageId;
|
||||||
@@ -545,7 +570,9 @@ int MaemoDeviceConfigWizard::nextId() const
|
|||||||
d->wizardData.publicKeyFilePath
|
d->wizardData.publicKeyFilePath
|
||||||
= d->keyCreationPage.publicKeyFilePath();
|
= d->keyCreationPage.publicKeyFilePath();
|
||||||
return KeyDeploymentPageId;
|
return KeyDeploymentPageId;
|
||||||
case KeyDeploymentPageId: return FinalPageId;
|
case KeyDeploymentPageId:
|
||||||
|
d->wizardData.hostName = d->keyDeploymentPage.hostAddress();
|
||||||
|
return FinalPageId;
|
||||||
case FinalPageId: return -1;
|
case FinalPageId: return -1;
|
||||||
default:
|
default:
|
||||||
Q_ASSERT(false);
|
Q_ASSERT(false);
|
||||||
|
|||||||
@@ -35,21 +35,22 @@
|
|||||||
#define MAEMODEVICECONFIGWIZARD_H
|
#define MAEMODEVICECONFIGWIZARD_H
|
||||||
|
|
||||||
#include <QtCore/QScopedPointer>
|
#include <QtCore/QScopedPointer>
|
||||||
#include <QtCore/QSharedPointer>
|
|
||||||
#include <QtGui/QWizard>
|
#include <QtGui/QWizard>
|
||||||
|
|
||||||
namespace Qt4ProjectManager {
|
namespace Qt4ProjectManager {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
class MaemoDeviceConfig;
|
class MaemoDeviceConfig;
|
||||||
|
class MaemoDeviceConfigurations;
|
||||||
struct MaemoDeviceConfigWizardPrivate;
|
struct MaemoDeviceConfigWizardPrivate;
|
||||||
|
|
||||||
class MaemoDeviceConfigWizard : public QWizard
|
class MaemoDeviceConfigWizard : public QWizard
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit MaemoDeviceConfigWizard(QWidget *parent = 0);
|
explicit MaemoDeviceConfigWizard(MaemoDeviceConfigurations *devConfigs,
|
||||||
|
QWidget *parent = 0);
|
||||||
~MaemoDeviceConfigWizard();
|
~MaemoDeviceConfigWizard();
|
||||||
QSharedPointer<MaemoDeviceConfig> deviceConfig() const;
|
void createDeviceConfig();
|
||||||
virtual int nextId() const;
|
virtual int nextId() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
Reference in New Issue
Block a user