Skip to content

Commit

Permalink
Apply default value to SplitProject
Browse files Browse the repository at this point in the history
  • Loading branch information
sdercolin committed Oct 16, 2023
1 parent 7458b52 commit dacf5d6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion src/main/kotlin/model/Feature.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,15 @@ sealed class FeatureConfig(val type: Feature) {
object ConvertPitch : FeatureConfig(Feature.ConvertPitch)
data class SplitProject(
val maxTrackCount: Int,
) : FeatureConfig(Feature.SplitProject)
) : FeatureConfig(Feature.SplitProject) {

companion object {
fun getDefault(format: Format): SplitProject = when (format) {
Format.Svp -> SplitProject(3)
else -> SplitProject(1)
}
}
}
}

fun List<FeatureConfig>.contains(feature: Feature) = any { it.type == feature }
2 changes: 1 addition & 1 deletion src/main/kotlin/ui/ConfigurationEditor.kt
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ val ConfigurationEditor = scopedFC<ConfigurationEditorProps> { props, scope ->
ProjectSplitState(
isAvailable = props.outputFormat.availableFeaturesForGeneration.contains(Feature.SplitProject),
isOn = false,
maxTrackCountInput = "1",
maxTrackCountInput = FeatureConfig.SplitProject.getDefault(props.outputFormat).maxTrackCount.toString(),
)
}
var dialogError by useState(DialogErrorState())
Expand Down

0 comments on commit dacf5d6

Please sign in to comment.