forked from qt-creator/qt-creator
Maemo: Small settings fixes and improvements.
Reviewed-by: kh1
This commit is contained in:
@@ -74,6 +74,12 @@ namespace {
|
||||
const QString DefaultKeyFile =
|
||||
QDesktopServices::storageLocation(QDesktopServices::HomeLocation)
|
||||
+ QLatin1String("/.ssh/id_rsa");
|
||||
const int DefaultSshPort(22);
|
||||
const int DefaultGdbServerPort(10000);
|
||||
const QString DefaultUserName(QLatin1String("developer"));
|
||||
const MaemoDeviceConfig::AuthType DefaultAuthType(MaemoDeviceConfig::Key);
|
||||
const int DefaultTimeout(30);
|
||||
const MaemoDeviceConfig::DeviceType DefaultDeviceType(MaemoDeviceConfig::Physical);
|
||||
};
|
||||
|
||||
class DevConfIdMatcher
|
||||
@@ -90,12 +96,13 @@ private:
|
||||
|
||||
MaemoDeviceConfig::MaemoDeviceConfig(const QString &name)
|
||||
: name(name),
|
||||
type(Physical),
|
||||
sshPort(22),
|
||||
gdbServerPort(10000),
|
||||
authentication(Key),
|
||||
type(DefaultDeviceType),
|
||||
sshPort(DefaultSshPort),
|
||||
gdbServerPort(DefaultGdbServerPort),
|
||||
uname(DefaultUserName),
|
||||
authentication(DefaultAuthType),
|
||||
keyFile(DefaultKeyFile),
|
||||
timeout(30),
|
||||
timeout(DefaultTimeout),
|
||||
internalId(MaemoDeviceConfigurations::instance().m_nextId++)
|
||||
{
|
||||
}
|
||||
@@ -103,15 +110,15 @@ MaemoDeviceConfig::MaemoDeviceConfig(const QString &name)
|
||||
MaemoDeviceConfig::MaemoDeviceConfig(const QSettings &settings,
|
||||
quint64 &nextId)
|
||||
: name(settings.value(NameKey).toString()),
|
||||
type(static_cast<DeviceType>(settings.value(TypeKey, Physical).toInt())),
|
||||
type(static_cast<DeviceType>(settings.value(TypeKey, DefaultDeviceType).toInt())),
|
||||
host(settings.value(HostKey).toString()),
|
||||
sshPort(settings.value(SshPortKey, 22).toInt()),
|
||||
gdbServerPort(settings.value(GdbServerPortKey, 10000).toInt()),
|
||||
uname(settings.value(UserNameKey).toString()),
|
||||
authentication(static_cast<AuthType>(settings.value(AuthKey).toInt())),
|
||||
sshPort(settings.value(SshPortKey, DefaultSshPort).toInt()),
|
||||
gdbServerPort(settings.value(GdbServerPortKey, DefaultGdbServerPort).toInt()),
|
||||
uname(settings.value(UserNameKey, DefaultUserName).toString()),
|
||||
authentication(static_cast<AuthType>(settings.value(AuthKey, DefaultAuthType).toInt())),
|
||||
pwd(settings.value(PasswordKey).toString()),
|
||||
keyFile(settings.value(KeyFileKey).toString()),
|
||||
timeout(settings.value(TimeoutKey, 30).toInt()),
|
||||
keyFile(settings.value(KeyFileKey, DefaultKeyFile).toString()),
|
||||
timeout(settings.value(TimeoutKey, DefaultTimeout).toInt()),
|
||||
internalId(settings.value(InternalIdKey, nextId).toInt())
|
||||
{
|
||||
if (internalId == nextId)
|
||||
|
||||
@@ -196,24 +196,16 @@ void MaemoSettingsWidget::display(const MaemoDeviceConfig &devConfig)
|
||||
m_ui->deviceButton->setChecked(true);
|
||||
else
|
||||
m_ui->simulatorButton->setChecked(true);
|
||||
|
||||
if (devConfig.authentication == MaemoDeviceConfig::Password)
|
||||
m_ui->passwordButton->setChecked(true);
|
||||
else
|
||||
m_ui->keyButton->setChecked(true);
|
||||
m_ui->hostLineEdit->setText(devConfig.host);
|
||||
m_ui->sshPortLineEdit->setText(QString::number(devConfig.sshPort));
|
||||
m_ui->gdbServerPortLineEdit
|
||||
->setText(QString::number(devConfig.gdbServerPort));
|
||||
m_ui->timeoutLineEdit->setText(QString::number(devConfig.timeout));
|
||||
m_ui->userLineEdit->setText(devConfig.uname);
|
||||
m_ui->pwdLineEdit->setText(devConfig.pwd);
|
||||
m_ui->keyFileLineEdit->setPath(devConfig.keyFile);
|
||||
m_ui->detailsWidget->setEnabled(true);
|
||||
m_nameValidator->setDisplayName(devConfig.name);
|
||||
m_sshPortValidator->setValue(devConfig.sshPort);
|
||||
m_gdbServerPortValidator->setValue(devConfig.gdbServerPort);
|
||||
m_timeoutValidator->setValue(devConfig.timeout);
|
||||
m_ui->detailsWidget->setEnabled(true);
|
||||
}
|
||||
|
||||
void MaemoSettingsWidget::saveSettings()
|
||||
@@ -251,14 +243,25 @@ void MaemoSettingsWidget::deviceTypeChanged()
|
||||
// "information" file, to which we have no access here,
|
||||
// so we hard-code the last known values.
|
||||
if (currentConfig().type == MaemoDeviceConfig::Simulator) {
|
||||
currentConfig().host = QLatin1String("localhost");
|
||||
currentConfig().sshPort = 6666;
|
||||
currentConfig().gdbServerPort = 13219;
|
||||
m_ui->hostLineEdit->setReadOnly(true);
|
||||
m_ui->sshPortLineEdit->setReadOnly(true);
|
||||
m_ui->gdbServerPortLineEdit->setReadOnly(true);
|
||||
} else {
|
||||
m_ui->hostLineEdit->setReadOnly(false);
|
||||
m_ui->sshPortLineEdit->setReadOnly(false);
|
||||
m_ui->gdbServerPortLineEdit->setReadOnly(false);
|
||||
}
|
||||
m_ui->hostLineEdit->setText(currentConfig().host);
|
||||
m_ui->sshPortLineEdit->setText(QString::number(currentConfig().sshPort));
|
||||
m_ui->gdbServerPortLineEdit
|
||||
->setText(QString::number(currentConfig().gdbServerPort));
|
||||
m_ui->timeoutLineEdit->setText(QString::number(currentConfig().timeout));
|
||||
m_ui->userLineEdit->setText(currentConfig().uname);
|
||||
m_ui->pwdLineEdit->setText(currentConfig().pwd);
|
||||
m_ui->keyFileLineEdit->setPath(currentConfig().keyFile);
|
||||
}
|
||||
|
||||
void MaemoSettingsWidget::authenticationTypeChanged()
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>526</width>
|
||||
<height>487</height>
|
||||
<height>514</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -346,8 +346,8 @@ p, li { white-space: pre-wrap; }
|
||||
<slot>timeoutEditingFinished()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>385</x>
|
||||
<y>282</y>
|
||||
<x>396</x>
|
||||
<y>309</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>425</x>
|
||||
@@ -362,8 +362,8 @@ p, li { white-space: pre-wrap; }
|
||||
<slot>userNameEditingFinished()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>385</x>
|
||||
<y>309</y>
|
||||
<x>396</x>
|
||||
<y>336</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>422</x>
|
||||
@@ -378,8 +378,8 @@ p, li { white-space: pre-wrap; }
|
||||
<slot>passwordEditingFinished()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>385</x>
|
||||
<y>336</y>
|
||||
<x>396</x>
|
||||
<y>363</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>423</x>
|
||||
@@ -475,7 +475,7 @@ p, li { white-space: pre-wrap; }
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>150</x>
|
||||
<y>357</y>
|
||||
<y>384</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>257</x>
|
||||
@@ -491,7 +491,7 @@ p, li { white-space: pre-wrap; }
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>150</x>
|
||||
<y>357</y>
|
||||
<y>384</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>257</x>
|
||||
@@ -538,8 +538,8 @@ p, li { white-space: pre-wrap; }
|
||||
<slot>gdbServerPortEditingFinished()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>218</x>
|
||||
<y>255</y>
|
||||
<x>369</x>
|
||||
<y>282</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>427</x>
|
||||
@@ -547,6 +547,22 @@ p, li { white-space: pre-wrap; }
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>keyButton</sender>
|
||||
<signal>toggled(bool)</signal>
|
||||
<receiver>maemoSettingsWidget</receiver>
|
||||
<slot>authenticationTypeChanged()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>257</x>
|
||||
<y>189</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>525</x>
|
||||
<y>408</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
<slots>
|
||||
<slot>configNameEditingFinished()</slot>
|
||||
|
||||
Reference in New Issue
Block a user