2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2011-07-06 10:38:53 +02:00
|
|
|
**
|
2013-01-28 17:12:19 +01:00
|
|
|
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
|
2012-10-02 09:12:39 +02:00
|
|
|
** Contact: http://www.qt-project.org/legal
|
2011-07-06 10:38:53 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2011-07-06 10:38:53 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and Digia. For licensing terms and
|
|
|
|
|
** conditions see http://qt.digia.com/licensing. For further information
|
|
|
|
|
** use the contact form at http://qt.digia.com/contact-us.
|
2011-07-06 10:38:53 +02:00
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
2012-10-02 09:12:39 +02:00
|
|
|
** Alternatively, 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, Digia gives you certain additional
|
|
|
|
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
2011-07-06 10:38:53 +02:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
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"
|
2013-03-27 18:54:03 +01:00
|
|
|
#include "cppcodestylesettings.h"
|
|
|
|
|
#include "cppcodeformatter.h"
|
2011-02-03 15:48:14 +01:00
|
|
|
|
|
|
|
|
#include <coreplugin/dialogs/ioptionspage.h>
|
2013-03-27 18:54:03 +01:00
|
|
|
|
2012-02-15 10:42:41 +01:00
|
|
|
#include <QWidget>
|
|
|
|
|
#include <QPointer>
|
2011-02-03 15:48:14 +01:00
|
|
|
|
|
|
|
|
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
|