forked from qt-creator/qt-creator
Debugger/ProjectExplorer: Promote run configuration aspect widgets
These are the widgets at the bottom of the run config settings that share the ability to switch between a global and per-target setting. There is nothing inherently debugger specific here, except for the common history. Change-Id: I4c57c138bb05c2a505f1bac13161352417bd8fe4 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -8,7 +8,6 @@ add_qtc_plugin(Debugger
|
||||
SOURCES
|
||||
analyzer/analyzerbase.qrc
|
||||
analyzer/analyzericons.h
|
||||
analyzer/analyzerrunconfigwidget.cpp analyzer/analyzerrunconfigwidget.h
|
||||
analyzer/analyzerutils.cpp analyzer/analyzerutils.h
|
||||
analyzer/detailederrorview.cpp analyzer/detailederrorview.h
|
||||
analyzer/diagnosticlocation.cpp analyzer/diagnosticlocation.h
|
||||
|
@@ -1,65 +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 "analyzerrunconfigwidget.h"
|
||||
|
||||
#include "../debuggertr.h"
|
||||
|
||||
#include <utils/detailswidget.h>
|
||||
#include <utils/layoutbuilder.h>
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QLayout>
|
||||
#include <QPushButton>
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
namespace Debugger {
|
||||
|
||||
AnalyzerRunConfigWidget::AnalyzerRunConfigWidget(ProjectExplorer::GlobalOrProjectAspect *aspect)
|
||||
{
|
||||
using namespace Layouting;
|
||||
|
||||
auto settingsCombo = new QComboBox;
|
||||
settingsCombo->addItem(Tr::tr("Global"));
|
||||
settingsCombo->addItem(Tr::tr("Custom"));
|
||||
|
||||
auto restoreButton = new QPushButton(Tr::tr("Restore Global"));
|
||||
|
||||
auto innerPane = new QWidget;
|
||||
auto configWidget = aspect->projectSettings()->layouter()().emerge();
|
||||
|
||||
auto details = new DetailsWidget;
|
||||
details->setWidget(innerPane);
|
||||
|
||||
Column {
|
||||
Row { settingsCombo, restoreButton, st },
|
||||
configWidget
|
||||
}.attachTo(innerPane);
|
||||
|
||||
Column { details }.attachTo(this);
|
||||
|
||||
details->layout()->setContentsMargins(0, 0, 0, 0);
|
||||
innerPane->layout()->setContentsMargins(0, 0, 0, 0);
|
||||
layout()->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
auto chooseSettings = [=](int setting) {
|
||||
const bool isCustom = (setting == 1);
|
||||
|
||||
settingsCombo->setCurrentIndex(setting);
|
||||
aspect->setUsingGlobalSettings(!isCustom);
|
||||
configWidget->setEnabled(isCustom);
|
||||
restoreButton->setEnabled(isCustom);
|
||||
details->setSummaryText(isCustom
|
||||
? Tr::tr("Use Customized Settings")
|
||||
: Tr::tr("Use Global Settings"));
|
||||
};
|
||||
|
||||
chooseSettings(aspect->isUsingGlobalSettings() ? 0 : 1);
|
||||
|
||||
connect(settingsCombo, &QComboBox::activated, this, chooseSettings);
|
||||
connect(restoreButton, &QPushButton::clicked,
|
||||
aspect, &ProjectExplorer::GlobalOrProjectAspect::resetProjectToGlobalSettings);
|
||||
}
|
||||
|
||||
} // namespace Debugger
|
@@ -1,18 +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 <debugger/debugger_global.h>
|
||||
|
||||
#include <projectexplorer/runconfiguration.h>
|
||||
|
||||
namespace Debugger {
|
||||
|
||||
class DEBUGGER_EXPORT AnalyzerRunConfigWidget : public QWidget
|
||||
{
|
||||
public:
|
||||
AnalyzerRunConfigWidget(ProjectExplorer::GlobalOrProjectAspect *aspect);
|
||||
};
|
||||
|
||||
} // namespace Debugger
|
@@ -231,8 +231,6 @@ QtcPlugin {
|
||||
files: [
|
||||
"analyzerbase.qrc",
|
||||
"analyzericons.h",
|
||||
"analyzerrunconfigwidget.cpp",
|
||||
"analyzerrunconfigwidget.h",
|
||||
"analyzerutils.cpp",
|
||||
"analyzerutils.h",
|
||||
"detailederrorview.cpp",
|
||||
|
@@ -6,11 +6,13 @@
|
||||
#include "perfrunconfigurationaspect.h"
|
||||
#include "perfsettings.h"
|
||||
|
||||
#include <debugger/analyzer/analyzerrunconfigwidget.h>
|
||||
#include <projectexplorer/runconfiguration.h>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
namespace PerfProfiler::Internal {
|
||||
|
||||
PerfRunConfigurationAspect::PerfRunConfigurationAspect(ProjectExplorer::Target *target)
|
||||
PerfRunConfigurationAspect::PerfRunConfigurationAspect(Target *target)
|
||||
{
|
||||
setProjectSettings(new PerfSettings(target));
|
||||
setGlobalSettings(&PerfProfiler::globalSettings());
|
||||
@@ -18,7 +20,7 @@ PerfRunConfigurationAspect::PerfRunConfigurationAspect(ProjectExplorer::Target *
|
||||
setDisplayName(Tr::tr("Performance Analyzer Settings"));
|
||||
setUsingGlobalSettings(true);
|
||||
resetProjectToGlobalSettings();
|
||||
setConfigWidgetCreator([this] { return new Debugger::AnalyzerRunConfigWidget(this); });
|
||||
setConfigWidgetCreator([this] { return createRunConfigAspectWidget(this); });
|
||||
}
|
||||
|
||||
} // PerfProfiler::Internal
|
||||
|
@@ -32,9 +32,10 @@
|
||||
#include <utils/utilsicons.h>
|
||||
#include <utils/variablechooser.h>
|
||||
|
||||
#include <QComboBox>
|
||||
#include <QHash>
|
||||
#include <QLayout>
|
||||
#include <QPushButton>
|
||||
#include <QTimer>
|
||||
#include <QLoggingCategory>
|
||||
|
||||
using namespace Utils;
|
||||
@@ -119,6 +120,62 @@ void GlobalOrProjectAspect::resetProjectToGlobalSettings()
|
||||
}
|
||||
|
||||
|
||||
class RunConfigAspectWidget : public QWidget
|
||||
{
|
||||
public:
|
||||
explicit RunConfigAspectWidget(GlobalOrProjectAspect *aspect)
|
||||
{
|
||||
using namespace Layouting;
|
||||
|
||||
auto settingsCombo = new QComboBox;
|
||||
settingsCombo->addItem(Tr::tr("Global"));
|
||||
settingsCombo->addItem(Tr::tr("Custom"));
|
||||
|
||||
auto restoreButton = new QPushButton(Tr::tr("Restore Global"));
|
||||
|
||||
auto innerPane = new QWidget;
|
||||
auto configWidget = aspect->projectSettings()->layouter()().emerge();
|
||||
|
||||
auto details = new DetailsWidget;
|
||||
details->setWidget(innerPane);
|
||||
|
||||
Column {
|
||||
Row { settingsCombo, restoreButton, st },
|
||||
configWidget
|
||||
}.attachTo(innerPane);
|
||||
|
||||
Column { details }.attachTo(this);
|
||||
|
||||
details->layout()->setContentsMargins(0, 0, 0, 0);
|
||||
innerPane->layout()->setContentsMargins(0, 0, 0, 0);
|
||||
layout()->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
auto chooseSettings = [=](int setting) {
|
||||
const bool isCustom = (setting == 1);
|
||||
|
||||
settingsCombo->setCurrentIndex(setting);
|
||||
aspect->setUsingGlobalSettings(!isCustom);
|
||||
configWidget->setEnabled(isCustom);
|
||||
restoreButton->setEnabled(isCustom);
|
||||
details->setSummaryText(isCustom
|
||||
? Tr::tr("Use Customized Settings")
|
||||
: Tr::tr("Use Global Settings"));
|
||||
};
|
||||
|
||||
chooseSettings(aspect->isUsingGlobalSettings() ? 0 : 1);
|
||||
|
||||
connect(settingsCombo, &QComboBox::activated, this, chooseSettings);
|
||||
connect(restoreButton, &QPushButton::clicked,
|
||||
aspect, &ProjectExplorer::GlobalOrProjectAspect::resetProjectToGlobalSettings);
|
||||
}
|
||||
};
|
||||
|
||||
QWidget *createRunConfigAspectWidget(GlobalOrProjectAspect *aspect)
|
||||
{
|
||||
return new RunConfigAspectWidget(aspect);
|
||||
}
|
||||
|
||||
|
||||
/*!
|
||||
\class ProjectExplorer::RunConfiguration
|
||||
\inmodule QtCreator
|
||||
|
@@ -115,6 +115,8 @@ private:
|
||||
Utils::AspectContainer *m_globalSettings = nullptr; // Not owned.
|
||||
};
|
||||
|
||||
PROJECTEXPLORER_EXPORT QWidget *createRunConfigAspectWidget(GlobalOrProjectAspect *);
|
||||
|
||||
// Documentation inside.
|
||||
class PROJECTEXPLORER_EXPORT RunConfiguration : public ProjectConfiguration
|
||||
{
|
||||
|
@@ -7,11 +7,13 @@
|
||||
#include "qmlprofilersettings.h"
|
||||
#include "qmlprofilertr.h"
|
||||
|
||||
#include <debugger/analyzer/analyzerrunconfigwidget.h>
|
||||
#include <projectexplorer/runconfiguration.h>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
namespace QmlProfiler::Internal {
|
||||
|
||||
QmlProfilerRunConfigurationAspect::QmlProfilerRunConfigurationAspect(ProjectExplorer::Target *)
|
||||
QmlProfilerRunConfigurationAspect::QmlProfilerRunConfigurationAspect(Target *)
|
||||
{
|
||||
setProjectSettings(new QmlProfilerSettings);
|
||||
setGlobalSettings(&Internal::globalSettings());
|
||||
@@ -19,7 +21,7 @@ QmlProfilerRunConfigurationAspect::QmlProfilerRunConfigurationAspect(ProjectExpl
|
||||
setDisplayName(Tr::tr("QML Profiler Settings"));
|
||||
setUsingGlobalSettings(true);
|
||||
resetProjectToGlobalSettings();
|
||||
setConfigWidgetCreator([this] { return new Debugger::AnalyzerRunConfigWidget(this); });
|
||||
setConfigWidgetCreator([this] { return createRunConfigAspectWidget(this); });
|
||||
}
|
||||
|
||||
} // QmlProfiler::Internal
|
||||
|
@@ -9,12 +9,12 @@
|
||||
#include <coreplugin/icontext.h>
|
||||
#include <coreplugin/icore.h>
|
||||
|
||||
#include <debugger/analyzer/analyzerrunconfigwidget.h>
|
||||
#include <debugger/analyzer/analyzericons.h>
|
||||
|
||||
#include <extensionsystem/iplugin.h>
|
||||
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <projectexplorer/runconfiguration.h>
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
# include "valgrindmemcheckparsertest.h"
|
||||
@@ -37,7 +37,7 @@ public:
|
||||
setDisplayName(Tr::tr("Valgrind Settings"));
|
||||
setUsingGlobalSettings(true);
|
||||
resetProjectToGlobalSettings();
|
||||
setConfigWidgetCreator([this] { return new Debugger::AnalyzerRunConfigWidget(this); });
|
||||
setConfigWidgetCreator([this] { return createRunConfigAspectWidget(this); });
|
||||
}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user