MCPcopy Create free account
hub / github.com/WarmUpTill/SceneSwitcher / PathChanged

Method PathChanged

plugins/scripting/macro-segment-script-inline.cpp:104–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

102}
103
104void MacroSegmentScriptInlineEdit::PathChanged(const QString &path)
105{
106 GUARD_LOADING_AND_LOCK();
107
108 if (path.isEmpty()) {
109 _entryData->SetPath(path.toStdString());
110 return;
111 }
112
113 // Script language will be detected by OBS based on file extension so
114 // adjust it if necessary
115 QString pathAdjusted = path;
116 if (_entryData->GetLanguage() == OBS_SCRIPT_LANG_PYTHON &&
117 !path.endsWith(".py")) {
118 if (path.endsWith(".lua")) {
119 pathAdjusted.chop(4);
120 }
121 pathAdjusted += ".py";
122 }
123 if (_entryData->GetLanguage() == OBS_SCRIPT_LANG_LUA &&
124 !path.endsWith(".lua")) {
125 if (path.endsWith(".py")) {
126 pathAdjusted.chop(3);
127 }
128 pathAdjusted += ".lua";
129 }
130
131 const QSignalBlocker b(_path);
132 _path->SetPath(pathAdjusted);
133 _entryData->SetPath(pathAdjusted.toStdString());
134
135 SetupContentIssueWarning();
136}
137
138void MacroSegmentScriptInlineEdit::PopulateWidgets()
139{

Callers

nothing calls this directly

Calls 2

SetPathMethod · 0.45
GetLanguageMethod · 0.45

Tested by

no test coverage detected