Cleanup: Remove searchKeywords from optionspage widgets

If no specialization is provided then the UI strings are searched.

So get rid of extra code collecting all those strings in a lot of
places.

Change-Id: Ibcb48a67e5c7b74e5960fe38b1cb2f74259b503a
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
Tobias Hunger
2014-04-30 12:56:36 +02:00
parent 8845683197
commit 7e47a8a453
17 changed files with 6 additions and 154 deletions

View File

@@ -65,20 +65,6 @@ ClangFormatOptionsPageWidget::~ClangFormatOptionsPageWidget()
delete ui;
}
QString ClangFormatOptionsPageWidget::searchKeywords() const
{
QString keywords;
const QLatin1Char sep(' ');
QTextStream(&keywords) << sep << ui->configuration->title()
<< sep << ui->commandLabel->text()
<< sep << ui->options->title()
<< sep << ui->usePredefinedStyle->text()
<< sep << ui->useCustomizedStyle->text()
<< sep << ui->formatEntireFileFallback->text();
keywords.remove(QLatin1Char('&'));
return keywords;
}
void ClangFormatOptionsPageWidget::restore()
{
ui->command->setPath(m_settings->command());
@@ -110,8 +96,7 @@ void ClangFormatOptionsPageWidget::apply()
ClangFormatOptionsPage::ClangFormatOptionsPage(ClangFormatSettings *settings, QObject *parent) :
IOptionsPage(parent),
m_widget(0),
m_settings(settings),
m_searchKeywords()
m_settings(settings)
{
setId(Constants::ClangFormat::OPTION_ID);
setDisplayName(tr("Clang Format"));
@@ -124,11 +109,8 @@ QWidget *ClangFormatOptionsPage::widget()
{
m_settings->read();
if (!m_widget) {
if (!m_widget)
m_widget = new ClangFormatOptionsPageWidget(m_settings);
if (m_searchKeywords.isEmpty())
m_searchKeywords = m_widget->searchKeywords();
}
m_widget->restore();
return m_widget;
@@ -144,11 +126,6 @@ void ClangFormatOptionsPage::finish()
{
}
bool ClangFormatOptionsPage::matches(const QString &searchKeyWord) const
{
return m_searchKeywords.contains(searchKeyWord, Qt::CaseInsensitive);
}
} // namespace ClangFormat
} // namespace Internal
} // namespace Beautifier