From 3941f0593b94f8003760c6d9cbe59f684ab30372 Mon Sep 17 00:00:00 2001 From: hjk Date: Fri, 26 Apr 2019 17:06:23 +0200 Subject: AutoTools: Use the base BuildConfiguration config widget Change-Id: I928b9bc7adc3424008ead27fe8457d345e1bcda5 Reviewed-by: Christian Kandeler --- .../autotoolsbuildconfiguration.cpp | 26 ++++--- .../autotoolsbuildconfiguration.h | 1 - .../autotoolsbuildsettingswidget.cpp | 81 ---------------------- .../autotoolsbuildsettingswidget.h | 64 ----------------- .../autotoolsprojectmanager.pro | 2 - .../autotoolsprojectmanager.qbs | 2 - 6 files changed, 15 insertions(+), 161 deletions(-) delete mode 100644 src/plugins/autotoolsprojectmanager/autotoolsbuildsettingswidget.cpp delete mode 100644 src/plugins/autotoolsprojectmanager/autotoolsbuildsettingswidget.h (limited to 'src/plugins/autotoolsprojectmanager') diff --git a/src/plugins/autotoolsprojectmanager/autotoolsbuildconfiguration.cpp b/src/plugins/autotoolsprojectmanager/autotoolsbuildconfiguration.cpp index 33ebf0f188..8ea2db675e 100644 --- a/src/plugins/autotoolsprojectmanager/autotoolsbuildconfiguration.cpp +++ b/src/plugins/autotoolsprojectmanager/autotoolsbuildconfiguration.cpp @@ -26,7 +26,6 @@ ****************************************************************************/ #include "autotoolsbuildconfiguration.h" -#include "autotoolsbuildsettingswidget.h" #include "makestep.h" #include "autotoolsproject.h" #include "autotoolsprojectconstants.h" @@ -44,15 +43,13 @@ #include #include -#include -#include - -using namespace AutotoolsProjectManager; using namespace AutotoolsProjectManager::Constants; -using namespace Internal; using namespace ProjectExplorer; using namespace ProjectExplorer::Constants; +using namespace Utils; +namespace AutotoolsProjectManager { +namespace Internal { // AutotoolsBuildConfiguration @@ -62,6 +59,15 @@ AutotoolsBuildConfiguration::AutotoolsBuildConfiguration(Target *parent, Core::I // / is used so the un-changed check in setBuildDirectory() works correctly. // The leading / is to avoid the relative the path expansion in BuildConfiguration::buildDirectory. setBuildDirectory(Utils::FileName::fromString("/")); + setConfigWidgetDisplayName(tr("Autotools Manager")); + + BaseStringAspect *bd = buildDirectoryAspect(); + bd->setLabelText(tr("Build directory:")); + bd->setDisplayStyle(BaseStringAspect::PathChooserDisplay); + bd->setExpectedKind(PathChooser::Directory); + bd->setBaseFileName(parent->project()->projectDirectory()); + bd->setEnvironment(environment()); + bd->setHistoryCompleter("AutoTools.BuildDir.History"); } void AutotoolsBuildConfiguration::initialize(const BuildInfo &info) @@ -97,11 +103,6 @@ void AutotoolsBuildConfiguration::initialize(const BuildInfo &info) cleanSteps->appendStep(cleanMakeStep); } -NamedWidget *AutotoolsBuildConfiguration::createConfigWidget() -{ - return new AutotoolsBuildSettingsWidget(this); -} - // AutotoolsBuildConfiguration class @@ -143,3 +144,6 @@ BuildConfiguration::BuildType AutotoolsBuildConfiguration::buildType() const // TODO: Should I return something different from Unknown? return Unknown; } + +} // Internal +} // AutotoolsProjectManager diff --git a/src/plugins/autotoolsprojectmanager/autotoolsbuildconfiguration.h b/src/plugins/autotoolsprojectmanager/autotoolsbuildconfiguration.h index 2cd784c235..b2f02cbd0e 100644 --- a/src/plugins/autotoolsprojectmanager/autotoolsbuildconfiguration.h +++ b/src/plugins/autotoolsprojectmanager/autotoolsbuildconfiguration.h @@ -42,7 +42,6 @@ class AutotoolsBuildConfiguration : public ProjectExplorer::BuildConfiguration AutotoolsBuildConfiguration(ProjectExplorer::Target *parent, Core::Id id); void initialize(const ProjectExplorer::BuildInfo &info) override; - ProjectExplorer::NamedWidget *createConfigWidget() override; BuildType buildType() const override; }; diff --git a/src/plugins/autotoolsprojectmanager/autotoolsbuildsettingswidget.cpp b/src/plugins/autotoolsprojectmanager/autotoolsbuildsettingswidget.cpp deleted file mode 100644 index 08eb39d7ee..0000000000 --- a/src/plugins/autotoolsprojectmanager/autotoolsbuildsettingswidget.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Openismus GmbH. -** Author: Peter Penz (ppenz@openismus.com) -** Author: Patricia Santana Cruz (patriciasantanacruz@gmail.com) -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#include "autotoolsbuildsettingswidget.h" -#include "autotoolsproject.h" -#include "autotoolsbuildconfiguration.h" - -#include -#include - -#include - -#include -#include -#include -#include -#include -#include - -using namespace AutotoolsProjectManager; -using namespace AutotoolsProjectManager::Internal; -using namespace ProjectExplorer; - -AutotoolsBuildSettingsWidget::AutotoolsBuildSettingsWidget(AutotoolsBuildConfiguration *bc) : - m_pathChooser(new Utils::PathChooser), - m_buildConfiguration(bc) -{ - auto fl = new QFormLayout(this); - fl->setContentsMargins(0, 0, 0, 0); - fl->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow); - - m_pathChooser->setEnabled(true); - m_pathChooser->setExpectedKind(Utils::PathChooser::Directory); - m_pathChooser->setBaseFileName(bc->target()->project()->projectDirectory()); - m_pathChooser->setEnvironment(bc->environment()); - m_pathChooser->setHistoryCompleter(QLatin1String("AutoTools.BuildDir.History")); - fl->addRow(tr("Build directory:"), m_pathChooser); - connect(m_pathChooser, &Utils::PathChooser::rawPathChanged, - this, &AutotoolsBuildSettingsWidget::buildDirectoryChanged); - - m_pathChooser->setBaseFileName(bc->target()->project()->projectDirectory()); - m_pathChooser->setPath(m_buildConfiguration->rawBuildDirectory().toString()); - setDisplayName(tr("Autotools Manager")); - - connect(bc, &BuildConfiguration::environmentChanged, - this, &AutotoolsBuildSettingsWidget::environmentHasChanged); -} - -void AutotoolsBuildSettingsWidget::buildDirectoryChanged() -{ - m_buildConfiguration->setBuildDirectory(Utils::FileName::fromString(m_pathChooser->rawPath())); -} - -void AutotoolsBuildSettingsWidget::environmentHasChanged() -{ - m_pathChooser->setEnvironment(m_buildConfiguration->environment()); -} diff --git a/src/plugins/autotoolsprojectmanager/autotoolsbuildsettingswidget.h b/src/plugins/autotoolsprojectmanager/autotoolsbuildsettingswidget.h deleted file mode 100644 index 8419a57962..0000000000 --- a/src/plugins/autotoolsprojectmanager/autotoolsbuildsettingswidget.h +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 Openismus GmbH. -** Author: Peter Penz (ppenz@openismus.com) -** Author: Patricia Santana Cruz (patriciasantanacruz@gmail.com) -** Contact: https://www.qt.io/licensing/ -** -** This file is part of Qt Creator. -** -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -****************************************************************************/ - -#pragma once - -#include - -QT_BEGIN_NAMESPACE -class QComboBox; -QT_END_NAMESPACE - -namespace Utils { class PathChooser; } - -namespace AutotoolsProjectManager { -namespace Internal { - -class AutotoolsBuildConfiguration; - -/** - * @brief Implementation of ProjectExplorer::BuildConfigWidget interface. - * - * Provides an editor to configure the build directory and build steps. - */ -class AutotoolsBuildSettingsWidget : public ProjectExplorer::NamedWidget -{ - Q_OBJECT - -public: - AutotoolsBuildSettingsWidget(AutotoolsBuildConfiguration *bc); - -private: - void buildDirectoryChanged(); - void environmentHasChanged(); - - Utils::PathChooser *m_pathChooser; - AutotoolsBuildConfiguration *m_buildConfiguration; -}; - -} // namespace Internal -} // namespace AutotoolsProjectManager diff --git a/src/plugins/autotoolsprojectmanager/autotoolsprojectmanager.pro b/src/plugins/autotoolsprojectmanager/autotoolsprojectmanager.pro index 8082c55c3f..92b6dd8e7d 100644 --- a/src/plugins/autotoolsprojectmanager/autotoolsprojectmanager.pro +++ b/src/plugins/autotoolsprojectmanager/autotoolsprojectmanager.pro @@ -3,7 +3,6 @@ include(../../qtcreatorplugin.pri) HEADERS = autotoolsprojectplugin.h\ autotoolsopenprojectwizard.h\ autotoolsproject.h\ - autotoolsbuildsettingswidget.h\ autotoolsbuildconfiguration.h\ autotoolsprojectconstants.h\ makestep.h\ @@ -16,7 +15,6 @@ HEADERS = autotoolsprojectplugin.h\ SOURCES = autotoolsprojectplugin.cpp\ autotoolsopenprojectwizard.cpp\ autotoolsproject.cpp\ - autotoolsbuildsettingswidget.cpp\ autotoolsbuildconfiguration.cpp\ makestep.cpp\ autogenstep.cpp\ diff --git a/src/plugins/autotoolsprojectmanager/autotoolsprojectmanager.qbs b/src/plugins/autotoolsprojectmanager/autotoolsprojectmanager.qbs index f2354d52db..a6e4a2721b 100644 --- a/src/plugins/autotoolsprojectmanager/autotoolsprojectmanager.qbs +++ b/src/plugins/autotoolsprojectmanager/autotoolsprojectmanager.qbs @@ -18,8 +18,6 @@ QtcPlugin { "autoreconfstep.h", "autotoolsbuildconfiguration.cpp", "autotoolsbuildconfiguration.h", - "autotoolsbuildsettingswidget.cpp", - "autotoolsbuildsettingswidget.h", "autotoolsopenprojectwizard.cpp", "autotoolsopenprojectwizard.h", "autotoolsproject.cpp", -- cgit v1.2.3