forked from qt-creator/qt-creator
		
	Options dialog: Further polishing.
Task-number: QTCREATOR-26
This commit is contained in:
		@@ -34,6 +34,8 @@
 | 
			
		||||
#include <coreplugin/icore.h>
 | 
			
		||||
#include <extensionsystem/pluginmanager.h>
 | 
			
		||||
 | 
			
		||||
#include <QtCore/QTextStream>
 | 
			
		||||
 | 
			
		||||
using namespace CppTools::Internal;
 | 
			
		||||
 | 
			
		||||
CompletionSettingsPage::CompletionSettingsPage(CppCodeCompletion *completion)
 | 
			
		||||
@@ -75,7 +77,12 @@ QWidget *CompletionSettingsPage::createPage(QWidget *parent)
 | 
			
		||||
    m_page->caseSensitive->setChecked(m_completion->caseSensitivity() == Qt::CaseSensitive);
 | 
			
		||||
    m_page->autoInsertBrackets->setChecked(m_completion->autoInsertBrackets());
 | 
			
		||||
    m_page->partiallyComplete->setChecked(m_completion->isPartialCompletionEnabled());
 | 
			
		||||
 | 
			
		||||
    if (m_searchKeywords.isEmpty()) {
 | 
			
		||||
        QTextStream(&m_searchKeywords) << m_page->caseSensitive->text()
 | 
			
		||||
                << ' ' << m_page->autoInsertBrackets->text()
 | 
			
		||||
                << ' ' << m_page->partiallyComplete->text();
 | 
			
		||||
        m_searchKeywords.remove(QLatin1Char('&'));
 | 
			
		||||
    }
 | 
			
		||||
    return w;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -86,3 +93,8 @@ void CompletionSettingsPage::apply()
 | 
			
		||||
    m_completion->setAutoInsertBrackets(m_page->autoInsertBrackets->isChecked());
 | 
			
		||||
    m_completion->setPartialCompletionEnabled(m_page->partiallyComplete->isChecked());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool CompletionSettingsPage::matches(const QString &s) const
 | 
			
		||||
{
 | 
			
		||||
    return m_searchKeywords.contains(s, Qt::CaseInsensitive);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -57,10 +57,12 @@ public:
 | 
			
		||||
    QWidget *createPage(QWidget *parent);
 | 
			
		||||
    void apply();
 | 
			
		||||
    void finish() { }
 | 
			
		||||
    virtual bool matches(const QString &) const;
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    CppCodeCompletion *m_completion;
 | 
			
		||||
    Ui_CompletionSettingsPage *m_page;
 | 
			
		||||
    QString m_searchKeywords;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
} // namespace Internal
 | 
			
		||||
 
 | 
			
		||||
@@ -44,6 +44,7 @@
 | 
			
		||||
#include <QtCore/QCoreApplication>
 | 
			
		||||
#include <QtCore/QDate>
 | 
			
		||||
#include <QtCore/QLocale>
 | 
			
		||||
#include <QtCore/QTextStream>
 | 
			
		||||
 | 
			
		||||
#include <QtGui/QFileDialog>
 | 
			
		||||
#include <QtGui/QMessageBox>
 | 
			
		||||
@@ -237,6 +238,16 @@ CppFileSettings CppFileSettingsWidget::settings() const
 | 
			
		||||
    return rc;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
QString CppFileSettingsWidget::searchKeywords() const
 | 
			
		||||
{
 | 
			
		||||
    QString rc;
 | 
			
		||||
    QTextStream(&rc) << m_ui->headerSuffixLabel->text()
 | 
			
		||||
            << ' ' << m_ui->sourceSuffixLabel->text()
 | 
			
		||||
            << ' ' << m_ui->lowerCaseFileNamesCheckBox->text();
 | 
			
		||||
    rc.remove(QLatin1Char('&'));
 | 
			
		||||
    return rc;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static inline void setComboText(QComboBox *cb, const QString &text, int defaultIndex = 0)
 | 
			
		||||
{
 | 
			
		||||
    const int index = cb->findText(text);
 | 
			
		||||
@@ -312,6 +323,8 @@ QWidget *CppFileSettingsPage::createPage(QWidget *parent)
 | 
			
		||||
 | 
			
		||||
    m_widget = new CppFileSettingsWidget(parent);
 | 
			
		||||
    m_widget->setSettings(*m_settings);
 | 
			
		||||
    if (m_searchKeywords.isEmpty())
 | 
			
		||||
        m_searchKeywords = m_widget->searchKeywords();
 | 
			
		||||
    return m_widget;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -327,6 +340,11 @@ void CppFileSettingsPage::apply()
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool CppFileSettingsPage::matches(const QString &s) const
 | 
			
		||||
{
 | 
			
		||||
    return m_searchKeywords.contains(s, Qt::CaseInsensitive);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -77,6 +77,8 @@ public:
 | 
			
		||||
    CppFileSettings settings() const;
 | 
			
		||||
    void setSettings(const CppFileSettings &s);
 | 
			
		||||
 | 
			
		||||
    QString searchKeywords() const;
 | 
			
		||||
 | 
			
		||||
private slots:    
 | 
			
		||||
    void slotEdit();
 | 
			
		||||
 | 
			
		||||
@@ -103,10 +105,12 @@ public:
 | 
			
		||||
    virtual QWidget *createPage(QWidget *parent);
 | 
			
		||||
    virtual void apply();
 | 
			
		||||
    virtual void finish() { }
 | 
			
		||||
    virtual bool matches(const QString &) const;
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    const QSharedPointer<CppFileSettings> m_settings;
 | 
			
		||||
    QPointer<CppFileSettingsWidget> m_widget;
 | 
			
		||||
    QString m_searchKeywords;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
} // namespace Internal
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user