forked from qt-creator/qt-creator
Simplfy API of CMakeOpenProjectWizard remove some left over QStringList
We don't call it with a list anymore, so make it just a QString
This commit is contained in:
@@ -80,14 +80,14 @@ CMakeOpenProjectWizard::CMakeOpenProjectWizard(CMakeManager *cmakeManager, const
|
|||||||
}
|
}
|
||||||
|
|
||||||
CMakeOpenProjectWizard::CMakeOpenProjectWizard(CMakeManager *cmakeManager, const QString &sourceDirectory,
|
CMakeOpenProjectWizard::CMakeOpenProjectWizard(CMakeManager *cmakeManager, const QString &sourceDirectory,
|
||||||
const QStringList &needToCreate, const QStringList &needToUpdate)
|
const QString &buildDirectory, CMakeOpenProjectWizard::Mode mode)
|
||||||
: m_cmakeManager(cmakeManager),
|
: m_cmakeManager(cmakeManager),
|
||||||
m_sourceDirectory(sourceDirectory),
|
m_sourceDirectory(sourceDirectory),
|
||||||
m_creatingCbpFiles(true)
|
m_creatingCbpFiles(true)
|
||||||
{
|
{
|
||||||
foreach(const QString &buildDirectory, needToCreate)
|
if (mode == CMakeOpenProjectWizard::NeedToCreate)
|
||||||
addPage(new CMakeRunPage(this, CMakeRunPage::Recreate, buildDirectory));
|
addPage(new CMakeRunPage(this, CMakeRunPage::Recreate, buildDirectory));
|
||||||
foreach(const QString &buildDirectory, needToUpdate)
|
else
|
||||||
addPage(new CMakeRunPage(this, CMakeRunPage::Update, buildDirectory));
|
addPage(new CMakeRunPage(this, CMakeRunPage::Update, buildDirectory));
|
||||||
setOption(QWizard::NoCancelButton);
|
setOption(QWizard::NoCancelButton);
|
||||||
setOption(QWizard::NoBackButtonOnStartPage);
|
setOption(QWizard::NoBackButtonOnStartPage);
|
||||||
|
|||||||
@@ -59,10 +59,16 @@ public:
|
|||||||
CMakeRunPageId
|
CMakeRunPageId
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum Mode {
|
||||||
|
Nothing,
|
||||||
|
NeedToCreate,
|
||||||
|
NeedToUpdate
|
||||||
|
};
|
||||||
|
|
||||||
// used at importing a project without a .user file
|
// used at importing a project without a .user file
|
||||||
CMakeOpenProjectWizard(CMakeManager *cmakeManager, const QString &sourceDirectory);
|
CMakeOpenProjectWizard(CMakeManager *cmakeManager, const QString &sourceDirectory);
|
||||||
// used to update if we have already a .user file
|
// used to update if we have already a .user file
|
||||||
CMakeOpenProjectWizard(CMakeManager *cmakeManager, const QString &sourceDirectory, const QStringList &needToCreate, const QStringList &needToUpdate);
|
CMakeOpenProjectWizard(CMakeManager *cmakeManager, const QString &sourceDirectory, const QString &buildDirectory, Mode mode);
|
||||||
// used to change the build directory of one buildconfiguration
|
// used to change the build directory of one buildconfiguration
|
||||||
CMakeOpenProjectWizard(CMakeManager *cmakeManager, const QString &sourceDirectory, const QString &oldBuildDirectory);
|
CMakeOpenProjectWizard(CMakeManager *cmakeManager, const QString &sourceDirectory, const QString &oldBuildDirectory);
|
||||||
|
|
||||||
|
|||||||
@@ -95,13 +95,16 @@ void CMakeProject::slotActiveBuildConfiguration()
|
|||||||
|
|
||||||
QString cbpFile = CMakeManager::findCbpFile(QDir(buildDirectory(activeBuildConfiguration())));
|
QString cbpFile = CMakeManager::findCbpFile(QDir(buildDirectory(activeBuildConfiguration())));
|
||||||
QFileInfo cbpFileFi(cbpFile);
|
QFileInfo cbpFileFi(cbpFile);
|
||||||
|
CMakeOpenProjectWizard::Mode mode;
|
||||||
if (!cbpFileFi.exists())
|
if (!cbpFileFi.exists())
|
||||||
needToCreate << buildDirectory(activeBuildConfiguration());
|
mode = CMakeOpenProjectWizard::NeedToCreate;
|
||||||
else if (cbpFileFi.lastModified() < sourceFileInfo.lastModified())
|
else if (cbpFileFi.lastModified() < sourceFileInfo.lastModified())
|
||||||
needToUpdate << buildDirectory(activeBuildConfiguration());
|
mode = CMakeOpenProjectWizard::NeedToUpdate;
|
||||||
|
else
|
||||||
|
mode = CMakeOpenProjectWizard::Nothing;
|
||||||
|
|
||||||
if (!needToCreate.isEmpty() || !needToUpdate.isEmpty()) {
|
if (mode != CMakeOpenProjectWizard::Nothing) {
|
||||||
CMakeOpenProjectWizard copw(m_manager, sourceFileInfo.absolutePath(), needToCreate, needToUpdate);
|
CMakeOpenProjectWizard copw(m_manager, sourceFileInfo.absolutePath(), buildDirectory(activeBuildConfiguration()), mode);
|
||||||
copw.exec();
|
copw.exec();
|
||||||
}
|
}
|
||||||
// reparse
|
// reparse
|
||||||
@@ -570,13 +573,15 @@ void CMakeProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsReader
|
|||||||
QStringList needToUpdate;
|
QStringList needToUpdate;
|
||||||
QString cbpFile = CMakeManager::findCbpFile(QDir(buildDirectory(activeBuildConfiguration())));
|
QString cbpFile = CMakeManager::findCbpFile(QDir(buildDirectory(activeBuildConfiguration())));
|
||||||
QFileInfo cbpFileFi(cbpFile);
|
QFileInfo cbpFileFi(cbpFile);
|
||||||
if (!cbpFileFi.exists())
|
|
||||||
needToCreate << buildDirectory(activeBuildConfiguration());
|
|
||||||
else if (cbpFileFi.lastModified() < sourceFileInfo.lastModified())
|
|
||||||
needToUpdate << buildDirectory(activeBuildConfiguration());
|
|
||||||
|
|
||||||
if (!needToCreate.isEmpty() || !needToUpdate.isEmpty()) {
|
CMakeOpenProjectWizard::Mode mode = CMakeOpenProjectWizard::Nothing;
|
||||||
CMakeOpenProjectWizard copw(m_manager, sourceFileInfo.absolutePath(), needToCreate, needToUpdate);
|
if (!cbpFileFi.exists())
|
||||||
|
mode = CMakeOpenProjectWizard::NeedToCreate;
|
||||||
|
else if (cbpFileFi.lastModified() < sourceFileInfo.lastModified())
|
||||||
|
mode = CMakeOpenProjectWizard::NeedToUpdate;
|
||||||
|
|
||||||
|
if (mode != CMakeOpenProjectWizard::Nothing) {
|
||||||
|
CMakeOpenProjectWizard copw(m_manager, sourceFileInfo.absolutePath(), buildDirectory(activeBuildConfiguration()), mode);
|
||||||
copw.exec();
|
copw.exec();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user