summaryrefslogtreecommitdiff
path: root/src/plugins/cpptools/cppcodestylesettingspage.h
diff options
context:
space:
mode:
authorChristian Kamm <christian.d.kamm@nokia.com>2011-02-03 15:48:14 +0100
committerChristian Kamm <christian.d.kamm@nokia.com>2011-05-24 12:45:07 +0200
commit779fafcbfe6f92dd1288664fae512f69bc12418b (patch)
tree38a3b75cc3a18f386ab72102e97f06ffa24d4d29 /src/plugins/cpptools/cppcodestylesettingspage.h
parentf69eb52944a7fc8306cbb72b7325a610045dea7a (diff)
downloadqt-creator-779fafcbfe6f92dd1288664fae512f69bc12418b.tar.gz
Make C++ code style configurable.
Change-Id: Iaf08edb2361146e6b5e1cbafdb716a23c938875b Done-with: Jarek Kobus Task-number: QTCREATORBUG-2670 Task-number: QTCREATORBUG-4310 Task-number: QTCREATORBUG-2763 Task-number: QTCREATORBUG-3623 Task-number: QTCREATORBUG-567 Reviewed-on: http://codereview.qt.nokia.com/74 Reviewed-by: Leandro T. C. Melo <leandro.melo@nokia.com> Reviewed-by: Jarek Kobus <jaroslaw.kobus@nokia.com> Reviewed-by: Roberto Raggi <roberto.raggi@nokia.com>
Diffstat (limited to 'src/plugins/cpptools/cppcodestylesettingspage.h')
-rw-r--r--src/plugins/cpptools/cppcodestylesettingspage.h98
1 files changed, 98 insertions, 0 deletions
diff --git a/src/plugins/cpptools/cppcodestylesettingspage.h b/src/plugins/cpptools/cppcodestylesettingspage.h
new file mode 100644
index 0000000000..fd4e78bf85
--- /dev/null
+++ b/src/plugins/cpptools/cppcodestylesettingspage.h
@@ -0,0 +1,98 @@
+#ifndef CPPCODESTYLESETTINGSPAGE_H
+#define CPPCODESTYLESETTINGSPAGE_H
+
+#include "cpptools_global.h"
+
+#include <coreplugin/dialogs/ioptionspage.h>
+#include <QtGui/QWidget>
+#include <QtCore/QPointer>
+#include <QtCore/QSharedPointer>
+#include <QtCore/QVariant>
+#include <QtCore/QStringList>
+
+#include "cppcodestylesettings.h"
+#include "cppcodeformatter.h"
+
+QT_BEGIN_NAMESPACE
+namespace Ui {
+ class CppCodeStyleSettingsPage;
+}
+QT_END_NAMESPACE
+
+namespace TextEditor {
+ class FontSettings;
+ class TabSettings;
+ class TabPreferences;
+ class IFallbackPreferences;
+ class SnippetEditorWidget;
+}
+
+namespace CppTools {
+
+class CppCodeStylePreferences;
+
+namespace Internal {
+
+class CppCodeStylePreferencesWidget : public QWidget
+{
+ Q_OBJECT
+public:
+ explicit CppCodeStylePreferencesWidget(QWidget *parent = 0);
+ virtual ~CppCodeStylePreferencesWidget();
+
+ void setTabPreferences(TextEditor::TabPreferences *tabPreferences);
+ void setCppCodeStylePreferences(CppTools::CppCodeStylePreferences *codeStylePreferences);
+
+ QString searchKeywords() const;
+
+private slots:
+ void setFontSettings(const TextEditor::FontSettings &fontSettings);
+ void setVisualizeWhitespace(bool on);
+ void slotCppCodeStyleSettingsChanged();
+ void slotSettingsChanged();
+ void updatePreview();
+ void setCppCodeStyleSettings(const CppTools::CppCodeStyleSettings &settings);
+ void slotCurrentFallbackChanged(TextEditor::IFallbackPreferences *);
+
+signals:
+ void cppCodeStyleSettingsChanged(const CppTools::CppCodeStyleSettings &);
+private:
+ CppCodeStyleSettings cppCodeStyleSettings() const;
+
+ TextEditor::TabPreferences *m_tabPreferences;
+ CppCodeStylePreferences *m_cppCodeStylePreferences;
+ Ui::CppCodeStyleSettingsPage *m_ui;
+ QList<TextEditor::SnippetEditorWidget *> m_previews;
+};
+
+
+class CppCodeStyleSettingsPage : public Core::IOptionsPage
+{
+ Q_OBJECT
+
+public:
+ explicit CppCodeStyleSettingsPage(QWidget *parent = 0);
+ ~CppCodeStyleSettingsPage();
+
+ virtual QString id() const;
+ virtual QString displayName() const;
+ virtual QString category() const;
+ virtual QString displayCategory() const;
+ virtual QIcon categoryIcon() const;
+
+ virtual QWidget *createPage(QWidget *parent);
+ virtual void apply();
+ virtual void finish() { }
+ virtual bool matches(const QString &) const;
+
+private:
+ QString m_searchKeywords;
+ TextEditor::TabPreferences *m_pageTabPreferences;
+ CppCodeStylePreferences *m_pageCppCodeStylePreferences;
+ QPointer<CppCodeStylePreferencesWidget> m_widget;
+};
+
+} // namespace Internal
+} // namespace CppTools
+
+#endif // CPPCODESTYLESETTINGSPAGE_H