-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(media): add audio icon SVG and enhance SlideMedia with media typ…
…e detection feat(export): enhance media handling by copying media parts and relationships during slide export media audio stable media based on content-type feat(slide): refactor media icon creation and positioning for improved layout video stable
- Loading branch information
1 parent
75a97a6
commit 8e8e5fe
Showing
15 changed files
with
748 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
615 changes: 602 additions & 13 deletions
615
backend/src/main/java/fr/cgi/magneto/helper/SlideHelper.java
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
package fr.cgi.magneto.model.slides; | ||
|
||
import org.apache.poi.xslf.usermodel.XSLFSlide; | ||
|
||
public abstract class Slide { | ||
protected String title; | ||
protected String description = ""; | ||
|
||
public abstract Object createApacheSlide(); | ||
public abstract Object createApacheSlide(XSLFSlide newSlide); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
backend/src/main/java/fr/cgi/magneto/model/slides/SlideDescription.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
package fr.cgi.magneto.model.slides; | ||
|
||
import org.apache.poi.xslf.usermodel.XSLFSlide; | ||
|
||
public class SlideDescription extends Slide { | ||
|
||
public SlideDescription(String description) { | ||
this.description = description; | ||
} | ||
|
||
@Override | ||
public Object createApacheSlide() { | ||
public Object createApacheSlide(XSLFSlide newSlide) { | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 62 additions & 12 deletions
74
backend/src/main/java/fr/cgi/magneto/model/slides/SlideMedia.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,83 @@ | ||
package fr.cgi.magneto.model.slides; | ||
|
||
import org.apache.poi.xslf.usermodel.XMLSlideShow; | ||
import org.apache.poi.xslf.usermodel.XSLFSlide; | ||
import fr.cgi.magneto.helper.SlideHelper; | ||
|
||
public class SlideMedia extends Slide { | ||
|
||
public enum MediaType { | ||
IMAGE, | ||
AUDIO, | ||
VIDEO | ||
} | ||
|
||
private byte[] resourceData; | ||
private final String fileExtension; | ||
private final String fileContentType; | ||
private final String caption; | ||
private final MediaType mediaType; | ||
|
||
public SlideMedia(String title, String caption, byte[] resourceData, | ||
String fileExtension) { | ||
String fileContentType) { | ||
this.title = title; | ||
this.caption = caption; | ||
this.resourceData = resourceData; | ||
this.fileExtension = fileExtension; | ||
this.fileContentType = fileContentType; | ||
this.mediaType = determineMediaType(fileContentType); | ||
|
||
// Log des informations dans le constructeur | ||
System.out.println("SlideMedia - Construction:"); | ||
System.out.println("Title: " + title); | ||
System.out.println("Caption: " + caption); | ||
System.out.println("File extension: " + fileContentType); | ||
System.out.println( | ||
"Resource data present: " + (resourceData != null ? "Yes (" + resourceData.length + " bytes)" : "No")); | ||
System.out.println("Determined media type: " + mediaType); | ||
} | ||
|
||
@Override | ||
public Object createApacheSlide() { | ||
private MediaType determineMediaType(String contentType) { | ||
String type = contentType.toLowerCase(); | ||
MediaType mediaType; | ||
|
||
if (type.startsWith("audio/")) { | ||
mediaType = MediaType.AUDIO; | ||
} else if (type.startsWith("video/")) { | ||
mediaType = MediaType.VIDEO; | ||
} else { | ||
mediaType = MediaType.IMAGE; | ||
} | ||
|
||
XMLSlideShow ppt = new XMLSlideShow(); | ||
XSLFSlide slide = ppt.createSlide(); | ||
// Log du type de média déterminé | ||
System.out.println("determineMediaType - Content Type: " + contentType + " -> Type: " + mediaType); | ||
|
||
return mediaType; | ||
} | ||
|
||
@Override | ||
public Object createApacheSlide(XSLFSlide newSlide) { | ||
// Log au début de la création de la slide | ||
System.out.println("\nStarting createApacheSlide:"); | ||
System.out.println("Title: " + title); | ||
System.out.println("Media type: " + mediaType); | ||
System.out.println("Resource data size: " + (resourceData != null ? resourceData.length : "null") + " bytes"); | ||
System.out.println("File extension: " + fileContentType); | ||
|
||
SlideHelper.createTitle(slide, title); | ||
SlideHelper.createImage(slide, resourceData, fileExtension); | ||
SlideHelper.createLegend(slide, caption); | ||
SlideHelper.createTitle(newSlide, title); | ||
switch (mediaType) { | ||
case AUDIO: | ||
System.out.println("Creating audio slide..."); | ||
SlideHelper.createAudio(newSlide, resourceData, fileContentType); | ||
break; | ||
case VIDEO: | ||
System.out.println("Creating video slide..."); | ||
SlideHelper.createVideo(newSlide, resourceData, fileContentType); | ||
break; | ||
default: | ||
System.out.println("Creating image slide..."); | ||
SlideHelper.createImage(newSlide, resourceData, fileContentType); | ||
} | ||
SlideHelper.createLegend(newSlide, caption); | ||
|
||
return slide; | ||
System.out.println("Slide creation completed."); | ||
return newSlide; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.