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,
|
||||
const QStringList &needToCreate, const QStringList &needToUpdate)
|
||||
const QString &buildDirectory, CMakeOpenProjectWizard::Mode mode)
|
||||
: m_cmakeManager(cmakeManager),
|
||||
m_sourceDirectory(sourceDirectory),
|
||||
m_creatingCbpFiles(true)
|
||||
{
|
||||
foreach(const QString &buildDirectory, needToCreate)
|
||||
if (mode == CMakeOpenProjectWizard::NeedToCreate)
|
||||
addPage(new CMakeRunPage(this, CMakeRunPage::Recreate, buildDirectory));
|
||||
foreach(const QString &buildDirectory, needToUpdate)
|
||||
else
|
||||
addPage(new CMakeRunPage(this, CMakeRunPage::Update, buildDirectory));
|
||||
setOption(QWizard::NoCancelButton);
|
||||
setOption(QWizard::NoBackButtonOnStartPage);
|
||||
|
||||
@@ -59,10 +59,16 @@ public:
|
||||
CMakeRunPageId
|
||||
};
|
||||
|
||||
enum Mode {
|
||||
Nothing,
|
||||
NeedToCreate,
|
||||
NeedToUpdate
|
||||
};
|
||||
|
||||
// used at importing a project without a .user file
|
||||
CMakeOpenProjectWizard(CMakeManager *cmakeManager, const QString &sourceDirectory);
|
||||
// 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
|
||||
CMakeOpenProjectWizard(CMakeManager *cmakeManager, const QString &sourceDirectory, const QString &oldBuildDirectory);
|
||||
|
||||
|
||||
@@ -95,13 +95,16 @@ void CMakeProject::slotActiveBuildConfiguration()
|
||||
|
||||
QString cbpFile = CMakeManager::findCbpFile(QDir(buildDirectory(activeBuildConfiguration())));
|
||||
QFileInfo cbpFileFi(cbpFile);
|
||||
CMakeOpenProjectWizard::Mode mode;
|
||||
if (!cbpFileFi.exists())
|
||||
needToCreate << buildDirectory(activeBuildConfiguration());
|
||||
mode = CMakeOpenProjectWizard::NeedToCreate;
|
||||
else if (cbpFileFi.lastModified() < sourceFileInfo.lastModified())
|
||||
needToUpdate << buildDirectory(activeBuildConfiguration());
|
||||
mode = CMakeOpenProjectWizard::NeedToUpdate;
|
||||
else
|
||||
mode = CMakeOpenProjectWizard::Nothing;
|
||||
|
||||
if (!needToCreate.isEmpty() || !needToUpdate.isEmpty()) {
|
||||
CMakeOpenProjectWizard copw(m_manager, sourceFileInfo.absolutePath(), needToCreate, needToUpdate);
|
||||
if (mode != CMakeOpenProjectWizard::Nothing) {
|
||||
CMakeOpenProjectWizard copw(m_manager, sourceFileInfo.absolutePath(), buildDirectory(activeBuildConfiguration()), mode);
|
||||
copw.exec();
|
||||
}
|
||||
// reparse
|
||||
@@ -570,13 +573,15 @@ void CMakeProject::restoreSettingsImpl(ProjectExplorer::PersistentSettingsReader
|
||||
QStringList needToUpdate;
|
||||
QString cbpFile = CMakeManager::findCbpFile(QDir(buildDirectory(activeBuildConfiguration())));
|
||||
QFileInfo cbpFileFi(cbpFile);
|
||||
if (!cbpFileFi.exists())
|
||||
needToCreate << buildDirectory(activeBuildConfiguration());
|
||||
else if (cbpFileFi.lastModified() < sourceFileInfo.lastModified())
|
||||
needToUpdate << buildDirectory(activeBuildConfiguration());
|
||||
|
||||
if (!needToCreate.isEmpty() || !needToUpdate.isEmpty()) {
|
||||
CMakeOpenProjectWizard copw(m_manager, sourceFileInfo.absolutePath(), needToCreate, needToUpdate);
|
||||
CMakeOpenProjectWizard::Mode mode = CMakeOpenProjectWizard::Nothing;
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user