Skip to content

Commit

Permalink
KnobChoice: ensure we do not display the ID of the internal planes in…
Browse files Browse the repository at this point in the history
… the GUI
  • Loading branch information
MrKepzie committed Jul 4, 2017
1 parent 5551454 commit 51b0294
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions Gui/KnobGuiChoice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,27 @@ KnobGuiChoice::updateToolTip()
_comboBox->setToolTip( tt );
}

// The project only saves the choice ID that was selected and not the associated label.
// If the ID cannot be found in the menu upon loading the project, then the ID of the choice
// will be displayed in the menu.
// For a plane selector, if the plane is not present in the menu when loading the project it will display
// the raw ID of the plane which contains stuff that should not be displayed to the user.
static void ensureUnknownChocieIsNotInternalPlaneID(QString& label)
{
if (label.contains(QLatin1String(kNatronColorPlaneID))) {
label.replace(QLatin1String(kNatronColorPlaneID), QLatin1String(kNatronColorPlaneLabel)); ;
} else if (label.contains(QLatin1String(kNatronBackwardMotionVectorsPlaneID))) {
label.replace(QLatin1String(kNatronBackwardMotionVectorsPlaneID), QLatin1String(kNatronBackwardMotionVectorsPlaneLabel)); ;
} else if (label.contains(QLatin1String(kNatronForwardMotionVectorsPlaneID))) {
label.replace(QLatin1String(kNatronForwardMotionVectorsPlaneID), QLatin1String(kNatronForwardMotionVectorsPlaneLabel)); ;
} else if (label.contains(QLatin1String(kNatronDisparityLeftPlaneID))) {
label.replace(QLatin1String(kNatronDisparityLeftPlaneID), QLatin1String(kNatronDisparityLeftPlaneLabel)); ;
} else if (label.contains(QLatin1String(kNatronDisparityRightPlaneID))) {
label.replace(QLatin1String(kNatronDisparityRightPlaneID), QLatin1String(kNatronDisparityRightPlaneLabel)); ;
}

}

void
KnobGuiChoice::updateGUI(int /*dimension*/)
{
Expand Down Expand Up @@ -386,6 +407,7 @@ KnobGuiChoice::updateGUI(int /*dimension*/)
if ( _comboBox->isCascading() || activeEntry.id.empty() ) {
_comboBox->setCurrentIndex_no_emit( knob->getValue() );
} else {
ensureUnknownChocieIsNotInternalPlaneID(activeEntryLabel);
_comboBox->setCurrentText_no_emit( activeEntryLabel );
}
}
Expand Down

0 comments on commit 51b0294

Please sign in to comment.