2011-07-06 10:38:53 +02:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
2012-01-26 18:33:46 +01:00
|
|
|
** Copyright (c) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
2011-07-06 10:38:53 +02:00
|
|
|
**
|
2011-11-02 15:59:12 +01:00
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
2011-07-06 10:38:53 +02:00
|
|
|
**
|
|
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
|
**
|
|
|
|
|
** This file may be used under the terms of the GNU Lesser General Public
|
|
|
|
|
** License version 2.1 as published by the Free Software Foundation and
|
|
|
|
|
** appearing in the file LICENSE.LGPL included in the packaging of this file.
|
|
|
|
|
** Please review the following information to ensure the GNU Lesser General
|
|
|
|
|
** Public License version 2.1 requirements will be met:
|
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
|
|
|
**
|
|
|
|
|
** In addition, as a special exception, Nokia gives you certain additional
|
|
|
|
|
** rights. These rights are described in the Nokia Qt LGPL Exception
|
|
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
|
|
|
|
** Other Usage
|
|
|
|
|
**
|
|
|
|
|
** Alternatively, this file may be used in accordance with the terms and
|
|
|
|
|
** conditions contained in a signed written agreement between you and Nokia.
|
|
|
|
|
**
|
|
|
|
|
** If you have questions regarding the use of this file, please contact
|
2011-11-02 15:59:12 +01:00
|
|
|
** Nokia at qt-info@nokia.com.
|
2011-07-06 10:38:53 +02:00
|
|
|
**
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
2011-02-03 15:48:14 +01:00
|
|
|
#ifndef CPPCODESTYLESETTINGSPAGE_H
|
|
|
|
|
#define CPPCODESTYLESETTINGSPAGE_H
|
|
|
|
|
|
|
|
|
|
#include "cpptools_global.h"
|
|
|
|
|
|
|
|
|
|
#include <coreplugin/dialogs/ioptionspage.h>
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QWidget>
|
|
|
|
|
#include <QPointer>
|
|
|
|
|
#include <QSharedPointer>
|
|
|
|
|
#include <QVariant>
|
|
|
|
|
#include <QStringList>
|
2011-02-03 15:48:14 +01:00
|
|
|
|
|
|
|
|
#include "cppcodestylesettings.h"
|
|
|
|
|
#include "cppcodeformatter.h"
|
|
|
|
|
|
|
|
|
|
namespace TextEditor {
|
|
|
|
|
class FontSettings;
|
|
|
|
|
class TabSettings;
|
2011-08-16 10:45:23 +02:00
|
|
|
class ICodeStylePreferences;
|
2011-02-03 15:48:14 +01:00
|
|
|
class SnippetEditorWidget;
|
2011-08-16 10:45:23 +02:00
|
|
|
class CodeStyleEditor;
|
2011-02-03 15:48:14 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
namespace CppTools {
|
|
|
|
|
|
|
|
|
|
class CppCodeStylePreferences;
|
|
|
|
|
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
2011-05-24 13:56:19 +02:00
|
|
|
namespace Ui {
|
|
|
|
|
class CppCodeStyleSettingsPage;
|
|
|
|
|
}
|
|
|
|
|
|
2011-02-03 15:48:14 +01:00
|
|
|
class CppCodeStylePreferencesWidget : public QWidget
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
|
|
|
|
explicit CppCodeStylePreferencesWidget(QWidget *parent = 0);
|
|
|
|
|
virtual ~CppCodeStylePreferencesWidget();
|
|
|
|
|
|
2011-08-16 10:45:23 +02:00
|
|
|
void setCodeStyle(CppTools::CppCodeStylePreferences *codeStylePreferences);
|
2011-02-03 15:48:14 +01:00
|
|
|
|
|
|
|
|
QString searchKeywords() const;
|
|
|
|
|
|
|
|
|
|
private slots:
|
2011-05-31 16:36:58 +02:00
|
|
|
void decorateEditors(const TextEditor::FontSettings &fontSettings);
|
2011-02-03 15:48:14 +01:00
|
|
|
void setVisualizeWhitespace(bool on);
|
2011-08-16 10:45:23 +02:00
|
|
|
void slotTabSettingsChanged(const TextEditor::TabSettings &settings);
|
|
|
|
|
void slotCodeStyleSettingsChanged();
|
2011-02-03 15:48:14 +01:00
|
|
|
void updatePreview();
|
2011-08-16 10:45:23 +02:00
|
|
|
void setTabSettings(const TextEditor::TabSettings &settings);
|
|
|
|
|
void setCodeStyleSettings(const CppTools::CppCodeStyleSettings &settings, bool preview = true);
|
|
|
|
|
void slotCurrentPreferencesChanged(TextEditor::ICodeStylePreferences *, bool preview = true);
|
2011-02-03 15:48:14 +01:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
CppCodeStyleSettings cppCodeStyleSettings() const;
|
|
|
|
|
|
2011-08-16 10:45:23 +02:00
|
|
|
CppCodeStylePreferences *m_preferences;
|
2011-02-03 15:48:14 +01:00
|
|
|
Ui::CppCodeStyleSettingsPage *m_ui;
|
|
|
|
|
QList<TextEditor::SnippetEditorWidget *> m_previews;
|
2011-06-21 18:03:44 +02:00
|
|
|
bool m_blockUpdates;
|
2011-02-03 15:48:14 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class CppCodeStyleSettingsPage : public Core::IOptionsPage
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
explicit CppCodeStyleSettingsPage(QWidget *parent = 0);
|
2012-05-22 11:17:13 +02:00
|
|
|
|
|
|
|
|
QWidget *createPage(QWidget *parent);
|
|
|
|
|
void apply();
|
|
|
|
|
void finish() { }
|
|
|
|
|
bool matches(const QString &) const;
|
2011-02-03 15:48:14 +01:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
QString m_searchKeywords;
|
|
|
|
|
CppCodeStylePreferences *m_pageCppCodeStylePreferences;
|
2011-08-16 10:45:23 +02:00
|
|
|
QPointer<TextEditor::CodeStyleEditor> m_widget;
|
2011-02-03 15:48:14 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace CppTools
|
|
|
|
|
|
|
|
|
|
#endif // CPPCODESTYLESETTINGSPAGE_H
|