Skip to content

Commit

Permalink
Bug 776964 - Menu does not work without Javascript
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimitri van Heesch committed Jan 10, 2017
1 parent c10af45 commit 1be9772
Show file tree
Hide file tree
Showing 6 changed files with 520 additions and 96 deletions.
51 changes: 32 additions & 19 deletions qtools/Doxyfile
@@ -1,4 +1,4 @@
# Doxyfile 1.8.4
# Doxyfile 1.8.14

#---------------------------------------------------------------------------
# Project related configuration options
Expand All @@ -10,6 +10,7 @@ PROJECT_BRIEF =
PROJECT_LOGO =
OUTPUT_DIRECTORY = ../qtools_docs
CREATE_SUBDIRS = YES
ALLOW_UNICODE_NAMES = NO
OUTPUT_LANGUAGE = English
BRIEF_MEMBER_DESC = YES
REPEAT_BRIEF = YES
Expand All @@ -34,12 +35,14 @@ OPTIMIZE_FOR_FORTRAN = NO
OPTIMIZE_OUTPUT_VHDL = NO
EXTENSION_MAPPING =
MARKDOWN_SUPPORT = YES
TOC_INCLUDE_HEADINGS = 0
AUTOLINK_SUPPORT = YES
BUILTIN_STL_SUPPORT = NO
CPP_CLI_SUPPORT = NO
SIP_SUPPORT = NO
IDL_PROPERTY_SUPPORT = YES
DISTRIBUTE_GROUP_DOC = NO
GROUP_NESTED_COMPOUNDS = NO
SUBGROUPING = YES
INLINE_GROUPED_CLASSES = NO
INLINE_SIMPLE_STRUCTS = NO
Expand All @@ -62,7 +65,9 @@ HIDE_IN_BODY_DOCS = NO
INTERNAL_DOCS = NO
CASE_SENSE_NAMES = NO
HIDE_SCOPE_NAMES = NO
HIDE_COMPOUND_REFERENCE= NO
SHOW_INCLUDE_FILES = YES
SHOW_GROUPED_MEMB_INC = NO
FORCE_LOCAL_INCLUDES = NO
INLINE_INFO = YES
SORT_MEMBER_DOCS = YES
Expand All @@ -84,17 +89,18 @@ FILE_VERSION_FILTER =
LAYOUT_FILE =
CITE_BIB_FILES =
#---------------------------------------------------------------------------
# configuration options related to warning and progress messages
# Configuration options related to warning and progress messages
#---------------------------------------------------------------------------
QUIET = NO
WARNINGS = YES
WARN_IF_UNDOCUMENTED = YES
WARN_IF_DOC_ERROR = YES
WARN_NO_PARAMDOC = NO
WARN_AS_ERROR = NO
WARN_FORMAT = "$file:$line: $text "
WARN_LOGFILE =
#---------------------------------------------------------------------------
# configuration options related to the input files
# Configuration options related to the input files
#---------------------------------------------------------------------------
INPUT = .
INPUT_ENCODING = UTF-8
Expand All @@ -116,7 +122,7 @@ FILTER_SOURCE_FILES = NO
FILTER_SOURCE_PATTERNS =
USE_MDFILE_AS_MAINPAGE =
#---------------------------------------------------------------------------
# configuration options related to source browsing
# Configuration options related to source browsing
#---------------------------------------------------------------------------
SOURCE_BROWSER = YES
INLINE_SOURCES = NO
Expand All @@ -127,16 +133,14 @@ REFERENCES_LINK_SOURCE = YES
SOURCE_TOOLTIPS = YES
USE_HTAGS = NO
VERBATIM_HEADERS = YES
CLANG_ASSISTED_PARSING = NO
CLANG_OPTIONS =
#---------------------------------------------------------------------------
# configuration options related to the alphabetical class index
# Configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
ALPHABETICAL_INDEX = YES
COLS_IN_ALPHA_INDEX = 4
IGNORE_PREFIX = Q
#---------------------------------------------------------------------------
# configuration options related to the HTML output
# Configuration options related to the HTML output
#---------------------------------------------------------------------------
GENERATE_HTML = YES
HTML_OUTPUT =
Expand All @@ -150,6 +154,7 @@ HTML_COLORSTYLE_HUE = 220
HTML_COLORSTYLE_SAT = 100
HTML_COLORSTYLE_GAMMA = 80
HTML_TIMESTAMP = YES
HTML_DYNAMIC_MENUS = YES
HTML_DYNAMIC_SECTIONS = NO
HTML_INDEX_NUM_ENTRIES = 100
GENERATE_DOCSET = YES
Expand All @@ -175,7 +180,7 @@ QHG_LOCATION =
GENERATE_ECLIPSEHELP = YES
ECLIPSE_DOC_ID = org.doxygen.qtools
DISABLE_INDEX = NO
GENERATE_TREEVIEW = YES
GENERATE_TREEVIEW = NO
ENUM_VALUES_PER_LINE = 4
TREEVIEW_WIDTH = 250
EXT_LINKS_IN_WINDOW = NO
Expand All @@ -194,7 +199,7 @@ SEARCHDATA_FILE = searchdata.xml
EXTERNAL_SEARCH_ID =
EXTRA_SEARCH_MAPPINGS =
#---------------------------------------------------------------------------
# configuration options related to the LaTeX output
# Configuration options related to the LaTeX output
#---------------------------------------------------------------------------
GENERATE_LATEX = YES
LATEX_OUTPUT =
Expand All @@ -205,48 +210,51 @@ PAPER_TYPE = a4wide
EXTRA_PACKAGES =
LATEX_HEADER =
LATEX_FOOTER =
LATEX_EXTRA_STYLESHEET =
LATEX_EXTRA_FILES =
PDF_HYPERLINKS = YES
USE_PDFLATEX = YES
LATEX_BATCHMODE = NO
LATEX_HIDE_INDICES = NO
LATEX_SOURCE_CODE = YES
LATEX_BIB_STYLE = plain
LATEX_TIMESTAMP = NO
#---------------------------------------------------------------------------
# configuration options related to the RTF output
# Configuration options related to the RTF output
#---------------------------------------------------------------------------
GENERATE_RTF = NO
RTF_OUTPUT =
COMPACT_RTF = NO
RTF_HYPERLINKS = NO
RTF_STYLESHEET_FILE =
RTF_EXTENSIONS_FILE =
RTF_SOURCE_CODE = NO
#---------------------------------------------------------------------------
# configuration options related to the man page output
# Configuration options related to the man page output
#---------------------------------------------------------------------------
GENERATE_MAN = NO
MAN_OUTPUT =
MAN_EXTENSION = .3
MAN_SUBDIR =
MAN_LINKS = NO
#---------------------------------------------------------------------------
# configuration options related to the XML output
# Configuration options related to the XML output
#---------------------------------------------------------------------------
GENERATE_XML = NO
XML_OUTPUT = xml
XML_SCHEMA =
XML_DTD =
XML_PROGRAMLISTING = YES
#---------------------------------------------------------------------------
# configuration options related to the DOCBOOK output
# Configuration options related to the DOCBOOK output
#---------------------------------------------------------------------------
GENERATE_DOCBOOK = NO
DOCBOOK_OUTPUT = docbook
DOCBOOK_PROGRAMLISTING = NO
#---------------------------------------------------------------------------
# configuration options for the AutoGen Definitions output
# Configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
# configuration options related to the Perl module output
# Configuration options related to the Perl module output
#---------------------------------------------------------------------------
GENERATE_PERLMOD = NO
PERLMOD_LATEX = NO
Expand All @@ -265,7 +273,7 @@ PREDEFINED = Q_EXPORT=
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration::additions related to external references
# Configuration options related to external references
#---------------------------------------------------------------------------
TAGFILES =
GENERATE_TAGFILE = ../qtools_docs/qtools.tag
Expand All @@ -278,6 +286,7 @@ PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
CLASS_DIAGRAMS = YES
MSCGEN_PATH =
DIA_PATH =
HIDE_UNDOC_RELATIONS = YES
HAVE_DOT = YES
DOT_NUM_THREADS = 0
Expand All @@ -301,6 +310,10 @@ INTERACTIVE_SVG = YES
DOT_PATH =
DOTFILE_DIRS =
MSCFILE_DIRS =
DIAFILE_DIRS =
PLANTUML_JAR_PATH =
PLANTUML_CFG_FILE =
PLANTUML_INCLUDE_PATH =
DOT_GRAPH_MAX_NODES = 50
MAX_DOT_GRAPH_DEPTH = 0
DOT_TRANSPARENT = YES
Expand Down
12 changes: 12 additions & 0 deletions src/config.xml
Expand Up @@ -1938,6 +1938,18 @@ hr.footer {
each generated HTML page will contain the date and time when the page
was generated. Setting this to \c YES can help to show when doxygen was last run
and thus if the documentation is up to date.
]]>
</docs>
</option>
<option type='bool' id='HTML_DYNAMIC_MENUS' defval='1' depends='GENERATE_HTML'>
<docs>
<![CDATA[
If the \c HTML_DYNAMIC_MENUS tag is set to \c YES then the generated HTML
documentation will contain a main index with vertical navigation menus that
are dynamically created via Javascript. If disabled, the navigation index will consists of
multiple levels of tabs that are statically embedded in every HTML page.
Disable this option to support browsers that do not have Javascript, like
the Qt help browser.
]]>
</docs>
</option>
Expand Down
75 changes: 69 additions & 6 deletions src/htmlgen.cpp
Expand Up @@ -310,7 +310,7 @@ static QCString substituteHtmlKeywords(const QCString &s,

if (!serverBasedSearch)
{
if (disableIndex)
if (disableIndex || !Config_getBool(HTML_DYNAMIC_MENUS))
{
searchCssJs += "<script type=\"text/javascript\">\n"
" $(document).ready(function() { init_search(); });\n"
Expand All @@ -319,7 +319,7 @@ static QCString substituteHtmlKeywords(const QCString &s,
}
else
{
if (disableIndex)
if (disableIndex || !Config_getBool(HTML_DYNAMIC_MENUS))
{
searchCssJs += "<script type=\"text/javascript\">\n"
" $(document).ready(function() {\n"
Expand Down Expand Up @@ -730,13 +730,20 @@ void HtmlGenerator::init()
createSubDirs(d);

ResourceMgr &mgr = ResourceMgr::instance();
mgr.copyResource("tabs.css",dname);
if (Config_getBool(HTML_DYNAMIC_MENUS))
{
mgr.copyResourceAs("tabs.css",dname,"tabs.css");
}
else // stylesheet for the 'old' static tabs
{
mgr.copyResourceAs("fixed_tabs.css",dname,"tabs.css");
}
mgr.copyResource("jquery.js",dname);
if (Config_getBool(INTERACTIVE_SVG))
{
mgr.copyResource("svgpan.js",dname);
}
if (!Config_getBool(DISABLE_INDEX))
if (!Config_getBool(DISABLE_INDEX) && Config_getBool(HTML_DYNAMIC_MENUS))
{
mgr.copyResource("menu.js",dname);
}
Expand Down Expand Up @@ -826,6 +833,10 @@ void HtmlGenerator::writeSearchData(const char *dir)
{
searchCss = mgr.getAsString("search_nomenu.css");
}
else if (!Config_getBool(HTML_DYNAMIC_MENUS))
{
searchCss = mgr.getAsString("search_fixedtabs.css");
}
else
{
searchCss = mgr.getAsString("search.css");
Expand Down Expand Up @@ -2149,8 +2160,36 @@ static void writeDefaultQuickLinks(FTextStream &t,bool compact,
static bool searchEngine = Config_getBool(SEARCHENGINE);
static bool externalSearch = Config_getBool(EXTERNAL_SEARCH);
LayoutNavEntry *root = LayoutDocManager::instance().rootNavEntry();

if (compact)
LayoutNavEntry::Kind kind = (LayoutNavEntry::Kind)-1;
LayoutNavEntry::Kind altKind = (LayoutNavEntry::Kind)-1; // fall back for the old layout file
bool highlightParent=FALSE;
switch (hli) // map HLI enums to LayoutNavEntry::Kind enums
{
case HLI_Main: kind = LayoutNavEntry::MainPage; break;
case HLI_Modules: kind = LayoutNavEntry::Modules; break;
//case HLI_Directories: kind = LayoutNavEntry::Dirs; break;
case HLI_Namespaces: kind = LayoutNavEntry::NamespaceList; altKind = LayoutNavEntry::Namespaces; break;
case HLI_Hierarchy: kind = LayoutNavEntry::ClassHierarchy; break;
case HLI_Classes: kind = LayoutNavEntry::ClassIndex; altKind = LayoutNavEntry::Classes; break;
case HLI_Annotated: kind = LayoutNavEntry::ClassList; altKind = LayoutNavEntry::Classes; break;
case HLI_Files: kind = LayoutNavEntry::FileList; altKind = LayoutNavEntry::Files; break;
case HLI_NamespaceMembers: kind = LayoutNavEntry::NamespaceMembers; break;
case HLI_Functions: kind = LayoutNavEntry::ClassMembers; break;
case HLI_Globals: kind = LayoutNavEntry::FileGlobals; break;
case HLI_Pages: kind = LayoutNavEntry::Pages; break;
case HLI_Examples: kind = LayoutNavEntry::Examples; break;
case HLI_UserGroup: kind = LayoutNavEntry::UserGroup; break;
case HLI_ClassVisible: kind = LayoutNavEntry::ClassList; altKind = LayoutNavEntry::Classes;
highlightParent = TRUE; break;
case HLI_NamespaceVisible: kind = LayoutNavEntry::NamespaceList; altKind = LayoutNavEntry::Namespaces;
highlightParent = TRUE; break;
case HLI_FileVisible: kind = LayoutNavEntry::FileList; altKind = LayoutNavEntry::Files;
highlightParent = TRUE; break;
case HLI_None: break;
case HLI_Search: break;
}

if (compact && Config_getBool(HTML_DYNAMIC_MENUS))
{
QCString searchPage;
if (externalSearch)
Expand Down Expand Up @@ -2187,6 +2226,30 @@ static void writeDefaultQuickLinks(FTextStream &t,bool compact,
t << "</script>" << endl;
t << "<div id=\"main-nav\"></div>" << endl;
}
else if (compact) // && !Config_getBool(HTML_DYNAMIC_MENUS)
{
// find highlighted index item
LayoutNavEntry *hlEntry = root->find(kind,kind==LayoutNavEntry::UserGroup ? file : 0);
if (!hlEntry && altKind!=(LayoutNavEntry::Kind)-1) { hlEntry=root->find(altKind); kind=altKind; }
if (!hlEntry) // highlighted item not found in the index! -> just show the level 1 index...
{
highlightParent=TRUE;
hlEntry = root->children().getFirst();
if (hlEntry==0)
{
return; // argl, empty index!
}
}
if (kind==LayoutNavEntry::UserGroup)
{
LayoutNavEntry *e = hlEntry->children().getFirst();
if (e)
{
hlEntry = e;
}
}
renderQuickLinksAsTabs(t,relPath,hlEntry,kind,highlightParent,hli==HLI_Search);
}
else
{
renderQuickLinksAsTree(t,relPath,root);
Expand Down

0 comments on commit 1be9772

Please sign in to comment.