void exportHtmlInitLogic(const QString &filename, struct htmlExportSetting &hes) { QString photosDirectory; QFile file(filename); QFileInfo info(file); QDir mainDir = info.absoluteDir(); mainDir.mkdir(file.fileName() + "_files"); QString exportFiles = file.fileName() + "_files"; QString json_dive_data = exportFiles + QDir::separator() + "file.js"; QString json_settings = exportFiles + QDir::separator() + "settings.js"; QString translation = exportFiles + QDir::separator() + "translation.js"; QString stat_file = exportFiles + QDir::separator() + "stat.js"; exportFiles += "/"; if (hes.exportPhotos) { photosDirectory = exportFiles + QDir::separator() + "photos" + QDir::separator(); mainDir.mkdir(photosDirectory); } exportHTMLsettings(json_settings, hes); exportHTMLstatistics(stat_file, hes); export_translation(qPrintable(translation)); export_HTML(qPrintable(json_dive_data), qPrintable(photosDirectory), hes.selectedOnly, hes.listOnly); QString searchPath = getSubsurfaceDataPath("theme"); if (searchPath.isEmpty()) { report_error(qPrintable(gettextFromC::tr("Cannot find a folder called 'theme' in the standard locations"))); return; } searchPath += QDir::separator(); file_copy_and_overwrite(searchPath + "dive_export.html", filename); file_copy_and_overwrite(searchPath + "list_lib.js", exportFiles + "list_lib.js"); file_copy_and_overwrite(searchPath + "poster.png", exportFiles + "poster.png"); file_copy_and_overwrite(searchPath + "jqplot.highlighter.min.js", exportFiles + "jqplot.highlighter.min.js"); file_copy_and_overwrite(searchPath + "jquery.jqplot.min.js", exportFiles + "jquery.jqplot.min.js"); file_copy_and_overwrite(searchPath + "jqplot.canvasAxisTickRenderer.min.js", exportFiles + "jqplot.canvasAxisTickRenderer.min.js"); file_copy_and_overwrite(searchPath + "jqplot.canvasTextRenderer.min.js", exportFiles + "jqplot.canvasTextRenderer.min.js"); file_copy_and_overwrite(searchPath + "jquery.min.js", exportFiles + "jquery.min.js"); file_copy_and_overwrite(searchPath + "jquery.jqplot.css", exportFiles + "jquery.jqplot.css"); file_copy_and_overwrite(searchPath + hes.themeFile, exportFiles + "theme.css"); }
void DiveLogExportDialog::exportHtmlInit(const QString &filename) { QFile file(filename); QFileInfo info(file); QDir mainDir = info.absoluteDir(); mainDir.mkdir(file.fileName() + "_files"); QString exportFiles = file.fileName() + "_files"; QString json_dive_data = exportFiles + QDir::separator() + "file.json"; QString json_settings = exportFiles + QDir::separator() + "settings.json"; QString stat_file = exportFiles + QDir::separator() + "stat.json"; QString photos_directory = exportFiles + QDir::separator() + "photos" + QDir::separator(); mainDir.mkdir(photos_directory); exportFiles += "/"; exportHTMLsettings(json_settings); exportHTMLstatistics(stat_file); export_HTML(json_dive_data.toUtf8().data(), photos_directory.toUtf8().data(), ui->exportSelectedDives->isChecked(), ui->exportListOnly->isChecked()); QString searchPath = getSubsurfaceDataPath("theme"); if (searchPath.isEmpty()) return; searchPath += QDir::separator(); copy_and_overwrite(searchPath + "dive_export.html", filename); copy_and_overwrite(searchPath + "list_lib.js", exportFiles + "list_lib.js"); copy_and_overwrite(searchPath + "poster.png", exportFiles + "poster.png"); copy_and_overwrite(searchPath + "jqplot.highlighter.min.js", exportFiles + "jqplot.highlighter.min.js"); copy_and_overwrite(searchPath + "jquery.jqplot.min.js", exportFiles + "jquery.jqplot.min.js"); copy_and_overwrite(searchPath + "jqplot.canvasAxisTickRenderer.min.js", exportFiles + "jqplot.canvasAxisTickRenderer.min.js"); copy_and_overwrite(searchPath + "jqplot.canvasTextRenderer.min.js", exportFiles + "jqplot.canvasTextRenderer.min.js"); copy_and_overwrite(searchPath + "jquery.min.js", exportFiles + "jquery.min.js"); copy_and_overwrite(searchPath + "jquery.jqplot.css", exportFiles + "jquery.jqplot.css"); copy_and_overwrite(searchPath + (ui->themeSelection->currentText() == "Light" ? "light.css" : "sand.css"), exportFiles + "theme.css"); }