| 102 | } |
| 103 | |
| 104 | void 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 | |
| 138 | void MacroSegmentScriptInlineEdit::PopulateWidgets() |
| 139 | { |
nothing calls this directly
no test coverage detected