Commit cc69195c authored by Tobias Hunger's avatar Tobias Hunger

Fix problemlabel from appearing wrongly

Fix problemlabel from appearing for people with heavily customized
build steps (e.g. those using qbs instead of qmake with a .pro-file
based project).

Change-Id: I5dcfff740270207b1ffa30cb083bd0e026801947
Reviewed-by: default avatarDaniel Teske <daniel.teske@digia.com>
Reviewed-by: default avatarTobias Hunger <tobias.hunger@digia.com>
parent 1c5c009b
...@@ -114,6 +114,13 @@ void Qt4ProjectConfigWidget::updateDetails() ...@@ -114,6 +114,13 @@ void Qt4ProjectConfigWidget::updateDetails()
.arg(QDir::toNativeSeparators(m_buildConfiguration->buildDirectory()))); .arg(QDir::toNativeSeparators(m_buildConfiguration->buildDirectory())));
} }
void Qt4ProjectConfigWidget::setProblemLabel(const QString &text)
{
m_ui->warningLabel->setVisible(!text.isEmpty());
m_ui->problemLabel->setVisible(!text.isEmpty());
m_ui->problemLabel->setText(text);
}
void Qt4ProjectConfigWidget::environmentChanged() void Qt4ProjectConfigWidget::environmentChanged()
{ {
m_ui->shadowBuildDirEdit->setEnvironment(m_buildConfiguration->environment()); m_ui->shadowBuildDirEdit->setEnvironment(m_buildConfiguration->environment());
...@@ -202,22 +209,20 @@ void Qt4ProjectConfigWidget::shadowBuildEdited() ...@@ -202,22 +209,20 @@ void Qt4ProjectConfigWidget::shadowBuildEdited()
void Qt4ProjectConfigWidget::updateProblemLabel() void Qt4ProjectConfigWidget::updateProblemLabel()
{ {
bool targetMismatch = false;
bool incompatibleBuild = false;
bool allGood = false;
ProjectExplorer::Kit *k = m_buildConfiguration->target()->kit(); ProjectExplorer::Kit *k = m_buildConfiguration->target()->kit();
const QString proFileName = m_buildConfiguration->target()->project()->document()->fileName(); const QString proFileName = m_buildConfiguration->target()->project()->document()->fileName();
// Check for Qt version:
QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(k); QtSupport::BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(k);
if (!version) { if (!version) {
m_ui->problemLabel->setVisible(true); setProblemLabel(tr("This target cannot build this project since it does not define a Qt version."));
m_ui->warningLabel->setVisible(true);
m_ui->problemLabel->setText(tr("This target cannot build this project since it does not define a "
"Qt version."));
return; return;
} }
bool targetMismatch = false;
bool incompatibleBuild = false;
bool allGood = false;
// we only show if we actually have a qmake and makestep // we only show if we actually have a qmake and makestep
if (m_buildConfiguration->qmakeStep() && m_buildConfiguration->makeStep()) { if (m_buildConfiguration->qmakeStep() && m_buildConfiguration->makeStep()) {
QString makefile = m_buildConfiguration->buildDirectory() + QLatin1Char('/'); QString makefile = m_buildConfiguration->buildDirectory() + QLatin1Char('/');
...@@ -244,7 +249,7 @@ void Qt4ProjectConfigWidget::updateProblemLabel() ...@@ -244,7 +249,7 @@ void Qt4ProjectConfigWidget::updateProblemLabel()
QString shadowBuildWarning; QString shadowBuildWarning;
if (!version->supportsShadowBuilds() && m_buildConfiguration->shadowBuild()) { if (!version->supportsShadowBuilds() && m_buildConfiguration->shadowBuild()) {
shadowBuildWarning =tr("The Qt version %1 does not support shadow builds, building might fail.") shadowBuildWarning = tr("The Qt version %1 does not support shadow builds, building might fail.")
.arg(version->displayName()) .arg(version->displayName())
+ QLatin1String("<br>"); + QLatin1String("<br>");
} }
...@@ -257,12 +262,7 @@ void Qt4ProjectConfigWidget::updateProblemLabel() ...@@ -257,12 +262,7 @@ void Qt4ProjectConfigWidget::updateProblemLabel()
issues = version->reportIssues(proFileName, buildDirectory); issues = version->reportIssues(proFileName, buildDirectory);
qSort(issues); qSort(issues);
if (issues.isEmpty() && shadowBuildWarning.isEmpty()) { if (!issues.isEmpty() || !shadowBuildWarning.isEmpty()) {
m_ui->problemLabel->setVisible(false);
m_ui->warningLabel->setVisible(false);
} else {
m_ui->problemLabel->setVisible(true);
m_ui->warningLabel->setVisible(true);
QString text = QLatin1String("<nobr>") + shadowBuildWarning; QString text = QLatin1String("<nobr>") + shadowBuildWarning;
foreach (const ProjectExplorer::Task &task, issues) { foreach (const ProjectExplorer::Task &task, issues) {
QString type; QString type;
...@@ -283,23 +283,23 @@ void Qt4ProjectConfigWidget::updateProblemLabel() ...@@ -283,23 +283,23 @@ void Qt4ProjectConfigWidget::updateProblemLabel()
text.append(QLatin1String("<br>")); text.append(QLatin1String("<br>"));
text.append(type + task.description); text.append(type + task.description);
} }
m_ui->problemLabel->setText(text); setProblemLabel(text);
return;
} }
} else if (targetMismatch) { } else if (targetMismatch) {
m_ui->problemLabel->setVisible(true); setProblemLabel(shadowBuildWarning + tr("A build for a different project exists in %1, which will be overwritten.",
m_ui->warningLabel->setVisible(true); "%1 build directory")
m_ui->problemLabel->setText(shadowBuildWarning + tr("A build for a different project exists in %1, which will be overwritten.", .arg(m_ui->shadowBuildDirEdit->path()));
"%1 build directory") return;
.arg(m_ui->shadowBuildDirEdit->path()));
} else if (incompatibleBuild) { } else if (incompatibleBuild) {
m_ui->warningLabel->setVisible(true); setProblemLabel(shadowBuildWarning +tr("An incompatible build exists in %1, which will be overwritten.",
m_ui->problemLabel->setVisible(true); "%1 build directory")
m_ui->problemLabel->setText(shadowBuildWarning +tr("An incompatible build exists in %1, which will be overwritten.", .arg(m_ui->shadowBuildDirEdit->path()));
"%1 build directory") return;
.arg(m_ui->shadowBuildDirEdit->path()));
} else if (!shadowBuildWarning.isEmpty()) { } else if (!shadowBuildWarning.isEmpty()) {
m_ui->warningLabel->setVisible(true); setProblemLabel(shadowBuildWarning);
m_ui->problemLabel->setVisible(true); return;
m_ui->problemLabel->setText(shadowBuildWarning);
} }
setProblemLabel(QString());
} }
...@@ -72,6 +72,7 @@ private slots: ...@@ -72,6 +72,7 @@ private slots:
private: private:
void updateDetails(); void updateDetails();
void setProblemLabel(const QString &text);
Ui::Qt4ProjectConfigWidget *m_ui; Ui::Qt4ProjectConfigWidget *m_ui;
QAbstractButton *m_browseButton; QAbstractButton *m_browseButton;
......
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