static void generateJSNavTree(const QList<FTVNode> &nodeList) { QCString htmlOutput = Config_getString("HTML_OUTPUT"); QFile f(htmlOutput+"/navtreedata.js"); NavIndexEntryList navIndex; if (f.open(IO_WriteOnly) /*&& fidx.open(IO_WriteOnly)*/) { //FTextStream tidx(&fidx); //tidx << "var NAVTREEINDEX =" << endl; //tidx << "{" << endl; FTextStream t(&f); t << "var NAVTREE =" << endl; t << "[" << endl; t << " [ "; QCString &projName = Config_getString("PROJECT_NAME"); if (projName.isEmpty()) { if (Doxygen::mainPage && !Doxygen::mainPage->title().isEmpty()) // Use title of main page as root { t << "\"" << convertToJSString(Doxygen::mainPage->title()) << "\", "; } else // Use default section title as root { LayoutNavEntry *lne = LayoutDocManager::instance().rootNavEntry()->find(LayoutNavEntry::MainPage); t << "\"" << convertToJSString(lne->title()) << "\", "; } } else // use PROJECT_NAME as root tree element { t << "\"" << convertToJSString(projName) << "\", "; } t << "\"index" << Doxygen::htmlFileExtension << "\", "; // add special entry for index page navIndex.append(new NavIndexEntry("index"+Doxygen::htmlFileExtension,"")); // related page index is written as a child of index.html, so add this as well navIndex.append(new NavIndexEntry("pages"+Doxygen::htmlFileExtension,"")); bool first=TRUE; generateJSTree(navIndex,t,nodeList,1,first); if (first) t << "]" << endl; else t << endl << " ] ]" << endl; t << "];" << endl << endl; // write the navigation index (and sub-indices) navIndex.sort(); int subIndex=0; int elemCount=0; const int maxElemCount=250; //QFile fidx(htmlOutput+"/navtreeindex.js"); QFile fsidx(htmlOutput+"/navtreeindex0.js"); if (/*fidx.open(IO_WriteOnly) &&*/ fsidx.open(IO_WriteOnly)) { //FTextStream tidx(&fidx); FTextStream tsidx(&fsidx); t << "var NAVTREEINDEX =" << endl; t << "[" << endl; tsidx << "var NAVTREEINDEX" << subIndex << " =" << endl; tsidx << "{" << endl; QListIterator<NavIndexEntry> li(navIndex); NavIndexEntry *e; bool first=TRUE; for (li.toFirst(); (e=li.current());) // for each entry { if (elemCount==0) { if (!first) { t << "," << endl; } else { first=FALSE; } t << "\"" << e->url << "\""; } tsidx << "\"" << e->url << "\":[" << e->path << "]"; ++li; if (li.current() && elemCount<maxElemCount-1) tsidx << ","; // not last entry tsidx << endl; elemCount++; if (li.current() && elemCount>=maxElemCount) // switch to new sub-index { tsidx << "};" << endl; elemCount=0; fsidx.close(); subIndex++; fsidx.setName(htmlOutput+"/navtreeindex"+QCString().setNum(subIndex)+".js"); if (!fsidx.open(IO_WriteOnly)) break; tsidx.setDevice(&fsidx); tsidx << "var NAVTREEINDEX" << subIndex << " =" << endl; tsidx << "{" << endl; } } tsidx << "};" << endl; t << endl << "];" << endl; } t << endl << "var SYNCONMSG = '" << theTranslator->trPanelSynchronisationTooltip(FALSE) << "';"; t << endl << "var SYNCOFFMSG = '" << theTranslator->trPanelSynchronisationTooltip(TRUE) << "';"; } ResourceMgr::instance().copyResource("navtree.js",htmlOutput); }
static void generateJSNavTree(const QList<FTVNode> &nodeList) { QCString htmlOutput = Config_getString(HTML_OUTPUT); QFile f(htmlOutput+"/navtreedata.js"); NavIndexEntryList navIndex; if (f.open(IO_WriteOnly) /*&& fidx.open(IO_WriteOnly)*/) { //FTextStream tidx(&fidx); //tidx << "var NAVTREEINDEX =" << endl; //tidx << "{" << endl; FTextStream t(&f); t << "/*\n@ @licstart The following is the entire license notice for the\n" "JavaScript code in this file.\n\nCopyright (C) 1997-2017 by Dimitri van Heesch\n\n" "This program is free software; you can redistribute it and/or modify\n" "it under the terms of the GNU General Public License as published by\n" "the Free Software Foundation; either version 2 of the License, or\n" "(at your option) any later version.\n\n" "This program is distributed in the hope that it will be useful,\n" "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" " GNU General Public License for more details.\n\n" "You should have received a copy of the GNU General Public License along\n" "with this program; if not, write to the Free Software Foundation, Inc.,\n" "51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\n\n" "@licend The above is the entire license notice\n" "for the JavaScript code in this file\n" "*/\n"; t << "var NAVTREE =" << endl; t << "[" << endl; t << " [ "; QCString &projName = Config_getString(PROJECT_NAME); if (projName.isEmpty()) { if (Doxygen::mainPage && !Doxygen::mainPage->title().isEmpty()) // Use title of main page as root { t << "\"" << convertToJSString(Doxygen::mainPage->title()) << "\", "; } else // Use default section title as root { LayoutNavEntry *lne = LayoutDocManager::instance().rootNavEntry()->find(LayoutNavEntry::MainPage); t << "\"" << convertToJSString(lne->title()) << "\", "; } } else // use PROJECT_NAME as root tree element { t << "\"" << convertToJSString(projName) << "\", "; } t << "\"index" << Doxygen::htmlFileExtension << "\", "; // add special entry for index page navIndex.append(new NavIndexEntry("index"+Doxygen::htmlFileExtension,"")); // related page index is written as a child of index.html, so add this as well navIndex.append(new NavIndexEntry("pages"+Doxygen::htmlFileExtension,"")); bool first=TRUE; generateJSTree(navIndex,t,nodeList,1,first); if (first) t << "]" << endl; else t << endl << " ] ]" << endl; t << "];" << endl << endl; // write the navigation index (and sub-indices) navIndex.sort(); int subIndex=0; int elemCount=0; const int maxElemCount=250; //QFile fidx(htmlOutput+"/navtreeindex.js"); QFile fsidx(htmlOutput+"/navtreeindex0.js"); if (/*fidx.open(IO_WriteOnly) &&*/ fsidx.open(IO_WriteOnly)) { //FTextStream tidx(&fidx); FTextStream tsidx(&fsidx); t << "var NAVTREEINDEX =" << endl; t << "[" << endl; tsidx << "var NAVTREEINDEX" << subIndex << " =" << endl; tsidx << "{" << endl; QListIterator<NavIndexEntry> li(navIndex); NavIndexEntry *e; bool first=TRUE; for (li.toFirst();(e=li.current());) // for each entry { if (elemCount==0) { if (!first) { t << "," << endl; } else { first=FALSE; } t << "\"" << e->url << "\""; } tsidx << "\"" << e->url << "\":[" << e->path << "]"; ++li; if (li.current() && elemCount<maxElemCount-1) tsidx << ","; // not last entry tsidx << endl; elemCount++; if (li.current() && elemCount>=maxElemCount) // switch to new sub-index { tsidx << "};" << endl; elemCount=0; fsidx.close(); subIndex++; fsidx.setName(htmlOutput+"/navtreeindex"+QCString().setNum(subIndex)+".js"); if (!fsidx.open(IO_WriteOnly)) break; tsidx.setDevice(&fsidx); tsidx << "var NAVTREEINDEX" << subIndex << " =" << endl; tsidx << "{" << endl; } } tsidx << "};" << endl; t << endl << "];" << endl; } t << endl << "var SYNCONMSG = '" << theTranslator->trPanelSynchronisationTooltip(FALSE) << "';"; t << endl << "var SYNCOFFMSG = '" << theTranslator->trPanelSynchronisationTooltip(TRUE) << "';"; } ResourceMgr::instance().copyResource("navtree.js",htmlOutput); }