forked from qt-creator/qt-creator
TargetSetupWidget: Use Utils::Guard
Change-Id: I8f055b523f37c89e1f62ee7748aec445b9c82a8b Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -123,10 +123,9 @@ void TargetSetupWidget::setKitSelected(bool b)
|
||||
{
|
||||
// Only check target if there are build configurations possible
|
||||
b &= hasSelectedBuildConfigurations();
|
||||
m_ignoreChange = true;
|
||||
const GuardLocker locker(m_ignoreChanges);
|
||||
m_detailsWidget->setChecked(b);
|
||||
m_detailsWidget->widget()->setEnabled(b);
|
||||
m_ignoreChange = false;
|
||||
}
|
||||
|
||||
void TargetSetupWidget::addBuildInfo(const BuildInfo &info, bool isImport)
|
||||
@@ -184,7 +183,7 @@ void TargetSetupWidget::addBuildInfo(const BuildInfo &info, bool isImport)
|
||||
|
||||
void TargetSetupWidget::targetCheckBoxToggled(bool b)
|
||||
{
|
||||
if (m_ignoreChange)
|
||||
if (m_ignoreChanges.isLocked())
|
||||
return;
|
||||
m_detailsWidget->widget()->setEnabled(b);
|
||||
if (b && (contains(m_infoStore, &BuildInfoStore::hasIssues)
|
||||
@@ -301,9 +300,8 @@ void TargetSetupWidget::updateDefaultBuildDirectories()
|
||||
for (BuildInfoStore &buildInfoStore : m_infoStore) {
|
||||
if (buildInfoStore.buildInfo.typeName == buildInfo.typeName) {
|
||||
if (!buildInfoStore.customBuildDir) {
|
||||
m_ignoreChange = true;
|
||||
const GuardLocker locker(m_ignoreChanges);
|
||||
buildInfoStore.pathChooser->setFilePath(buildInfo.buildDirectory);
|
||||
m_ignoreChange = false;
|
||||
}
|
||||
found = true;
|
||||
break;
|
||||
@@ -334,7 +332,7 @@ void TargetSetupWidget::checkBoxToggled(bool b)
|
||||
|
||||
void TargetSetupWidget::pathChanged()
|
||||
{
|
||||
if (m_ignoreChange)
|
||||
if (m_ignoreChanges.isLocked())
|
||||
return;
|
||||
auto pathChooser = qobject_cast<Utils::PathChooser *>(sender());
|
||||
QTC_ASSERT(pathChooser, return);
|
||||
|
@@ -31,6 +31,8 @@
|
||||
#include "kit.h"
|
||||
#include "task.h"
|
||||
|
||||
#include <utils/guard.h>
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@@ -117,7 +119,7 @@ private:
|
||||
};
|
||||
std::vector<BuildInfoStore> m_infoStore;
|
||||
|
||||
bool m_ignoreChange = false;
|
||||
Utils::Guard m_ignoreChanges;
|
||||
int m_selected = 0; // Number of selected "buildconfigurations"
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user