From 0449064f5dff1d087a4ece03fce4751580406468 Mon Sep 17 00:00:00 2001 From: WarmUpTill Date: Thu, 12 Oct 2023 20:54:03 +0200 Subject: [PATCH] Enable empty name warning to be hidden Used for the twitch token selection for which the whole name selection will be hidden if no token is connected. --- src/utils/item-selection-helpers.cpp | 10 ++++++++-- src/utils/item-selection-helpers.hpp | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/utils/item-selection-helpers.cpp b/src/utils/item-selection-helpers.cpp index 6b734f92..d5086d65 100644 --- a/src/utils/item-selection-helpers.cpp +++ b/src/utils/item-selection-helpers.cpp @@ -298,8 +298,14 @@ void ItemSettingsDialog::NameChanged(const QString &text) return; } if (text.isEmpty()) { - SetNameWarning( - obs_module_text("AdvSceneSwitcher.item.emptyName")); + if (_showNameEmptyWarning) { + SetNameWarning(obs_module_text( + "AdvSceneSwitcher.item.emptyName")); + return; + } + _nameHint->setText(""); + _nameHint->hide(); + _buttonbox->button(QDialogButtonBox::Ok)->setDisabled(true); return; } if (text == obs_module_text(_selectStr.data()) || diff --git a/src/utils/item-selection-helpers.hpp b/src/utils/item-selection-helpers.hpp index d060f5c2..eac3a5e5 100644 --- a/src/utils/item-selection-helpers.hpp +++ b/src/utils/item-selection-helpers.hpp @@ -59,6 +59,7 @@ protected: std::string_view _addStr; std::string_view _conflictStr; QString _originalName; + bool _showNameEmptyWarning = true; }; typedef bool (*SettingsCallback)(QWidget *, Item &);