20 parser.
setExampleShortOption(
"phoenix_slider -i fileInput1.png fileInput2.png fileInput3.mp4 fileInput4.png -o output.html");
24 PString defaultOutput(
"output.html");
25 parser.
addOption(
"output",
"o", defaultOutput,
"name of the output HTML file");
28 parser.
addOption(
"numbercolor",
"n", defaultColor,
"color of the slides' number (black, white, blue, green, red, yellow, gray(by default))");
30 PString defaultTextFootpage(
"");
31 parser.
addOption(
"footpage",
"f", defaultTextFootpage,
"text to be written on the foot page");
33 PString defaultFootpageColor(
"white");
34 parser.
addOption(
"footpagecolor",
"g", defaultFootpageColor,
"color of the foot page (black, white, blue, green, red, yellow, white(by default))");
45 fs <<
"<!DOCTYPE html>\n";
48 fs <<
"\t\t<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n";
49 fs <<
"\t\t<style>\n";
50 fs <<
"\t\t\t* {box-sizing: border-box;}\n";
51 fs <<
"\t\t\tbody {\n";
53 fs <<
"\t\t\t\tfont-family: Arial, sans-serif;\n";
54 fs <<
"\t\t\t\tbackground-color: black;\n";
57 fs <<
"\t\t\t.mySlides {\n";
58 fs <<
"\t\t\t\tdisplay: none;\n";
59 fs <<
"\t\t\t\tvertical-align: middle;\n";
61 fs <<
"\t\t\timg {\n";
62 fs <<
"\t\t\t\tvertical-align: middle;\n";
65 fs <<
"\t\t\t/* Slideshow container */\n";
66 fs <<
"\t\t\t.slideshow-container {\n";
68 fs <<
"\t\t\t\tposition: relative;\n";
69 fs <<
"\t\t\t\tmargin: auto;\n";
72 fs <<
"\t\t\t/* Caption text */\n";
73 fs <<
"\t\t\t.text {\n";
75 fs <<
"\t\t\t\tcolor: "<<footPageColor<<
";\n";
77 fs <<
"\t\t\t\tfont-size: 30px;\n";
78 fs <<
"\t\t\t\tpadding: 8px 12px;\n";
79 fs <<
"\t\t\t\tposition: absolute;\n";
80 fs <<
"\t\t\t\tbottom: 8px;\n";
81 fs <<
"\t\t\t\tmargin-left: 40px;\n";
83 fs <<
"\t\t\t\ttext-align: left;\n";
86 fs <<
"\t\t\t/* Number text (1/3 etc) */\n";
87 fs <<
"\t\t\t.numbertext {\n";
89 fs <<
"\t\t\t\tcolor: "<<numberColor<<
";\n";
90 fs <<
"\t\t\t\tfont-size: 40px;\n";
91 fs <<
"\t\t\t\tpadding: 8px 12px;\n";
92 fs <<
"\t\t\t\tposition: absolute;\n";
94 fs <<
"\t\t\t\tbottom: 8px;\n";
95 fs <<
"\t\t\t\twidth: 100%;\n";
96 fs <<
"\t\t\t\ttext-align: right;\n";
99 fs <<
"\t\t\t.slideContent{\n";
100 fs <<
"\t\t\t\tcolor: "<<footPageColor<<
";\n";
101 fs <<
"\t\t\t\tdisplay: block;\n";
102 fs <<
"\t\t\t\tposition: absolute;\n";
103 fs <<
"\t\t\t\twidth: 100%;\n";
104 fs <<
"\t\t\t\ttop: 0px;\n";
107 fs <<
"\t\t\t.slideContent h1{\n";
108 fs <<
"\t\t\t\tcolor: "<<footPageColor<<
";\n";
109 fs <<
"\t\t\t\ttext-align: center;\n";
110 fs <<
"\t\t\t\tfont-size: 60px;\n";
113 fs <<
"\t\t\t.slideContent .slidebody{\n";
114 fs <<
"\t\t\t\tcolor: "<<footPageColor<<
";\n";
115 fs <<
"\t\t\t\tmargin-left: 40px;\n";
116 fs <<
"\t\t\t\ttext-align: left;\n";
117 fs <<
"\t\t\t\tfont-size: 40px;\n";
128 fs <<
"\t\t\t/* The dots/bullets/indicators */\n";
129 fs <<
"\t\t\t.dot {\n";
130 fs <<
"\t\t\t\theight: 15px;\n";
131 fs <<
"\t\t\t\twidth: 15px;\n";
132 fs <<
"\t\t\t\tmargin: 0 2px;\n";
133 fs <<
"\t\t\t\tbackground-color: #bbb;\n";
134 fs <<
"\t\t\t\tborder-radius: 50%;\n";
135 fs <<
"\t\t\t\tdisplay: inline-block;\n";
136 fs <<
"\t\t\t\ttransition: background-color 0.6s ease;\n";
139 fs <<
"\t\t\t.active {\n";
140 fs <<
"\t\t\t\tbackground-color: #717171;\n";
143 fs <<
"\t\t\t/* Fading animation */\n";
144 fs <<
"\t\t\t.fade {\n";
145 fs <<
"\t\t\t\tanimation-name: fade;\n";
146 fs <<
"\t\t\t\tanimation-duration: 1.5s;\n";
149 fs <<
"\t\t\t@keyframes fade {\n";
150 fs <<
"\t\t\t\tfrom {opacity: .4}\n";
151 fs <<
"\t\t\t\tto {opacity: 1}\n";
154 fs <<
"\t\t\t/* On smaller screens, decrease text size */\n";
155 fs <<
"\t\t\t@media only screen and (max-width: 300px) {\n";
156 fs <<
"\t\t\t\t.text {font-size: 11px}\n";
158 fs <<
"\t\t</style>\n";
167 fs <<
"let slideIndex = 1;\n";
168 fs <<
"showSlides(slideIndex);\n";
170 fs <<
"// Next/previous controls\n";
171 fs <<
"function plusSlides(n){\n";
172 fs <<
"\tshowSlides(slideIndex += n);\n";
175 fs <<
"// Thumbnail image controls\n";
176 fs <<
"function currentSlide(n){\n";
177 fs <<
"\tshowSlides(slideIndex = n);\n";
180 fs <<
"function showSlides(n) {\n";
182 fs <<
"\tlet slides = document.getElementsByClassName(\"mySlides\");\n";
184 fs <<
"\tif(n > slides.length){slideIndex = 1}\n";
185 fs <<
"\tif(n < 1){slideIndex = slides.length}\n";
186 fs <<
"\tfor(i = 0; i < slides.length; i++){\n";
187 fs <<
"\t\tslides[i].style.display = \"none\";\n";
192 fs <<
"\tslides[slideIndex-1].style.display = \"block\";\n";
196 fs <<
"document.onkeydown = function(e){\n";
197 fs <<
"\tswitch(e.keyCode){\n";
198 fs <<
"\t\tcase 37:\n";
199 fs <<
"\t\t\t//left\n";
200 fs <<
"\t\t\te.preventDefault();\n";
201 fs <<
"\t\t\tslideIndex--;\n";
202 fs <<
"\t\t\tshowSlides(slideIndex);\n";
203 fs <<
"\t\t\tbreak;\n";
204 fs <<
"\t\tcase 39:\n";
205 fs <<
"\t\t\t//right\n";
206 fs <<
"\t\t\te.preventDefault();\n";
207 fs <<
"\t\t\tslideIndex++;\n";
208 fs <<
"\t\t\tshowSlides(slideIndex);\n";
209 fs <<
"\t\t\tbreak;\n";
221 if(slideNumber != 0lu){
222 fs <<
"\t\t\t\t<div class=\"numbertext\">"<<(slideNumber + 1lu)<<
"</div>\n";
225 fs <<
"\t\t\t\t<div class=\"text\">"<<footPage<<
"</div>\n";
238 fs <<
"\t\t\t<div class=\"mySlides\">\n";
240 fs <<
"\t\t\t\t<img src=\""<<filePng<<
"\" style=\"width:100%\">\n";
242 fs <<
"\t\t\t</div>\n";
253 if(fileMp4.size() > 8lu){
255 if(baseName.substr(baseName.size() - 4lu, baseName.size()) ==
"loop"){
256 loopAttribute =
" loop";
260 fs <<
"\t\t\t<div class=\"mySlides\">\n";
262 fs <<
"\t\t\t\t<video style=\"width:100%\" autoplay muted"<<loopAttribute<<
">\n";
263 fs <<
"\t\t\t\t <!-- Be careful, if you do not have sound, check if the video has MP3 sound and not AC3 -->\n";
264 fs <<
"\t\t\t\t <source src=\""<<fileMp4<<
"\" type=\"video/mp4\">\n";
265 fs <<
"\t\t\t\t</video>\n";
268 fs <<
"\t\t\t</div>\n";
279 PString backGroundFile(CMAKE_INSTALL_PREFIX
"/share/PhoenixSlider/theme2.png");
280 if(slideNumber == 0){
281 backGroundFile = CMAKE_INSTALL_PREFIX
"/share/PhoenixSlider/firstTheme.png";
283 fs <<
"\t\t\t<div class=\"mySlides\">\n";
285 fs <<
"\t\t\t\t<img src=\""<<backGroundFile<<
"\" style=\"width:100%\">\n";
286 fs <<
"\t\t\t\t<div class=\"slideContent\">\n";
288 fs <<
"\t\t\t\t</div>\n";
289 fs <<
"\t\t\t</div>\n";
304 if(fileExtention ==
"png"){
306 }
else if(fileExtention ==
"mp4"){
308 }
else if(fileExtention ==
"html"){
311 std::cerr <<
"slider_saveHtmlSlide : unknown extention '"<<fileExtention<<
"' of file '"<<filePng<<
"'" << std::endl;
325 if(outputFileName ==
"" || listInputFile.size() == 0lu){
return;}
328 fs.open(outputFileName.c_str());
330 std::cerr <<
"slider_makeHtmlSlides : can't open file '" << outputFileName <<
"'" << std::endl;
335 fs <<
"\t<body>" << std::endl;
336 fs <<
"\t\t<div class=\"slideshow-container\">" << std::endl;
338 long unsigned int i(-1lu);
339 for(PVecPath::const_iterator it(listInputFile.begin()); it != listInputFile.end(); ++it){
341 PString currentFileName(listFileName.back());
343 if(previousFile.size() < 6lu || currentFileName.size() < 6lu){
346 if(previousFile.substr(0, previousFile.size() - 6lu) != currentFileName.substr(0, currentFileName.size() - 6lu)){
350 previousFile = currentFileName;
353 fs <<
"\t\t</div>" << std::endl;
354 fs <<
"\t\t<br>" << std::endl;
356 fs <<
"\t</body>" << std::endl;
357 fs <<
"</html>\n" << std::endl;
362 int main(
int argc,
char** argv){
368 defaultMode.
getValue(listInputFile,
"input");
370 PPath outputFile(
"output.html");
371 defaultMode.
getValue(outputFile,
"output");
374 defaultMode.
getValue(numberColor,
"numbercolor");
377 defaultMode.
getValue(footPage,
"footpage");
379 PString footPageColor(
"white");
380 defaultMode.
getValue(footPageColor,
"footpagecolor");
std::vector< PPath > PVecPath
std::vector< PString > PVecString
int main(int argc, char **argv)
OptionParser createOptionParser()
Create the OptionParser of this program.
void slider_makeHtmlSlides(const PPath &outputFileName, const PVecPath &listInputFile, const PString &numberColor, const PString &footPage, const PString &footPageColor)
Make the tex slides.
void slider_saveHtmlSlideNumber(std::ofstream &fs, long unsigned int slideNumber, const PString &footPage)
Save the HTML slide number.
void slider_saveHtmlSlidePng(std::ofstream &fs, const PPath &filePng, long unsigned int slideNumber, const PString &footPage)
Make the html png slide.
void slider_saveJavascript(std::ofstream &fs)
Make the HTML slider javascript.
void slider_saveHtmlSlide(std::ofstream &fs, const PPath &filePng, long unsigned int slideNumber, const PString &footPage)
Make the beamer tex slide.
void slider_saveHtmlHeader(std::ofstream &fs, const PString &numberColor, const PString &footPageColor)
Make the HTML slider header.
void slider_saveHtmlSlideMp4(std::ofstream &fs, const PPath &fileMp4, long unsigned int slideNumber, const PString &footPage)
Make the html mp4 slide.
void slider_saveHtmlSlideHtml(std::ofstream &fs, const PPath &fileTex, long unsigned int slideNumber, const PString &footPage)
Save the html slide with a html file.
Describe a mode in the program arguments.
bool getValue(T &value, const PString &optionName) const
Get the value of the option.
Parse the options passed to a program.
void parseArgument(int argc, char **argv)
Parse the arguments passed to the program.
void addOption(const PString &longOption, const PString &shortOption, OptionType::OptionType optionType, bool isRequired, const PString &docString)
Add an option in the OptionParser.
void setExampleShortOption(const PString &example)
Set the example usage of the program.
void setExampleLongOption(const PString &example)
Set the example usage of the program.
const OptionMode & getDefaultMode() const
Get default mode.
Path of a directory or a file.
PPath & eraseExtension()
Erase the extension of the PPath.
PString getExtension() const
Get file extension.
PString loadFileContent() const
Get the file content in a PString.