Add support for variables in file FileSelection widget

This commit is contained in:
WarmUpTill 2023-02-22 14:23:18 +01:00 committed by WarmUpTill
parent 1dd46fb777
commit 783f76d55d
3 changed files with 15 additions and 7 deletions

View File

@ -1257,7 +1257,7 @@ void MacroConditionVideoEdit::UpdateEntryData()
_patternMatchMode->setCurrentIndex(_patternMatchMode->findData(
_entryData->_patternMatchParameters.matchMode));
_brightnessThreshold->SetDoubleValue(_entryData->_brightnessThreshold);
_modelDataPath->SetPath(_entryData->GetModelDataPath().c_str());
_modelDataPath->SetPath(_entryData->GetModelDataPath());
_objectScaleThreshold->SetDoubleValue(
_entryData->_objMatchParameters.scaleFactor);
_matchText->setPlainText(_entryData->_ocrParamters.text);

View File

@ -7,12 +7,12 @@
#include <filesystem>
FileSelection::FileSelection(FileSelection::Type type, QWidget *parent)
: QWidget(parent), _type(type)
: QWidget(parent),
_type(type),
_filePath(new VariableLineEdit(this)),
_browseButton(
new QPushButton(obs_module_text("AdvSceneSwitcher.browse")))
{
_filePath = new QLineEdit();
_browseButton =
new QPushButton(obs_module_text("AdvSceneSwitcher.browse"));
QWidget::connect(_filePath, SIGNAL(editingFinished()), this,
SLOT(PathChange()));
QWidget::connect(_browseButton, SIGNAL(clicked()), this,
@ -24,6 +24,11 @@ FileSelection::FileSelection(FileSelection::Type type, QWidget *parent)
setLayout(layout);
}
void FileSelection::SetPath(const VariableResolvingString &path)
{
_filePath->setText(path);
}
void FileSelection::SetPath(const QString &path)
{
_filePath->setText(path);

View File

@ -1,4 +1,6 @@
#pragma once
#include "variable-line-edit.hpp"
#include <QLineEdit>
#include <QPushButton>
#include <QWidget>
@ -15,6 +17,7 @@ public:
FileSelection(FileSelection::Type type = FileSelection::Type::READ,
QWidget *parent = 0);
void SetPath(const VariableResolvingString &);
void SetPath(const QString &);
QPushButton *Button() { return _browseButton; }
static QString ValidPathOrDesktop(const QString &path);
@ -27,6 +30,6 @@ signals:
private:
Type _type;
QLineEdit *_filePath;
VariableLineEdit *_filePath;
QPushButton *_browseButton;
};