forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/10.0'
Conflicts: src/plugins/python/pipsupport.cpp src/plugins/qtsupport/exampleslistmodel.cpp src/plugins/qtsupport/examplesparser.cpp tests/auto/examples/tst_examples.cpp Change-Id: I00273622423fa99d41621969f6ecbbdaa0e18664
This commit is contained in:
@@ -12,6 +12,7 @@ add_qtc_plugin(ClangFormat
|
||||
clangformatindenter.cpp clangformatindenter.h
|
||||
clangformatplugin.cpp clangformatplugin.h
|
||||
clangformatsettings.cpp clangformatsettings.h
|
||||
clangformattr.h
|
||||
clangformatutils.cpp clangformatutils.h
|
||||
EXPLICIT_MOC
|
||||
clangformatconfigwidget.cpp clangformatconfigwidget.h
|
||||
|
||||
@@ -89,7 +89,8 @@ ClangFormatConfigWidget::ClangFormatConfigWidget(TextEditor::ICodeStylePreferenc
|
||||
|
||||
d->checksScrollArea->setWidget(d->checksWidget);
|
||||
d->checksScrollArea->setWidgetResizable(true);
|
||||
d->checksWidget->setEnabled(!codeStyle->isReadOnly());
|
||||
d->checksWidget->setEnabled(!codeStyle->isReadOnly()
|
||||
&& !codeStyle->isTemporarilyReadOnly());
|
||||
|
||||
FilePath fileName;
|
||||
if (d->project)
|
||||
@@ -140,7 +141,8 @@ void ClangFormatConfigWidget::slotCodeStyleChanged(
|
||||
d->config->setIsReadOnly(codeStyle->isReadOnly());
|
||||
d->style = d->config->style();
|
||||
|
||||
d->checksWidget->setEnabled(!codeStyle->isReadOnly());
|
||||
d->checksWidget->setEnabled(!codeStyle->isReadOnly()
|
||||
&& !codeStyle->isTemporarilyReadOnly());
|
||||
|
||||
fillTable();
|
||||
updatePreview();
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include "clangformatutils.h"
|
||||
|
||||
#include <projectexplorer/project.h>
|
||||
#include <texteditor/icodestylepreferences.h>
|
||||
|
||||
#include <utils/layoutbuilder.h>
|
||||
|
||||
@@ -24,10 +25,11 @@ using namespace Utils;
|
||||
|
||||
namespace ClangFormat {
|
||||
|
||||
ClangFormatGlobalConfigWidget::ClangFormatGlobalConfigWidget(ProjectExplorer::Project *project,
|
||||
QWidget *parent)
|
||||
ClangFormatGlobalConfigWidget::ClangFormatGlobalConfigWidget(
|
||||
TextEditor::ICodeStylePreferences *codeStyle, ProjectExplorer::Project *project, QWidget *parent)
|
||||
: CppCodeStyleWidget(parent)
|
||||
, m_project(project)
|
||||
, m_codeStyle(codeStyle)
|
||||
{
|
||||
resize(489, 305);
|
||||
|
||||
@@ -171,10 +173,19 @@ void ClangFormatGlobalConfigWidget::initOverrideCheckBox()
|
||||
".clang-format file."));
|
||||
|
||||
m_overrideDefault->setChecked(getProjectOverriddenSettings(m_project));
|
||||
m_codeStyle->currentPreferences()->setTemporarilyReadOnly(!m_overrideDefault->isChecked());
|
||||
|
||||
connect(m_overrideDefault, &QCheckBox::toggled, this, [this](bool checked) {
|
||||
if (m_project)
|
||||
m_project->setNamedSettings(Constants::OVERRIDE_FILE_ID, checked);
|
||||
else {
|
||||
m_codeStyle->currentPreferences()->setTemporarilyReadOnly(!checked);
|
||||
emit m_codeStyle->currentPreferencesChanged(m_codeStyle->currentPreferences());
|
||||
}
|
||||
});
|
||||
|
||||
connect(m_codeStyle, &TextEditor::ICodeStylePreferences::currentPreferencesChanged, this, [this] {
|
||||
m_codeStyle->currentPreferences()->setTemporarilyReadOnly(!m_overrideDefault->isChecked());
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ class QLabel;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
namespace ProjectExplorer { class Project; }
|
||||
namespace TextEditor { class ICodeStylePreferences; }
|
||||
|
||||
namespace ClangFormat {
|
||||
|
||||
@@ -22,7 +23,8 @@ class ClangFormatGlobalConfigWidget : public CppEditor::CppCodeStyleWidget
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ClangFormatGlobalConfigWidget(ProjectExplorer::Project *project = nullptr,
|
||||
explicit ClangFormatGlobalConfigWidget(TextEditor::ICodeStylePreferences *codeStyle,
|
||||
ProjectExplorer::Project *project = nullptr,
|
||||
QWidget *parent = nullptr);
|
||||
~ClangFormatGlobalConfigWidget() override;
|
||||
void apply() override;
|
||||
@@ -36,6 +38,7 @@ private:
|
||||
bool projectClangFormatFileExists();
|
||||
|
||||
ProjectExplorer::Project *m_project;
|
||||
TextEditor::ICodeStylePreferences *m_codeStyle;
|
||||
|
||||
QLabel *m_projectHasClangFormat;
|
||||
QLabel *m_formattingModeLabel;
|
||||
|
||||
@@ -51,9 +51,9 @@ public:
|
||||
}
|
||||
|
||||
CodeStyleEditorWidget *createAdditionalGlobalSettings(
|
||||
Project *project, QWidget *parent) override
|
||||
ICodeStylePreferences *codeStyle, Project *project, QWidget *parent) override
|
||||
{
|
||||
return new ClangFormatGlobalConfigWidget(project, parent);
|
||||
return new ClangFormatGlobalConfigWidget(codeStyle, project, parent);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user