#include "html.h" #include #include #include #include #include #include #include HTML::HTML() { } void HTML::Generate(S1000D_Manager* _SM, bool _toScorm, SplashForm* _splash) { SM = _SM; toScorm = _toScorm; ru_const = &SM->ru_const; splash = _splash; svgUI = 0; paraIdent = true; paraTextAlign = ""; iframeDivCnt = 0; if(!SM->isConsole) {splash->Reset(); splash->SetTitle("Генерация HTML...");} QStringList htmlHead, htmlTail; QFile blankFile(":new/BlankXML/blank.html"); if (!blankFile.open(QFile::ReadOnly | QFile::Text)) return; QString s; bool isHead = true; while(!blankFile.atEnd()) { s = QString::fromLocal8Bit(blankFile.readLine()).replace("\n",""); if(isHead) htmlHead.append(s); else htmlTail.append(s); if(s.contains("
")) isHead = false; } blankFile.close(); acrList.clear(); for(int i=0;iitems.count();i++) if(SM->items[i].moduleType == mtDM) { SM->setCurItem(i); //qDebug() << "html: " << SM->item->fileName; if(SM->item->schemeType == stLEARNING) continue; idList.clear(); ID_pars = ID_tabs = ID_figs = ID_mmos = 0; SM->item->html.clear(); foreach(QString s, htmlHead) { // if(!toScorm && s == "") { // add(1, ""); // } add(0, s); } add(6, "
"); add(6, "
"); add(6, "
"); add(6, "
"); add(6, "
"); add(6, "
"); add(6, "
"); add(6, "
"); QString itemTechName = SM->getNodeText("identAndStatusSection.dmAddress.dmAddressItems.dmTitle.techName"); QString itemInfoName = SM->getNodeText("identAndStatusSection.dmAddress.dmAddressItems.dmTitle.infoName"); itemTechName.replace("'", "\""); itemInfoName.replace("'", "\""); //if(!toScorm) add(6, "
"); add(6, "

"+itemTechName+"

"); if(itemInfoName != "") add(6, "

"+itemInfoName+"

"); //if(!toScorm) add(6, "
"); add(6, "
"); add(6, "
"); QDomNode rootNode; if(SM->item->schemeType == stDESCRIPT) rootNode = SM->findElement("content.description"); if(SM->item->schemeType == stCREW) rootNode = SM->findElement("content.crew.descrCrew"); if(SM->item->schemeType == stLEARNING) rootNode = SM->findElement("content.learning.learningAssessment"); for(int j=0;j"); //if(toScorm) { // add(6, "
"); // add(6, " "); // add(6, "
"); //} add(6, "
"); add(6, "
"); add(6, "
"); if(true) { //toScorm add(6, "
"); // содержание add(6, " "); add(6, "
"); add(6, "
"); // изображения add(6, " "); add(6, "
"); add(6, "
"); // мультимедиа add(6, " "); add(6, "
"); add(6, "
"); // таблицы add(6, " "); add(6, "
"); add(6, "
"); add(6, " "); add(6, "
"); add(6, "
"); add(6, " "); add(6, "
"); } // переименовываем временные тексты ссылок idTitle_ for(int i=htmlHead.count();iitem->html.count();i++) while(1) { int _b = SM->item->html[i].indexOf("idTitle_"); if(_b == -1) break; int _e = SM->item->html[i].indexOf("<",_b+8); QString id = SM->item->html[i].mid(_b+8, _e-(_b+8)); QString newTitle = id; for(int j=0;jfigureTitle)) newTitle = ru_const->figureShortTitle+" "+idList[j].title.mid(ru_const->figureTitle.length()+1, idList[j].title.indexOf(":")-(ru_const->figureTitle.length()+1)); if(idList[j].title.startsWith(ru_const->tableTitle)) newTitle = ru_const->tableShortTitle+" "+idList[j].title.mid(ru_const->tableTitle.length()+1, idList[j].title.indexOf(":")-(ru_const->tableTitle.length()+1)); //qDebug() << id << "->" << newTitle; break; } else { if(!SM->isConsole) qDebug() << "Неизвестная структура заголовка в idList" << id << idList[j].title; } } } if(newTitle == id) if(!SM->isConsole) qDebug() << "[html: "+QString::number(i)+"] Ссылка не переименована: " + id + " ("+SM->item->fileName+")"; SM->item->html[i].replace(SM->item->html[i].mid(_b, _e-_b), newTitle); } //for(int j=0;jitem->html.count();j++) // if(!SM->item->html[j].contains("\n")) SM->item->html[j] += "\n"; foreach(QString s, htmlTail) add(0, s); } //mtDM } QString HTML::domElementToXML(const QDomElement& elem, int lvl) { QString head = spc(lvl)+"<"+elem.tagName(); QDomNamedNodeMap attrs = elem.attributes(); for(int i = 0; i\n"; QString mid = ""; if(elem.childNodes().count() != 0) { if(elem.childNodes().count() == 1 && elem.childNodes().at(0).isText()) { head += ">"; mid += elem.childNodes().at(0).toText().nodeValue(); tail = "\n"; } else { head += ">\n"; for(int i=0;iisConsole) splash->Step(); QString name = node.nodeName(); if(name != "acronym") footnoteID = ""; if(name == "#text") { cat(node.nodeValue().replace("<","<").replace(">",">")); return; } if(name == "para") { QString ident = ""; QString textStyle = ""; if(paraTextAlign != "") textStyle = " text-align: "+paraTextAlign+";"; if(node.childNodes().count() > 0) { if(node.childNodes().at(0).nodeName() == "multimedia") ident = " style=\"text-indent: 0px;"+textStyle+"\""; if(node.childNodes().at(0).nodeName() == "figure") ident = " style=\"text-indent: 0px;"+textStyle+"\""; if(!paraIdent) ident = " style=\"text-indent: 0px;"+textStyle+"\""; } if(ident == "" && textStyle != "") ident = " style=\""+textStyle+"\""; add(lvl, "
"); for(int j=0;j"); cat("
"); return; } if(name == "levelledPara") { QString id = "ID_par"+QString::number(ID_pars++); add(lvl, "

"); QString title = ""; if(node.childNodes().at(0).nodeName() == "title") title = node.childNodes().at(0).childNodes().at(0).nodeValue(); if(title != "") { labelStruct lbl; lbl.id = id; lbl.title = title; lbl.type = "par"; idList.append(lbl); } cat(title); cat("

"); for(int j=0;j"); for(int j=0;j"); return; } if(name == "internalRef") { QString id = "", target = ""; for(int j=0;j"); cat("idTitle_"+id); //TODO cat(""); return; } if(name == "dmSegmentRef") { QString tPath = node.toElement().attribute("targetPath"); //int _b = tPath.indexOf("'"); //QString id = tPath.mid(_b+1, tPath.indexOf("'", _b+1)-(_b+1)); QString refFileCode = SM->dmCodeIdentString(node.toElement().namedItem("dmRefIdent").namedItem("dmCode")); QString refTechName = node.toElement().namedItem("dmRefAddressItems").namedItem("dmTitle").namedItem("techName").childNodes().at(0).toText().data(); QString refInfoName = node.toElement().namedItem("dmRefAddressItems").namedItem("dmTitle").namedItem("infoName").childNodes().at(0).toText().data(); int refItemInd = -1; int tmpCurItem = SM->itemIndex; for(int i=0;iitems.count();i++) if(SM->items[i].moduleType == mtDM){ SM->setCurItem(i); QString itemFileCode = SM->dmIdentString("identAndStatusSection.dmAddress.dmIdent"); QString itemTechName = SM->item->doc.namedItem("dmodule").namedItem("identAndStatusSection").namedItem("dmAddress").namedItem("dmAddressItems").namedItem("dmTitle").namedItem("techName").childNodes().at(0).toText().data(); QString itemInfoName = SM->item->doc.namedItem("dmodule").namedItem("identAndStatusSection").namedItem("dmAddress").namedItem("dmAddressItems").namedItem("dmTitle").namedItem("infoName").childNodes().at(0).toText().data(); if(refFileCode == itemFileCode && refTechName == itemTechName && refInfoName == itemInfoName) { refItemInd = i; break; } } if(refItemInd == -1) { qDebug() << "HTML dmSegmentRef: ref item not found ("+refTechName+" "+refFileCode+")"; SM->setCurItem(tmpCurItem); return; } QString labelTitle = ""; QDomNode labelNode = SM->getNodeFromXPath(tPath); //, true if(labelNode.isNull()) { qDebug() << "HTML dmSegmentRef: labelNode.isNull "; qDebug() << " path: " << tPath; qDebug() << " fileName: " << SM->item->fileName; SM->setCurItem(tmpCurItem); return; } else { //qDebug() << "HTML dmSegmentRef: OK - " << tPath; } if(labelNode.toElement().namedItem("title").isNull()) { qDebug() << "HTML dmSegmentRef: labelNode.title.isNull"; //return; } else { labelTitle = labelNode.toElement().namedItem("title").toElement().firstChild().toText().data(); } QString id = labelNode.attributes().namedItem("id").nodeValue(); id = id.replace(".", "_").replace(":", "_").replace("-", "_").replace(" ", "_"); //normID QString htmlFileName = SM->item->fileName; htmlFileName = htmlFileName.replace(".xml", ".html"); //*********** //qDebug() << ""; SM->setCurItem(tmpCurItem); cat(""); cat(refTechName + " / " + labelTitle); cat(""); return; } if(name == "randomList") { bool oldParaIdent = paraIdent; paraIdent = false; if(node.firstChild().nodeName() == "title") { add(lvl, "
"); for(int j=0;j"); } add(lvl, ""); add(lvl, " "); for(int j=0;j"); if(node.childNodes().at(j).childNodes().count() > 0) if(node.childNodes().at(j).childNodes().at(0).childNodes().count() > 0) { QString child0name = node.childNodes().at(j).childNodes().at(0).childNodes().at(0).nodeName(); if(child0name == "randomList" || child0name == "sequentialList") add(lvl, " "); else add(lvl, " "); } add(lvl, " "); } add(lvl, " "); add(lvl, "
-"); for(int k=0;k"); add(lvl, "
"); //if(oldParaIdent) cat("
"); paraIdent = oldParaIdent; return; } if(name == "sequentialList") { bool oldParaIdent = paraIdent; paraIdent = false; if(node.firstChild().nodeName() == "title") { add(lvl, "
"); for(int j=0;j"); } add(lvl, ""); add(lvl, " "); int cnt = 0; for(int j=0;j"); if(node.childNodes().at(j).childNodes().count() > 0) if(node.childNodes().at(j).childNodes().at(0).childNodes().count() > 0) { QString child0name = node.childNodes().at(j).childNodes().at(0).childNodes().at(0).nodeName(); if(child0name == "randomList" || child0name == "sequentialList") add(lvl, " "); else add(lvl, " "); } add(lvl, " "); } add(lvl, " "); add(lvl, "
"+QString::number(++cnt)+"."); for(int k=0;k"); add(lvl, "
"); //if(oldParaIdent) cat("
"); paraIdent = oldParaIdent; return; } if(name == "figure") { QString id = node.attributes().namedItem("id").nodeValue(); QString title = node.namedItem("title").firstChild().nodeValue(); QString infoEntityIdent = node.namedItem("graphic").attributes().namedItem("infoEntityIdent").nodeValue(); QString reproductionScale = node.namedItem("graphic").attributes().namedItem("reproductionScale").nodeValue(); QString reproductionHeight = node.namedItem("graphic").attributes().namedItem("reproductionHeight").nodeValue(); QString reproductionWidth = node.namedItem("graphic").attributes().namedItem("reproductionWidth").nodeValue(); QString isInlineClass = ""; if(id == "" && title == "") isInlineClass = " class='inlineImg' "; QString imgStyle = "", scaleStyle = "", wStyle = "", hStyle = ""; //if(reproductionScale != "") scaleStyle = ": "+reproductionScale+";' "; // пока не используется if(reproductionHeight != "") hStyle = "height: "+reproductionHeight+";"; if(reproductionWidth != "") wStyle = "width: "+reproductionWidth+";"; if(scaleStyle+wStyle+hStyle != "") imgStyle = " style='"+scaleStyle+wStyle+hStyle+"' "; if(infoEntityIdent == "") { add(lvl, "Ошибка чтения изображения
"); return; } if(id == "") id = "ID_fig"+QString::number(ID_figs); ID_figs++; id = id.replace(".", "_").replace(":", "_").replace("-", "_").replace(" ", "_"); //normID labelStruct lbl; lbl.id = id; lbl.title = title; lbl.type = "fig"; idList.append(lbl); QFileInfo svgInfo(SM->projectPath+"/"+infoEntityIdent); QString svgfile = infoEntityIdent.section("/",-1,-1); //QString svgdir = infoEntityIdent.section("/",0,-2); //qDebug() << SM->projectPath+"/"+infoEntityIdent << svgfile.toLower().split(".").last(); QString txtfile = svgInfo.absolutePath()+"/"+svgfile.left(svgfile.length()-3)+"txt"; QFileInfo txtInfo(txtfile); if(svgInfo.exists() && svgfile.toLower().split(".").last() == "svg" && txtInfo.exists()) { // прописываем хотспоты в svg QDomDocument svg; if(!SM->isConsole) splash->SetTitle("Обработка SVG файла: "+infoEntityIdent); QApplication::processEvents(); //qDebug() << "-- Processing SVG "+infoEntityIdent; //QElapsedTimer timer; timer.start(); QFile txtFile(txtfile); if (!txtFile.open(QFile::ReadOnly)) { // | QFile::Text qDebug() << "html: Ошибка открытия файла "+svgInfo.absolutePath()+"/"+svgfile.left(svgfile.length()-3)+"txt"; return; } QByteArray data = txtFile.readAll(); for(int i=0;i < data.length()-2;i++) { if(data[i] == (char)10 && (data[i+1] != (char)13)) data[i] = 13; } QStringList txtLines = QString(QString(data).toUtf8()).replace("\r\r","\r").split("\r"); // //qDebug() << txtLines; txtFile.close(); QFile svgFile(SM->projectPath+"/"+infoEntityIdent); if (!svgFile.open(QFile::ReadOnly | QFile::Text)){ qDebug() << "html: Ошибка открытия файла "+SM->projectPath+"/"+infoEntityIdent; return; } svg.setContent(svgFile.readAll()); svgFile.close(); QDomNode svgNode = svg.namedItem("svg"); if(svgNode.isNull()) { qDebug() << "html: Ошибка в svg-файле "+SM->projectPath+"/"+infoEntityIdent; return; } svgNode.attributes().namedItem("width").toAttr().setNodeValue("100%"); svgNode.attributes().removeNamedItem("height"); QStringList txtNums, txtTitles; foreach(QString s, txtLines) if(s.indexOf(" - ")) { txtNums.append(s.mid(0, s.indexOf(" - "))); txtTitles.append(s.mid(s.indexOf(" - ")+3)); } //qDebug() << " searchSVGNodeForText: " << (int)timer.elapsed()/1000; for(int j=0;jisConsole) splash->Step(); QDomNode g = svgNode.childNodes().at(j); if(g.nodeName() != "g") continue; if(!SM->isConsole) splash->Step(); QString title = searchSVGNodeForText(g); if(title == "") continue; int ind = txtNums.indexOf(title); if(ind == -1) continue; QString hotspotTitle = txtTitles[ind]; QString hotspotImage = txtTitles[ind]; if(hotspotImage.indexOf("} ") != -1) { // вариант {title} filename int _b = hotspotImage.indexOf("{")+1; hotspotTitle = hotspotImage.mid(_b, hotspotImage.indexOf("} ")-_b); hotspotImage = hotspotImage.mid(hotspotImage.indexOf("} ")+2); } if(QFile::exists(SM->projectPath+"/"+hotspotImage)) { g.toElement().setAttribute("style", "cursor: pointer;"); g.toElement().setAttribute("onmouseout", "hideTooltipImg();"); g.toElement().setAttribute("onmousemove", "showTooltipImg(evt, '"+hotspotImage+"', '"+hotspotTitle+"');"); g.toElement().setAttribute("onclick", "viewer.show('"+hotspotImage+"');"); } else { g.toElement().setAttribute("style", "cursor: pointer;"); g.toElement().setAttribute("onmouseout", "hideTooltip();"); g.toElement().setAttribute("onmousemove", "showTooltip(evt, '"+hotspotTitle+"');"); } } //qDebug() << " svg.namedItem(svg).save: " << (int)timer.elapsed()/1000; QString svgNodeText; svgNodeText = domElementToXML(svg.namedItem("svg").toElement(), 0); //QTextStream outsvg(&svgNodeText); //outsvg << svg.namedItem("svg"); //svg.namedItem("svg").save(outsvg, 2); //qDebug() << " svgNodeText.indexOf(id=): " << (int)timer.elapsed()/1000; QString svgIDprefix; svgIDprefix.fill('0', 3-QString::number(svgUI).length()); svgIDprefix = "id"+svgIDprefix+QString::number(svgUI++)+"_"; int j, i=0; QString _id; while(1) { i = svgNodeText.indexOf("id=\"", i); if(i == -1) break; j = svgNodeText.indexOf("\"", i+4); _id = svgNodeText.mid(i+4, j-i-4); for(int k=svgIDprefix.length()-1; k>=0; k--) svgNodeText.insert(i+4, svgIDprefix[k]); svgNodeText.replace("#"+_id, "#"+svgIDprefix+_id); i = j+1; } //qDebug() << " final saving to mem: " << (int)timer.elapsed()/1000; add(lvl, "
"); add(0, "\n\n"); add(0, svgNodeText); //foreach (QString s, svgNodeText.split("\n")) // add(lvl, s); add(0, "\n"); //qDebug() << "-- End of SVG "+infoEntityIdent+": " << (int)timer.elapsed()/1000; } else { QString imgfilename = QString(infoEntityIdent); add(lvl, " "); //if(toScorm) { // add(lvl, " \"Показать\""); // add(lvl, "
"); // add(lvl, " \"Показать\""); // add(lvl, "
"); //} else { // add(lvl, "
"); // add(lvl, " \"Показать\""); // add(lvl, "
"); //} } //add(lvl, "
"); if(title != "") { add(lvl, "
" + title + "
"); cat("
"); } //cat("
"); if(!SM->isConsole) splash->SetTitle("Генерация HTML..."); return; } if(name == "table") { bool oldParaIdent = paraIdent; paraIdent = false; QString id, colsep, rowsep, frame, tocentry, align; id=frame=tocentry=align=""; colsep=rowsep="0"; int cols; //, rows for(int j=0;j"); add(lvl, "
"); add(lvl+1, ""); QString title=""; struct colspecStruct { QString name, align, colwidth; }; QList colspec; struct spanspecStruct { QString spanname; int st, end; }; QList spanspec; for(int j=0;j"); //add(lvl+2, " "+title+""); //add(lvl+2, ""); } if(node.childNodes().at(j).nodeName() == "tgroup") { cols = -1; for(int k=0;k");add(lvl, ""); return; } for(int k=0;k"); for(int l=0;l"); // или 0? for(int m=0;m"); } } //entrys add(lvl+3, ""); } add(lvl+2, ""); }//thead, tbody } //tgroup childs } //tgroup } //table add(lvl+1, "
"); add(lvl, "
"); add(lvl, "
"); cat("
" + title + "
"); cat("

"); labelStruct lbl; lbl.id = id; lbl.title = title; lbl.type = "tab"; idList.append(lbl); paraIdent = oldParaIdent; return; } if(name == "warning") { bool oldParaIdent = paraIdent; paraIdent = false; add(lvl, "
"); for(int j=0;j"); for(int k=0;k"); } add(lvl, "
"); paraIdent = oldParaIdent; return; } if(name == "caution") { bool oldParaIdent = paraIdent; paraIdent = false; add(lvl, "
"); for(int j=0;j"); for(int k=0;k"); } add(lvl, "
"); paraIdent = oldParaIdent; return; } if(name == "note") { bool oldParaIdent = paraIdent; paraIdent = false; add(lvl, "
"); for(int j=0;j
"); paraIdent = oldParaIdent; return; } if(name == "supScript" || name == "subScript") { if(node.childNodes().count() == 1) if(node.childNodes().at(0).nodeName() == "footnote" || node.childNodes().at(0).nodeName() == "footnoteRef") { parseNode(node.childNodes().at(0), lvl); return; } add(lvl, "<"+name.left(3)+" class=\"script_"+name.left(3)+"script\">"); for(int j=0;j"); return; } if(name == "footnote") { for(int j=0;j"); cat(""); // if(footnoteID != "") cat(QString::number(acrList.count()));// else cat(newAcr.term); cat(""); // cat("
"); // // cat(""); // // if(footnoteID != "") // cat(QString::number(acrList.count())); // else // cat(newAcr.term); // cat(""); // cat("
"); // cat(newAcr.definition); // cat("
"); return; } if(name == "footnoteRef") { QString internalRefId = ""; internalRefId = node.attributes().namedItem("internalRefId").nodeValue(); if(internalRefId == "") return; QString term = "***", definition = "Ссылка на термин ID "+internalRefId+" некорректна"; for(int j=0;j"); cat(""); // cat(term); cat(""); // cat("
"); // cat(""); // // cat(term); // cat(""); // cat("
"); // cat(definition); // cat("
"); return; } if(name == "externalPubRef") { QDomNode codeNode, titleNode; codeNode = node.childNodes().at(0).toElement().namedItem("externalPubCode"); titleNode = node.childNodes().at(0).toElement().namedItem("externalPubTitle"); QString refType="", refName="", refTitle=""; if(codeNode.attributes().item(0).toAttr().nodeName() == "pubCodingScheme") refType = codeNode.attributes().item(0).toAttr().nodeValue(); refName = codeNode.childNodes().at(0).nodeValue(); refTitle = titleNode.childNodes().at(0).nodeValue(); if(refType == "URL") { cat(""); cat(refTitle); cat(""); } if(refType == "file") { // копируем всю папку с указанным файлом. Если такой нет - игнорируем refName = refName; //refTitle = refTitle; QFileInfo info(SM->item->importedFromLyX); QString refDir = info.absolutePath() + "/" + refName.split("/")[0]; //QDir dir = QDir(refDir); if(!QDir(refDir).exists() && !QDir(SM->projectPath+"/"+refName.split("/")[0]).exists()) { cat("Гиперссылка: Папка "+refDir+" не найдена. Установите относительный путь к файлу."); return; } if(!QDir(SM->projectPath+"/"+refName.split("/")[0]).exists()) SM->copyDir(refDir, SM->projectPath+"/"+refName.split("/")[0]); cat(""); cat(refTitle); cat(""); } return; } if(name == "multimedia") { QString title="", infoEntityIdent="", multimediaType="", scname = ""; title = node.toElement().namedItem("title").childNodes().at(0).nodeValue(); infoEntityIdent = node.toElement().namedItem("multimediaObject").attributes().namedItem("infoEntityIdent").nodeValue(); multimediaType = node.toElement().namedItem("multimediaObject").attributes().namedItem("multimediaType").nodeValue(); scname = node.toElement().namedItem("multimediaObject").childNodes().at(0).attributes().namedItem("scenario").nodeValue(); if(multimediaType == "3D") { //infoEntityIdent = infoEntityIdent; // копируем всю папку с указанным файлом. Если такой нет - игнорируем QFileInfo info(SM->item->importedFromLyX); QString refDir = info.absolutePath() + "/" + infoEntityIdent.split("/")[0]; // if(!QDir(refDir).exists()) { // cat("3D: Папка "+refDir+" не найдена. Установите относительный путь к файлу."); // return; // } if(QDir(refDir).exists()) // && !QDir(SM->projectPath+"/"+infoEntityIdent.split("/")[0]).exists() if(!SM->copyDir(refDir, SM->projectPath+"/"+infoEntityIdent.split("/")[0])) { QMessageBox::critical(nullptr,"Ошибка", "Ошибка копирования папки '"+refDir+"'",QMessageBox::Ok); return; } iframeDivCnt++; QString divID = "d"+QString::number(iframeDivCnt); QString scfilename = SM->projectPath+"/"+ QFileInfo(infoEntityIdent).path()+"/StreamingAssets/Scenario/"+QFileInfo(scname).fileName(); if(scname.toLower() == "freemode") { QString divScName = scname+QString::number(iframeDivCnt); QString iframeSrc = infoEntityIdent; add(lvl, "
"); //add(lvl, ""); } else if(QFile::exists(scfilename) || scname.toLower().startsWith("system_")) { QString indexfn = SM->projectPath+"/"+ infoEntityIdent; QString scenariofn = SM->projectPath+"/"+QFileInfo(infoEntityIdent).path() +"/"+ QFileInfo(scname).baseName()+".html"; QFile indexFile(indexfn); indexFile.open(QFile::ReadOnly | QFile::Text); QString htmlData = QString(indexFile.readAll()); indexFile.close(); htmlData.replace("FreeMode", scname); QFile scFile(scenariofn); if(QFile::exists(scenariofn)) QFile::remove(scenariofn); scFile.open(QFile::WriteOnly | QFile::Text); QTextStream out(&scFile); out << htmlData; scFile.close(); // можно сделать чтение ширины/высоты с htmlData: // canvas.style.width = "936px"; canvas.style.height = "526px"; // scRegister(scName, scTitle, divID, iframeSrc) //
QString divScName = QFileInfo(scname).fileName(); QString iframeSrc = QFileInfo(infoEntityIdent).path()+"/"+QFileInfo(scname).baseName()+".html"; add(lvl, "
"); //add(lvl, ""); } else { add(lvl, "
Сценарий " + scfilename + " не найден

"); } add(lvl, "
" + title + "

"); } if(multimediaType == "video") { QString id = "ID_mmo"+QString::number(ID_mmos++); labelStruct lbl; lbl.id = id; lbl.title = title; lbl.type = "mmo"; idList.append(lbl); add(lvl, "
"); add(lvl, "
"); add(lvl, "
"); add(lvl, " "); add(lvl, " "); add(lvl, " "); add(lvl, "
"); add(lvl, "
"); add(lvl, "
" + title + "

"); add(lvl, "
"); } return; } QString s = "(-unknown-) " + node.nodeName() + " " + node.nodeValue() + "
"; qDebug() << "Unknown S1000D node: "+node.nodeName(); add(0, s); //for(int j=0;jitem->html.append(spc(lvl)+s); } void HTML::cat(QString s) { int ind = SM->item->html.count()-1; if(ind < 0) ind = 0; SM->item->html[ind] += s; } QString HTML::searchSVGNodeForText(QDomNode node) { if(node.nodeName() == "tspan") return node.childNodes().at(0).nodeValue(); for(int j=0;jВ полете: Величина непревышаемой скорости полета (VNE // // // VNE // Величина непревышаемой скорости // ) составляет 300 км/ч. // Величина непревышаемой скорости полета VNE // при работе //NE // //void clearDir( const QString path ) //{ // QDir dir( path ); // dir.setFilter( QDir::NoDotAndDotDot | QDir::Files ); // foreach( QString dirItem, dir.entryList() ) // dir.remove( dirItem ); // dir.setFilter( QDir::NoDotAndDotDot | QDir::Dirs ); // foreach( QString dirItem, dir.entryList() ) // { // QDir subDir( dir.absoluteFilePath( dirItem ) ); // subDir.removeRecursively(); // } //} //tmp: //http://digitalnativestudios.com/textmeshpro/docs/rich-text/#color