Move GetSceneGroupByName functions to scene-group.hpp

This commit is contained in:
WarmUpTill 2021-06-21 20:11:43 +02:00 committed by WarmUpTill
parent 9670a01e1a
commit 7cfa956b80
3 changed files with 23 additions and 20 deletions

View File

@ -82,3 +82,6 @@ private:
SceneGroup *sceneGroup = nullptr;
};
SceneGroup *GetSceneGroupByName(const char *name);
SceneGroup *GetSceneGroupByQString(const QString &name);

View File

@ -684,3 +684,23 @@ void SceneGroupEditWidget::RepeatChanged(int state)
std::lock_guard<std::mutex> lock(switcher->m);
sceneGroup->repeat = state;
}
SceneGroup *GetSceneGroupByName(const char *name)
{
if (!switcher) {
return nullptr;
}
for (SceneGroup &sg : switcher->sceneGroups) {
if (sg.name == name) {
return &sg;
}
}
return nullptr;
}
SceneGroup *GetSceneGroupByQString(const QString &name)
{
return GetSceneGroupByName(name.toUtf8().constData());
}

View File

@ -9,26 +9,6 @@ static inline bool SceneGroupValid(SceneGroup *group)
return false;
}
static inline SceneGroup *GetSceneGroupByName(const char *name)
{
if (!switcher) {
return nullptr;
}
for (SceneGroup &sg : switcher->sceneGroups) {
if (sg.name == name) {
return &sg;
}
}
return nullptr;
}
static inline SceneGroup *GetSceneGroupByQString(const QString &name)
{
return GetSceneGroupByName(name.toUtf8().constData());
}
bool SceneSwitcherEntry::initialized()
{
return (usePreviousScene || WeakSourceValid(scene) ||