forked from qt-creator/qt-creator
ProjectExplorer: Create project panels centrally
Change-Id: I4b6fb52edb4b7d6df4e1184c432d239b77b30aac Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -114,7 +114,6 @@ add_qtc_plugin(ProjectExplorer
|
|||||||
msvcparser.cpp msvcparser.h
|
msvcparser.cpp msvcparser.h
|
||||||
msvctoolchain.cpp msvctoolchain.h
|
msvctoolchain.cpp msvctoolchain.h
|
||||||
osparser.cpp osparser.h
|
osparser.cpp osparser.h
|
||||||
panelswidget.cpp panelswidget.h
|
|
||||||
parseissuesdialog.cpp parseissuesdialog.h
|
parseissuesdialog.cpp parseissuesdialog.h
|
||||||
processparameters.cpp processparameters.h
|
processparameters.cpp processparameters.h
|
||||||
processstep.cpp processstep.h
|
processstep.cpp processstep.h
|
||||||
|
@@ -6,7 +6,6 @@
|
|||||||
#include "buildconfiguration.h"
|
#include "buildconfiguration.h"
|
||||||
#include "buildinfo.h"
|
#include "buildinfo.h"
|
||||||
#include "buildmanager.h"
|
#include "buildmanager.h"
|
||||||
#include "panelswidget.h"
|
|
||||||
#include "project.h"
|
#include "project.h"
|
||||||
#include "projectconfigurationmodel.h"
|
#include "projectconfigurationmodel.h"
|
||||||
#include "projectexplorertr.h"
|
#include "projectexplorertr.h"
|
||||||
@@ -358,9 +357,7 @@ void BuildSettingsWidget::deleteConfiguration(BuildConfiguration *deleteConfigur
|
|||||||
|
|
||||||
QWidget *createBuildSettingsWidget(Target *target)
|
QWidget *createBuildSettingsWidget(Target *target)
|
||||||
{
|
{
|
||||||
auto panel = new PanelsWidget(true);
|
return new BuildSettingsWidget(target);
|
||||||
panel->addWidget(new BuildSettingsWidget(target));
|
|
||||||
return panel;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // ProjectExplorer::Internal
|
} // ProjectExplorer::Internal
|
||||||
|
@@ -1,113 +0,0 @@
|
|||||||
// Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
||||||
|
|
||||||
#include "panelswidget.h"
|
|
||||||
|
|
||||||
#include <coreplugin/icore.h>
|
|
||||||
#include <utils/layoutbuilder.h>
|
|
||||||
#include <utils/qtcassert.h>
|
|
||||||
#include <utils/styledbar.h>
|
|
||||||
#include <utils/stylehelper.h>
|
|
||||||
#include <utils/theme/theme.h>
|
|
||||||
|
|
||||||
#include <QCheckBox>
|
|
||||||
#include <QHBoxLayout>
|
|
||||||
#include <QLabel>
|
|
||||||
#include <QScrollArea>
|
|
||||||
#include <QVBoxLayout>
|
|
||||||
|
|
||||||
using namespace Utils;
|
|
||||||
|
|
||||||
namespace ProjectExplorer::Internal {
|
|
||||||
|
|
||||||
const int ABOVE_HEADING_MARGIN = 10;
|
|
||||||
const int CONTENTS_MARGIN = 5;
|
|
||||||
const int BELOW_CONTENTS_MARGIN = 16;
|
|
||||||
|
|
||||||
PanelsWidget::PanelsWidget(bool addStretch)
|
|
||||||
{
|
|
||||||
m_root = new QWidget(nullptr);
|
|
||||||
m_root->setFocusPolicy(Qt::NoFocus);
|
|
||||||
m_root->setContentsMargins(0, 0, 0, 0);
|
|
||||||
|
|
||||||
const auto scroller = new QScrollArea(this);
|
|
||||||
scroller->setWidget(m_root);
|
|
||||||
scroller->setFrameStyle(QFrame::NoFrame);
|
|
||||||
scroller->setWidgetResizable(true);
|
|
||||||
scroller->setFocusPolicy(Qt::NoFocus);
|
|
||||||
|
|
||||||
// The layout holding the individual panels:
|
|
||||||
auto topLayout = new QVBoxLayout(m_root);
|
|
||||||
topLayout->setContentsMargins(PanelVMargin, 0, PanelVMargin, 0);
|
|
||||||
topLayout->setSpacing(0);
|
|
||||||
|
|
||||||
m_layout = new QVBoxLayout;
|
|
||||||
m_layout->setSpacing(0);
|
|
||||||
|
|
||||||
topLayout->addLayout(m_layout);
|
|
||||||
if (addStretch)
|
|
||||||
topLayout->addStretch(1);
|
|
||||||
|
|
||||||
auto layout = new QVBoxLayout(this);
|
|
||||||
layout->setContentsMargins(0, 0, 0, 0);
|
|
||||||
layout->setSpacing(0);
|
|
||||||
layout->addWidget(scroller);
|
|
||||||
|
|
||||||
//layout->addWidget(new FindToolBarPlaceHolder(this));
|
|
||||||
}
|
|
||||||
|
|
||||||
PanelsWidget::~PanelsWidget() = default;
|
|
||||||
|
|
||||||
void PanelsWidget::addWidget(QWidget *widget)
|
|
||||||
{
|
|
||||||
setWindowTitle(widget->windowTitle());
|
|
||||||
widget->setContentsMargins(0, CONTENTS_MARGIN, 0, BELOW_CONTENTS_MARGIN);
|
|
||||||
widget->setParent(m_root);
|
|
||||||
m_layout->addWidget(widget);
|
|
||||||
}
|
|
||||||
|
|
||||||
void PanelsWidget::addGlobalSettingsProperties(ProjectSettingsWidget *widget)
|
|
||||||
{
|
|
||||||
if (!widget->isUseGlobalSettingsCheckBoxVisible() && !widget->isUseGlobalSettingsLabelVisible())
|
|
||||||
return;
|
|
||||||
m_layout->setContentsMargins(0, 0, 0, 0);
|
|
||||||
const auto useGlobalSettingsCheckBox = new QCheckBox;
|
|
||||||
useGlobalSettingsCheckBox->setChecked(widget->useGlobalSettings());
|
|
||||||
useGlobalSettingsCheckBox->setEnabled(widget->isUseGlobalSettingsCheckBoxEnabled());
|
|
||||||
|
|
||||||
const QString labelText = widget->isUseGlobalSettingsCheckBoxVisible()
|
|
||||||
? QStringLiteral("Use <a href=\"dummy\">global settings</a>")
|
|
||||||
: QStringLiteral("<a href=\"dummy\">Global settings</a>");
|
|
||||||
const auto settingsLabel = new QLabel(labelText);
|
|
||||||
settingsLabel->setEnabled(widget->isUseGlobalSettingsCheckBoxEnabled());
|
|
||||||
|
|
||||||
const auto horizontalLayout = new QHBoxLayout;
|
|
||||||
horizontalLayout->setContentsMargins(0, CONTENTS_MARGIN, 0, CONTENTS_MARGIN);
|
|
||||||
horizontalLayout->setSpacing(CONTENTS_MARGIN);
|
|
||||||
|
|
||||||
if (widget->isUseGlobalSettingsCheckBoxVisible()) {
|
|
||||||
horizontalLayout->addWidget(useGlobalSettingsCheckBox);
|
|
||||||
|
|
||||||
connect(widget, &ProjectSettingsWidget::useGlobalSettingsCheckBoxEnabledChanged,
|
|
||||||
this, [useGlobalSettingsCheckBox, settingsLabel](bool enabled) {
|
|
||||||
useGlobalSettingsCheckBox->setEnabled(enabled);
|
|
||||||
settingsLabel->setEnabled(enabled);
|
|
||||||
});
|
|
||||||
connect(useGlobalSettingsCheckBox, &QCheckBox::stateChanged,
|
|
||||||
widget, &ProjectSettingsWidget::setUseGlobalSettings);
|
|
||||||
connect(widget, &ProjectSettingsWidget::useGlobalSettingsChanged,
|
|
||||||
useGlobalSettingsCheckBox, &QCheckBox::setChecked);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (widget->isUseGlobalSettingsLabelVisible()) {
|
|
||||||
horizontalLayout->addWidget(settingsLabel);
|
|
||||||
connect(settingsLabel, &QLabel::linkActivated, this, [widget] {
|
|
||||||
Core::ICore::showOptionsDialog(widget->globalSettingsId());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
horizontalLayout->addStretch(1);
|
|
||||||
m_layout->addLayout(horizontalLayout);
|
|
||||||
m_layout->addWidget(Layouting::createHr());
|
|
||||||
}
|
|
||||||
|
|
||||||
} // ProjectExplorer::Internal
|
|
@@ -1,30 +0,0 @@
|
|||||||
// Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "projectsettingswidget.h"
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
|
||||||
class QVBoxLayout;
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
||||||
namespace ProjectExplorer::Internal {
|
|
||||||
|
|
||||||
class PanelsWidget final : public QWidget
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
explicit PanelsWidget(bool addStretch);
|
|
||||||
~PanelsWidget() final;
|
|
||||||
|
|
||||||
static int constexpr PanelVMargin = 14;
|
|
||||||
|
|
||||||
void addGlobalSettingsProperties(ProjectSettingsWidget *widget);
|
|
||||||
void addWidget(QWidget *widget);
|
|
||||||
|
|
||||||
private:
|
|
||||||
QVBoxLayout *m_layout;
|
|
||||||
QWidget *m_root;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // ProjectExplorer::Internal
|
|
@@ -88,7 +88,6 @@ QtcPlugin {
|
|||||||
"msvcparser.cpp", "msvcparser.h",
|
"msvcparser.cpp", "msvcparser.h",
|
||||||
"msvctoolchain.cpp", "msvctoolchain.h",
|
"msvctoolchain.cpp", "msvctoolchain.h",
|
||||||
"osparser.cpp", "osparser.h",
|
"osparser.cpp", "osparser.h",
|
||||||
"panelswidget.cpp", "panelswidget.h",
|
|
||||||
"parseissuesdialog.cpp", "parseissuesdialog.h",
|
"parseissuesdialog.cpp", "parseissuesdialog.h",
|
||||||
"processparameters.cpp", "processparameters.h",
|
"processparameters.cpp", "processparameters.h",
|
||||||
"processstep.cpp", "processstep.h",
|
"processstep.cpp", "processstep.h",
|
||||||
|
@@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
#include "project.h"
|
#include "project.h"
|
||||||
#include "projectsettingswidget.h"
|
#include "projectsettingswidget.h"
|
||||||
#include "projectwindow.h"
|
|
||||||
|
|
||||||
#include <utils/layoutbuilder.h>
|
#include <utils/layoutbuilder.h>
|
||||||
|
|
||||||
|
@@ -10,7 +10,6 @@
|
|||||||
#include "kit.h"
|
#include "kit.h"
|
||||||
#include "kitmanager.h"
|
#include "kitmanager.h"
|
||||||
#include "kitoptionspage.h"
|
#include "kitoptionspage.h"
|
||||||
#include "panelswidget.h"
|
|
||||||
#include "project.h"
|
#include "project.h"
|
||||||
#include "projectexplorer.h"
|
#include "projectexplorer.h"
|
||||||
#include "projectexplorerconstants.h"
|
#include "projectexplorerconstants.h"
|
||||||
@@ -56,6 +55,7 @@
|
|||||||
#include <utils/utilsicons.h>
|
#include <utils/utilsicons.h>
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
#include <QCheckBox>
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
#include <QDockWidget>
|
#include <QDockWidget>
|
||||||
@@ -81,6 +81,105 @@ const char kRegExpActionId[] = "OutputFilter.RegularExpressions.BuildSystemOutpu
|
|||||||
const char kCaseSensitiveActionId[] = "OutputFilter.CaseSensitive.BuildSystemOutput";
|
const char kCaseSensitiveActionId[] = "OutputFilter.CaseSensitive.BuildSystemOutput";
|
||||||
const char kInvertActionId[] = "OutputFilter.Invert.BuildSystemOutput";
|
const char kInvertActionId[] = "OutputFilter.Invert.BuildSystemOutput";
|
||||||
|
|
||||||
|
const int CONTENTS_MARGIN = 5;
|
||||||
|
const int BELOW_CONTENTS_MARGIN = 16;
|
||||||
|
const int PanelVMargin = 14;
|
||||||
|
|
||||||
|
class ProjectPanel final : public QWidget
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit ProjectPanel(QWidget *inner, bool addGlobalSettings, bool addStretch)
|
||||||
|
{
|
||||||
|
setWindowTitle(inner->windowTitle());
|
||||||
|
|
||||||
|
auto root = new QWidget(nullptr);
|
||||||
|
root->setFocusPolicy(Qt::NoFocus);
|
||||||
|
root->setContentsMargins(0, 0, 0, 0);
|
||||||
|
|
||||||
|
const auto scroller = new QScrollArea(this);
|
||||||
|
scroller->setWidget(root);
|
||||||
|
scroller->setFrameStyle(QFrame::NoFrame);
|
||||||
|
scroller->setWidgetResizable(true);
|
||||||
|
scroller->setFocusPolicy(Qt::NoFocus);
|
||||||
|
|
||||||
|
// The layout holding the individual panels:
|
||||||
|
auto topLayout = new QVBoxLayout(root);
|
||||||
|
topLayout->setContentsMargins(PanelVMargin, 0, PanelVMargin, 0);
|
||||||
|
topLayout->setSpacing(0);
|
||||||
|
|
||||||
|
m_layout = new QVBoxLayout;
|
||||||
|
m_layout->setSpacing(0);
|
||||||
|
|
||||||
|
topLayout->addLayout(m_layout);
|
||||||
|
if (addStretch)
|
||||||
|
topLayout->addStretch(1);
|
||||||
|
|
||||||
|
auto layout = new QVBoxLayout(this);
|
||||||
|
layout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
layout->setSpacing(0);
|
||||||
|
layout->addWidget(scroller);
|
||||||
|
|
||||||
|
//layout->addWidget(new FindToolBarPlaceHolder(this));
|
||||||
|
|
||||||
|
if (addGlobalSettings) {
|
||||||
|
auto widget = dynamic_cast<ProjectSettingsWidget *>(inner);
|
||||||
|
if (QTC_GUARD(widget)) {
|
||||||
|
if (widget->isUseGlobalSettingsCheckBoxVisible() || widget->isUseGlobalSettingsLabelVisible()) {
|
||||||
|
m_layout->setContentsMargins(0, 0, 0, 0);
|
||||||
|
const auto useGlobalSettingsCheckBox = new QCheckBox;
|
||||||
|
useGlobalSettingsCheckBox->setChecked(widget->useGlobalSettings());
|
||||||
|
useGlobalSettingsCheckBox->setEnabled(widget->isUseGlobalSettingsCheckBoxEnabled());
|
||||||
|
|
||||||
|
const QString labelText = widget->isUseGlobalSettingsCheckBoxVisible()
|
||||||
|
? QStringLiteral("Use <a href=\"dummy\">global settings</a>")
|
||||||
|
: QStringLiteral("<a href=\"dummy\">Global settings</a>");
|
||||||
|
const auto settingsLabel = new QLabel(labelText);
|
||||||
|
settingsLabel->setEnabled(widget->isUseGlobalSettingsCheckBoxEnabled());
|
||||||
|
|
||||||
|
const auto horizontalLayout = new QHBoxLayout;
|
||||||
|
horizontalLayout->setContentsMargins(0, CONTENTS_MARGIN, 0, CONTENTS_MARGIN);
|
||||||
|
horizontalLayout->setSpacing(CONTENTS_MARGIN);
|
||||||
|
|
||||||
|
if (widget->isUseGlobalSettingsCheckBoxVisible()) {
|
||||||
|
horizontalLayout->addWidget(useGlobalSettingsCheckBox);
|
||||||
|
|
||||||
|
connect(widget, &ProjectSettingsWidget::useGlobalSettingsCheckBoxEnabledChanged,
|
||||||
|
this, [useGlobalSettingsCheckBox, settingsLabel](bool enabled) {
|
||||||
|
useGlobalSettingsCheckBox->setEnabled(enabled);
|
||||||
|
settingsLabel->setEnabled(enabled);
|
||||||
|
});
|
||||||
|
connect(useGlobalSettingsCheckBox, &QCheckBox::stateChanged,
|
||||||
|
widget, &ProjectSettingsWidget::setUseGlobalSettings);
|
||||||
|
connect(widget, &ProjectSettingsWidget::useGlobalSettingsChanged,
|
||||||
|
useGlobalSettingsCheckBox, &QCheckBox::setChecked);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (widget->isUseGlobalSettingsLabelVisible()) {
|
||||||
|
horizontalLayout->addWidget(settingsLabel);
|
||||||
|
connect(settingsLabel, &QLabel::linkActivated, this, [widget] {
|
||||||
|
Core::ICore::showOptionsDialog(widget->globalSettingsId());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
horizontalLayout->addStretch(1);
|
||||||
|
m_layout->addLayout(horizontalLayout);
|
||||||
|
m_layout->addWidget(Layouting::createHr());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inner->setContentsMargins(0, CONTENTS_MARGIN, 0, BELOW_CONTENTS_MARGIN);
|
||||||
|
inner->setParent(root);
|
||||||
|
m_layout->addWidget(inner);
|
||||||
|
|
||||||
|
setFocusProxy(inner);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
QVBoxLayout *m_layout;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class BuildSystemOutputWindow : public OutputWindow
|
class BuildSystemOutputWindow : public OutputWindow
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -502,13 +601,8 @@ QVariant MiscSettingsPanelItem::data(int column, int role) const
|
|||||||
ProjectPanels MiscSettingsPanelItem::panelWidgets() const
|
ProjectPanels MiscSettingsPanelItem::panelWidgets() const
|
||||||
{
|
{
|
||||||
if (!m_widget) {
|
if (!m_widget) {
|
||||||
ProjectSettingsWidget *inner = m_factory->createWidget(m_project);
|
m_widget = new ProjectPanel(m_factory->createWidget(m_project), true, false);
|
||||||
auto panel = new PanelsWidget(true);
|
m_widget->setWindowTitle(m_factory->displayName());
|
||||||
panel->addGlobalSettingsProperties(inner);
|
|
||||||
panel->addWidget(inner);
|
|
||||||
panel->setFocusProxy(inner);
|
|
||||||
panel->setWindowTitle(m_factory->displayName());
|
|
||||||
m_widget = panel;
|
|
||||||
}
|
}
|
||||||
return {m_widget.get()};
|
return {m_widget.get()};
|
||||||
}
|
}
|
||||||
@@ -876,9 +970,9 @@ public:
|
|||||||
ProjectPanels panelWidgets() const final
|
ProjectPanels panelWidgets() const final
|
||||||
{
|
{
|
||||||
if (!m_buildSettingsWidget)
|
if (!m_buildSettingsWidget)
|
||||||
m_buildSettingsWidget = createBuildSettingsWidget(target());
|
m_buildSettingsWidget = new ProjectPanel(createBuildSettingsWidget(target()), false, true);
|
||||||
if (!m_runSettingsWidget)
|
if (!m_runSettingsWidget)
|
||||||
m_runSettingsWidget = createRunSettingsWidget(target());
|
m_runSettingsWidget = new ProjectPanel(createRunSettingsWidget(target()), false, true);
|
||||||
|
|
||||||
return { m_buildSettingsWidget.get(), m_runSettingsWidget.get() };
|
return { m_buildSettingsWidget.get(), m_runSettingsWidget.get() };
|
||||||
}
|
}
|
||||||
@@ -1083,13 +1177,8 @@ ProjectItemBase *TargetGroupItem::activeItem()
|
|||||||
|
|
||||||
ProjectPanels TargetGroupItem::panelWidgets() const
|
ProjectPanels TargetGroupItem::panelWidgets() const
|
||||||
{
|
{
|
||||||
if (!m_targetSetupPage) {
|
if (!m_targetSetupPage)
|
||||||
auto inner = new TargetSetupPageWrapper(m_project);
|
m_targetSetupPage = new ProjectPanel(new TargetSetupPageWrapper(m_project), false, false);
|
||||||
auto panel = new PanelsWidget(false);
|
|
||||||
panel->addWidget(inner);
|
|
||||||
panel->setFocusProxy(inner);
|
|
||||||
m_targetSetupPage = panel;
|
|
||||||
}
|
|
||||||
|
|
||||||
return {m_targetSetupPage.get()};
|
return {m_targetSetupPage.get()};
|
||||||
}
|
}
|
||||||
@@ -1433,8 +1522,7 @@ public:
|
|||||||
|
|
||||||
auto innerLayout = new QVBoxLayout;
|
auto innerLayout = new QVBoxLayout;
|
||||||
innerLayout->setSpacing(10);
|
innerLayout->setSpacing(10);
|
||||||
innerLayout->setContentsMargins(PanelsWidget::PanelVMargin, innerLayout->spacing(),
|
innerLayout->setContentsMargins(PanelVMargin, innerLayout->spacing(), PanelVMargin, 0);
|
||||||
PanelsWidget::PanelVMargin, 0);
|
|
||||||
#ifdef QT_NO_DEBUG
|
#ifdef QT_NO_DEBUG
|
||||||
const QStringList list = ICore::settings()->value("HideOptionCategories").toStringList();
|
const QStringList list = ICore::settings()->value("HideOptionCategories").toStringList();
|
||||||
#else
|
#else
|
||||||
|
@@ -7,7 +7,6 @@
|
|||||||
#include "buildmanager.h"
|
#include "buildmanager.h"
|
||||||
#include "buildstepspage.h"
|
#include "buildstepspage.h"
|
||||||
#include "deployconfiguration.h"
|
#include "deployconfiguration.h"
|
||||||
#include "panelswidget.h"
|
|
||||||
#include "project.h"
|
#include "project.h"
|
||||||
#include "projectconfigurationmodel.h"
|
#include "projectconfigurationmodel.h"
|
||||||
#include "projectexplorerconstants.h"
|
#include "projectexplorerconstants.h"
|
||||||
@@ -793,9 +792,7 @@ void RunSettingsWidget::updateEnabledState()
|
|||||||
|
|
||||||
QWidget *createRunSettingsWidget(Target *target)
|
QWidget *createRunSettingsWidget(Target *target)
|
||||||
{
|
{
|
||||||
auto panel = new PanelsWidget(true);
|
return new RunSettingsWidget(target);
|
||||||
panel->addWidget(new RunSettingsWidget(target));
|
|
||||||
return panel;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // ProjectExplorer::Internal
|
} // ProjectExplorer::Internal
|
||||||
|
Reference in New Issue
Block a user