SceneSwitcher/plugins/scripting/macro-segment-script-inline.hpp
WarmUpTill ea4a951554
Some checks failed
debian-build / build (push) Has been cancelled
Check locale / ubuntu64 (push) Has been cancelled
Push to master / Check Formatting 🔍 (push) Has been cancelled
Push to master / Build Project 🧱 (push) Has been cancelled
Push to master / Create Release 🛫 (push) Has been cancelled
Add warning if inline script file is invalid
2025-09-23 22:59:42 +02:00

60 lines
1.4 KiB
C++

#pragma once
#include "file-selection.hpp"
#include "inline-script.hpp"
#include "sync-helpers.hpp"
#include "variable-text-edit.hpp"
#include <QLayout>
namespace advss {
class MacroSegmentScriptInline : public Lockable {
public:
InlineScript::Type GetType() const { return _script.GetType(); }
void SetType(InlineScript::Type);
obs_script_lang GetLanguage() const { return _script.GetLanguage(); }
void SetLanguage(obs_script_lang);
StringVariable GetScript() const { return _script.GetText(); }
void SetScript(const std::string &);
std::string GetPath() const { return _script.GetPath(); }
void SetPath(const std::string &);
protected:
InlineScript _script;
};
class MacroSegmentScriptInlineEdit : public QWidget {
Q_OBJECT
public:
MacroSegmentScriptInlineEdit(
QWidget *, std::shared_ptr<MacroSegmentScriptInline> = nullptr);
virtual ~MacroSegmentScriptInlineEdit() = default;
protected slots:
void ScriptTypeChanged(int);
void LanguageChanged(int);
void ScriptChanged();
void PathChanged(const QString &);
protected:
void PopulateWidgets();
void SetupWidgetConnections();
void SetupLayout();
void SetWidgetVisibility();
void SetupContentIssueWarning() const;
QComboBox *_scriptType;
QComboBox *_language;
ScriptEditor *_script;
FileSelection *_path;
QPushButton *_openFile;
QHBoxLayout *_fileLayout;
QLabel *_contentIssueWarning;
std::shared_ptr<MacroSegmentScriptInline> _entryData;
bool _loading = true;
};
} // namespace advss