2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2011-07-06 10:38:53 +02:00
|
|
|
**
|
2015-01-14 18:07:15 +01:00
|
|
|
** Copyright (C) 2015 The Qt Company Ltd.
|
|
|
|
|
** Contact: http://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
|
2015-01-14 18:07:15 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms and
|
|
|
|
|
** conditions see http://www.qt.io/terms-conditions. For further information
|
2014-10-01 13:21:18 +02:00
|
|
|
** use the contact form at http://www.qt.io/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
|
2014-10-01 13:21:18 +02:00
|
|
|
** General Public License version 2.1 or version 3 as published by the Free
|
|
|
|
|
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
|
|
|
|
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
|
|
|
|
** following information to ensure the GNU Lesser General Public License
|
|
|
|
|
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2012-10-02 09:12:39 +02:00
|
|
|
**
|
2015-01-14 18:07:15 +01:00
|
|
|
** In addition, as a special exception, The Qt Company gives you certain additional
|
|
|
|
|
** rights. These rights are described in The Qt Company 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 {
|
|
|
|
|
|
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
|