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: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
This commit is contained in:
Tobias Hunger
2011-07-11 09:38:16 +00:00
parent eca6ac029a
commit c4ba51ca36
2 changed files with 32 additions and 19 deletions

View File

@@ -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->addItem(tr("<custom>"), QLatin1String("custom"));
d->m_abi->setCurrentIndex(0); d->m_abi->setCurrentIndex(0);
for (int i = 0; i < abiList.count(); ++i) { for (int i = 0; i < abiList.count(); ++i) {
const QString abiString = abiList.at(i).toString(); const QString abiString = abiList.at(i).toString();
d->m_abi->addItem(abiString, abiString); 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 (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. d->m_abi->setCurrentIndex(1); // default to the first Abi if none is selected.
} else { else
d->m_architectureComboBox->setCurrentIndex(static_cast<int>(current.architecture())); setCustomAbi(current);
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;
}
}
}
} }
modeChanged();
blockSignals(false); blockSignals(false);
} }
@@ -218,6 +204,31 @@ void AbiWidget::modeChanged()
d->m_osFlavorComboBox->setEnabled(customMode); d->m_osFlavorComboBox->setEnabled(customMode);
d->m_binaryFormatComboBox->setEnabled(customMode); d->m_binaryFormatComboBox->setEnabled(customMode);
d->m_wordWidthComboBox->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 } // namespace ProjectExplorer

View File

@@ -68,6 +68,8 @@ private slots:
void modeChanged(); void modeChanged();
private: private:
void setCustomAbi(const Abi &a);
Internal::AbiWidgetPrivate *const d; Internal::AbiWidgetPrivate *const d;
}; };