forked from qt-creator/qt-creator
ProjectExplorer: inline codestylesettingspropertiespage.ui
Change-Id: I8682685d554fce5d618da913d35720465ac52278 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -25,7 +25,7 @@ add_qtc_plugin(ProjectExplorer
|
||||
buildtargetinfo.h
|
||||
buildtargettype.h
|
||||
clangparser.cpp clangparser.h
|
||||
codestylesettingspropertiespage.cpp codestylesettingspropertiespage.h codestylesettingspropertiespage.ui
|
||||
codestylesettingspropertiespage.cpp codestylesettingspropertiespage.h
|
||||
compileoutputwindow.cpp compileoutputwindow.h
|
||||
configtaskhandler.cpp configtaskhandler.h
|
||||
copytaskhandler.cpp copytaskhandler.h
|
||||
|
||||
@@ -24,36 +24,55 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "codestylesettingspropertiespage.h"
|
||||
|
||||
#include "editorconfiguration.h"
|
||||
#include "project.h"
|
||||
|
||||
#include <texteditor/texteditorsettings.h>
|
||||
#include <texteditor/icodestylepreferencesfactory.h>
|
||||
#include <texteditor/codestyleeditor.h>
|
||||
|
||||
using namespace TextEditor;
|
||||
using namespace ProjectExplorer;
|
||||
using namespace ProjectExplorer::Internal;
|
||||
#include <utils/layoutbuilder.h>
|
||||
|
||||
CodeStyleSettingsWidget::CodeStyleSettingsWidget(Project *project) : ProjectSettingsWidget(), m_project(project)
|
||||
#include <QComboBox>
|
||||
#include <QLabel>
|
||||
#include <QLayout>
|
||||
#include <QStackedWidget>
|
||||
|
||||
using namespace TextEditor;
|
||||
|
||||
namespace ProjectExplorer::Internal {
|
||||
|
||||
CodeStyleSettingsWidget::CodeStyleSettingsWidget(Project *project)
|
||||
{
|
||||
m_ui.setupUi(this);
|
||||
auto languageComboBox = new QComboBox(this);
|
||||
auto stackedWidget = new QStackedWidget(this);
|
||||
|
||||
setUseGlobalSettingsCheckBoxVisible(false);
|
||||
setUseGlobalSettingsLabelVisible(false);
|
||||
|
||||
const EditorConfiguration *config = m_project->editorConfiguration();
|
||||
const EditorConfiguration *config = project->editorConfiguration();
|
||||
|
||||
for (ICodeStylePreferencesFactory *factory : TextEditorSettings::codeStyleFactories()) {
|
||||
Utils::Id languageId = factory->languageId();
|
||||
ICodeStylePreferences *codeStylePreferences = config->codeStyle(languageId);
|
||||
|
||||
auto preview = factory->createCodeStyleEditor(codeStylePreferences, project, m_ui.stackedWidget);
|
||||
auto preview = factory->createCodeStyleEditor(codeStylePreferences, project, stackedWidget);
|
||||
if (preview && preview->layout())
|
||||
preview->layout()->setContentsMargins(QMargins());
|
||||
m_ui.stackedWidget->addWidget(preview);
|
||||
m_ui.languageComboBox->addItem(factory->displayName());
|
||||
stackedWidget->addWidget(preview);
|
||||
languageComboBox->addItem(factory->displayName());
|
||||
}
|
||||
|
||||
connect(m_ui.languageComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
||||
m_ui.stackedWidget, &QStackedWidget::setCurrentIndex);
|
||||
connect(languageComboBox, &QComboBox::currentIndexChanged,
|
||||
stackedWidget, &QStackedWidget::setCurrentIndex);
|
||||
|
||||
using namespace Utils::Layouting;
|
||||
|
||||
Column {
|
||||
Row { new QLabel(tr("Language:")), languageComboBox, Stretch() },
|
||||
stackedWidget
|
||||
}.attachTo(this, false);
|
||||
}
|
||||
|
||||
} // ProjectExplorer::Internal
|
||||
|
||||
@@ -25,11 +25,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "ui_codestylesettingspropertiespage.h"
|
||||
#include <projectexplorer/projectsettingswidget.h>
|
||||
|
||||
namespace ProjectExplorer {
|
||||
class EditorConfiguration;
|
||||
|
||||
class Project;
|
||||
|
||||
namespace Internal {
|
||||
@@ -39,10 +38,6 @@ class CodeStyleSettingsWidget : public ProjectSettingsWidget
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit CodeStyleSettingsWidget(Project *project);
|
||||
|
||||
private:
|
||||
Ui::CodeStyleSettingsPropertiesPage m_ui;
|
||||
Project *m_project;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>ProjectExplorer::Internal::CodeStyleSettingsPropertiesPage</class>
|
||||
<widget class="QWidget" name="ProjectExplorer::Internal::CodeStyleSettingsPropertiesPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>293</width>
|
||||
<height>180</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string/>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="languageLabel">
|
||||
<property name="text">
|
||||
<string>Language:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="languageComboBox"/>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>73</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="3">
|
||||
<widget class="QStackedWidget" name="stackedWidget"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
@@ -42,7 +42,7 @@ Project {
|
||||
"buildtargetinfo.h",
|
||||
"buildtargettype.h",
|
||||
"clangparser.cpp", "clangparser.h",
|
||||
"codestylesettingspropertiespage.cpp", "codestylesettingspropertiespage.h", "codestylesettingspropertiespage.ui",
|
||||
"codestylesettingspropertiespage.cpp", "codestylesettingspropertiespage.h",
|
||||
"compileoutputwindow.cpp", "compileoutputwindow.h",
|
||||
"configtaskhandler.cpp", "configtaskhandler.h",
|
||||
"copytaskhandler.cpp", "copytaskhandler.h",
|
||||
|
||||
Reference in New Issue
Block a user