Preferences: Add default implementation for filtering

The default "matches" method now takes the widget and looks for all
child labels, checkboxes, push buttons and group boxes.
Because of that, the former "createWidget" method
can be called multiple times without creating a new widget
(-->widget()), and the "finished" method must ensure that the created
widget gets deleted, since not all widgets that were created are added
to the UI anymore.

Change-Id: Ia231c7c78dd8819146668e6447d36d22e7836904
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
Eike Ziller
2013-12-03 14:17:03 +01:00
parent ea1a92484a
commit deb43b4c8a
118 changed files with 1093 additions and 1731 deletions

View File

@@ -291,22 +291,23 @@ QString CMakeSettingsPage::findCmakeExecutable() const
return Utils::Environment::systemEnvironment().searchInPath(QLatin1String("cmake"));
}
QWidget *CMakeSettingsPage::createPage(QWidget *parent)
QWidget *CMakeSettingsPage::widget()
{
QWidget *outerWidget = new QWidget(parent);
QFormLayout *formLayout = new QFormLayout(outerWidget);
formLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
m_pathchooser = new Utils::PathChooser;
m_pathchooser->setExpectedKind(Utils::PathChooser::ExistingCommand);
formLayout->addRow(tr("Executable:"), m_pathchooser);
formLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Ignored, QSizePolicy::MinimumExpanding));
if (!m_widget) {
m_widget = new QWidget;
QFormLayout *formLayout = new QFormLayout(m_widget);
formLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow);
m_pathchooser = new Utils::PathChooser;
m_pathchooser->setExpectedKind(Utils::PathChooser::ExistingCommand);
formLayout->addRow(tr("Executable:"), m_pathchooser);
formLayout->addItem(new QSpacerItem(0, 0, QSizePolicy::Ignored, QSizePolicy::MinimumExpanding));
m_preferNinja = new QCheckBox(tr("Prefer Ninja generator (CMake 2.8.9 or higher required)"));
formLayout->addRow(m_preferNinja);
}
m_pathchooser->setPath(m_cmakeValidatorForUser.cmakeExecutable());
m_preferNinja = new QCheckBox(tr("Prefer Ninja generator (CMake 2.8.9 or higher required)"));
m_preferNinja->setChecked(preferNinja());
formLayout->addRow(m_preferNinja);
return outerWidget;
return m_widget;
}
void CMakeSettingsPage::saveSettings() const
@@ -329,7 +330,7 @@ void CMakeSettingsPage::apply()
void CMakeSettingsPage::finish()
{
delete m_widget;
}
QString CMakeSettingsPage::cmakeExecutable() const