mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-06-18 06:40:31 -05:00
Rename function and class
This commit is contained in:
parent
11f769cf09
commit
e0602f8de2
|
|
@ -209,11 +209,11 @@ MacroConditionSceneOrderEdit::MacroConditionSceneOrderEdit(
|
|||
populateConditionSelection(_conditions);
|
||||
if (entryData.get()) {
|
||||
if (entryData->_condition == SceneOrderCondition::POSITION) {
|
||||
_sources->SetShowAllSelectionType(
|
||||
SceneItemSelectionWidget::AllSelectionType::ANY);
|
||||
_sources->SetPlaceholderType(
|
||||
SceneItemSelectionWidget::Placeholder::ANY);
|
||||
} else {
|
||||
_sources->SetShowAllSelectionType(
|
||||
SceneItemSelectionWidget::AllSelectionType::ALL);
|
||||
_sources->SetPlaceholderType(
|
||||
SceneItemSelectionWidget::Placeholder::ALL);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -301,11 +301,11 @@ void MacroConditionSceneOrderEdit::ConditionChanged(int index)
|
|||
SetWidgetVisibility(_entryData->_condition ==
|
||||
SceneOrderCondition::POSITION);
|
||||
if (_entryData->_condition == SceneOrderCondition::POSITION) {
|
||||
_sources->SetShowAllSelectionType(
|
||||
SceneItemSelectionWidget::AllSelectionType::ANY);
|
||||
_sources->SetPlaceholderType(
|
||||
SceneItemSelectionWidget::Placeholder::ANY);
|
||||
} else {
|
||||
_sources->SetShowAllSelectionType(
|
||||
SceneItemSelectionWidget::AllSelectionType::ALL);
|
||||
_sources->SetPlaceholderType(
|
||||
SceneItemSelectionWidget::Placeholder::ALL);
|
||||
}
|
||||
|
||||
emit HeaderInfoChanged(
|
||||
|
|
|
|||
|
|
@ -74,8 +74,7 @@ MacroConditionSceneTransformEdit::MacroConditionSceneTransformEdit(
|
|||
: QWidget(parent),
|
||||
_scenes(new SceneSelectionWidget(window(), true, false, false, true)),
|
||||
_sources(new SceneItemSelectionWidget(
|
||||
parent, true,
|
||||
SceneItemSelectionWidget::AllSelectionType::ANY)),
|
||||
parent, true, SceneItemSelectionWidget::Placeholder::ANY)),
|
||||
_getSettings(new QPushButton(obs_module_text(
|
||||
"AdvSceneSwitcher.condition.sceneTransform.getTransform"))),
|
||||
_settings(new ResizingPlainTextEdit(this)),
|
||||
|
|
|
|||
|
|
@ -208,11 +208,11 @@ void MacroConditionSceneVisibilityEdit::ConditionChanged(int index)
|
|||
static_cast<MacroConditionSceneVisibility::Condition>(index);
|
||||
if (_entryData->_condition ==
|
||||
MacroConditionSceneVisibility::Condition::CHANGED) {
|
||||
_sources->SetShowAllSelectionType(
|
||||
SceneItemSelectionWidget::AllSelectionType::ANY, false);
|
||||
_sources->SetPlaceholderType(
|
||||
SceneItemSelectionWidget::Placeholder::ANY, false);
|
||||
} else {
|
||||
_sources->SetShowAllSelectionType(
|
||||
SceneItemSelectionWidget::AllSelectionType::ALL, false);
|
||||
_sources->SetPlaceholderType(
|
||||
SceneItemSelectionWidget::Placeholder::ALL, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -226,11 +226,11 @@ void MacroConditionSceneVisibilityEdit::UpdateEntryData()
|
|||
_scenes->SetScene(_entryData->_scene);
|
||||
if (_entryData->_condition ==
|
||||
MacroConditionSceneVisibility::Condition::CHANGED) {
|
||||
_sources->SetShowAllSelectionType(
|
||||
SceneItemSelectionWidget::AllSelectionType::ANY, false);
|
||||
_sources->SetPlaceholderType(
|
||||
SceneItemSelectionWidget::Placeholder::ANY, false);
|
||||
} else {
|
||||
_sources->SetShowAllSelectionType(
|
||||
SceneItemSelectionWidget::AllSelectionType::ALL, false);
|
||||
_sources->SetPlaceholderType(
|
||||
SceneItemSelectionWidget::Placeholder::ALL, false);
|
||||
}
|
||||
_sources->SetSceneItem(_entryData->_source);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -276,8 +276,8 @@ void SceneItemSelectionWidget::PopulateItemSelection()
|
|||
|
||||
SceneItemSelectionWidget::SceneItemSelectionWidget(QWidget *parent,
|
||||
bool showAll,
|
||||
AllSelectionType type)
|
||||
: QWidget(parent), _hasAllEntry(showAll), _allType(type)
|
||||
Placeholder type)
|
||||
: QWidget(parent), _hasPlaceholderEntry(showAll), _placeholder(type)
|
||||
{
|
||||
_sceneItems = new QComboBox();
|
||||
_idx = new QComboBox();
|
||||
|
|
@ -316,7 +316,7 @@ void SceneItemSelectionWidget::SetSceneItem(const SceneItemSelection &item)
|
|||
switch (item._type) {
|
||||
case SceneItemSelection::Type::SOURCE: {
|
||||
int idx = item._idx;
|
||||
if (_hasAllEntry) {
|
||||
if (_hasPlaceholderEntry) {
|
||||
idx += 1;
|
||||
}
|
||||
_idx->setCurrentIndex(idx);
|
||||
|
|
@ -342,12 +342,12 @@ void SceneItemSelectionWidget::SetSceneItem(const SceneItemSelection &item)
|
|||
switch (item._idxType) {
|
||||
case SceneItemSelection::IdxType::ALL:
|
||||
case SceneItemSelection::IdxType::ANY:
|
||||
_allType = AllSelectionType::ALL;
|
||||
_placeholder = Placeholder::ALL;
|
||||
_idx->setCurrentIndex(0);
|
||||
break;
|
||||
case SceneItemSelection::IdxType::INDIVIDUAL:
|
||||
int idx = item._idx;
|
||||
if (_hasAllEntry) {
|
||||
if (_hasPlaceholderEntry) {
|
||||
idx += 1;
|
||||
}
|
||||
_idx->setCurrentIndex(idx);
|
||||
|
|
@ -364,15 +364,15 @@ void SceneItemSelectionWidget::SetScene(const SceneSelection &s)
|
|||
PopulateItemSelection();
|
||||
}
|
||||
|
||||
void SceneItemSelectionWidget::SetShowAll(bool value)
|
||||
void SceneItemSelectionWidget::ShowPlaceholder(bool value)
|
||||
{
|
||||
_hasAllEntry = value;
|
||||
_hasPlaceholderEntry = value;
|
||||
}
|
||||
|
||||
void SceneItemSelectionWidget::SetShowAllSelectionType(AllSelectionType t,
|
||||
bool resetSelection)
|
||||
void SceneItemSelectionWidget::SetPlaceholderType(Placeholder t,
|
||||
bool resetSelection)
|
||||
{
|
||||
_allType = t;
|
||||
_placeholder = t;
|
||||
if (resetSelection) {
|
||||
_sceneItems->setCurrentIndex(0);
|
||||
} else {
|
||||
|
|
@ -400,12 +400,12 @@ void SceneItemSelectionWidget::SelectionChanged(const QString &name)
|
|||
_idx->hide();
|
||||
}
|
||||
|
||||
if (_hasAllEntry) {
|
||||
switch (_allType) {
|
||||
case SceneItemSelectionWidget::AllSelectionType::ALL:
|
||||
if (_hasPlaceholderEntry) {
|
||||
switch (_placeholder) {
|
||||
case SceneItemSelectionWidget::Placeholder::ALL:
|
||||
s._idxType = SceneItemSelection::IdxType::ALL;
|
||||
break;
|
||||
case SceneItemSelectionWidget::AllSelectionType::ANY:
|
||||
case SceneItemSelectionWidget::Placeholder::ANY:
|
||||
s._idxType = SceneItemSelection::IdxType::ANY;
|
||||
break;
|
||||
}
|
||||
|
|
@ -431,19 +431,19 @@ void SceneItemSelectionWidget::IdxChanged(int idx)
|
|||
}
|
||||
|
||||
_currentSelection._idx = idx;
|
||||
if (_hasAllEntry && idx == 0) {
|
||||
switch (_allType) {
|
||||
case SceneItemSelectionWidget::AllSelectionType::ALL:
|
||||
if (_hasPlaceholderEntry && idx == 0) {
|
||||
switch (_placeholder) {
|
||||
case SceneItemSelectionWidget::Placeholder::ALL:
|
||||
_currentSelection._idxType =
|
||||
SceneItemSelection::IdxType::ALL;
|
||||
break;
|
||||
case SceneItemSelectionWidget::AllSelectionType::ANY:
|
||||
case SceneItemSelectionWidget::Placeholder::ANY:
|
||||
_currentSelection._idxType =
|
||||
SceneItemSelection::IdxType::ANY;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (_hasAllEntry && idx > 0) {
|
||||
if (_hasPlaceholderEntry && idx > 0) {
|
||||
_currentSelection._idx -= 1;
|
||||
_currentSelection._idxType =
|
||||
SceneItemSelection::IdxType::INDIVIDUAL;
|
||||
|
|
@ -473,8 +473,8 @@ void SceneItemSelectionWidget::ItemRename(const QString &, const QString &)
|
|||
void SceneItemSelectionWidget::SetupIdxSelection(int sceneItemCount)
|
||||
{
|
||||
_idx->clear();
|
||||
if (_hasAllEntry) {
|
||||
if (_allType == AllSelectionType::ALL) {
|
||||
if (_hasPlaceholderEntry) {
|
||||
if (_placeholder == Placeholder::ALL) {
|
||||
_idx->addItem(obs_module_text(
|
||||
"AdvSceneSwitcher.sceneItemSelection.all"));
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -43,16 +43,13 @@ class SceneItemSelectionWidget : public QWidget {
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
// Influences what is being displaye for the "all" entry
|
||||
enum class AllSelectionType { ALL, ANY };
|
||||
SceneItemSelectionWidget(
|
||||
QWidget *parent, bool addAllSelection = true,
|
||||
AllSelectionType allType = AllSelectionType::ALL);
|
||||
enum class Placeholder { ALL, ANY };
|
||||
SceneItemSelectionWidget(QWidget *parent, bool addPlaceholder = true,
|
||||
Placeholder placeholderType = Placeholder::ALL);
|
||||
void SetSceneItem(const SceneItemSelection &);
|
||||
void SetScene(const SceneSelection &);
|
||||
void SetShowAll(bool);
|
||||
void SetShowAllSelectionType(AllSelectionType t,
|
||||
bool resetSelection = true);
|
||||
void ShowPlaceholder(bool);
|
||||
void SetPlaceholderType(Placeholder t, bool resetSelection = true);
|
||||
signals:
|
||||
void SceneItemChanged(const SceneItemSelection &);
|
||||
|
||||
|
|
@ -74,8 +71,8 @@ private:
|
|||
|
||||
SceneSelection _scene;
|
||||
SceneItemSelection _currentSelection;
|
||||
bool _hasAllEntry = false;
|
||||
AllSelectionType _allType = AllSelectionType::ALL;
|
||||
bool _hasPlaceholderEntry = false;
|
||||
Placeholder _placeholder = Placeholder::ALL;
|
||||
|
||||
// Order of entries
|
||||
// 1. "select entry" entry
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user