Commit 12e4f2b2 authored by Thorbjørn Lindeijer's avatar Thorbjørn Lindeijer

Some code simplification in CompletionSettingsPage

parent b7fe1e79
......@@ -42,10 +42,15 @@ using namespace CppTools::Internal;
CompletionSettingsPage::CompletionSettingsPage(CppCodeCompletion *completion)
: m_completion(completion)
, m_page(0)
, m_page(new Ui_CompletionSettingsPage)
{
}
CompletionSettingsPage::~CompletionSettingsPage()
{
delete m_page;
}
QString CompletionSettingsPage::name() const
{
return tr("Completion");
......@@ -63,7 +68,6 @@ QString CompletionSettingsPage::trCategory() const
QWidget *CompletionSettingsPage::createPage(QWidget *parent)
{
m_page = new Ui_CompletionSettingsPage;
QWidget *w = new QWidget(parent);
m_page->setupUi(w);
......@@ -76,13 +80,11 @@ QWidget *CompletionSettingsPage::createPage(QWidget *parent)
void CompletionSettingsPage::finished(bool accepted)
{
if (accepted) {
m_completion->setCaseSensitivity(
m_page->caseSensitive->isChecked() ? Qt::CaseSensitive : Qt::CaseInsensitive);
m_completion->setAutoInsertBraces(m_page->autoInsertBraces->isChecked());
m_completion->setPartialCompletionEnabled(m_page->partiallyComplete->isChecked());
}
if (!accepted)
return;
delete m_page;
m_page = 0;
m_completion->setCaseSensitivity(
m_page->caseSensitive->isChecked() ? Qt::CaseSensitive : Qt::CaseInsensitive);
m_completion->setAutoInsertBraces(m_page->autoInsertBraces->isChecked());
m_completion->setPartialCompletionEnabled(m_page->partiallyComplete->isChecked());
}
......@@ -49,6 +49,7 @@ class CompletionSettingsPage : public Core::IOptionsPage
{
public:
CompletionSettingsPage(CppCodeCompletion *completion);
~CompletionSettingsPage();
QString name() const;
QString category() const;
......
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