forked from qt-creator/qt-creator
Maemo settings: Turn timeout field into a spinbox.
Also, the hint on milliseconds was wrong. The unit is seconds. As requested by Friedemann.
This commit is contained in:
@@ -62,26 +62,6 @@ bool configNameExists(const QList<MaemoDeviceConfig> &devConfs,
|
|||||||
DevConfNameMatcher(name)) != devConfs.constEnd();
|
DevConfNameMatcher(name)) != devConfs.constEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
class TimeoutValidator : public QIntValidator
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
TimeoutValidator() : QIntValidator(0, SHRT_MAX, 0)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void setValue(int oldValue) { m_oldValue = oldValue; }
|
|
||||||
|
|
||||||
virtual void fixup(QString &input) const
|
|
||||||
{
|
|
||||||
int dummy = 0;
|
|
||||||
if (validate(input, dummy) != Acceptable)
|
|
||||||
input = QString::number(m_oldValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
int m_oldValue;
|
|
||||||
};
|
|
||||||
|
|
||||||
class NameValidator : public QValidator
|
class NameValidator : public QValidator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -118,7 +98,6 @@ MaemoSettingsWidget::MaemoSettingsWidget(QWidget *parent)
|
|||||||
m_ui(new Ui_MaemoSettingsWidget),
|
m_ui(new Ui_MaemoSettingsWidget),
|
||||||
m_devConfs(MaemoDeviceConfigurations::instance().devConfigs()),
|
m_devConfs(MaemoDeviceConfigurations::instance().devConfigs()),
|
||||||
m_nameValidator(new NameValidator(m_devConfs)),
|
m_nameValidator(new NameValidator(m_devConfs)),
|
||||||
m_timeoutValidator(new TimeoutValidator),
|
|
||||||
m_keyDeployer(0)
|
m_keyDeployer(0)
|
||||||
{
|
{
|
||||||
initGui();
|
initGui();
|
||||||
@@ -148,7 +127,7 @@ QString MaemoSettingsWidget::searchKeywords() const
|
|||||||
<< ' ' << m_ui->passwordLabel->text()
|
<< ' ' << m_ui->passwordLabel->text()
|
||||||
<< ' ' << m_ui->portsLabel->text()
|
<< ' ' << m_ui->portsLabel->text()
|
||||||
<< ' ' << m_ui->pwdLineEdit->text()
|
<< ' ' << m_ui->pwdLineEdit->text()
|
||||||
<< ' ' << m_ui->timeoutLineEdit->text()
|
<< ' ' << m_ui->timeoutSpinBox->value()
|
||||||
<< ' ' << m_ui->userLineEdit->text()
|
<< ' ' << m_ui->userLineEdit->text()
|
||||||
<< ' ' << m_ui->userNameLabel->text();
|
<< ' ' << m_ui->userNameLabel->text();
|
||||||
rc.remove(QLatin1Char('&'));
|
rc.remove(QLatin1Char('&'));
|
||||||
@@ -159,7 +138,6 @@ void MaemoSettingsWidget::initGui()
|
|||||||
{
|
{
|
||||||
m_ui->setupUi(this);
|
m_ui->setupUi(this);
|
||||||
m_ui->nameLineEdit->setValidator(m_nameValidator);
|
m_ui->nameLineEdit->setValidator(m_nameValidator);
|
||||||
m_ui->timeoutLineEdit->setValidator(m_timeoutValidator);
|
|
||||||
m_ui->keyFileLineEdit->setExpectedKind(Utils::PathChooser::File);
|
m_ui->keyFileLineEdit->setExpectedKind(Utils::PathChooser::File);
|
||||||
|
|
||||||
foreach (const MaemoDeviceConfig &devConf, m_devConfs)
|
foreach (const MaemoDeviceConfig &devConf, m_devConfs)
|
||||||
@@ -223,7 +201,7 @@ void MaemoSettingsWidget::display(const MaemoDeviceConfig &devConfig)
|
|||||||
m_ui->keyButton->setChecked(true);
|
m_ui->keyButton->setChecked(true);
|
||||||
m_ui->detailsWidget->setEnabled(true);
|
m_ui->detailsWidget->setEnabled(true);
|
||||||
m_nameValidator->setDisplayName(devConfig.name);
|
m_nameValidator->setDisplayName(devConfig.name);
|
||||||
m_timeoutValidator->setValue(devConfig.timeout);
|
m_ui->timeoutSpinBox->setValue(devConfig.timeout);
|
||||||
fillInValues();
|
fillInValues();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -233,7 +211,7 @@ void MaemoSettingsWidget::fillInValues()
|
|||||||
m_ui->hostLineEdit->setText(currentConfig().host);
|
m_ui->hostLineEdit->setText(currentConfig().host);
|
||||||
m_ui->sshPortSpinBox->setValue(currentConfig().sshPort);
|
m_ui->sshPortSpinBox->setValue(currentConfig().sshPort);
|
||||||
m_ui->gdbServerPortSpinBox->setValue(currentConfig().gdbServerPort);
|
m_ui->gdbServerPortSpinBox->setValue(currentConfig().gdbServerPort);
|
||||||
m_ui->timeoutLineEdit->setText(QString::number(currentConfig().timeout));
|
m_ui->timeoutSpinBox->setValue(currentConfig().timeout);
|
||||||
m_ui->userLineEdit->setText(currentConfig().uname);
|
m_ui->userLineEdit->setText(currentConfig().uname);
|
||||||
m_ui->pwdLineEdit->setText(currentConfig().pwd);
|
m_ui->pwdLineEdit->setText(currentConfig().pwd);
|
||||||
m_ui->keyFileLineEdit->setPath(currentConfig().keyFile);
|
m_ui->keyFileLineEdit->setPath(currentConfig().keyFile);
|
||||||
@@ -317,17 +295,7 @@ void MaemoSettingsWidget::gdbServerPortEditingFinished()
|
|||||||
|
|
||||||
void MaemoSettingsWidget::timeoutEditingFinished()
|
void MaemoSettingsWidget::timeoutEditingFinished()
|
||||||
{
|
{
|
||||||
setTimeout(m_ui->timeoutLineEdit, currentConfig().timeout,
|
currentConfig().timeout = m_ui->timeoutSpinBox->value();
|
||||||
m_timeoutValidator);
|
|
||||||
}
|
|
||||||
|
|
||||||
void MaemoSettingsWidget::setTimeout(const QLineEdit *lineEdit,
|
|
||||||
int &confVal, TimeoutValidator *validator)
|
|
||||||
{
|
|
||||||
bool ok;
|
|
||||||
confVal = lineEdit->text().toInt(&ok);
|
|
||||||
Q_ASSERT(ok);
|
|
||||||
validator->setValue(confVal);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MaemoSettingsWidget::userNameEditingFinished()
|
void MaemoSettingsWidget::userNameEditingFinished()
|
||||||
@@ -461,7 +429,7 @@ void MaemoSettingsWidget::clearDetails()
|
|||||||
m_ui->hostLineEdit->clear();
|
m_ui->hostLineEdit->clear();
|
||||||
m_ui->sshPortSpinBox->clear();
|
m_ui->sshPortSpinBox->clear();
|
||||||
m_ui->gdbServerPortSpinBox->clear();
|
m_ui->gdbServerPortSpinBox->clear();
|
||||||
m_ui->timeoutLineEdit->clear();
|
m_ui->timeoutSpinBox->clear();
|
||||||
m_ui->userLineEdit->clear();
|
m_ui->userLineEdit->clear();
|
||||||
m_ui->pwdLineEdit->clear();
|
m_ui->pwdLineEdit->clear();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ namespace Internal {
|
|||||||
|
|
||||||
class MaemoSshRunner;
|
class MaemoSshRunner;
|
||||||
class NameValidator;
|
class NameValidator;
|
||||||
class TimeoutValidator;
|
|
||||||
|
|
||||||
class MaemoSettingsWidget : public QWidget
|
class MaemoSettingsWidget : public QWidget
|
||||||
{
|
{
|
||||||
@@ -95,8 +94,6 @@ private:
|
|||||||
void initGui();
|
void initGui();
|
||||||
void display(const MaemoDeviceConfig &devConfig);
|
void display(const MaemoDeviceConfig &devConfig);
|
||||||
MaemoDeviceConfig ¤tConfig();
|
MaemoDeviceConfig ¤tConfig();
|
||||||
void setTimeout(const QLineEdit *lineEdit, int &confVal,
|
|
||||||
TimeoutValidator *validator);
|
|
||||||
void clearDetails();
|
void clearDetails();
|
||||||
QString parseTestOutput();
|
QString parseTestOutput();
|
||||||
void fillInValues();
|
void fillInValues();
|
||||||
@@ -106,7 +103,6 @@ private:
|
|||||||
MaemoDeviceConfig m_lastConfigHW;
|
MaemoDeviceConfig m_lastConfigHW;
|
||||||
MaemoDeviceConfig m_lastConfigSim;
|
MaemoDeviceConfig m_lastConfigSim;
|
||||||
NameValidator * const m_nameValidator;
|
NameValidator * const m_nameValidator;
|
||||||
TimeoutValidator * const m_timeoutValidator;
|
|
||||||
MaemoSshRunner *m_keyDeployer;
|
MaemoSshRunner *m_keyDeployer;
|
||||||
QString m_publicKeyFileName;
|
QString m_publicKeyFileName;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>484</width>
|
<width>563</width>
|
||||||
<height>307</height>
|
<height>336</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
@@ -18,6 +18,9 @@
|
|||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QFormLayout" name="formLayout">
|
<layout class="QFormLayout" name="formLayout">
|
||||||
|
<property name="fieldGrowthPolicy">
|
||||||
|
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||||
|
</property>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="configurationLabel">
|
<widget class="QLabel" name="configurationLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -213,12 +216,38 @@
|
|||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="1">
|
<item row="5" column="1">
|
||||||
<widget class="QLineEdit" name="timeoutLineEdit">
|
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||||
<property name="placeholderText">
|
<item>
|
||||||
<string>Timeout value in milliseconds</string>
|
<widget class="QSpinBox" name="timeoutSpinBox">
|
||||||
|
<property name="suffix">
|
||||||
|
<string>s</string>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>10000</number>
|
||||||
|
</property>
|
||||||
|
<property name="singleStep">
|
||||||
|
<number>10</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>1000</number>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
<item row="6" column="0">
|
<item row="6" column="0">
|
||||||
<widget class="QLabel" name="userNameLabel">
|
<widget class="QLabel" name="userNameLabel">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -373,22 +402,6 @@
|
|||||||
</hint>
|
</hint>
|
||||||
</hints>
|
</hints>
|
||||||
</connection>
|
</connection>
|
||||||
<connection>
|
|
||||||
<sender>timeoutLineEdit</sender>
|
|
||||||
<signal>editingFinished()</signal>
|
|
||||||
<receiver>MaemoSettingsWidget</receiver>
|
|
||||||
<slot>timeoutEditingFinished()</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>335</x>
|
|
||||||
<y>202</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>425</x>
|
|
||||||
<y>187</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
<connection>
|
||||||
<sender>userLineEdit</sender>
|
<sender>userLineEdit</sender>
|
||||||
<signal>editingFinished()</signal>
|
<signal>editingFinished()</signal>
|
||||||
|
|||||||
Reference in New Issue
Block a user