Update the qt version description on name change.

It was not updating to "has no name" when editing the version name.
This moves the construction of the description to QtVersion.
This commit is contained in:
con
2010-12-03 15:28:54 +01:00
parent 773343f396
commit 277d9be93a
3 changed files with 27 additions and 22 deletions

View File

@@ -561,8 +561,8 @@ void QtOptionsPageWidget::showEnvironmentPage(QTreeWidgetItem *item)
{
if (item) {
int index = indexForTreeItem(item);
m_ui->errorLabel->setText("");
if (index < 0) {
m_ui->errorLabel->setText("");
makeMSVCVisible(false);
makeMingwVisible(false);
makeS60Visible(false);
@@ -577,10 +577,6 @@ void QtOptionsPageWidget::showEnvironmentPage(QTreeWidgetItem *item)
makeMSVCVisible(false);
makeMingwVisible(false);
makeS60Visible(false);
if (!m_versions.at(index)->isValid())
m_ui->errorLabel->setText(m_versions.at(index)->invalidReason());
else
m_ui->errorLabel->setText(tr("This Qt Version has a unknown toolchain."));
} else if (types.contains(ProjectExplorer::ToolChain_MinGW)) {
makeMSVCVisible(false);
makeMingwVisible(true);
@@ -623,23 +619,7 @@ void QtOptionsPageWidget::showEnvironmentPage(QTreeWidgetItem *item)
makeS60Visible(false);
}
if (m_ui->errorLabel->text().isEmpty()) {
QString envs;
if (targets.contains(Constants::DESKTOP_TARGET_ID))
envs = tr("Desktop", "Qt Version is meant for the desktop");
else if (targets.contains(Constants::S60_DEVICE_TARGET_ID) ||
targets.contains(Constants::S60_EMULATOR_TARGET_ID))
envs = tr("Symbian", "Qt Version is meant for Symbian");
else if (targets.contains(Constants::MAEMO_DEVICE_TARGET_ID))
envs = tr("Maemo", "Qt Version is meant for Maemo");
else if (targets.contains(Constants::QT_SIMULATOR_TARGET_ID))
envs = tr("Qt Simulator", "Qt Version is meant for Qt Simulator");
else
envs = tr("unkown", "No idea what this Qt Version is meant for!");
m_ui->errorLabel->setText(tr("Found Qt version %1, using mkspec %2 (%3)")
.arg(m_versions.at(index)->qtVersionString(),
m_versions.at(index)->mkspec(), envs));
}
m_ui->errorLabel->setText(m_versions.at(index)->description());
} else {
makeMSVCVisible(false);
makeMingwVisible(false);
@@ -722,6 +702,7 @@ void QtOptionsPageWidget::updateCurrentQtName()
return;
m_versions[currentItemIndex]->setDisplayName(m_ui->nameEdit->text());
currentItem->setText(0, m_versions[currentItemIndex]->displayName());
m_ui->errorLabel->setText(m_versions.at(currentItemIndex)->description());
}

View File

@@ -1615,6 +1615,29 @@ QString QtVersion::invalidReason() const
return QString();
}
QString QtVersion::description() const
{
if (!isValid())
return invalidReason();
if (possibleToolChainTypes().isEmpty())
return QCoreApplication::translate("QtVersion", "This Qt Version has a unknown toolchain.");
QSet<QString> targets = supportedTargetIds();
QString envs;
if (targets.contains(Constants::DESKTOP_TARGET_ID))
envs = QCoreApplication::translate("QtVersion", "Desktop", "Qt Version is meant for the desktop");
else if (targets.contains(Constants::S60_DEVICE_TARGET_ID) ||
targets.contains(Constants::S60_EMULATOR_TARGET_ID))
envs = QCoreApplication::translate("QtVersion", "Symbian", "Qt Version is meant for Symbian");
else if (targets.contains(Constants::MAEMO_DEVICE_TARGET_ID))
envs = QCoreApplication::translate("QtVersion", "Maemo", "Qt Version is meant for Maemo");
else if (targets.contains(Constants::QT_SIMULATOR_TARGET_ID))
envs = QCoreApplication::translate("QtVersion", "Qt Simulator", "Qt Version is meant for Qt Simulator");
else
envs = QCoreApplication::translate("QtVersion", "unkown", "No idea what this Qt Version is meant for!");
return QCoreApplication::translate("QtVersion", "Qt version %1, using mkspec %2 (%3)")
.arg(qtVersionString(), mkspec(), envs);
}
QtVersion::QmakeBuildConfigs QtVersion::defaultBuildConfig() const
{
updateToolChainAndMkspec();

View File

@@ -71,6 +71,7 @@ public:
bool isValid() const; //TOOD check that the dir exists and the name is non empty
QString invalidReason() const;
QString description() const;
bool isAutodetected() const { return m_isAutodetected; }
QString autodetectionSource() const { return m_autodetectionSource; }