diff --git a/Deliverables/sprint-13/build-documentation.pdf b/Deliverables/sprint-13/build-documentation.pdf new file mode 100644 index 00000000..d50baf22 Binary files /dev/null and b/Deliverables/sprint-13/build-documentation.pdf differ diff --git a/Deliverables/sprint-13/design-documentation.pdf b/Deliverables/sprint-13/design-documentation.pdf new file mode 100644 index 00000000..4e52f2b8 Binary files /dev/null and b/Deliverables/sprint-13/design-documentation.pdf differ diff --git a/Deliverables/sprint-13/user-documentation.pdf b/Deliverables/sprint-13/user-documentation.pdf new file mode 100644 index 00000000..5fbba4cc Binary files /dev/null and b/Deliverables/sprint-13/user-documentation.pdf differ diff --git a/GUI/src/main/kotlin/ui/components/general/ProjectManager.kt b/GUI/src/main/kotlin/ui/components/general/ProjectManager.kt index 5381f310..65433f29 100644 --- a/GUI/src/main/kotlin/ui/components/general/ProjectManager.kt +++ b/GUI/src/main/kotlin/ui/components/general/ProjectManager.kt @@ -36,10 +36,10 @@ fun ProjectMenu( state: MutableState, modifier: Modifier = Modifier, ) { - var errorDialogText = remember { mutableStateOf(null) } + val errorDialogText = remember { mutableStateOf(null) } var expanded by remember { mutableStateOf(false) } val padding = 8.dp - var showConfirmationDialog = remember { mutableStateOf(false) } + val showConfirmationDialog = remember { mutableStateOf(false) } if (errorDialogText.value != null) { ErrorDialog(onCloseRequest = { errorDialogText.value = null }, text = errorDialogText.value!!) @@ -88,7 +88,7 @@ fun ProjectMenu( Text("Save Project", fontSize = MaterialTheme.typography.bodyMedium.fontSize) }, onClick = { - openFileSaverAndGetPath(state.value.saveProjectPath) { path -> handleSaveProject(state, path) } + openFileSaverAndGetPath(state.value.saveProjectPath) { path -> handleSaveProject(state, path, errorDialogText) } expanded = false }, enabled = state.value.screen == Screen.DiffScreen, @@ -152,12 +152,19 @@ fun handleOpenProject( fun handleSaveProject( state: MutableState, path: String, + saveError: MutableState, ) { var savePath = path + // add .mkv extension if not present if (!savePath.endsWith(".mkv")) { savePath = "$savePath.mkv" } + + if (state.value.outputPath == savePath) { + saveError.value = "The project cannot be saved to the same location as the loaded project. Please choose a different location." + return + } // set save path state.value.saveProjectPath = savePath diff --git a/GUI/src/main/kotlin/ui/screens/DiffScreen.kt b/GUI/src/main/kotlin/ui/screens/DiffScreen.kt index 42049ca3..8322e681 100644 --- a/GUI/src/main/kotlin/ui/screens/DiffScreen.kt +++ b/GUI/src/main/kotlin/ui/screens/DiffScreen.kt @@ -54,12 +54,12 @@ import java.io.File @Composable fun DiffScreen(state: MutableState) { // create the navigator, which implements the jumping logic - val navigator = remember { FrameNavigation(state) } + val navigator = FrameNavigation(state) val showConfirmationDialog = remember { mutableStateOf(false) } val frameGrabber = FrameGrabber(state) val thumbnailGrabber = FrameGrabber(state) - DisposableEffect(Unit) { + DisposableEffect(state.value) { onDispose { frameGrabber.close() thumbnailGrabber.close() @@ -97,7 +97,23 @@ fun DiffScreen(state: MutableState) { Row { IconButton( modifier = Modifier.padding(8.dp), - content = { Icon(Icons.Default.ArrowBack, "back button") }, + content = { + Icon(Icons.Default.ArrowBack, "back button") + // ##### Confirmation Dialog ##### + ConfirmationPopup( + showDialog = showConfirmationDialog.value, + onConfirm = { + state.value = + state.value.copy( + screen = Screen.SelectVideoScreen, + hasUnsavedChanges = false, + ) + }, + onCancel = { showConfirmationDialog.value = false }, + text = + "Are you sure you want to go back to the main screen without saving the Difference Video?", + ) + }, onClick = { if (state.value.hasUnsavedChanges) { showConfirmationDialog.value = true @@ -170,18 +186,4 @@ fun DiffScreen(state: MutableState) { // ##### Navigation ##### NavigationButtons(navigator, Modifier.weight(1f), Modifier.weight(0.10f)) } - // ##### Confirmation Dialog ##### - ConfirmationPopup( - showDialog = showConfirmationDialog.value, - onConfirm = { - state.value = - state.value.copy( - screen = Screen.SelectVideoScreen, - hasUnsavedChanges = false, - ) - }, - onCancel = { showConfirmationDialog.value = false }, - text = - "Are you sure you want to go back to the main screen without saving the Difference Video?", - ) }