diff options
author | Robert Dailey <rcdailey@gmail.com> | 2015-02-15 19:17:54 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-11-17 15:03:10 (GMT) |
commit | 2b958a20275c1c73aee745c29ecf4d2de1377f7b (patch) | |
tree | f5acc4711da7ed70f28a65bcc84ef1af71dcda6c /Source/QtDialog/FirstConfigure.cxx | |
parent | 30b0db7bb5482258ccdb96d2f0b7aadb5d3b23ac (diff) | |
download | CMake-2b958a20275c1c73aee745c29ecf4d2de1377f7b.zip CMake-2b958a20275c1c73aee745c29ecf4d2de1377f7b.tar.gz CMake-2b958a20275c1c73aee745c29ecf4d2de1377f7b.tar.bz2 |
cmake-gui: Add option to specify generator toolset
The -T parameter to CMake may now be specified through cmake-gui via a
new text field in the first-time configure wizard (below the generator
chooser).
The generator factories specify whether or not they support toolsets.
This information is propagated to the Qt code and used to determine if
the selected generator should also display the optional Toolset widgets.
Diffstat (limited to 'Source/QtDialog/FirstConfigure.cxx')
-rw-r--r-- | Source/QtDialog/FirstConfigure.cxx | 70 |
1 files changed, 66 insertions, 4 deletions
diff --git a/Source/QtDialog/FirstConfigure.cxx b/Source/QtDialog/FirstConfigure.cxx index 6de9f00..61aad72 100644 --- a/Source/QtDialog/FirstConfigure.cxx +++ b/Source/QtDialog/FirstConfigure.cxx @@ -15,6 +15,11 @@ StartCompilerSetup::StartCompilerSetup(QWidget* p) l->addWidget(new QLabel(tr("Specify the generator for this project"))); this->GeneratorOptions = new QComboBox(this); l->addWidget(this->GeneratorOptions); + + // Add the ability to specify toolset (-T parameter) + ToolsetFrame = CreateToolsetWidgets(); + l->addWidget(ToolsetFrame); + l->addSpacing(6); this->CompilerSetupOptions[0] = new QRadioButton(tr("Use default native compilers"), this); @@ -36,17 +41,51 @@ StartCompilerSetup::StartCompilerSetup(QWidget* p) this, SLOT(onSelectionChanged(bool))); QObject::connect(this->CompilerSetupOptions[3], SIGNAL(toggled(bool)), this, SLOT(onSelectionChanged(bool))); + QObject::connect(GeneratorOptions, + SIGNAL(currentIndexChanged(QString const&)), + this, SLOT(onGeneratorChanged(QString const&))); +} + +QFrame* StartCompilerSetup::CreateToolsetWidgets() +{ + QFrame* frame = new QFrame(this); + QVBoxLayout* l = new QVBoxLayout(frame); + l->setContentsMargins(0, 0, 0, 0); + + ToolsetLabel = new QLabel(tr("Optional toolset to use (-T parameter)")); + l->addWidget(ToolsetLabel); + + Toolset = new QLineEdit(frame); + l->addWidget(Toolset); + + return frame; } StartCompilerSetup::~StartCompilerSetup() { } -void StartCompilerSetup::setGenerators(const QStringList& gens) +void StartCompilerSetup::setGenerators( + std::vector<cmake::GeneratorInfo> const& gens) { this->GeneratorOptions->clear(); - this->GeneratorOptions->addItems(gens); -}; + + QStringList generator_list; + + std::vector<cmake::GeneratorInfo>::const_iterator it; + for (it = gens.begin(); it != gens.end(); ++it) + { + generator_list.append(QString::fromLocal8Bit(it->name.c_str())); + + if (it->supportsToolset) + { + this->GeneratorsSupportingToolset.append( + QString::fromLocal8Bit(it->name.c_str())); + } + } + + this->GeneratorOptions->addItems(generator_list); +} void StartCompilerSetup::setCurrentGenerator(const QString& gen) { @@ -62,6 +101,11 @@ QString StartCompilerSetup::getGenerator() const return this->GeneratorOptions->currentText(); }; +QString StartCompilerSetup::getToolset() const +{ + return this->Toolset->text(); +}; + bool StartCompilerSetup::defaultSetup() const { return this->CompilerSetupOptions[0]->isChecked(); @@ -88,6 +132,18 @@ void StartCompilerSetup::onSelectionChanged(bool on) selectionChanged(); } +void StartCompilerSetup::onGeneratorChanged(QString const& name) +{ + if (GeneratorsSupportingToolset.contains(name)) + { + ToolsetFrame->show(); + } + else + { + ToolsetFrame->hide(); + } +} + int StartCompilerSetup::nextId() const { if(compilerSetup()) @@ -325,7 +381,8 @@ FirstConfigure::~FirstConfigure() { } -void FirstConfigure::setGenerators(const QStringList& gens) +void FirstConfigure::setGenerators( + std::vector<cmake::GeneratorInfo> const& gens) { this->mStartCompilerSetupPage->setGenerators(gens); } @@ -335,6 +392,11 @@ QString FirstConfigure::getGenerator() const return this->mStartCompilerSetupPage->getGenerator(); } +QString FirstConfigure::getToolset() const +{ + return this->mStartCompilerSetupPage->getToolset(); +} + void FirstConfigure::loadFromSettings() { QSettings settings; |