Commit c4ba51ca authored by Tobias Hunger's avatar Tobias Hunger
Browse files

Abi: Abi widget shows nicer info

Fix the abi widget to not show unrelated abis on the disabled
custom abi comboboxes.

Task-number: QTCREATORBUG-5370
Change-Id: I22360be781159507999c845d2278eac1ef252174
Reviewed-on: http://codereview.qt.nokia.com/1407

Reviewed-by: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarTobias Hunger <tobias.hunger@nokia.com>
parent eca6ac02
......@@ -151,6 +151,7 @@ void AbiWidget::setAbis(const QList<Abi> &abiList, const Abi &current)
d->m_abi->addItem(tr("<custom>"), QLatin1String("custom"));
d->m_abi->setCurrentIndex(0);
for (int i = 0; i < abiList.count(); ++i) {
const QString abiString = abiList.at(i).toString();
d->m_abi->addItem(abiString, abiString);
......@@ -159,27 +160,12 @@ void AbiWidget::setAbis(const QList<Abi> &abiList, const Abi &current)
}
if (d->m_abi->currentIndex() == 0) {
if (!current.isValid() && !abiList.isEmpty()) {
if (!current.isValid() && !abiList.isEmpty())
d->m_abi->setCurrentIndex(1); // default to the first Abi if none is selected.
} else {
d->m_architectureComboBox->setCurrentIndex(static_cast<int>(current.architecture()));
d->m_osComboBox->setCurrentIndex(static_cast<int>(current.os()));
osChanged();
for (int i = 0; i < d->m_osFlavorComboBox->count(); ++i) {
if (d->m_osFlavorComboBox->itemData(i).toInt() == current.osFlavor()) {
d->m_osFlavorComboBox->setCurrentIndex(i);
break;
}
}
d->m_binaryFormatComboBox->setCurrentIndex(static_cast<int>(current.binaryFormat()));
for (int i = 0; i < d->m_wordWidthComboBox->count(); ++i) {
if (d->m_wordWidthComboBox->itemData(i).toInt() == current.wordWidth()) {
d->m_wordWidthComboBox->setCurrentIndex(i);
break;
}
}
}
else
setCustomAbi(current);
}
modeChanged();
blockSignals(false);
}
......@@ -218,6 +204,31 @@ void AbiWidget::modeChanged()
d->m_osFlavorComboBox->setEnabled(customMode);
d->m_binaryFormatComboBox->setEnabled(customMode);
d->m_wordWidthComboBox->setEnabled(customMode);
if (!customMode) {
Abi current(d->m_abi->itemData(d->m_abi->currentIndex()).toString());
setCustomAbi(current);
}
}
void AbiWidget::setCustomAbi(const Abi &current)
{
d->m_architectureComboBox->setCurrentIndex(static_cast<int>(current.architecture()));
d->m_osComboBox->setCurrentIndex(static_cast<int>(current.os()));
osChanged();
for (int i = 0; i < d->m_osFlavorComboBox->count(); ++i) {
if (d->m_osFlavorComboBox->itemData(i).toInt() == current.osFlavor()) {
d->m_osFlavorComboBox->setCurrentIndex(i);
break;
}
}
d->m_binaryFormatComboBox->setCurrentIndex(static_cast<int>(current.binaryFormat()));
for (int i = 0; i < d->m_wordWidthComboBox->count(); ++i) {
if (d->m_wordWidthComboBox->itemData(i).toInt() == current.wordWidth()) {
d->m_wordWidthComboBox->setCurrentIndex(i);
break;
}
}
}
} // namespace ProjectExplorer
......@@ -68,6 +68,8 @@ private slots:
void modeChanged();
private:
void setCustomAbi(const Abi &a);
Internal::AbiWidgetPrivate *const d;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment