Skip to content

Commit

Permalink
Show refresh button if source / filter selection is a variable
Browse files Browse the repository at this point in the history
  • Loading branch information
WarmUpTill committed Feb 13, 2024
1 parent 3760fa8 commit 69a9302
Show file tree
Hide file tree
Showing 16 changed files with 175 additions and 58 deletions.
5 changes: 2 additions & 3 deletions data/locale/de-DE.ini
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ AdvSceneSwitcher.condition.filter.type.active="Ist aktiviert"
AdvSceneSwitcher.condition.filter.type.showing="Ist deaktiviert"
AdvSceneSwitcher.condition.filter.type.settingsMatch="Einstellungen passen"
AdvSceneSwitcher.condition.filter.getSettings="Aktuelle Einstellungen abrufen"
AdvSceneSwitcher.condition.filter.entry.line1="Auf{{sources}}{{filters}}{{conditions}}{{settingSelection}}"
AdvSceneSwitcher.condition.filter.entry.line1="Auf{{sources}}{{filters}}{{conditions}}{{settingSelection}}{{refresh}}"
AdvSceneSwitcher.condition.filter.entry.line2="{{settings}}"
AdvSceneSwitcher.condition.filter.entry.line3="{{regex}} {{getSettings}}"
AdvSceneSwitcher.condition.sceneOrder="Reihenfolge der Szenenelemente"
Expand Down Expand Up @@ -445,7 +445,7 @@ AdvSceneSwitcher.action.filter="Filter"
AdvSceneSwitcher.action.filter.type.enable="Aktivieren"
AdvSceneSwitcher.action.filter.type.disable="Deaktivieren"
AdvSceneSwitcher.action.filter.type.settings="Einstellungen festlegen"
AdvSceneSwitcher.action.filter.entry="Auf {{sources}} {{actions}} {{filters}}"
AdvSceneSwitcher.action.filter.entry="Auf{{sources}}{{actions}}{{filters}}{{filters}}{{refresh}}"
AdvSceneSwitcher.action.filter.getSettings="Aktuelle Einstellungen abfragen"
AdvSceneSwitcher.action.source="Quelle"
AdvSceneSwitcher.action.source.type.enable="Aktivieren"
Expand All @@ -455,7 +455,6 @@ AdvSceneSwitcher.action.source.type.refreshSettings="Aktualisieren der Quellenei
AdvSceneSwitcher.action.source.type.pressSettingsButton="Drücken der Einstellungstaste"
AdvSceneSwitcher.action.source.type.refreshSettings.tooltip="Kann verwendet werden, um Browser-, Medien- usw. Quellen zu aktualisieren"
AdvSceneSwitcher.action.source.noSettingsButtons="Keine Buttons gefunden!"
AdvSceneSwitcher.action.source.entry="{{actions}}{{sources}}{{settingsButtons}}{{deinterlaceMode}}{{deinterlaceOrder}}"
AdvSceneSwitcher.action.source.warning="Warnung: Das globale Aktivieren und Deaktivieren von Quellen kann nicht über die OBS-Benutzeroberfläche gesteuert werden"
AdvSceneSwitcher.action.source.getSettings="Aktuelle Einstellungen abfragen"
AdvSceneSwitcher.action.media="Medien"
Expand Down
16 changes: 12 additions & 4 deletions data/locale/en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -380,9 +380,11 @@ AdvSceneSwitcher.condition.source.type.settingsMatch="Settings match"
AdvSceneSwitcher.condition.source.type.settingsChanged="Settings changed"
AdvSceneSwitcher.condition.source.type.individualSettingMatches="Setting value matches"
AdvSceneSwitcher.condition.source.type.individualSettingChanged="Setting value changed"
AdvSceneSwitcher.condition.source.refresh="Refresh"
AdvSceneSwitcher.condition.source.refreshTooltip="Repopulate the source settings selection with the settings of the source which's name matches the variable value."
AdvSceneSwitcher.condition.source.sceneVisibilityHint="Scene specific visibility can be checked using the \"Scene item visibility\" condition"
AdvSceneSwitcher.condition.source.getSettings="Get current settings"
AdvSceneSwitcher.condition.source.entry.line1="{{sources}}{{conditions}}{{settingSelection}}"
AdvSceneSwitcher.condition.source.entry.line1="{{sources}}{{conditions}}{{settingSelection}}{{refresh}}"
AdvSceneSwitcher.condition.source.entry.line2="{{settings}}"
AdvSceneSwitcher.condition.source.entry.line3="{{regex}}{{getSettings}}"
AdvSceneSwitcher.condition.virtualCamera="Virtual camera"
Expand All @@ -396,8 +398,10 @@ AdvSceneSwitcher.condition.filter.type.settingsMatch="Settings match"
AdvSceneSwitcher.condition.filter.type.settingsChanged="Settings changed"
AdvSceneSwitcher.condition.filter.type.individualSettingMatches="Settings value matches"
AdvSceneSwitcher.condition.filter.type.individualSettingChanged="Settings value changed"
AdvSceneSwitcher.condition.filter.refresh="Refresh"
AdvSceneSwitcher.condition.filter.refreshTooltip="Repopulate the filter settings selection with the settings of the filter which's name matches the variable value."
AdvSceneSwitcher.condition.filter.getSettings="Get current settings"
AdvSceneSwitcher.condition.filter.entry.line1="On{{sources}}{{filters}}{{conditions}}{{settingSelection}}"
AdvSceneSwitcher.condition.filter.entry.line1="On{{sources}}{{filters}}{{conditions}}{{settingSelection}}{{refresh}}"
AdvSceneSwitcher.condition.filter.entry.line2="{{settings}}"
AdvSceneSwitcher.condition.filter.entry.line3="{{regex}}{{getSettings}}"
AdvSceneSwitcher.condition.sceneOrder="Scene item order"
Expand Down Expand Up @@ -665,7 +669,9 @@ AdvSceneSwitcher.action.filter.type.enable="Enable"
AdvSceneSwitcher.action.filter.type.disable="Disable"
AdvSceneSwitcher.action.filter.type.toggle="Toggle"
AdvSceneSwitcher.action.filter.type.settings="Set settings"
AdvSceneSwitcher.action.filter.entry="On{{sources}}{{actions}}{{filters}}"
AdvSceneSwitcher.action.filter.refresh="Refresh"
AdvSceneSwitcher.action.filter.refreshTooltip="Repopulate the filter settings selection with the settings of the filter which's name matches the variable value."
AdvSceneSwitcher.action.filter.entry="On{{sources}}{{actions}}{{filters}}{{refresh}}"
AdvSceneSwitcher.action.filter.entry.settings="{{settings}}{{settingsInputMethod}}{{settingValue}}{{tempVar}}"
AdvSceneSwitcher.action.filter.getSettings="Get current settings"
AdvSceneSwitcher.action.filter.inputMethod.individualManual="Set to fixed value"
Expand All @@ -684,7 +690,7 @@ AdvSceneSwitcher.action.source.type.openInteractionDialog="Open interaction dial
AdvSceneSwitcher.action.source.type.openFilterDialog="Open filter dialog"
AdvSceneSwitcher.action.source.type.openPropertiesDialog="Open properties dialog"
AdvSceneSwitcher.action.source.noSettingsButtons="No buttons found!"
AdvSceneSwitcher.action.source.entry="{{actions}}{{sources}}{{settingsButtons}}{{deinterlaceMode}}{{deinterlaceOrder}}"
AdvSceneSwitcher.action.source.entry="{{actions}}{{sources}}{{settingsButtons}}{{deinterlaceMode}}{{deinterlaceOrder}}{{refresh}}"
AdvSceneSwitcher.action.source.entry.settings="{{settings}}{{settingsInputMethod}}{{settingValue}}{{tempVar}}"
AdvSceneSwitcher.action.source.warning="Warning: Enabling and disabling sources globally cannot be controlled by the OBS UI\nYou might be looking for \"Scene item visibility\""
AdvSceneSwitcher.action.source.getSettings="Get current settings"
Expand All @@ -702,6 +708,8 @@ AdvSceneSwitcher.action.source.deinterlaceOrder.bottomFieldFirst="Bottom Field F
AdvSceneSwitcher.action.source.inputMethod.individualManual="Set to fixed value"
AdvSceneSwitcher.action.source.inputMethod.individualTempvar="Set to macro property"
AdvSceneSwitcher.action.source.inputMethod.json="Set setting JSON string"
AdvSceneSwitcher.action.source.refresh="Refresh"
AdvSceneSwitcher.action.source.refreshTooltip="Repopulate the source settings selection with the settings of the source which's name matches the variable value."
AdvSceneSwitcher.action.media="Media"
AdvSceneSwitcher.action.media.type.play="Play"
AdvSceneSwitcher.action.media.type.pause="Pause"
Expand Down
5 changes: 2 additions & 3 deletions data/locale/es-ES.ini
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ AdvSceneSwitcher.condition.filter.type.active="Está habilitado"
AdvSceneSwitcher.condition.filter.type.showing="Está deshabilitado"
AdvSceneSwitcher.condition.filter.type.settingsMatch="Coincidencia de configuración"
AdvSceneSwitcher.condition.filter.getSettings="Obtener la configuración actual"
AdvSceneSwitcher.condition.filter.entry.line1="En{{sources}}{{filters}}{{conditions}}{{settingSelection}}"
AdvSceneSwitcher.condition.filter.entry.line1="En{{sources}}{{filters}}{{conditions}}{{settingSelection}}{{refresh}}"
AdvSceneSwitcher.condition.filter.entry.line2="{{settings}}"
AdvSceneSwitcher.condition.filter.entry.line3="{{regex}} {{getSettings}}"
AdvSceneSwitcher.condition.sceneOrder="Orden de elementos de escena"
Expand Down Expand Up @@ -367,13 +367,12 @@ AdvSceneSwitcher.action.filter="Filtro"
AdvSceneSwitcher.action.filter.type.enable="Habilitar"
AdvSceneSwitcher.action.filter.type.disable="Deshabilitar"
AdvSceneSwitcher.action.filter.type.settings="Establecer configuración"
AdvSceneSwitcher.action.filter.entry="En {{sources}} {{actions}} {{filters}}"
AdvSceneSwitcher.action.filter.entry="En{{sources}}{{actions}}{{filters}}{{refresh}}"
AdvSceneSwitcher.action.filter.getSettings="Obtener la configuración actual"
AdvSceneSwitcher.action.source="Fuente"
AdvSceneSwitcher.action.source.type.enable="Habilitar"
AdvSceneSwitcher.action.source.type.disable="Deshabilitar"
AdvSceneSwitcher.action.source.type.settings="Establecer configuración"
AdvSceneSwitcher.action.source.entry="{{actions}}{{sources}}{{settingsButtons}}{{deinterlaceMode}}{{deinterlaceOrder}}"
AdvSceneSwitcher.action.source.warning="Advertencia: la IU de OBS no puede controlar la habilitación y deshabilitación global de fuentes"
AdvSceneSwitcher.action.source.getSettings="Obtener la configuración actual"
AdvSceneSwitcher.action.media="Medios"
Expand Down
4 changes: 2 additions & 2 deletions data/locale/fr-FR.ini
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ AdvSceneSwitcher.condition.filter.type.showing="Est désactivé"
AdvSceneSwitcher.condition.filter.type.settingsMatch="Correspond aux paramètres"
AdvSceneSwitcher.condition.filter.type.settingsChanged="Paramètres modifiés"
AdvSceneSwitcher.condition.filter.getSettings="Obtenir les paramètres actuels"
AdvSceneSwitcher.condition.filter.entry.line1="Sur{{sources}}{{filters}}{{conditions}}{{settingSelection}}"
AdvSceneSwitcher.condition.filter.entry.line1="Sur{{sources}}{{filters}}{{conditions}}{{settingSelection}}{{refresh}}"
AdvSceneSwitcher.condition.sceneOrder="Ordre des éléments de la scène"
AdvSceneSwitcher.condition.sceneOrder.type.above="Est au-dessus de"
AdvSceneSwitcher.condition.sceneOrder.type.below="Est en dessous de"
Expand Down Expand Up @@ -523,7 +523,7 @@ AdvSceneSwitcher.action.filter.type.enable="Activer"
AdvSceneSwitcher.action.filter.type.disable="Désactiver"
AdvSceneSwitcher.action.filter.type.toggle="Basculer"
AdvSceneSwitcher.action.filter.type.settings="Définir les paramètres"
AdvSceneSwitcher.action.filter.entry="Sur{{sources}}{{actions}}{{filters}}"
AdvSceneSwitcher.action.filter.entry="Sur{{sources}}{{actions}}{{filters}}{{refresh}}"
AdvSceneSwitcher.action.filter.getSettings="Obtenir les paramètres actuels"
AdvSceneSwitcher.action.source="Source"
AdvSceneSwitcher.action.source.type.enable="Activer"
Expand Down
5 changes: 2 additions & 3 deletions data/locale/tr-TR.ini
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ AdvSceneSwitcher.condition.filter.type.active="Etkinleştirildi"
AdvSceneSwitcher.condition.filter.type.showing="Etkisizleştirildi"
AdvSceneSwitcher.condition.filter.type.settingsMatch="Ayarlar eşleşti"
AdvSceneSwitcher.condition.filter.getSettings="Mevcut ayarları al"
AdvSceneSwitcher.condition.filter.entry.line1="Açık{{sources}}{{filters}}{{conditions}}{{settingSelection}}"
AdvSceneSwitcher.condition.filter.entry.line1="Açık{{sources}}{{filters}}{{conditions}}{{settingSelection}}{{refresh}}"
AdvSceneSwitcher.condition.filter.entry.line2="{{settings}}"
AdvSceneSwitcher.condition.filter.entry.line3="{{regex}} {{getSettings}}"
AdvSceneSwitcher.condition.sceneOrder="Sahne öğesi sırası"
Expand Down Expand Up @@ -297,13 +297,12 @@ AdvSceneSwitcher.action.filter="Filtrele"
AdvSceneSwitcher.action.filter.type.enable="Etkin"
AdvSceneSwitcher.action.filter.type.disable="Etkisiz"
AdvSceneSwitcher.action.filter.type.settings="Ayarları yap"
AdvSceneSwitcher.action.filter.entry="Açık {{sources}} {{actions}} {{filters}}"
AdvSceneSwitcher.action.filter.entry="Açık{{sources}}{{actions}}{{filters}}{{refresh}}"
AdvSceneSwitcher.action.filter.getSettings="Mevcut ayarları al"
AdvSceneSwitcher.action.source="Kaynak"
AdvSceneSwitcher.action.source.type.enable="Etkin"
AdvSceneSwitcher.action.source.type.disable="Etkisiz"
AdvSceneSwitcher.action.source.type.settings="Ayarları yap"
AdvSceneSwitcher.action.source.entry="{{actions}}{{sources}}{{settingsButtons}}{{deinterlaceMode}}{{deinterlaceOrder}}"
AdvSceneSwitcher.action.source.warning="Uyarı: Kaynakların global olarak etkinleştirilmesi ve devre dışı bırakılması, OBS UI tarafından kontrol edilemez"
AdvSceneSwitcher.action.source.getSettings="Mevcut Ayarları yap"
AdvSceneSwitcher.action.media="Medya"
Expand Down
5 changes: 2 additions & 3 deletions data/locale/zh-CN.ini
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ AdvSceneSwitcher.condition.filter.type.active="已启用"
AdvSceneSwitcher.condition.filter.type.showing="已关闭"
AdvSceneSwitcher.condition.filter.type.settingsMatch="设置完全匹配"
AdvSceneSwitcher.condition.filter.getSettings="获取当前设置"
AdvSceneSwitcher.condition.filter.entry.line1="在{{sources}}的{{filters}}是{{conditions}}{{settingSelection}}"
AdvSceneSwitcher.condition.filter.entry.line1="在{{sources}}的{{filters}}是{{conditions}}{{settingSelection}}{{refresh}}"
AdvSceneSwitcher.condition.filter.entry.line2="{{settings}}"
AdvSceneSwitcher.condition.filter.entry.line3="{{regex}} {{getSettings}}"
AdvSceneSwitcher.condition.sceneOrder="场景项目顺序"
Expand Down Expand Up @@ -502,7 +502,7 @@ AdvSceneSwitcher.action.filter="滤镜"
AdvSceneSwitcher.action.filter.type.enable="开启"
AdvSceneSwitcher.action.filter.type.disable="关闭"
AdvSceneSwitcher.action.filter.type.settings="参数设置"
AdvSceneSwitcher.action.filter.entry=" {{sources}} {{actions}} {{filters}}"
AdvSceneSwitcher.action.filter.entry="置{{sources}}{{actions}}{{filters}}{{refresh}}"
AdvSceneSwitcher.action.filter.getSettings="获取当前设置"
AdvSceneSwitcher.action.source=""
AdvSceneSwitcher.action.source.type.enable="启用"
Expand All @@ -512,7 +512,6 @@ AdvSceneSwitcher.action.source.type.refreshSettings="刷新源设置"
AdvSceneSwitcher.action.source.type.pressSettingsButton="按下设置按钮"
AdvSceneSwitcher.action.source.type.refreshSettings.tooltip="可用于刷新浏览器、媒体、源、etc"
AdvSceneSwitcher.action.source.noSettingsButtons="未找到按钮!"
AdvSceneSwitcher.action.source.entry="{{actions}}{{sources}}{{settingsButtons}}{{deinterlaceMode}}{{deinterlaceOrder}}"
AdvSceneSwitcher.action.source.warning="警告:OBS UI无法控制全局启用和禁用源,注意,通过这个设置禁用,我测试,你必须通过这个在启用才行,不然点击小眼睛你无法显示!"
AdvSceneSwitcher.action.source.getSettings="获取当前设置"
AdvSceneSwitcher.action.media="媒体"
Expand Down
36 changes: 30 additions & 6 deletions plugins/base/macro-action-filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,14 +187,18 @@ MacroActionFilterEdit::MacroActionFilterEdit(
_manualSettingValue(new VariableTextEdit(this, 5, 1, 1)),
_tempVars(new TempVariableSelection(this)),
_filterSettings(new SourceSettingSelection(this)),
_settingsString(new VariableTextEdit(this))
_settingsString(new VariableTextEdit(this)),
_refreshSettingSelection(new QPushButton(
obs_module_text("AdvSceneSwitcher.action.filter.refresh")))
{
_filters->setSizeAdjustPolicy(QComboBox::AdjustToContents);

populateActionSelection(_actions);
auto sources = GetSourcesWithFilterNames();
sources.sort();
_sources->SetSourceNameList(sources);
_refreshSettingSelection->setToolTip(obs_module_text(
"AdvSceneSwitcher.action.filter.refreshTooltip"));

populateSettingsInputMethods(_settingsInputMethods);

Expand All @@ -221,6 +225,8 @@ MacroActionFilterEdit::MacroActionFilterEdit(
QWidget::connect(_filterSettings,
SIGNAL(SelectionChanged(const SourceSetting &)), this,
SLOT(SelectionChanged(const SourceSetting &)));
QWidget::connect(_refreshSettingSelection, SIGNAL(clicked()), this,
SLOT(RefreshVariableSourceSelectionValue()));

auto entrylayout = new QHBoxLayout;

Expand All @@ -232,8 +238,8 @@ MacroActionFilterEdit::MacroActionFilterEdit(
{"{{settingsInputMethod}}", _settingsInputMethods},
{"{{settingValue}}", _manualSettingValue},
{"{{tempVar}}", _tempVars},
{"{{getSettings}}", _getSettings},
};
{"{{refresh}}", _refreshSettingSelection}};

PlaceWidgets(obs_module_text("AdvSceneSwitcher.action.filter.entry"),
entrylayout, widgetPlaceholders);
_settingsLayout->setContentsMargins(0, 0, 0, 0);
Expand Down Expand Up @@ -302,6 +308,7 @@ void MacroActionFilterEdit::FilterChanged(const FilterSelection &filter)
const auto filters =
_entryData->_filter.GetFilters(_entryData->_source);
_filterSettings->SetSource(filters.empty() ? nullptr : filters.at(0));
SetWidgetVisibility();
emit HeaderInfoChanged(
QString::fromStdString(_entryData->GetShortDesc()));
}
Expand All @@ -328,9 +335,11 @@ void MacroActionFilterEdit::GetSettingsClicked()
case MacroActionFilter::SettingsInputMethod::INDIVIDUAL_MANUAL: {
const auto filters =
_entryData->_filter.GetFilters(_entryData->_source);
_manualSettingValue->setPlainText(GetSourceSettingValue(
filters.empty() ? nullptr : filters.at(0),
_entryData->_setting));
_manualSettingValue->setPlainText(
GetSourceSettingValue(filters.empty() ? nullptr
: filters.at(0),
_entryData->_setting)
.value_or(""));
break;
}
case MacroActionFilter::SettingsInputMethod::INDIVIDUAL_TEMPVAR:
Expand Down Expand Up @@ -407,6 +416,13 @@ void MacroActionFilterEdit::ManualSettingsValueChanged()
updateGeometry();
}

void MacroActionFilterEdit::RefreshVariableSourceSelectionValue()
{
const auto filters =
_entryData->_filter.GetFilters(_entryData->_source);
_filterSettings->SetSource(filters.empty() ? nullptr : filters.at(0));
}

void MacroActionFilterEdit::SetWidgetVisibility()
{
SetLayoutVisible(_settingsLayout,
Expand Down Expand Up @@ -438,6 +454,14 @@ void MacroActionFilterEdit::SetWidgetVisibility()
_manualSettingValue->hide();
}

_refreshSettingSelection->setVisible(
_entryData->_settingsInputMethod ==
MacroActionFilter::SettingsInputMethod::INDIVIDUAL_MANUAL &&
(_entryData->_source.GetType() ==
SourceSelection::Type::VARIABLE ||
_entryData->_filter.GetType() ==
FilterSelection::Type::VARIABLE));

adjustSize();
updateGeometry();
}
Expand Down
2 changes: 2 additions & 0 deletions plugins/base/macro-action-filter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ private slots:
void SelectionChanged(const TempVariableRef &);
void SelectionChanged(const SourceSetting &);
void ManualSettingsValueChanged();
void RefreshVariableSourceSelectionValue();
signals:
void HeaderInfoChanged(const QString &);

Expand All @@ -93,6 +94,7 @@ private slots:
TempVariableSelection *_tempVars;
SourceSettingSelection *_filterSettings;
VariableTextEdit *_settingsString;
QPushButton *_refreshSettingSelection;

std::shared_ptr<MacroActionFilter> _entryData;

Expand Down
Loading

0 comments on commit 69a9302

Please sign in to comment.