Add option to set and check list source settings by name

This makes it easier to select the intended settings value as the
underlying value often has no direct connection to the user facing name.

It also makes it possible to select list entries whos underlying value
changes frequently, but the user facing value does not.
(E.g. device IDs based on the input port compared to the device name)
This commit is contained in:
WarmUpTill
2025-06-17 20:58:27 +02:00
committed by WarmUpTill
parent 874b9b86e2
commit 3e1fdbde45
14 changed files with 492 additions and 48 deletions

View File

@@ -6,6 +6,7 @@
#include <obs-frontend-api.h>
#include <QGraphicsColorizeEffect>
#include <QListView>
#include <QMainWindow>
#include <QPropertyAnimation>
#include <QScrollBar>
@@ -104,6 +105,19 @@ int FindIdxInRagne(QComboBox *list, int start, int stop,
return foundIdx;
}
void SetRowVisibleByValue(QComboBox *list, const QString &value, bool show)
{
int index = list->findText(value);
if (index == -1) {
return;
}
auto view = qobject_cast<QListView *>(list->view());
if (view) {
view->setRowHidden(index, !show);
}
}
QWidget *GetSettingsWindow()
{
return SettingsWindowIsOpened() ? AdvSceneSwitcher::window : nullptr;