Commit 48b2fa52 authored by Tobias Hunger's avatar Tobias Hunger
Browse files

Gcc: Improve config widget

Change-Id: Id26ed4c1712ae93c70efb7f23ef00684ead9ca0a
Reviewed-on: http://codereview.qt.nokia.com/405

Reviewed-by: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarTobias Hunger <tobias.hunger@nokia.com>
parent 405a1629
......@@ -159,21 +159,24 @@ void AbiWidget::setAbis(const QList<Abi> &abiList, const Abi &current)
}
if (d->m_abi->currentIndex() == 0) {
d->m_abi->setCurrentIndex(0);
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;
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;
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;
}
}
}
}
......
......@@ -606,12 +606,11 @@ Internal::GccToolChainConfigWidget::GccToolChainConfigWidget(GccToolChain *tc) :
connect(m_compilerPath, SIGNAL(changed(QString)), this, SLOT(handlePathChange()));
layout->addRow(tr("&Compiler path:"), m_compilerPath);
layout->addRow(tr("&ABI:"), m_abiWidget);
m_abiWidget->setEnabled(false);
addDebuggerCommandControls(layout, gnuVersionArgs);
addErrorLabel(layout);
populateAbiList(tc->supportedAbis(), tc->targetAbi());
connect(m_abiWidget, SIGNAL(abiChanged()), this, SLOT(handleAbiChange()));
setFromToolchain();
......@@ -635,19 +634,14 @@ void Internal::GccToolChainConfigWidget::apply()
m_autoDebuggerCommand = QLatin1String("<manually set>");
}
void Internal::GccToolChainConfigWidget::populateAbiList(const QList<Abi> &list, const Abi &current)
{
m_abiWidget->setAbis(list, current);
handleAbiChange();
}
void Internal::GccToolChainConfigWidget::setFromToolchain()
{
blockSignals(true);
GccToolChain *tc = static_cast<GccToolChain *>(toolChain());
Q_ASSERT(tc);
m_compilerPath->setPath(tc->compilerPath());
m_abiWidget->setAbis(tc->supportedAbis(), tc->targetAbi());
setDebuggerCommand(tc->debuggerCommand());
populateAbiList(tc->supportedAbis(), tc->targetAbi());
blockSignals(false);
}
bool Internal::GccToolChainConfigWidget::isDirty() const
......@@ -669,10 +663,17 @@ void Internal::GccToolChainConfigWidget::handlePathChange()
{
QString path = m_compilerPath->path();
QList<Abi> abiList;
if (QFileInfo(path).isExecutable())
bool haveCompiler = false;
if (!path.isEmpty()) {
QFileInfo fi(path);
haveCompiler = fi.isExecutable() && fi.isFile();
}
if (haveCompiler)
abiList = guessGccAbi(path, Utils::Environment::systemEnvironment().toStringList());
populateAbiList(abiList, m_abiWidget->currentAbi());
emit dirty(toolChain());
m_abiWidget->setEnabled(haveCompiler);
Abi currentAbi = m_abiWidget->currentAbi();
m_abiWidget->setAbis(abiList, abiList.contains(currentAbi) ? currentAbi : Abi());
handleAbiChange();
}
void Internal::GccToolChainConfigWidget::handleAbiChange()
......
......@@ -98,7 +98,6 @@ private slots:
void handleAbiChange();
private:
void populateAbiList(const QList<Abi> &supported, const Abi &current);
void setFromToolchain();
Utils::PathChooser *m_compilerPath;
......
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