Commit 14a79dad authored by dt's avatar dt
Browse files

Simplfy API of CMakeOpenProjectWizard remove some left over QStringList

We don't call it with a list anymore, so make it just a QString
parent 0bda19a0
......@@ -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);
CMakeOpenProjectWizard::Mode mode = CMakeOpenProjectWizard::Nothing;
if (!cbpFileFi.exists())
needToCreate << buildDirectory(activeBuildConfiguration());
mode = CMakeOpenProjectWizard::NeedToCreate;
else if (cbpFileFi.lastModified() < sourceFileInfo.lastModified())
needToUpdate << buildDirectory(activeBuildConfiguration());
mode = CMakeOpenProjectWizard::NeedToUpdate;
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();
}
}
......
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