forked from qt-creator/qt-creator
Some steps towards making qmakestep and makestep not mandotary.
Also fix a small bug with the import label.
This commit is contained in:
@@ -116,7 +116,7 @@ bool QMakeStep::init(const QString &name)
|
|||||||
if (QDir(workingDirectory).exists(QLatin1String("Makefile"))) {
|
if (QDir(workingDirectory).exists(QLatin1String("Makefile"))) {
|
||||||
QString qtPath = QtVersionManager::findQtVersionFromMakefile(workingDirectory);
|
QString qtPath = QtVersionManager::findQtVersionFromMakefile(workingDirectory);
|
||||||
if (qtVersion->path() == qtPath) {
|
if (qtVersion->path() == qtPath) {
|
||||||
needToRunQMake = m_pro->compareBuildConfigurationToImportFrom(name, workingDirectory);
|
needToRunQMake = !m_pro->compareBuildConfigurationToImportFrom(name, workingDirectory);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -724,7 +724,7 @@ void Qt4Project::addDefaultBuild()
|
|||||||
// Migrate settings
|
// Migrate settings
|
||||||
QMakeStep *qs = qmakeStep();
|
QMakeStep *qs = qmakeStep();
|
||||||
foreach (const QString &buildConfiguration, buildConfigurations()) {
|
foreach (const QString &buildConfiguration, buildConfigurations()) {
|
||||||
QVariant v = qs->value(buildConfiguration, "buildConfiguration");
|
QVariant v = qs ? qs->value(buildConfiguration, "buildConfiguration") : QVariant();
|
||||||
if (v.isValid()) {
|
if (v.isValid()) {
|
||||||
qs->setValue(buildConfiguration, "buildConfiguration", QVariant());
|
qs->setValue(buildConfiguration, "buildConfiguration", QVariant());
|
||||||
setValue(buildConfiguration, "buildConfiguration", v);
|
setValue(buildConfiguration, "buildConfiguration", v);
|
||||||
@@ -736,6 +736,7 @@ void Qt4Project::addDefaultBuild()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Restoring configuration
|
// Restoring configuration
|
||||||
foreach(const QString &bc, buildConfigurations()) {
|
foreach(const QString &bc, buildConfigurations()) {
|
||||||
setValue(bc, "addQDumper", QVariant());
|
setValue(bc, "addQDumper", QVariant());
|
||||||
@@ -1137,9 +1138,11 @@ QString Qt4Project::extractSpecFromArgumentList(const QStringList &list)
|
|||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// returns true if both are equal
|
||||||
bool Qt4Project::compareBuildConfigurationToImportFrom(const QString &buildConfiguration, const QString &workingDirectory)
|
bool Qt4Project::compareBuildConfigurationToImportFrom(const QString &buildConfiguration, const QString &workingDirectory)
|
||||||
{
|
{
|
||||||
if (QDir(workingDirectory).exists(QLatin1String("Makefile"))) {
|
QMakeStep *qs = qmakeStep();
|
||||||
|
if (QDir(workingDirectory).exists(QLatin1String("Makefile")) && qs) {
|
||||||
QString qtPath = QtVersionManager::findQtVersionFromMakefile(workingDirectory);
|
QString qtPath = QtVersionManager::findQtVersionFromMakefile(workingDirectory);
|
||||||
QtVersion *version = qtVersion(buildConfiguration);
|
QtVersion *version = qtVersion(buildConfiguration);
|
||||||
if (version->path() == qtPath) {
|
if (version->path() == qtPath) {
|
||||||
@@ -1151,7 +1154,7 @@ bool Qt4Project::compareBuildConfigurationToImportFrom(const QString &buildConfi
|
|||||||
// now compare arguments lists
|
// now compare arguments lists
|
||||||
// we have to compare without the spec/platform cmd argument
|
// we have to compare without the spec/platform cmd argument
|
||||||
// and compare that on its own
|
// and compare that on its own
|
||||||
QString actualSpec = extractSpecFromArgumentList(qmakeStep()->value(buildConfiguration, "qmakeArgs").toStringList());
|
QString actualSpec = extractSpecFromArgumentList(qs->value(buildConfiguration, "qmakeArgs").toStringList());
|
||||||
if (actualSpec.isEmpty())
|
if (actualSpec.isEmpty())
|
||||||
actualSpec = version->mkspec();
|
actualSpec = version->mkspec();
|
||||||
QString parsedSpec = extractSpecFromArgumentList(result.second);
|
QString parsedSpec = extractSpecFromArgumentList(result.second);
|
||||||
@@ -1176,7 +1179,7 @@ bool Qt4Project::compareBuildConfigurationToImportFrom(const QString &buildConfi
|
|||||||
if (QFileInfo(parsedSpec).isRelative())
|
if (QFileInfo(parsedSpec).isRelative())
|
||||||
parsedSpec = QDir::cleanPath(workingDirectory + "/" + parsedSpec);
|
parsedSpec = QDir::cleanPath(workingDirectory + "/" + parsedSpec);
|
||||||
|
|
||||||
QStringList actualArgs = removeSpecFromArgumentList(qmakeStep()->value(buildConfiguration, "qmakeArgs").toStringList());
|
QStringList actualArgs = removeSpecFromArgumentList(qs->value(buildConfiguration, "qmakeArgs").toStringList());
|
||||||
QStringList parsedArgs = removeSpecFromArgumentList(result.second);
|
QStringList parsedArgs = removeSpecFromArgumentList(result.second);
|
||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
@@ -1190,11 +1193,11 @@ bool Qt4Project::compareBuildConfigurationToImportFrom(const QString &buildConfi
|
|||||||
qDebug()<<"Parsed spec:"<<parsedSpec;
|
qDebug()<<"Parsed spec:"<<parsedSpec;
|
||||||
|
|
||||||
if (actualArgs == parsedArgs && actualSpec == parsedSpec)
|
if (actualArgs == parsedArgs && actualSpec == parsedSpec)
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -201,16 +201,23 @@ void Qt4ProjectConfigWidget::updateImportLabel()
|
|||||||
{
|
{
|
||||||
bool visible = false;
|
bool visible = false;
|
||||||
|
|
||||||
QString qtPath = QtVersionManager::findQtVersionFromMakefile(m_pro->buildDirectory(m_buildConfiguration));
|
// we only show if we actually have a qmake and makestep
|
||||||
QtVersion *version = m_pro->qtVersion(m_buildConfiguration);
|
if (m_pro->qmakeStep() && m_pro->makeStep()) {
|
||||||
if (!qtPath.isEmpty()) {
|
QString qtPath = QtVersionManager::findQtVersionFromMakefile(m_pro->buildDirectory(m_buildConfiguration));
|
||||||
if (qtPath != (version ? version->path() : QString())) {
|
QtVersion *version = m_pro->qtVersion(m_buildConfiguration);
|
||||||
visible = true;
|
// check that there's a makefile
|
||||||
|
if (!qtPath.isEmpty()) {
|
||||||
|
// and that the makefile path is different from the current version
|
||||||
|
if (qtPath != (version ? version->path() : QString())) {
|
||||||
|
// import enable
|
||||||
|
visible = true;
|
||||||
|
} else {
|
||||||
|
// check that the qmake flags, arguments match
|
||||||
|
visible = !m_pro->compareBuildConfigurationToImportFrom(m_buildConfiguration, m_pro->buildDirectory(m_buildConfiguration));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
visible = !m_pro->compareBuildConfigurationToImportFrom(m_buildConfiguration, m_pro->buildDirectory(m_buildConfiguration));
|
visible = false;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
visible = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_ui->importLabel->setVisible(visible);
|
m_ui->importLabel->setVisible(visible);
|
||||||
@@ -231,6 +238,8 @@ void Qt4ProjectConfigWidget::shadowBuildLineEditTextChanged()
|
|||||||
|
|
||||||
void Qt4ProjectConfigWidget::importLabelClicked()
|
void Qt4ProjectConfigWidget::importLabelClicked()
|
||||||
{
|
{
|
||||||
|
if (!m_pro->qmakeStep() || !m_pro->makeStep())
|
||||||
|
return;
|
||||||
QString directory = m_pro->buildDirectory(m_buildConfiguration);
|
QString directory = m_pro->buildDirectory(m_buildConfiguration);
|
||||||
if (!directory.isEmpty()) {
|
if (!directory.isEmpty()) {
|
||||||
QString qtPath = QtVersionManager::findQtVersionFromMakefile(directory);
|
QString qtPath = QtVersionManager::findQtVersionFromMakefile(directory);
|
||||||
|
Reference in New Issue
Block a user