From e59da46773222e07eb5117065f97a6396b8f5fbd Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 12 Feb 2019 10:18:26 +0100 Subject: [PATCH] ProjectExplore: Inline KitAspectWidget::{is,set}Mutable ... into its only user. Less indirection, less code. Change-Id: I8aa750c5850dff92c847eda8c2d6403cc3063f2d Reviewed-by: Christian Kandeler --- src/plugins/projectexplorer/kitmanager.cpp | 10 ---------- src/plugins/projectexplorer/kitmanager.h | 2 -- src/plugins/projectexplorer/kitmanagerconfigwidget.cpp | 7 ++++--- 3 files changed, 4 insertions(+), 15 deletions(-) diff --git a/src/plugins/projectexplorer/kitmanager.cpp b/src/plugins/projectexplorer/kitmanager.cpp index 051a641afbd..57069ffcf11 100644 --- a/src/plugins/projectexplorer/kitmanager.cpp +++ b/src/plugins/projectexplorer/kitmanager.cpp @@ -496,16 +496,6 @@ Core::Id KitAspectWidget::kitInformationId() const return m_kitInformation->id(); } -bool KitAspectWidget::isMutable() const -{ - return m_kit->isMutable(m_kitInformation->id()); -} - -void KitAspectWidget::setMutable(bool b) -{ - m_kit->setMutable(m_kitInformation->id(), b); -} - QString KitAspectWidget::msgManage() { return tr("Manage..."); diff --git a/src/plugins/projectexplorer/kitmanager.h b/src/plugins/projectexplorer/kitmanager.h index 439a392ec47..6d7ef227425 100644 --- a/src/plugins/projectexplorer/kitmanager.h +++ b/src/plugins/projectexplorer/kitmanager.h @@ -135,8 +135,6 @@ public: virtual QWidget *buttonWidget() const { return nullptr; } bool isSticky() const { return m_isSticky; } - bool isMutable() const; - void setMutable(bool b); static QString msgManage(); diff --git a/src/plugins/projectexplorer/kitmanagerconfigwidget.cpp b/src/plugins/projectexplorer/kitmanagerconfigwidget.cpp index fa699708b78..2923b7a6f77 100644 --- a/src/plugins/projectexplorer/kitmanagerconfigwidget.cpp +++ b/src/plugins/projectexplorer/kitmanagerconfigwidget.cpp @@ -232,12 +232,13 @@ void KitManagerConfigWidget::addAspectToWorkingCopy(KitAspect *aspect) auto action = new QAction(tr("Mark as Mutable"), nullptr); action->setCheckable(true); - action->setChecked(widget->isMutable()); + action->setChecked(workingCopy()->isMutable(aspect->id())); + action->setEnabled(!widget->isSticky()); widget->mainWidget()->addAction(action); widget->mainWidget()->setContextMenuPolicy(Qt::ActionsContextMenu); - connect(action, &QAction::toggled, this, [this, widget, action] { - widget->setMutable(action->isChecked()); + connect(action, &QAction::toggled, this, [this, aspect, action] { + workingCopy()->setMutable(aspect->id(), action->isChecked()); emit dirty(); });