From 0ce64c2912697017fb2b74cbd8226c30699590c5 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 7 Sep 2026 16:13:15 +0000 Subject: [PATCH] Sort scene lists and transition dropdowns alphabetically OBS enumerates scenes and transitions in dock order, which turns the mark editor's "When coming from" / "And going to" lists and the transition pickers into a hunt once a collection grows. Sort all three case-insensitively (case only breaks ties, so the order stays stable). Scene lists are sorted after any names the matcher references but the collection no longer has are appended, so those stay in place alphabetically rather than piling up at the end. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01TUpBn7UAgdF4XVBGSQJVfv --- src/transition-tree-dialog.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/transition-tree-dialog.cpp b/src/transition-tree-dialog.cpp index 97c5f81..7fab590 100644 --- a/src/transition-tree-dialog.cpp +++ b/src/transition-tree-dialog.cpp @@ -94,6 +94,18 @@ QColor InvalidColor() return QColor(0xE0, 0x5A, 0x5A); } +/* OBS hands out scenes and transitions in dock order, which is arbitrary once + * a collection grows. Lists the user has to hunt through are sorted the way + * they would sort them by hand: case-insensitively, with case only breaking + * ties so the order stays stable. */ +void SortNames(QStringList &names) +{ + std::sort(names.begin(), names.end(), [](const QString &a, const QString &b) { + const int order = QString::compare(a, b, Qt::CaseInsensitive); + return order != 0 ? order < 0 : a < b; + }); +} + QString MarkSummary(const Mark &mark) { const auto usable = mark.UsableCandidates(); @@ -828,6 +840,8 @@ void TransitionTreeDialog::RefreshMatcherWidgets(const SceneMatcher &matcher, QC scenes << scene; } + SortNames(scenes); + const auto missing = matcher.MissingScenes(); for (const QString &scene : scenes) { auto *item = new QListWidgetItem(scene, sceneList); @@ -889,7 +903,8 @@ void TransitionTreeDialog::RefreshCandidateTable(Mark &mark) m_updating = true; const int previousRow = m_candidates->currentRow(); - const QStringList transitions = TransitionNames(); + QStringList transitions = TransitionNames(); + SortNames(transitions); m_candidates->setRowCount((int)mark.candidates.size()); @@ -996,8 +1011,11 @@ void TransitionTreeDialog::RefreshPresetPage() m_setDefaultTransition->setEnabled(true); m_setDefaultTransition->setChecked(preset->setDefaultTransition); + QStringList transitions = TransitionNames(); + SortNames(transitions); + m_defaultTransition->clear(); - m_defaultTransition->addItems(TransitionNames()); + m_defaultTransition->addItems(transitions); m_defaultTransition->setCurrentText(QString::fromUtf8(preset->defaultTransition.c_str())); m_defaultTransition->setEnabled(preset->setDefaultTransition);