diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CMakeVersion.cmake | 2 | ||||
-rw-r--r-- | Source/QtDialog/AddCacheEntry.cxx | 38 | ||||
-rw-r--r-- | Source/QtDialog/AddCacheEntry.h | 11 | ||||
-rw-r--r-- | Source/QtDialog/CMakeSetupDialog.cxx | 26 | ||||
-rw-r--r-- | Source/QtDialog/CMakeSetupDialog.h | 3 | ||||
-rw-r--r-- | Source/cmGlobalNinjaGenerator.cxx | 30 |
6 files changed, 67 insertions, 43 deletions
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index d79ac73..14b0789 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -2,5 +2,5 @@ set(CMake_VERSION_MAJOR 2) set(CMake_VERSION_MINOR 8) set(CMake_VERSION_PATCH 12) -set(CMake_VERSION_TWEAK 20140115) +set(CMake_VERSION_TWEAK 20140116) #set(CMake_VERSION_RC 1) diff --git a/Source/QtDialog/AddCacheEntry.cxx b/Source/QtDialog/AddCacheEntry.cxx index e7fedc5..3881045 100644 --- a/Source/QtDialog/AddCacheEntry.cxx +++ b/Source/QtDialog/AddCacheEntry.cxx @@ -15,14 +15,16 @@ #include <QCompleter> static const int NumTypes = 4; +static const int DefaultTypeIndex = 0; static const QByteArray TypeStrings[NumTypes] = { "BOOL", "PATH", "FILEPATH", "STRING" }; static const QCMakeProperty::PropertyType Types[NumTypes] = { QCMakeProperty::BOOL, QCMakeProperty::PATH, QCMakeProperty::FILEPATH, QCMakeProperty::STRING}; -AddCacheEntry::AddCacheEntry(QWidget* p, const QStringList& completions) - : QWidget(p) +AddCacheEntry::AddCacheEntry(QWidget* p, const QStringList& varNames, + const QStringList& varTypes) + : QWidget(p), VarNames(varNames), VarTypes(varTypes) { this->setupUi(this); for(int i=0; i<NumTypes; i++) @@ -43,7 +45,10 @@ AddCacheEntry::AddCacheEntry(QWidget* p, const QStringList& completions) this->setTabOrder(path, filepath); this->setTabOrder(filepath, string); this->setTabOrder(string, this->Description); - this->Name->setCompleter(new QCompleter(completions, this)); + QCompleter *completer = new QCompleter(this->VarNames, this); + this->Name->setCompleter(completer); + connect(completer, SIGNAL(activated(const QString&)), + this, SLOT(onCompletionActivated(const QString&))); } QString AddCacheEntry::name() const @@ -77,7 +82,32 @@ QCMakeProperty::PropertyType AddCacheEntry::type() const { return Types[idx]; } - return QCMakeProperty::BOOL; + return Types[DefaultTypeIndex]; } +QString AddCacheEntry::typeString() const +{ + int idx = this->Type->currentIndex(); + if(idx >= 0 && idx < NumTypes) + { + return TypeStrings[idx]; + } + return TypeStrings[DefaultTypeIndex]; +} +void AddCacheEntry::onCompletionActivated(const QString &text) +{ + int idx = this->VarNames.indexOf(text); + if (idx != -1) + { + QString vartype = this->VarTypes[idx]; + for (int i = 0; i < NumTypes; i++) + { + if (TypeStrings[i] == vartype) + { + this->Type->setCurrentIndex(i); + break; + } + } + } +} diff --git a/Source/QtDialog/AddCacheEntry.h b/Source/QtDialog/AddCacheEntry.h index e219d4e..38c3a74 100644 --- a/Source/QtDialog/AddCacheEntry.h +++ b/Source/QtDialog/AddCacheEntry.h @@ -24,12 +24,21 @@ class AddCacheEntry : public QWidget, public Ui::AddCacheEntry { Q_OBJECT public: - AddCacheEntry(QWidget* p, const QStringList& completions); + AddCacheEntry(QWidget* p, const QStringList& varNames, + const QStringList& varTypes); QString name() const; QVariant value() const; QString description() const; QCMakeProperty::PropertyType type() const; + QString typeString() const; + +private slots: + void onCompletionActivated(const QString &text); + +private: + const QStringList& VarNames; + const QStringList& VarTypes; }; #endif diff --git a/Source/QtDialog/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx index 1903c02..f62afd6 100644 --- a/Source/QtDialog/CMakeSetupDialog.cxx +++ b/Source/QtDialog/CMakeSetupDialog.cxx @@ -70,8 +70,10 @@ CMakeSetupDialog::CMakeSetupDialog() restoreGeometry(settings.value("geometry").toByteArray()); restoreState(settings.value("windowState").toByteArray()); - this->AddVariableCompletions = settings.value("AddVariableCompletionEntries", + this->AddVariableNames = settings.value("AddVariableNames", QStringList("CMAKE_INSTALL_PREFIX")).toStringList(); + this->AddVariableTypes = settings.value("AddVariableTypes", + QStringList("PATH")).toStringList(); QWidget* cont = new QWidget(this); this->setupUi(cont); @@ -1049,7 +1051,8 @@ void CMakeSetupDialog::addCacheEntry() dialog.resize(400, 200); dialog.setWindowTitle(tr("Add Cache Entry")); QVBoxLayout* l = new QVBoxLayout(&dialog); - AddCacheEntry* w = new AddCacheEntry(&dialog, this->AddVariableCompletions); + AddCacheEntry* w = new AddCacheEntry(&dialog, this->AddVariableNames, + this->AddVariableTypes); QDialogButtonBox* btns = new QDialogButtonBox( QDialogButtonBox::Ok | QDialogButtonBox::Cancel, Qt::Horizontal, &dialog); @@ -1064,23 +1067,26 @@ void CMakeSetupDialog::addCacheEntry() m->insertProperty(w->type(), w->name(), w->description(), w->value(), false); // only add variable names to the completion which are new - if (!this->AddVariableCompletions.contains(w->name())) + if (!this->AddVariableNames.contains(w->name())) { - this->AddVariableCompletions << w->name(); + this->AddVariableNames << w->name(); + this->AddVariableTypes << w->typeString(); // limit to at most 100 completion items - if (this->AddVariableCompletions.size() > 100) + if (this->AddVariableNames.size() > 100) { - this->AddVariableCompletions.removeFirst(); + this->AddVariableNames.removeFirst(); + this->AddVariableTypes.removeFirst(); } // make sure CMAKE_INSTALL_PREFIX is always there - if (!this->AddVariableCompletions.contains("CMAKE_INSTALL_PREFIX")) + if (!this->AddVariableNames.contains("CMAKE_INSTALL_PREFIX")) { - this->AddVariableCompletions << QString("CMAKE_INSTALL_PREFIX"); + this->AddVariableNames << "CMAKE_INSTALL_PREFIX"; + this->AddVariableTypes << "PATH"; } QSettings settings; settings.beginGroup("Settings/StartPath"); - settings.setValue("AddVariableCompletionEntries", - this->AddVariableCompletions); + settings.setValue("AddVariableNames", this->AddVariableNames); + settings.setValue("AddVariableTypes", this->AddVariableTypes); } } } diff --git a/Source/QtDialog/CMakeSetupDialog.h b/Source/QtDialog/CMakeSetupDialog.h index 963c7d1..1b26c64 100644 --- a/Source/QtDialog/CMakeSetupDialog.h +++ b/Source/QtDialog/CMakeSetupDialog.h @@ -110,7 +110,8 @@ protected: QTextCharFormat ErrorFormat; QTextCharFormat MessageFormat; - QStringList AddVariableCompletions; + QStringList AddVariableNames; + QStringList AddVariableTypes; QStringList FindHistory; QEventLoop LocalLoop; diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 65b01db..5e1f1ed 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -1107,46 +1107,24 @@ void cmGlobalNinjaGenerator::WriteTargetRebuildManifest(std::ostream& os) /*deptype=*/ "", /*rspfile=*/ "", /*rspcontent*/ "", - /*restat=*/ true, + /*restat=*/ false, /*generator=*/ true); - cmNinjaDeps implicitDeps, outputs, temp; - outputs.push_back(NINJA_BUILD_FILE); + cmNinjaDeps implicitDeps; for (std::vector<cmLocalGenerator *>::const_iterator i = this->LocalGenerators.begin(); i != this->LocalGenerators.end(); ++i) { const std::vector<std::string>& lf = (*i)->GetMakefile()->GetListFiles(); implicitDeps.insert(implicitDeps.end(), lf.begin(), lf.end()); - - const std::vector<std::string>& of = (*i)->GetMakefile()->GetOutputFiles(); - temp.insert(temp.end(), of.begin(), of.end()); } - - //Add the CMakeCache.txt file to the implicit depends so that we catch - //when somebody manually modifies the file. - implicitDeps.push_back("CMakeCache.txt"); - - //make sure nothing is in implicit depends twice std::sort(implicitDeps.begin(), implicitDeps.end()); implicitDeps.erase(std::unique(implicitDeps.begin(), implicitDeps.end()), implicitDeps.end()); - - - //make sure nothing is in outputs depends twice - std::sort(temp.begin(), temp.end()); - temp.erase(std::unique(temp.begin(), temp.end()), - temp.end()); - - //make sure that anything that is in implicitDeps is also NOT in outputs - std::set_difference(temp.begin(), - temp.end(), - implicitDeps.begin(), - implicitDeps.end(), - std::back_inserter(outputs)); + implicitDeps.push_back("CMakeCache.txt"); this->WriteBuild(os, "Re-run CMake if any of its inputs changed.", "RERUN_CMAKE", - outputs, + /*outputs=*/ cmNinjaDeps(1, NINJA_BUILD_FILE), /*explicitDeps=*/ cmNinjaDeps(), implicitDeps, /*orderOnlyDeps=*/ cmNinjaDeps(), |