forked from qt-creator/qt-creator
CMakePM: Add ability to stop CMake run in Settings
Previously the only way to stop the CMake run was to click on "x" button of the "Configure" progress bar. Now you can click in Settings on "Stop CMake". Change-Id: I167b86ba62679f197c194148b122ff0c87e87162 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -411,13 +411,16 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeBuildConfiguration *bc)
|
||||
});
|
||||
|
||||
connect(m_resetButton, &QPushButton::clicked, m_configModel, &ConfigModel::resetAllChanges);
|
||||
connect(m_reconfigureButton,
|
||||
&QPushButton::clicked,
|
||||
m_buildConfiguration,
|
||||
&CMakeBuildConfiguration::runCMakeWithExtraArguments);
|
||||
connect(m_setButton, &QPushButton::clicked, this, [this]() {
|
||||
setVariableUnsetFlag(false);
|
||||
connect(m_reconfigureButton, &QPushButton::clicked, this, [this]() {
|
||||
auto buildSystem = static_cast<CMakeBuildSystem *>(m_buildConfiguration->buildSystem());
|
||||
if (!buildSystem->isParsing()) {
|
||||
buildSystem->runCMakeWithExtraArguments();
|
||||
} else {
|
||||
buildSystem->stopCMakeRun();
|
||||
m_reconfigureButton->setEnabled(false);
|
||||
}
|
||||
});
|
||||
connect(m_setButton, &QPushButton::clicked, this, [this]() { setVariableUnsetFlag(false); });
|
||||
connect(m_unsetButton, &QPushButton::clicked, this, [this]() {
|
||||
setVariableUnsetFlag(true);
|
||||
});
|
||||
@@ -570,7 +573,15 @@ void CMakeBuildSettingsWidget::updateButtonState()
|
||||
});
|
||||
|
||||
m_resetButton->setEnabled(m_configModel->hasChanges() && !isParsing);
|
||||
m_reconfigureButton->setEnabled(!configChanges.isEmpty() && !isParsing);
|
||||
m_reconfigureButton->setEnabled(true);
|
||||
|
||||
if (isParsing)
|
||||
m_reconfigureButton->setText(tr("Stop CMake"));
|
||||
else if (m_configModel->hasChanges())
|
||||
m_reconfigureButton->setText(tr("Apply Configuration Changes"));
|
||||
else
|
||||
m_reconfigureButton->setText(tr("Run CMake"));
|
||||
|
||||
m_buildConfiguration->setConfigurationChanges(configChanges);
|
||||
}
|
||||
|
||||
@@ -1323,11 +1334,6 @@ BuildSystem *CMakeBuildConfiguration::buildSystem() const
|
||||
return m_buildSystem;
|
||||
}
|
||||
|
||||
void CMakeBuildConfiguration::runCMakeWithExtraArguments()
|
||||
{
|
||||
m_buildSystem->runCMakeWithExtraArguments();
|
||||
}
|
||||
|
||||
void CMakeBuildConfiguration::setSourceDirectory(const FilePath &path)
|
||||
{
|
||||
aspect<SourceDirectoryAspect>()->setValue(path.toString());
|
||||
|
||||
@@ -69,8 +69,6 @@ public:
|
||||
void buildTarget(const QString &buildTarget);
|
||||
ProjectExplorer::BuildSystem *buildSystem() const final;
|
||||
|
||||
void runCMakeWithExtraArguments();
|
||||
|
||||
void setSourceDirectory(const Utils::FilePath& path);
|
||||
Utils::FilePath sourceDirectory() const;
|
||||
|
||||
|
||||
@@ -434,6 +434,13 @@ void CMakeBuildSystem::runCMakeWithExtraArguments()
|
||||
| REPARSE_URGENT);
|
||||
}
|
||||
|
||||
void CMakeBuildSystem::stopCMakeRun()
|
||||
{
|
||||
qCDebug(cmakeBuildSystemLog) << cmakeBuildConfiguration()->displayName()
|
||||
<< "stopping CMake's runb";
|
||||
m_reader.stopCMakeRun();
|
||||
}
|
||||
|
||||
void CMakeBuildSystem::buildCMakeTarget(const QString &buildTarget)
|
||||
{
|
||||
QTC_ASSERT(!buildTarget.isEmpty(), return);
|
||||
|
||||
@@ -77,6 +77,7 @@ public:
|
||||
void runCMake();
|
||||
void runCMakeAndScanProjectTree();
|
||||
void runCMakeWithExtraArguments();
|
||||
void stopCMakeRun();
|
||||
|
||||
bool persistCMakeState();
|
||||
void clearCMakeCache();
|
||||
|
||||
@@ -148,6 +148,14 @@ void CMakeProcess::run(const BuildDirParameters ¶meters, const QStringList &
|
||||
m_future = std::move(future);
|
||||
}
|
||||
|
||||
void CMakeProcess::terminate()
|
||||
{
|
||||
if (m_process) {
|
||||
m_processWasCanceled = true;
|
||||
m_process->terminate();
|
||||
}
|
||||
}
|
||||
|
||||
QProcess::ProcessState CMakeProcess::state() const
|
||||
{
|
||||
if (m_process)
|
||||
|
||||
@@ -51,6 +51,7 @@ public:
|
||||
~CMakeProcess();
|
||||
|
||||
void run(const BuildDirParameters ¶meters, const QStringList &arguments);
|
||||
void terminate();
|
||||
|
||||
QProcess::ProcessState state() const;
|
||||
|
||||
|
||||
@@ -170,6 +170,12 @@ void FileApiReader::stop()
|
||||
m_isParsing = false;
|
||||
}
|
||||
|
||||
void FileApiReader::stopCMakeRun()
|
||||
{
|
||||
if (m_cmakeProcess)
|
||||
m_cmakeProcess->terminate();
|
||||
}
|
||||
|
||||
bool FileApiReader::isParsing() const
|
||||
{
|
||||
return m_isParsing;
|
||||
|
||||
@@ -64,6 +64,7 @@ public:
|
||||
void resetData();
|
||||
void parse(bool forceCMakeRun, bool forceInitialConfiguration, bool forceExtraConfiguration);
|
||||
void stop();
|
||||
void stopCMakeRun();
|
||||
|
||||
bool isParsing() const;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user