forked from qt-creator/qt-creator
Lua: Add function to stop running configurations
Change-Id: I85cb9113efeb0c7b1bdd6e12eb7cabe369458dee Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
@@ -113,6 +113,26 @@ void setupProjectModule()
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
result["stopRunConfigurationsByName"] =
|
||||||
|
[](const QString &displayName, const std::optional<bool> &force) -> int {
|
||||||
|
const auto runControls = ProjectExplorerPlugin::instance()->allRunControls();
|
||||||
|
|
||||||
|
int stoppedCount = 0;
|
||||||
|
for (const auto rc : runControls) {
|
||||||
|
if (rc && rc->displayName() == displayName) {
|
||||||
|
stoppedCount++;
|
||||||
|
|
||||||
|
if (force.has_value() && force.value()) {
|
||||||
|
rc->forceStop();
|
||||||
|
} else {
|
||||||
|
rc->initiateStop();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return stoppedCount;
|
||||||
|
};
|
||||||
|
|
||||||
result["RunMode"] = lua.create_table_with(
|
result["RunMode"] = lua.create_table_with(
|
||||||
"Normal", Constants::NORMAL_RUN_MODE, "Debug", Constants::DEBUG_RUN_MODE);
|
"Normal", Constants::NORMAL_RUN_MODE, "Debug", Constants::DEBUG_RUN_MODE);
|
||||||
|
|
||||||
|
@@ -50,4 +50,10 @@ function project.canRunStartupProject(runMode) end
|
|||||||
---@param displayName? string Override the run configuration display name with the provided name.
|
---@param displayName? string Override the run configuration display name with the provided name.
|
||||||
function project.runStartupProject(runnable, displayName) end
|
function project.runStartupProject(runnable, displayName) end
|
||||||
|
|
||||||
|
---Stops any configuration with display names equal to the provided name.
|
||||||
|
---@param displayName string The name for projects to stop.
|
||||||
|
---@param force? boolean Whether to close project forcefully (false assumeed if not provided).
|
||||||
|
---@return int Number of stopped configurations.
|
||||||
|
function project.stopRunConfigurationsByName(displayName, force) end
|
||||||
|
|
||||||
return project
|
return project
|
||||||
|
Reference in New Issue
Block a user