forked from qt-creator/qt-creator
CMake: Use BuildDirectoryAspect for UI related to Build Directory
Do not re-create the UI yourself. Change-Id: I8e7610ee6717105a3e05743d0451a3c6732197c5 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -31,8 +31,9 @@
|
||||
#include "cmakeproject.h"
|
||||
#include "cmakebuildconfiguration.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/find/itemviewfind.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <projectexplorer/buildaspects.h>
|
||||
#include <projectexplorer/kitmanager.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
@@ -105,20 +106,15 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeBuildConfiguration *bc)
|
||||
mainLayout->setContentsMargins(0, 0, 0, 0);
|
||||
mainLayout->setColumnStretch(1, 10);
|
||||
|
||||
auto project = bc->project();
|
||||
|
||||
auto buildDirChooser = new Utils::PathChooser;
|
||||
buildDirChooser->setBaseDirectory(project->projectDirectory());
|
||||
buildDirChooser->setFileName(bc->buildDirectory());
|
||||
connect(buildDirChooser, &Utils::PathChooser::rawPathChanged, this,
|
||||
[this](const QString &path) {
|
||||
m_configModel->flush(); // clear out config cache...
|
||||
m_buildConfiguration->setBuildDirectory(Utils::FilePath::fromString(path));
|
||||
});
|
||||
|
||||
int row = 0;
|
||||
mainLayout->addWidget(new QLabel(tr("Build directory:")), row, 0);
|
||||
mainLayout->addWidget(buildDirChooser, row, 1, 1, 2);
|
||||
auto buildDirAspect = bc->buildDirectoryAspect();
|
||||
connect(buildDirAspect, &ProjectConfigurationAspect::changed, this, [this]() {
|
||||
m_configModel->flush(); // clear out config cache...;
|
||||
});
|
||||
auto buildDirWidget = new QWidget;
|
||||
LayoutBuilder buildDirWidgetBuilder(buildDirWidget);
|
||||
buildDirAspect->addToLayout(buildDirWidgetBuilder);
|
||||
mainLayout->addWidget(buildDirWidget, row, 0, 1, 2);
|
||||
++row;
|
||||
|
||||
auto qmlDebugAspect = bc->aspect<QtSupport::QmlDebuggingAspect>();
|
||||
@@ -132,11 +128,6 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeBuildConfiguration *bc)
|
||||
++row;
|
||||
mainLayout->addItem(new QSpacerItem(20, 10), row, 0);
|
||||
|
||||
++row;
|
||||
m_errorMessageLabel = new Utils::InfoLabel({}, Utils::InfoLabel::Error);
|
||||
m_errorMessageLabel->setVisible(false);
|
||||
mainLayout->addWidget(m_errorMessageLabel, row, 0, 1, -1, Qt::AlignHCenter);
|
||||
|
||||
++row;
|
||||
m_warningMessageLabel = new Utils::InfoLabel({}, Utils::InfoLabel::Warning);
|
||||
m_warningMessageLabel->setVisible(false);
|
||||
@@ -257,13 +248,12 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeBuildConfiguration *bc)
|
||||
m_configView->expandAll();
|
||||
}
|
||||
|
||||
connect(bc->target(), &Target::parsingFinished, this, [this, buildDirChooser, stretcher] {
|
||||
connect(bc->target(), &Target::parsingFinished, this, [this, stretcher] {
|
||||
m_configModel->setConfiguration(m_buildConfiguration->configurationFromCMake());
|
||||
m_configView->expandAll();
|
||||
m_configView->setEnabled(true);
|
||||
stretcher->stretch();
|
||||
updateButtonState();
|
||||
buildDirChooser->triggerChanged(); // refresh valid state...
|
||||
handleQmlDebugCxxFlags();
|
||||
m_showProgressTimer.stop();
|
||||
m_progressIndicator->hide();
|
||||
@@ -342,9 +332,7 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeBuildConfiguration *bc)
|
||||
|
||||
void CMakeBuildSettingsWidget::setError(const QString &message)
|
||||
{
|
||||
bool showError = !message.isEmpty();
|
||||
m_errorMessageLabel->setVisible(showError);
|
||||
m_errorMessageLabel->setText(message);
|
||||
m_buildConfiguration->buildDirectoryAspect()->setProblem(message);
|
||||
}
|
||||
|
||||
void CMakeBuildSettingsWidget::setWarning(const QString &message)
|
||||
|
||||
@@ -88,7 +88,6 @@ private:
|
||||
QPushButton *m_reconfigureButton;
|
||||
QTimer m_showProgressTimer;
|
||||
Utils::FancyLineEdit *m_filterEdit;
|
||||
Utils::InfoLabel *m_errorMessageLabel;
|
||||
Utils::InfoLabel *m_warningMessageLabel;
|
||||
};
|
||||
|
||||
|
||||
@@ -43,10 +43,11 @@ public:
|
||||
bool isShadowBuild() const;
|
||||
void setProblem(const QString &description);
|
||||
|
||||
void addToLayout(LayoutBuilder &builder) override;
|
||||
|
||||
private:
|
||||
void toMap(QVariantMap &map) const override;
|
||||
void fromMap(const QVariantMap &map) override;
|
||||
void addToLayout(LayoutBuilder &builder) override;
|
||||
|
||||
void updateProblemLabel();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user