2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2011-07-06 10:38:53 +02:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
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
|
2016-01-15 14:57:40 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2011-07-06 10:38:53 +02:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2011-07-06 10:38:53 +02:00
|
|
|
**
|
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 {
|
|
|
|
|
|
2014-02-11 21:55:42 +02:00
|
|
|
namespace Ui { class CppCodeStyleSettingsPage; }
|
2011-05-24 13:56:19 +02:00
|
|
|
|
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
|
|
|
|
|
|
|
|
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
|
|
|
|
2013-12-03 14:17:03 +01:00
|
|
|
QWidget *widget();
|
2012-05-22 11:17:13 +02:00
|
|
|
void apply();
|
2013-12-03 14:17:03 +01:00
|
|
|
void finish();
|
2011-02-03 15:48:14 +01:00
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
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
|