Lua: Add buildStateChanged for project hooks

Change-Id: I9d9781f17f703cc382440388471ec5d2475739aa
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
Lukasz Papierkowski
2024-12-23 17:34:34 +01:00
committed by lie
parent 00f144f6f1
commit b771da3dd1
2 changed files with 15 additions and 0 deletions

View File

@@ -201,6 +201,20 @@ void setupProjectModule()
QTC_CHECK_EXPECTED(res); QTC_CHECK_EXPECTED(res);
}); });
}); });
// buildStateChanged
registerHook("projects.buildStateChanged", [](sol::main_function func, QObject *guard) {
QObject::connect(
BuildManager::instance(),
&BuildManager::buildStateChanged,
guard,
[func](ProjectExplorer::Project *pro) {
const bool isBuilding = BuildManager::isBuilding(pro);
expected_str<void> res = void_safe_call(func, pro, isBuilding);
QTC_CHECK_EXPECTED(res);
}
);
});
} }
} // namespace Lua::Internal } // namespace Lua::Internal

View File

@@ -59,6 +59,7 @@ EditorHooks = {}
---@field projectRemoved? function function(project: Project) ---@field projectRemoved? function function(project: Project)
---@field aboutToRemoveProject? function function(project: Project) ---@field aboutToRemoveProject? function function(project: Project)
---@field runActionsUpdated? function function() Called when Project.canRunStartupProject() might have changed. ---@field runActionsUpdated? function function() Called when Project.canRunStartupProject() might have changed.
---@field buildStateChanged? function function(project: Project, isBuilding: boolean)
---@class Hooks ---@class Hooks
---@field editors? EditorHooks ---@field editors? EditorHooks