diff options
Diffstat (limited to 'addon/doxywizard')
-rw-r--r-- | addon/doxywizard/CMakeLists.txt | 25 | ||||
-rw-r--r-- | addon/doxywizard/config_doxyw.l | 227 | ||||
-rwxr-xr-x | addon/doxywizard/doxywizard.cpp | 180 | ||||
-rwxr-xr-x | addon/doxywizard/doxywizard.h | 24 | ||||
-rw-r--r-- | addon/doxywizard/expert.cpp | 46 | ||||
-rw-r--r-- | addon/doxywizard/expert.h | 4 | ||||
-rw-r--r-- | addon/doxywizard/input.h | 1 | ||||
-rw-r--r-- | addon/doxywizard/inputbool.cpp | 40 | ||||
-rw-r--r-- | addon/doxywizard/inputbool.h | 1 | ||||
-rw-r--r-- | addon/doxywizard/inputint.cpp | 24 | ||||
-rw-r--r-- | addon/doxywizard/inputint.h | 1 | ||||
-rw-r--r-- | addon/doxywizard/inputstring.cpp | 5 | ||||
-rw-r--r-- | addon/doxywizard/inputstring.h | 1 | ||||
-rw-r--r-- | addon/doxywizard/inputstrlist.cpp | 68 | ||||
-rw-r--r-- | addon/doxywizard/inputstrlist.h | 1 | ||||
-rwxr-xr-x[-rw-r--r--] | addon/doxywizard/wizard.cpp | 102 | ||||
-rw-r--r-- | addon/doxywizard/wizard.h | 2 |
17 files changed, 543 insertions, 209 deletions
diff --git a/addon/doxywizard/CMakeLists.txt b/addon/doxywizard/CMakeLists.txt index 6aacd8b..1ee8ed5 100644 --- a/addon/doxywizard/CMakeLists.txt +++ b/addon/doxywizard/CMakeLists.txt @@ -29,10 +29,10 @@ if (NOT Qt5Core_FOUND) endif() include_directories( - . - ${CMAKE_SOURCE_DIR}/libversion - ${CMAKE_SOURCE_DIR}/qtools - ${GENERATED_SRC} + . + ${PROJECT_SOURCE_DIR}/libversion + ${PROJECT_SOURCE_DIR}/qtools + ${GENERATED_SRC} ) set(GENERATED_SRC_WIZARD ${GENERATED_SRC}/doxywizard) @@ -58,25 +58,26 @@ set_source_files_properties(${GENERATED_SRC_WIZARD}/settings.h PROPERTIES GENERA # generate version.cpp add_custom_command( - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/src/version.py ${VERSION} > ${GENERATED_SRC_WIZARD}/version.cpp - DEPENDS ${CMAKE_SOURCE_DIR}/VERSION ${CMAKE_SOURCE_DIR}/src/version.py + COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/src/version.py ${VERSION} > ${GENERATED_SRC_WIZARD}/version.cpp + DEPENDS ${PROJECT_SOURCE_DIR}/VERSION ${PROJECT_SOURCE_DIR}/src/version.py OUTPUT ${GENERATED_SRC_WIZARD}/version.cpp ) set_source_files_properties(${GENERATED_SRC_WIZARD}/version.cpp PROPERTIES GENERATED 1) # generate configdoc.cpp add_custom_command( -COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/src/configgen.py -wiz ${CMAKE_SOURCE_DIR}/src/config.xml > ${GENERATED_SRC_WIZARD}/configdoc.cpp -OUTPUT ${GENERATED_SRC_WIZARD}/configdoc.cpp + COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/src/configgen.py -wiz ${PROJECT_SOURCE_DIR}/src/config.xml > ${GENERATED_SRC_WIZARD}/configdoc.cpp + DEPENDS ${PROJECT_SOURCE_DIR}/src/configgen.py ${PROJECT_SOURCE_DIR}/src/config.xml + OUTPUT ${GENERATED_SRC_WIZARD}/configdoc.cpp ) set_source_files_properties(${GENERATED_SRC_WIZARD}/configdoc.cpp PROPERTIES GENERATED 1) -set(LEX_FILES config_doxyw) +set(LEX_FILES config_doxyw) foreach(lex_file ${LEX_FILES}) add_custom_command( - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/src/scan_states.py ${CMAKE_SOURCE_DIR}/addon/doxywizard/${lex_file}.l > ${GENERATED_SRC_WIZARD}/${lex_file}.l.h - DEPENDS ${CMAKE_SOURCE_DIR}/src/scan_states.py ${CMAKE_SOURCE_DIR}/addon/doxywizard/${lex_file}.l - OUTPUT ${GENERATED_SRC_WIZARD}/${lex_file}.l.h + COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/src/scan_states.py ${PROJECT_SOURCE_DIR}/addon/doxywizard/${lex_file}.l > ${GENERATED_SRC_WIZARD}/${lex_file}.l.h + DEPENDS ${PROJECT_SOURCE_DIR}/src/scan_states.py ${PROJECT_SOURCE_DIR}/addon/doxywizard/${lex_file}.l + OUTPUT ${GENERATED_SRC_WIZARD}/${lex_file}.l.h ) set_source_files_properties(${GENERATED_SRC_WIZARD}/${lex_file}.l.h PROPERTIES GENERATED 1) diff --git a/addon/doxywizard/config_doxyw.l b/addon/doxywizard/config_doxyw.l index 4018af7..71d48c9 100644 --- a/addon/doxywizard/config_doxyw.l +++ b/addon/doxywizard/config_doxyw.l @@ -3,8 +3,8 @@ * Copyright (C) 1997-2019 by Dimitri van Heesch. * * Permission to use, copy, modify, and distribute this software and its - * documentation under the terms of the GNU General Public License is hereby - * granted. No representations are made about the suitability of this software + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software * for any purpose. It is provided "as is" without express or implied warranty. * See the GNU General Public License for more details. * @@ -24,6 +24,7 @@ #include "config.h" #include "input.h" #include "inputstring.h" +#include "doxywizard.h" #include <QString> #include <QVariant> @@ -53,14 +54,14 @@ struct ConfigFileState YY_BUFFER_STATE oldState; YY_BUFFER_STATE newState; QString fileName; -}; +}; static const QHash<QString,Input*> *g_options; static FILE *g_file; static QString g_yyFileName; static QString g_includeName; static QVariant g_includePathList; -static QStack<ConfigFileState*> g_includeStack; +static QStack<ConfigFileState*> g_includeStack; static int g_includeDepth; static QVariant *g_arg; static Input *g_curOption=0; @@ -69,6 +70,8 @@ static QTextCodec *g_codec = QTextCodec::codecForName("UT static QString g_codecName = QString::fromLatin1("UTF-8"); static int g_lastState; static QByteArray g_tmpString; +static QString g_cmd; +static int g_part; static const char *stateToString(int state); @@ -77,14 +80,14 @@ static const char *stateToString(int state); #undef YY_INPUT #define YY_INPUT(buf,result,max_size) result=yyread(buf,max_size); -static int yyread(char *buf,int maxSize) +static yy_size_t yyread(char *buf,yy_size_t maxSize) { // no file included - if (g_includeStack.isEmpty()) + if (g_includeStack.isEmpty()) { return fread(buf,1,maxSize,g_file); - } - else + } + else { return fread(buf,1,maxSize,g_includeStack.top()->file); } @@ -96,19 +99,39 @@ static QString error_str = QString::fromLatin1("error: "); void config_err(const char *fmt, ...) { QString msg = error_str; + msg.append(QString::fromLatin1(fmt)); va_list args; va_start(args, fmt); - vfprintf(stderr, qPrintable(msg), args); + if (DoxygenWizard::debugFlag) + { + char debugOut[1000]; // this size should be sufficient + vsnprintf(debugOut, 1000,qPrintable(msg), args); + MainWindow::instance().outputLogText(QString::fromLatin1(debugOut)); + } + else + { + vfprintf(stderr, qPrintable(msg), args); + } va_end(args); } void config_warn(const char *fmt, ...) { QString msg = warning_str; + msg.append(QString::fromLatin1(fmt)); va_list args; va_start(args, fmt); - vfprintf(stderr, qPrintable(msg), args); + if (DoxygenWizard::debugFlag) + { + char debugOut[1000]; + vsnprintf(debugOut, 1000,qPrintable(msg), args); + MainWindow::instance().outputLogText(QString::fromLatin1(debugOut)); + } + else + { + vfprintf(stderr, qPrintable(msg), args); + } va_end(args); } @@ -138,7 +161,7 @@ static FILE *tryPath(const QString &path,const QString &fileName) FILE *f = fopen(absName.toLocal8Bit(),"r"); if (f==NULL) config_err("could not open file %s for reading\n",qPrintable(absName)); - else + else return f; } return NULL; @@ -154,7 +177,7 @@ static FILE *findFile(const QString &fileName) // relative path, try with include paths in the list QStringList sl = g_includePathList.toStringList(); substEnvVarsInStrList(sl); - foreach (QString s, sl) + foreach (QString s, sl) { FILE *f = tryPath(s,fileName); if (f) return f; @@ -165,18 +188,18 @@ static FILE *findFile(const QString &fileName) static void readIncludeFile(const QString &incName) { - if (g_includeDepth==MAX_INCLUDE_DEPTH) + if (g_includeDepth==MAX_INCLUDE_DEPTH) { config_err("maximum include depth (%d) reached, %s is not included. Aborting...\n", MAX_INCLUDE_DEPTH,qPrintable(incName)); exit(1); - } + } QString inc = incName; substEnvVarsInString(inc); inc = inc.trimmed(); uint incLen = inc.length(); - if (inc.at(0)==QChar::fromLatin1('"') && + if (inc.at(0)==QChar::fromLatin1('"') && inc.at(incLen-1)==QChar::fromLatin1('"')) // strip quotes { inc=inc.mid(1,incLen-2); @@ -191,7 +214,7 @@ static void readIncludeFile(const QString &incName) msg("@INCLUDE = %s: parsing...\n",qPrintable(inc)); #endif - // store the state of the old file + // store the state of the old file ConfigFileState *fs=new ConfigFileState; fs->oldState=YY_CURRENT_BUFFER; fs->fileName=g_yyFileName; @@ -203,7 +226,7 @@ static void readIncludeFile(const QString &incName) fs->newState=YY_CURRENT_BUFFER; g_yyFileName=inc; g_includeDepth++; - } + } else { config_err("@INCLUDE = %s: not found!\n",qPrintable(inc)); @@ -225,20 +248,20 @@ static void readIncludeFile(const QString &incName) %x GetEnum %x GetStrList %x GetQuotedString -%x GetEnvVar %x Include %% <*>\0x0d <Start,GetString,GetEnum,GetStrList,SkipInvalid>"#" { BEGIN(SkipComment); } -<Start>[a-z_A-Z][a-z_A-Z0-9]*[ \t]*"=" { QString cmd = g_codec->toUnicode(yytext); - cmd=cmd.left(cmd.length()-1).trimmed(); - g_curOption = g_options->value(cmd); +<Start>[a-z_A-Z][a-z_A-Z0-9]*[ \t]*"=" { g_cmd = g_codec->toUnicode(yytext); + g_part = 0; + g_cmd=g_cmd.left(g_cmd.length()-1).trimmed(); + g_curOption = g_options->value(g_cmd); if (g_curOption==0) // oops not known { config_warn("ignoring unsupported tag '%s' at line %d, file %s\n", - qPrintable(cmd),yylineno,qPrintable(g_yyFileName)); + qPrintable(g_cmd),yylineno,qPrintable(g_yyFileName)); BEGIN(SkipInvalid); } else // known tag @@ -271,20 +294,20 @@ static void readIncludeFile(const QString &incName) case Input::Obsolete: config_warn("Tag '%s' at line %d of file %s has become obsolete.\n" "To avoid this warning please update your configuration " - "file using \"doxygen -u\"\n", qPrintable(cmd), - yylineno,qPrintable(g_yyFileName)); + "file using \"doxygen -u\"\n", qPrintable(g_cmd), + yylineno,qPrintable(g_yyFileName)); BEGIN(SkipInvalid); break; } } } -<Start>[a-z_A-Z][a-z_A-Z0-9]*[ \t]*"+=" { QString cmd=g_codec->toUnicode(yytext); - cmd=cmd.left(cmd.length()-2).trimmed(); - g_curOption = g_options->value(cmd); +<Start>[a-z_A-Z][a-z_A-Z0-9]*[ \t]*"+=" { g_cmd=g_codec->toUnicode(yytext); + g_cmd=g_cmd.left(g_cmd.length()-2).trimmed(); + g_curOption = g_options->value(g_cmd); if (g_curOption==0) // oops not known { config_warn("ignoring unsupported tag '%s' at line %d, file %s\n", - yytext,yylineno,qPrintable(g_yyFileName)); + yytext,yylineno,qPrintable(g_yyFileName)); BEGIN(SkipInvalid); } else // known tag @@ -299,15 +322,15 @@ static void readIncludeFile(const QString &incName) case Input::String: case Input::Int: case Input::Bool: - config_warn("operator += not supported for '%s'. Ignoring line at line %d, file %s\n", - yytext,yylineno,qPrintable(g_yyFileName)); + config_warn("operator += not supported for '%s'. Ignoring line %d, file %s\n", + qPrintable(g_cmd),yylineno,qPrintable(g_yyFileName)); BEGIN(SkipInvalid); break; case Input::Obsolete: config_warn("Tag '%s' at line %d of file %s has become obsolete.\n" "To avoid this warning please update your configuration " - "file using \"doxygen -u\"\n", - qPrintable(cmd),yylineno,qPrintable(g_yyFileName)); + "file using \"doxygen -u\"\n", + qPrintable(g_cmd),yylineno,qPrintable(g_yyFileName)); BEGIN(SkipInvalid); break; } @@ -316,8 +339,8 @@ static void readIncludeFile(const QString &incName) <Start>"@INCLUDE_PATH"[ \t]*"=" { BEGIN(GetStrList); g_arg=&g_includePathList; *g_arg = QStringList(); g_elemStr=QString(); } /* include a config file */ <Start>"@INCLUDE"[ \t]*"=" { BEGIN(Include);} -<Include>([^ \"\t\r\n]+)|("\""[^\n\"]+"\"") { - readIncludeFile(g_codec->toUnicode(yytext)); +<Include>([^ \"\t\r\n]+)|("\""[^\n\"]+"\"") { + readIncludeFile(g_codec->toUnicode(yytext)); BEGIN(Start); } <<EOF>> { @@ -336,20 +359,20 @@ static void readIncludeFile(const QString &incName) yy_switch_to_buffer( fs->oldState ); yy_delete_buffer( oldBuf ); g_yyFileName=fs->fileName; - delete fs; + delete fs; g_includeDepth--; } } <Start>[a-z_A-Z0-9]+ { config_warn("ignoring unknown tag '%s' at line %d, file %s\n",yytext,yylineno,qPrintable(g_yyFileName)); } <GetString,GetEnum,SkipInvalid>\n { BEGIN(Start); } -<GetStrList>\n { +<GetStrList>\n { if (!g_elemStr.isEmpty()) { //printf("elemStr1='%s'\n",qPrintable(elemStr)); *g_arg = QVariant(g_arg->toStringList() << g_elemStr); } - BEGIN(Start); + BEGIN(Start); } <GetStrList>[ \t]+ { if (!g_elemStr.isEmpty()) @@ -360,30 +383,94 @@ static void readIncludeFile(const QString &incName) g_elemStr = QString(); } <GetString>[^ \"\t\r\n]+ { - *g_arg = QVariant(g_codec->toUnicode(yytext)); - checkEncoding(); + if (g_part == 1) // multiple unquoted parts, reset to default + { + config_warn("Invalid value for '%s' tag in line %d, file %s\n" + "Value should not contain unquoted whitespace, " + "using the default\n", + qPrintable(g_cmd),yylineno,qPrintable(g_yyFileName)); + *g_arg=QVariant(g_codec->toUnicode("")); + } + else if (g_part > 1) // multiple unquoted parts, reset to default + { + *g_arg=QVariant(g_codec->toUnicode("")); + } + else + { + *g_arg = QVariant(g_codec->toUnicode(yytext)); + checkEncoding(); + } + g_part++; } <GetEnum>[^ \"\t\r\n]+ { InputString *cur = dynamic_cast<InputString *>(g_curOption); - *g_arg = cur->checkEnumVal(g_codec->toUnicode(yytext)); + if (g_part == 1) // multiple unquoted parts, reset to default + { + config_warn("Invalid value for '%s' tag in line %d, file %s\n" + "Value should not contain unquoted whitespace, " + "using the default\n", + qPrintable(g_cmd),yylineno,qPrintable(g_yyFileName)); + *g_arg=QVariant(g_codec->toUnicode("")); + } + else if (g_part > 1) // multiple unquoted parts, reset to default + { + *g_arg=QVariant(g_codec->toUnicode("")); + } + else + { + *g_arg = cur->checkEnumVal(g_codec->toUnicode(yytext)); + } + g_part++; } <GetString,GetEnum,GetStrList,SkipInvalid>"\"" { g_lastState=YY_START; - BEGIN(GetQuotedString); + BEGIN(GetQuotedString); g_tmpString=""; } -<GetQuotedString>"\""|"\n" { +<GetQuotedString>"\""|"\n" { // we add a bogus space to signal that the string was quoted. This space will be stripped later on. g_tmpString+=" "; //printf("Quoted String = '%s'\n",qPrintable(tmpString)); if (g_lastState==GetString) { - *g_arg = g_codec->toUnicode(g_tmpString); - checkEncoding(); + if (g_part == 1) // multiple unquoted parts, reset to default + { + config_warn("Invalid value for '%s' tag in line %d, file %s\n" + "Value should not contain unquoted whitespace, " + "using the default\n", + qPrintable(g_cmd),yylineno,qPrintable(g_yyFileName)); + *g_arg=g_codec->toUnicode(""); + } + else if (g_part > 1) // multiple unquoted parts, reset to default + { + *g_arg=g_codec->toUnicode(""); + } + else + { + *g_arg = g_codec->toUnicode(g_tmpString); + checkEncoding(); + } + g_part++; } else if (g_lastState==GetEnum) { - InputString *cur = dynamic_cast<InputString *>(g_curOption); - *g_arg = cur->checkEnumVal(g_codec->toUnicode(g_tmpString)); + if (g_part == 1) // multiple unquoted parts, reset to default + { + config_warn("Invalid value for '%s' tag in line %d, file %s\n" + "Value should not contain unquoted whitespace, " + "using the default\n", + qPrintable(g_cmd),yylineno,qPrintable(g_yyFileName)); + *g_arg=g_codec->toUnicode(""); + } + else if (g_part > 1) // multiple unquoted parts, reset to default + { + *g_arg=g_codec->toUnicode(""); + } + else + { + InputString *cur = dynamic_cast<InputString *>(g_curOption); + *g_arg = cur->checkEnumVal(g_codec->toUnicode(g_tmpString)); + } + g_part++; } else { @@ -396,6 +483,9 @@ static void readIncludeFile(const QString &incName) } BEGIN(g_lastState); } +<GetQuotedString>("\\\\"|"@\\"|"\\@"|"@@") { + g_tmpString+=yytext; + } <GetQuotedString>"\\\"" { g_tmpString+='"'; } @@ -442,7 +532,7 @@ static void substEnvVarsInStrList(QStringList &sl) foreach (QString result, sl) { // an argument with quotes will have an extra space at the end, so wasQuoted will be TRUE. - bool wasQuoted = (result.indexOf(QChar::fromLatin1(' '))!=-1) || + bool wasQuoted = (result.indexOf(QChar::fromLatin1(' '))!=-1) || (result.indexOf(QChar::fromLatin1('\t'))!=-1); // here we strip the quote again substEnvVarsInString(result); @@ -452,7 +542,7 @@ static void substEnvVarsInStrList(QStringList &sl) if (!wasQuoted) /* as a result of the expansion, a single string may have expanded into a list, which we'll add to sl. If the original string already - contained multiple elements no further + contained multiple elements no further splitting is done to allow quoted items with spaces! */ { int l=result.length(); @@ -463,11 +553,11 @@ static void substEnvVarsInStrList(QStringList &sl) { QChar c=0; // skip until start of new word - while (i<l && ((c=result.at(i))==QChar::fromLatin1(' ') || c==QChar::fromLatin1('\t'))) i++; + while (i<l && ((c=result.at(i))==QChar::fromLatin1(' ') || c==QChar::fromLatin1('\t'))) i++; p=i; // p marks the start index of the word // skip until end of a word - while (i<l && ((c=result.at(i))!=QChar::fromLatin1(' ') && - c!=QChar::fromLatin1('\t') && + while (i<l && ((c=result.at(i))!=QChar::fromLatin1(' ') && + c!=QChar::fromLatin1('\t') && c!=QChar::fromLatin1('"'))) i++; if (i<l) // not at the end of the string { @@ -481,7 +571,7 @@ static void substEnvVarsInStrList(QStringList &sl) { out += result.mid(p,i-p); p=i+1; - break; + break; } else if (c==QChar::fromLatin1('\\')) // skip escaped stuff { @@ -516,13 +606,18 @@ bool parseConfig( const QHash<QString,Input *> &options ) { + yylineno = 1; + if (DoxygenWizard::debugFlag) + { + MainWindow::instance().outputLogStart(); + } QHashIterator<QString, Input*> i(options); g_file = fopen(fileName.toLocal8Bit(),"r"); if (g_file==NULL) return false; // reset all values i.toFront(); - while (i.hasNext()) + while (i.hasNext()) { i.next(); if (i.value()) @@ -542,7 +637,7 @@ bool parseConfig( // update the values in the UI i.toFront(); - while (i.hasNext()) + while (i.hasNext()) { i.next(); if (i.value()) @@ -554,8 +649,12 @@ bool parseConfig( { printf("Invalid option: %s\n",qPrintable(i.key())); } - } + } fclose(g_file); + if (DoxygenWizard::debugFlag) + { + MainWindow::instance().outputLogFinish(); + } return true; } @@ -572,29 +671,29 @@ void writeStringValue(QTextStream &t,QTextCodec *codec,const QString &s) { if (*p != QChar::fromLatin1('"')) { - while (!(c=*p++).isNull() && !needsEscaping) + while (!(c=*p++).isNull() && !needsEscaping) { - needsEscaping = (c==QChar::fromLatin1(' ') || - c==QChar::fromLatin1('\n') || - c==QChar::fromLatin1('\t') || + needsEscaping = (c==QChar::fromLatin1(' ') || + c==QChar::fromLatin1('\n') || + c==QChar::fromLatin1('\t') || c==QChar::fromLatin1('"')); } p=s.data(); - while (!(c=*p++).isNull() && !needsHashEscaping) + while (!(c=*p++).isNull() && !needsHashEscaping) { needsHashEscaping = (c==QChar::fromLatin1('#')); } } if (needsHashEscaping || needsEscaping) - { + { t << "\""; } if (needsEscaping) - { + { p=s.data(); while (!p->isNull()) { - if (*p ==QChar::fromLatin1(' ') && + if (*p ==QChar::fromLatin1(' ') && *(p+1)==QChar::fromLatin1('\0')) break; // skip inserted space at the end if (*p ==QChar::fromLatin1('"')) t << "\\"; // escape quotes t << *p++; @@ -605,7 +704,7 @@ void writeStringValue(QTextStream &t,QTextCodec *codec,const QString &s) t << s; } if (needsHashEscaping || needsEscaping) - { + { t << "\""; } } diff --git a/addon/doxywizard/doxywizard.cpp b/addon/doxywizard/doxywizard.cpp index ce22367..7b6aeb0 100755 --- a/addon/doxywizard/doxywizard.cpp +++ b/addon/doxywizard/doxywizard.cpp @@ -3,8 +3,8 @@ * Copyright (C) 1997-2019 by Dimitri van Heesch. * * Permission to use, copy, modify, and distribute this software and its - * documentation under the terms of the GNU General Public License is hereby - * granted. No representations are made about the suitability of this software + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software * for any purpose. It is provided "as is" without express or implied warranty. * See the GNU General Public License for more details. * @@ -22,6 +22,7 @@ #include <QVBoxLayout> #include <QLineEdit> #include <QLabel> +#include <QCheckBox> #include <QTextBrowser> #include <QStatusBar> #include <QProcess> @@ -41,6 +42,9 @@ #define MAX_RECENT_FILES 10 +// globally accessible variables +bool DoxygenWizard::debugFlag = false; + const int messageTimeout = 5000; //!< status bar message timeout in milliseconds. #define APPQT(x) QString::fromLatin1("<qt><pre>") + x + QString::fromLatin1("</pre></qt>") @@ -57,36 +61,39 @@ MainWindow::MainWindow() : m_settings(QString::fromLatin1("Doxygen.org"), QString::fromLatin1("Doxywizard")) { QMenu *file = menuBar()->addMenu(tr("File")); - file->addAction(tr("Open..."), + file->addAction(tr("Open..."), this, SLOT(openConfig()), Qt::CTRL+Qt::Key_O); m_recentMenu = file->addMenu(tr("Open recent")); - file->addAction(tr("Save"), + file->addAction(tr("Save"), this, SLOT(saveConfig()), Qt::CTRL+Qt::Key_S); - file->addAction(tr("Save as..."), + file->addAction(tr("Save as..."), this, SLOT(saveConfigAs()), Qt::SHIFT+Qt::CTRL+Qt::Key_S); - file->addAction(tr("Quit"), + file->addAction(tr("Quit"), this, SLOT(quit()), Qt::CTRL+Qt::Key_Q); QMenu *settings = menuBar()->addMenu(tr("Settings")); - settings->addAction(tr("Reset to factory defaults"), + m_resetDefault = settings->addAction(tr("Reset to factory defaults"), this,SLOT(resetToDefaults())); settings->addAction(tr("Use current settings at startup"), this,SLOT(makeDefaults())); - settings->addAction(tr("Clear recent list"), + m_clearRecent = settings->addAction(tr("Clear recent list"), this,SLOT(clearRecent())); QMenu *help = menuBar()->addMenu(tr("Help")); - help->addAction(tr("Online manual"), + help->addAction(tr("Online manual"), this, SLOT(manual()), Qt::Key_F1); - help->addAction(tr("About"), + help->addAction(tr("About"), this, SLOT(about()) ); m_expert = new Expert; m_wizard = new Wizard(m_expert->modelData()); // ----------- top part ------------------ + QWidget *mainPart = new QWidget; + QVBoxLayout *mainLayout = new QVBoxLayout(mainPart); QWidget *topPart = new QWidget; QVBoxLayout *rowLayout = new QVBoxLayout(topPart); + mainLayout->addWidget(topPart); // select working directory QHBoxLayout *dirLayout = new QHBoxLayout; @@ -107,11 +114,43 @@ MainWindow::MainWindow() m_saveLog = new QPushButton(tr("Save log...")); m_saveLog->setEnabled(false); QPushButton *showSettings = new QPushButton(tr("Show configuration")); - runLayout->addWidget(m_run); - runLayout->addWidget(m_runStatus); + + m_showCondensedSettings = new QCheckBox(this); + m_showCondensedSettings->setText(tr("Condensed")); + m_showCondensedSettings->setChecked(false); + m_showCondensedSettings->setToolTip(tr("Show only configuration settings different from default settings")); + + // select extra run options + m_runOptions = new QLineEdit; + + runTabLayout->addWidget(new QLabel(tr("Specify additional command line options for running doxygen"))); + runTabLayout->addWidget(m_runOptions); + + QVBoxLayout *runVLayout = new QVBoxLayout; + runLayout->addLayout(runVLayout); + QHBoxLayout *runVHLayout = new QHBoxLayout; + runVLayout->addLayout(runVHLayout); + runVHLayout->addWidget(m_run); + runVHLayout->addWidget(m_runStatus); + + QHBoxLayout *runVH2Layout = new QHBoxLayout; + runVLayout->addLayout(runVH2Layout); + m_launchHtml = new QPushButton(tr("Show HTML output")); + runVH2Layout->addWidget(m_launchHtml); + runVH2Layout->addStretch(1); // to have launch button not being stretched + runLayout->addStretch(1); - runLayout->addWidget(showSettings); - runLayout->addWidget(m_saveLog); + + QVBoxLayout *settingsLayout = new QVBoxLayout; + runLayout->addLayout(settingsLayout); + settingsLayout->addWidget(m_showCondensedSettings); + settingsLayout->addWidget(showSettings); + + QVBoxLayout *saveLayout = new QVBoxLayout; + runLayout->addLayout(saveLayout); + saveLayout->addWidget(m_saveLog); + saveLayout->setAlignment(Qt::AlignTop); + // saveLayout->addWidget(new QWidget); // to have the save button at the top // output produced by Doxygen runTabLayout->addLayout(runLayout); @@ -126,12 +165,6 @@ MainWindow::MainWindow() grid->addWidget(m_outputLog,0,0); grid->setColumnStretch(0,1); grid->setRowStretch(0,1); - QHBoxLayout *launchLayout = new QHBoxLayout; - m_launchHtml = new QPushButton(tr("Show HTML output")); - launchLayout->addWidget(m_launchHtml); - - launchLayout->addStretch(1); - grid->addLayout(launchLayout,1,0); runTabLayout->addLayout(grid); m_tabs = new QTabWidget; @@ -139,12 +172,12 @@ MainWindow::MainWindow() m_tabs->addTab(m_expert,tr("Expert")); m_tabs->addTab(runTab,tr("Run")); - rowLayout->addWidget(new QLabel(tr("Step 1: Specify the working directory from which doxygen will run"))); + rowLayout->addWidget(new QLabel(tr("Specify the working directory from which doxygen will run"))); rowLayout->addLayout(dirLayout); - rowLayout->addWidget(new QLabel(tr("Step 2: Configure doxygen using the Wizard and/or Expert tab, then switch to the Run tab to generate the documentation"))); - rowLayout->addWidget(m_tabs); + rowLayout->addWidget(new QLabel(tr("Configure doxygen using the Wizard and/or Expert tab, then switch to the Run tab to generate the documentation"))); + mainLayout->addWidget(m_tabs); - setCentralWidget(topPart); + setCentralWidget(mainPart); statusBar()->showMessage(tr("Welcome to Doxygen"),messageTimeout); m_runProcess = new QProcess; @@ -193,6 +226,10 @@ void MainWindow::quit() { saveSettings(); } + else + { + return; + } QApplication::exit(0); } @@ -220,7 +257,7 @@ void MainWindow::updateWorkingDir() void MainWindow::manual() { - QDesktopServices::openUrl(QUrl(QString::fromLatin1("http://www.doxygen.org/manual/index.html"))); + QDesktopServices::openUrl(QUrl(QString::fromLatin1("https://www.doxygen.org/manual/index.html"))); } void MainWindow::about() @@ -229,7 +266,15 @@ void MainWindow::about() QTextStream t(&msg,QIODevice::WriteOnly); t << QString::fromLatin1("<qt><center>A tool to configure and run doxygen version ")+ QString::fromLatin1(getDoxygenVersion())+ - QString::fromLatin1(" on your source files.</center><p><br>" + QString::fromLatin1(" on your source files.</center>")+ + QString::fromLatin1("<center>(Created with Qt version ")+ + QString::fromLatin1(QT_VERSION_STR); + if (qstrcmp(qVersion(),QT_VERSION_STR)) + { + t << QString::fromLatin1(", running with ")+ + QString::fromLatin1(qVersion()); + } + t << QString::fromLatin1(")</center><p><br>" "<center>Written by<br> Dimitri van Heesch<br>© 2000-2019</center><p>" "</qt>"); QMessageBox::about(this,tr("Doxygen GUI"),msg); @@ -288,7 +333,7 @@ void MainWindow::saveConfig(const QString &fileName) return; } QTextStream t(&f); - m_expert->writeConfig(t,false); + m_expert->writeConfig(t,false,false); updateConfigFileName(fileName); m_modified = false; updateTitle(); @@ -309,7 +354,7 @@ bool MainWindow::saveConfig() bool MainWindow::saveConfigAs() { - QString fileName = QFileDialog::getSaveFileName(this, QString(), + QString fileName = QFileDialog::getSaveFileName(this, QString(), m_workingDir->text()+QString::fromLatin1("/Doxyfile")); if (fileName.isEmpty()) return false; saveConfig(fileName); @@ -345,9 +390,11 @@ void MainWindow::clearRecent() { m_settings.setValue(QString::fromLatin1("recent/config%1").arg(i++),QString::fromLatin1("")); } + m_clearRecent->setEnabled(false); + m_recentMenu->setEnabled(false); m_settings.sync(); } - + } void MainWindow::resetToDefaults() @@ -362,6 +409,8 @@ void MainWindow::resetToDefaults() m_expert->resetToDefaults(); m_settings.setValue(QString::fromLatin1("wizard/loadsettings"), false); m_settings.sync(); + m_modified = false; + updateTitle(); m_wizard->refresh(); } } @@ -429,7 +478,7 @@ void MainWindow::addRecentFileList(const QString &fileName) { int i=m_recentFiles.indexOf(fileName); if (i!=-1) m_recentFiles.removeAt(i); - + // not found if (m_recentFiles.count() < MAX_RECENT_FILES) // append { @@ -440,12 +489,15 @@ void MainWindow::addRecentFileList(const QString &fileName) m_recentFiles.removeLast(); m_recentFiles.prepend(fileName); } + m_clearRecent->setEnabled(m_recentFiles.count()>0); + m_recentMenu->setEnabled(m_recentFiles.count()>0); + m_settings.sync(); } void MainWindow::updateRecentFile(void) { m_recentMenu->clear(); int i=0; - foreach( QString str, m_recentFiles ) + foreach( QString str, m_recentFiles ) { m_recentMenu->addAction(str); m_settings.setValue(QString::fromLatin1("recent/config%1").arg(i++),str); @@ -454,6 +506,9 @@ void MainWindow::updateRecentFile(void) { m_settings.setValue(QString::fromLatin1("recent/config%1").arg(i),QString::fromLatin1("")); } + m_clearRecent->setEnabled(m_recentFiles.count()>0); + m_recentMenu->setEnabled(m_recentFiles.count()>0); + m_settings.sync(); } void MainWindow::openRecent(QAction *action) @@ -468,18 +523,18 @@ void MainWindow::runDoxygen() { if (!m_running) { - QString doxygenPath; + QString doxygenPath; #if defined(Q_OS_MACX) doxygenPath = qApp->applicationDirPath()+QString::fromLatin1("/../Resources/"); qDebug() << tr("Doxygen path: ") << doxygenPath; - if ( !QFile(doxygenPath + QString::fromLatin1("doxygen")).exists() ) + if ( !QFile(doxygenPath + QString::fromLatin1("doxygen")).exists() ) { // No Doxygen binary in the resources, if there is a system Doxygen binary, use that instead if ( QFile(QString::fromLatin1("/usr/local/bin/doxygen")).exists() ) { doxygenPath = QString::fromLatin1("/usr/local/bin/"); } - else + else { qDebug() << tr("Can't find the doxygen command, make sure it's in your $$PATH"); doxygenPath = QString::fromLatin1(""); @@ -493,11 +548,14 @@ void MainWindow::runDoxygen() m_runProcess->setWorkingDirectory(m_workingDir->text()); QStringList env=QProcess::systemEnvironment(); // set PWD environment variable to m_workingDir - env.replaceInStrings(QRegExp(QString::fromLatin1("^PWD=(.*)"),Qt::CaseInsensitive), + env.replaceInStrings(QRegExp(QString::fromLatin1("^PWD=(.*)"),Qt::CaseInsensitive), QString::fromLatin1("PWD=")+m_workingDir->text()); m_runProcess->setEnvironment(env); QStringList args; + QStringList runOptions = m_runOptions->text().split(QLatin1Char(' '),QString::SkipEmptyParts); + + args << runOptions; args << QString::fromLatin1("-b"); // make stdout unbuffered args << QString::fromLatin1("-"); // read config from stdin @@ -511,7 +569,7 @@ void MainWindow::runDoxygen() return; } QTextStream t(m_runProcess); - m_expert->writeConfig(t,false); + m_expert->writeConfig(t,false,false); m_runProcess->closeWriteChannel(); if (m_runProcess->state() == QProcess::NotRunning) @@ -601,7 +659,7 @@ void MainWindow::showHtmlOutput() void MainWindow::saveLog() { - QString fn = QFileDialog::getSaveFileName(this, tr("Save log file"), + QString fn = QFileDialog::getSaveFileName(this, tr("Save log file"), m_workingDir->text()+ QString::fromLatin1("/doxygen_log.txt")); if (!fn.isEmpty()) @@ -625,7 +683,14 @@ void MainWindow::showSettings() { QString text; QTextStream t(&text); - m_expert->writeConfig(t,true); + if (m_showCondensedSettings->isChecked()) + { + m_expert->writeConfig(t,true,true); + } + else + { + m_expert->writeConfig(t,true,false); + } m_outputLog->clear(); m_outputLog->append(APPQT(text)); m_outputLog->ensureCursorVisible(); @@ -641,6 +706,7 @@ void MainWindow::configChanged() void MainWindow::updateTitle() { QString title = tr("Doxygen GUI frontend"); + m_resetDefault->setEnabled(m_modified); if (m_modified) { title+=QString::fromLatin1(" +"); @@ -685,11 +751,26 @@ bool MainWindow::discardUnsavedChanges(bool saveOption) return true; } +void MainWindow::outputLogStart() +{ + m_outputLog->clear(); +} +void MainWindow::outputLogText(QString text) +{ + m_outputLog->append(APPQT(text)); +} +void MainWindow::outputLogFinish() +{ + m_outputLog->ensureCursorVisible(); + m_saveLog->setEnabled(true); +} //----------------------------------------------------------------------- int main(int argc,char **argv) { QApplication a(argc,argv); - if (argc == 2) + int locArgc = argc; + + if (locArgc == 2) { if (!qstrcmp(argv[1],"--help")) { @@ -701,12 +782,25 @@ int main(int argc,char **argv) else if (!qstrcmp(argv[1],"--version")) { QMessageBox msgBox; - msgBox.setText(QString::fromLatin1("Doxywizard version: %1").arg(QString::fromLatin1(getFullVersion()))); + if (!qstrcmp(qVersion(),QT_VERSION_STR)) + { + msgBox.setText(QString::fromLatin1("Doxywizard version: %1, Qt version: %2").arg(QString::fromLatin1(getFullVersion()),QString::fromLatin1(QT_VERSION_STR))); + } + else + { + msgBox.setText(QString::fromLatin1("Doxywizard version: %1, Qt version: created with %2, running with %3").arg(QString::fromLatin1(getFullVersion()),QString::fromLatin1(QT_VERSION_STR),QString::fromLatin1(qVersion()))); + } msgBox.exec(); exit(0); } } - if (argc > 2) + if (!qstrcmp(argv[1],"--debug") && ((locArgc == 2) || (locArgc == 3))) + { + DoxygenWizard::debugFlag = true; + locArgc--; + } + + if (locArgc > 2) { QMessageBox msgBox; msgBox.setText(QString::fromLatin1("Too many arguments specified\n\nUsage: %1 [config file]").arg(QString::fromLatin1(argv[0]))); @@ -716,9 +810,9 @@ int main(int argc,char **argv) else { MainWindow &main = MainWindow::instance(); - if (argc==2 && argv[1][0]!='-') // name of config file as an argument + if (locArgc==2 && argv[argc-1][0]!='-') // name of config file as an argument { - main.loadConfigFromFile(QString::fromLocal8Bit(argv[1])); + main.loadConfigFromFile(QString::fromLocal8Bit(argv[argc-1])); } main.show(); return a.exec(); diff --git a/addon/doxywizard/doxywizard.h b/addon/doxywizard/doxywizard.h index c64941e..ff587aa 100755 --- a/addon/doxywizard/doxywizard.h +++ b/addon/doxywizard/doxywizard.h @@ -3,8 +3,8 @@ * Copyright (C) 1997-2019 by Dimitri van Heesch. * * Permission to use, copy, modify, and distribute this software and its - * documentation under the terms of the GNU General Public License is hereby - * granted. No representations are made about the suitability of this software + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software * for any purpose. It is provided "as is" without express or implied warranty. * See the GNU General Public License for more details. * @@ -20,6 +20,7 @@ class Expert; class Wizard; class QLabel; +class QCheckBox; class QLineEdit; class QPushButton; class QTextBrowser; @@ -40,6 +41,10 @@ class MainWindow : public QMainWindow void closeEvent(QCloseEvent *event); QString configFileName() const { return m_fileName; } void updateTitle(); + // access routines for outputLog pane + void outputLogStart(); + void outputLogText(QString text); + void outputLogFinish(); public slots: void manual(); @@ -65,7 +70,7 @@ class MainWindow : public QMainWindow void configChanged(); void clearRecent(); void selectRunTab(); - + private: MainWindow(); void saveConfig(const QString &fileName); @@ -78,9 +83,11 @@ class MainWindow : public QMainWindow bool discardUnsavedChanges(bool saveOption=true); QLineEdit *m_workingDir; + QLineEdit *m_runOptions; QPushButton *m_selWorkingDir; QPushButton *m_run; QPushButton *m_saveLog; + QCheckBox *m_showCondensedSettings; QPushButton *m_launchHtml; QPushButton *m_launchPdf; QTextBrowser *m_outputLog; @@ -91,6 +98,8 @@ class MainWindow : public QMainWindow QSettings m_settings; QMenu *m_recentMenu; QStringList m_recentFiles; + QAction *m_resetDefault; + QAction *m_clearRecent; QProcess *m_runProcess; QTimer *m_timer; QTabWidget *m_tabs; @@ -98,4 +107,13 @@ class MainWindow : public QMainWindow bool m_modified; }; +/*! \brief This class serves as a namespace for global variables used by the doxygen wizard. + * + * All fields in this class are public and static, so they can be used directly. + */ +class DoxygenWizard +{ + public: + static bool debugFlag; +}; #endif diff --git a/addon/doxywizard/expert.cpp b/addon/doxywizard/expert.cpp index c043994..7fd7df3 100644 --- a/addon/doxywizard/expert.cpp +++ b/addon/doxywizard/expert.cpp @@ -139,10 +139,14 @@ void Expert::createTopics(const QDomElement &rootElem) { // Remove _ from a group name like: Source_Browser QString name = childElem.attribute(SA("name")).replace(SA("_"),SA(" ")); - items.append(new QTreeWidgetItem((QTreeWidget*)0,QStringList(name))); - QWidget *widget = createTopicWidget(childElem); - m_topics[name] = widget; - m_topicStack->addWidget(widget); + QString setting = childElem.attribute(SA("setting")); + if (setting.isEmpty() || IS_SUPPORTED(setting.toLatin1())) + { + items.append(new QTreeWidgetItem((QTreeWidget*)0,QStringList(name))); + QWidget *widget = createTopicWidget(childElem); + m_topics[name] = widget; + m_topicStack->addWidget(widget); + } } childElem = childElem.nextSiblingElement(); } @@ -423,7 +427,7 @@ static QString getDocsForNode(const QDomElement &child) regexp.setPattern(SA("`([^`]+)`")); docs.replace(regexp,SA("<code>\\1</code>")); // \ref key "desc" -> <code>desc</code> - regexp.setPattern(SA("\\\\ref[ ]+[^ ]+[ ]+\"([^ ]+)\"")); + regexp.setPattern(SA("\\\\ref[ ]+[^ ]+[ ]+\"([^\"]+)\"")); docs.replace(regexp,SA("<code>\\1</code> ")); //\ref specials // \ref <key> -> description @@ -752,15 +756,18 @@ void Expert::loadConfig(const QString &fileName) } void Expert::saveTopic(QTextStream &t,QDomElement &elem,QTextCodec *codec, - bool brief) + bool brief,bool condensed) { if (!brief) { t << endl; } - t << "#---------------------------------------------------------------------------" << endl; - t << "# " << elem.attribute(SA("docs")) << endl; - t << "#---------------------------------------------------------------------------" << endl; + if (!condensed) + { + t << "#---------------------------------------------------------------------------" << endl; + t << "# " << elem.attribute(SA("docs")) << endl; + t << "#---------------------------------------------------------------------------" << endl; + } // write options... QDomElement childElem = elem.firstChildElement(); while (!childElem.isNull()) @@ -780,24 +787,29 @@ void Expert::saveTopic(QTextStream &t,QDomElement &elem,QTextCodec *codec, t << convertToComment(option->templateDocs()); t << endl; } - t << name.leftJustified(MAX_OPTION_LENGTH) << "="; - if (option && !option->isEmpty()) + bool toPrint = true; + if (option && condensed) toPrint = !option->isDefault(); + if (toPrint) { - t << " "; - option->writeValue(t,codec); + t << name.leftJustified(MAX_OPTION_LENGTH) << "="; + if (option && !option->isEmpty()) + { + t << " "; + option->writeValue(t,codec); + } + t << endl; } - t << endl; } } childElem = childElem.nextSiblingElement(); } } -bool Expert::writeConfig(QTextStream &t,bool brief) +bool Expert::writeConfig(QTextStream &t,bool brief, bool condensed) { // write global header t << "# Doxyfile " << getDoxygenVersion() << endl << endl; - if (!brief) + if (!brief && !condensed) { t << convertToComment(m_header); } @@ -817,7 +829,7 @@ bool Expert::writeConfig(QTextStream &t,bool brief) { if (childElem.tagName()==SA("group")) { - saveTopic(t,childElem,codec,brief); + saveTopic(t,childElem,codec,brief,condensed); } childElem = childElem.nextSiblingElement(); } diff --git a/addon/doxywizard/expert.h b/addon/doxywizard/expert.h index f58ef62..7011eb4 100644 --- a/addon/doxywizard/expert.h +++ b/addon/doxywizard/expert.h @@ -38,7 +38,7 @@ class Expert : public QSplitter, public DocIntf void loadSettings(QSettings *); void saveSettings(QSettings *); void loadConfig(const QString &fileName); - bool writeConfig(QTextStream &t,bool brief); + bool writeConfig(QTextStream &t,bool brief,bool condensed); QByteArray saveInnerState () const; bool restoreInnerState ( const QByteArray & state ); const QHash<QString,Input*> &modelData() const { return m_options; } @@ -67,7 +67,7 @@ class Expert : public QSplitter, public DocIntf private: void createTopics(const QDomElement &); - void saveTopic(QTextStream &t,QDomElement &elem,QTextCodec *codec,bool brief); + void saveTopic(QTextStream &t,QDomElement &elem,QTextCodec *codec,bool brief,bool dondensed); QSplitter *m_splitter; QTextBrowser *m_helper; diff --git a/addon/doxywizard/input.h b/addon/doxywizard/input.h index ff8339a..c1815d0 100644 --- a/addon/doxywizard/input.h +++ b/addon/doxywizard/input.h @@ -40,6 +40,7 @@ class Input virtual void setEnabled(bool) = 0; virtual void updateDependencies() = 0; virtual void reset() = 0; + virtual bool isDefault() = 0; virtual void writeValue(QTextStream &t,QTextCodec *codec) = 0; virtual void setTemplateDocs(const QString &docs) = 0; virtual bool isEmpty() { return false; }; diff --git a/addon/doxywizard/inputbool.cpp b/addon/doxywizard/inputbool.cpp index 63d9998..65e1d26 100644 --- a/addon/doxywizard/inputbool.cpp +++ b/addon/doxywizard/inputbool.cpp @@ -3,8 +3,8 @@ * Copyright (C) 1997-2019 by Dimitri van Heesch. * * Permission to use, copy, modify, and distribute this software and its - * documentation under the terms of the GNU General Public License is hereby - * granted. No representations are made about the suitability of this software + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software * for any purpose. It is provided "as is" without express or implied warranty. * See the GNU General Public License for more details. * @@ -18,7 +18,7 @@ #include <QTextCodec> #include <QGridLayout> -InputBool::InputBool( QGridLayout *layout, int &row, +InputBool::InputBool( QGridLayout *layout, int &row, const QString &id, bool checked, const QString &docs ) : m_default(checked), m_docs(docs), m_id(id) @@ -42,10 +42,10 @@ void InputBool::help() } void InputBool::setEnabled(bool b) -{ +{ m_enabled = b; - m_cb->setEnabled(b); - m_lab->setEnabled(b); + m_cb->setEnabled(b); + m_lab->setEnabled(b); updateDefault(); updateDependencies(); } @@ -60,7 +60,7 @@ void InputBool::updateDependencies() void InputBool::setValue( bool s ) { - if (m_state!=s) + if (m_state!=s) { m_state=s; updateDefault(); @@ -91,9 +91,18 @@ QVariant &InputBool::value() void InputBool::update() { QString v = m_value.toString().toLower(); - m_state = (v==QString::fromLatin1("yes") || - v==QString::fromLatin1("true") || - v==QString::fromLatin1("1")); + if (v==QString::fromLatin1("yes") || v==QString::fromLatin1("true") || v==QString::fromLatin1("1")) + { + m_state = true; + } + else if (v==QString::fromLatin1("no") || v==QString::fromLatin1("false") || v==QString::fromLatin1("0")) + { + m_state = false; + } + else + { + m_state = m_default; + } m_cb->setChecked( m_state ); updateDefault(); updateDependencies(); @@ -106,9 +115,14 @@ void InputBool::reset() void InputBool::writeValue(QTextStream &t,QTextCodec *codec) { - if (m_state) - t << codec->fromUnicode(QString::fromLatin1("YES")); - else + if (m_state) + t << codec->fromUnicode(QString::fromLatin1("YES")); + else t << codec->fromUnicode(QString::fromLatin1("NO")); } +bool InputBool::isDefault() +{ + return m_state == m_default; +} + diff --git a/addon/doxywizard/inputbool.h b/addon/doxywizard/inputbool.h index 98f7f85..a527e20 100644 --- a/addon/doxywizard/inputbool.h +++ b/addon/doxywizard/inputbool.h @@ -38,6 +38,7 @@ class InputBool : public QObject, public Input void addDependency(Input *option) { m_dependencies+=option; } void setEnabled(bool); void updateDependencies(); + bool isDefault(); void writeValue(QTextStream &t,QTextCodec *codec); void setTemplateDocs(const QString &docs) { m_tdocs = docs; } diff --git a/addon/doxywizard/inputint.cpp b/addon/doxywizard/inputint.cpp index 2aa019b..d97f1b0 100644 --- a/addon/doxywizard/inputint.cpp +++ b/addon/doxywizard/inputint.cpp @@ -3,8 +3,8 @@ * Copyright (C) 1997-2019 by Dimitri van Heesch. * * Permission to use, copy, modify, and distribute this software and its - * documentation under the terms of the GNU General Public License is hereby - * granted. No representations are made about the suitability of this software + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software * for any purpose. It is provided "as is" without express or implied warranty. * See the GNU General Public License for more details. * @@ -28,7 +28,7 @@ class NoWheelSpinBox : public QSpinBox }; InputInt::InputInt( QGridLayout *layout,int &row, - const QString & id, + const QString & id, int defVal, int minVal,int maxVal, const QString & docs ) : m_default(defVal), m_minVal(minVal), m_maxVal(maxVal), m_docs(docs), m_id(id) @@ -44,7 +44,7 @@ InputInt::InputInt( QGridLayout *layout,int &row, layout->addWidget( m_lab, row, 0 ); layout->addWidget( m_sp, row, 1 ); - connect(m_sp, SIGNAL(valueChanged(int)), + connect(m_sp, SIGNAL(valueChanged(int)), this, SLOT(setValue(int)) ); connect( m_lab, SIGNAL(enter()), SLOT(help()) ); connect( m_lab, SIGNAL(reset()), SLOT(reset()) ); @@ -61,7 +61,7 @@ void InputInt::setValue(int val) { val = qMax(m_minVal,val); val = qMin(m_maxVal,val); - if (val!=m_val) + if (val!=m_val) { m_val = val; m_sp->setValue(val); @@ -81,7 +81,7 @@ void InputInt::updateDefault() { m_lab->setText(QString::fromLatin1("<qt><font color='red'>")+m_id+QString::fromLatin1("</font></qt>")); } - emit changed(); + emit changed(); } } @@ -92,14 +92,17 @@ void InputInt::setEnabled(bool state) updateDefault(); } -QVariant &InputInt::value() +QVariant &InputInt::value() { return m_value; } void InputInt::update() { - setValue(m_value.toInt()); + bool ok; + int newVal = m_value.toInt(&ok); + if (!ok) newVal = m_default; + setValue(newVal); } void InputInt::reset() @@ -112,3 +115,8 @@ void InputInt::writeValue(QTextStream &t,QTextCodec *) t << m_val; } + +bool InputInt::isDefault() +{ + return m_val == m_default; +} diff --git a/addon/doxywizard/inputint.h b/addon/doxywizard/inputint.h index 10d735e..60d4415 100644 --- a/addon/doxywizard/inputint.h +++ b/addon/doxywizard/inputint.h @@ -41,6 +41,7 @@ class InputInt : public QObject, public Input void addDependency(Input *) { Q_ASSERT(false); } void setEnabled(bool); void updateDependencies() {} + bool isDefault(); void writeValue(QTextStream &t,QTextCodec *codec); void setTemplateDocs(const QString &docs) { m_tdocs = docs; } diff --git a/addon/doxywizard/inputstring.cpp b/addon/doxywizard/inputstring.cpp index 2f81b5b..e7a2b5b 100644 --- a/addon/doxywizard/inputstring.cpp +++ b/addon/doxywizard/inputstring.cpp @@ -253,6 +253,11 @@ void InputString::writeValue(QTextStream &t,QTextCodec *codec) writeStringValue(t,codec,m_str); } +bool InputString::isDefault() +{ + return m_str == m_default; +} + QString InputString::checkEnumVal(const QString &value) { QString val = value.trimmed().toLower(); diff --git a/addon/doxywizard/inputstring.h b/addon/doxywizard/inputstring.h index 1520584..c22d7a3 100644 --- a/addon/doxywizard/inputstring.h +++ b/addon/doxywizard/inputstring.h @@ -57,6 +57,7 @@ class InputString : public QObject, public Input void addDependency(Input *) { Q_ASSERT(false); } void setEnabled(bool); void updateDependencies() {} + bool isDefault(); void writeValue(QTextStream &t,QTextCodec *codec); void setTemplateDocs(const QString &docs) { m_tdocs = docs; } bool isEmpty() { return m_str.isEmpty(); } diff --git a/addon/doxywizard/inputstrlist.cpp b/addon/doxywizard/inputstrlist.cpp index dd1ecb2..f92f3fe 100644 --- a/addon/doxywizard/inputstrlist.cpp +++ b/addon/doxywizard/inputstrlist.cpp @@ -3,8 +3,8 @@ * Copyright (C) 1997-2019 by Dimitri van Heesch. * * Permission to use, copy, modify, and distribute this software and its - * documentation under the terms of the GNU General Public License is hereby - * granted. No representations are made about the suitability of this software + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software * for any purpose. It is provided "as is" without express or implied warranty. * See the GNU General Public License for more details. * @@ -25,7 +25,7 @@ #include <QTextCodec> InputStrList::InputStrList( QGridLayout *layout,int &row, - const QString & id, + const QString & id, const QStringList &sl, ListMode lm, const QString & docs) : m_default(sl), m_strList(sl), m_docs(docs), m_id(id) @@ -50,7 +50,7 @@ InputStrList::InputStrList( QGridLayout *layout,int &row, m_lb = new QListWidget; //m_lb->setMinimumSize(400,100); foreach (QString s, m_strList) m_lb->addItem(s); - + m_brFile=0; m_brDir=0; if (lm!=ListString) @@ -60,7 +60,7 @@ InputStrList::InputStrList( QGridLayout *layout,int &row, m_brFile = toolBar->addAction(QIcon(QString::fromLatin1(":/images/file.png")),QString(), this,SLOT(browseFiles())); m_brFile->setToolTip(tr("Browse to a file")); - } + } if (lm&ListDir) { m_brDir = toolBar->addAction(QIcon(QString::fromLatin1(":/images/folder.png")),QString(), @@ -78,9 +78,9 @@ InputStrList::InputStrList( QGridLayout *layout,int &row, m_value = m_strList; - connect(m_le, SIGNAL(returnPressed()), + connect(m_le, SIGNAL(returnPressed()), this, SLOT(addString()) ); - connect(m_lb, SIGNAL(currentTextChanged(const QString &)), + connect(m_lb, SIGNAL(currentTextChanged(const QString &)), this, SLOT(selectText(const QString &))); connect( m_lab, SIGNAL(enter()), SLOT(help()) ); connect( m_lab, SIGNAL(reset()), SLOT(reset()) ); @@ -154,7 +154,7 @@ void InputStrList::browseFiles() QString path = QFileInfo(MainWindow::instance().configFileName()).path(); QStringList fileNames = QFileDialog::getOpenFileNames(); - if (!fileNames.isEmpty()) + if (!fileNames.isEmpty()) { QStringList::Iterator it; for ( it= fileNames.begin(); it != fileNames.end(); ++it ) @@ -184,7 +184,7 @@ void InputStrList::browseDir() QString path = QFileInfo(MainWindow::instance().configFileName()).path(); QString dirName = QFileDialog::getExistingDirectory(); - if (!dirName.isNull()) + if (!dirName.isNull()) { QDir dir(path); if (!MainWindow::instance().configFileName().isEmpty() && dir.exists()) @@ -228,7 +228,7 @@ void InputStrList::update() void InputStrList::updateDefault() { - if (m_strList==m_default || !m_lab->isEnabled()) + if (isDefault() || !m_lab->isEnabled()) { m_lab->setText(QString::fromLatin1("<qt>")+m_id+QString::fromLatin1("</qt")); } @@ -246,9 +246,9 @@ void InputStrList::reset() void InputStrList::writeValue(QTextStream &t,QTextCodec *codec) { bool first=true; - foreach (QString s, m_strList) + foreach (QString s, m_strList) { - if (!first) + if (!first) { t << " \\" << endl; t << " "; @@ -258,6 +258,50 @@ void InputStrList::writeValue(QTextStream &t,QTextCodec *codec) } } +#include <QMessageBox> +bool InputStrList::isDefault() +{ + bool isEq = m_strList==m_default; + + if (!isEq) + { + isEq = true; + + auto it1 = m_strList.begin(); + auto it2 = m_default.begin(); + while (it1!=m_strList.end() && it2!=m_default.end()) + { + // skip over empty values + while (it1!=m_strList.end() && (*it1).isEmpty()) + { + ++it1; + } + while (it2!=m_default.end() && (*it2).isEmpty()) + { + ++it2; + } + if ((it1!=m_strList.end()) && (it2!=m_default.end())) + { + if ((*it1).trimmed()!= (*it2).trimmed()) // difference so not the default + { + isEq=false; + break; + } + ++it1; + ++it2; + } + else if ((it1!=m_strList.end()) || (it2!=m_default.end())) + { + // one list empty so cannot be the default + isEq=false; + break; + } + } + } + + return isEq; +} + bool InputStrList::isEmpty() { foreach (QString s, m_strList) diff --git a/addon/doxywizard/inputstrlist.h b/addon/doxywizard/inputstrlist.h index adb0fb0..d2e713d 100644 --- a/addon/doxywizard/inputstrlist.h +++ b/addon/doxywizard/inputstrlist.h @@ -51,6 +51,7 @@ class InputStrList : public QObject, public Input void addDependency(Input *) { Q_ASSERT(false); } void setEnabled(bool); void updateDependencies() {} + bool isDefault(); void writeValue(QTextStream &t,QTextCodec *codec); void setTemplateDocs(const QString &docs) { m_tdocs = docs; } bool isEmpty(); diff --git a/addon/doxywizard/wizard.cpp b/addon/doxywizard/wizard.cpp index c3c1b57..6be752f 100644..100755 --- a/addon/doxywizard/wizard.cpp +++ b/addon/doxywizard/wizard.cpp @@ -3,8 +3,8 @@ * Copyright (C) 1997-2019 by Dimitri van Heesch. * * Permission to use, copy, modify, and distribute this software and its - * documentation under the terms of the GNU General Public License is hereby - * granted. No representations are made about the suitability of this software + * documentation under the terms of the GNU General Public License is hereby + * granted. No representations are made about the suitability of this software * for any purpose. It is provided "as is" without express or implied warranty. * See the GNU General Public License for more details. * @@ -47,6 +47,7 @@ #define STR_OPTIMIZE_OUTPUT_JAVA QString::fromLatin1("OPTIMIZE_OUTPUT_JAVA") #define STR_OPTIMIZE_FOR_FORTRAN QString::fromLatin1("OPTIMIZE_FOR_FORTRAN") #define STR_OPTIMIZE_OUTPUT_VHDL QString::fromLatin1("OPTIMIZE_OUTPUT_VHDL") +#define STR_OPTIMIZE_OUTPUT_SLICE QString::fromLatin1("OPTIMIZE_OUTPUT_SLICE") #define STR_CPP_CLI_SUPPORT QString::fromLatin1("CPP_CLI_SUPPORT") #define STR_HIDE_SCOPE_NAMES QString::fromLatin1("HIDE_SCOPE_NAMES") #define STR_EXTRACT_ALL QString::fromLatin1("EXTRACT_ALL") @@ -56,6 +57,7 @@ #define STR_GENERATE_MAN QString::fromLatin1("GENERATE_MAN") #define STR_GENERATE_RTF QString::fromLatin1("GENERATE_RTF") #define STR_GENERATE_XML QString::fromLatin1("GENERATE_XML") +#define STR_GENERATE_DOCBOOK QString::fromLatin1("GENERATE_DOCBOOK") #define STR_GENERATE_HTMLHELP QString::fromLatin1("GENERATE_HTMLHELP") #define STR_GENERATE_TREEVIEW QString::fromLatin1("GENERATE_TREEVIEW") #define STR_USE_PDFLATEX QString::fromLatin1("USE_PDFLATEX") @@ -74,7 +76,7 @@ #define STR_HTML_COLORSTYLE_SAT QString::fromLatin1("HTML_COLORSTYLE_SAT") #define STR_HTML_COLORSTYLE_GAMMA QString::fromLatin1("HTML_COLORSTYLE_GAMMA") -static bool g_optimizeMapping[6][6] = +static bool g_optimizeMapping[7][7] = { // A: OPTIMIZE_OUTPUT_FOR_C // B: OPTIMIZE_OUTPUT_JAVA @@ -82,23 +84,26 @@ static bool g_optimizeMapping[6][6] = // D: OPTIMIZE_OUTPUT_VHDL // E: CPP_CLI_SUPPORT // F: HIDE_SCOPE_NAMES - // A B C D E F - { false,false,false,false,false,false }, // 0: C++ - { false,false,false,false,true, false }, // 1: C++/CLI - { false,true, false,false,false,false }, // 2: C#/Java - { true, false,false,false,false,true }, // 3: C/PHP - { false,false,true, false,false,false }, // 4: Fortran - { false,false,false,true, false,false }, // 5: VHDL + // G: OPTIMIZE_OUTPUT_SLICE + // A B C D E F G + { false,false,false,false,false,false,false }, // 0: C++ + { false,false,false,false,true, false,false }, // 1: C++/CLI + { false,true, false,false,false,false,false }, // 2: C#/Java + { true, false,false,false,false,true, false }, // 3: C/PHP + { false,false,true, false,false,false,false }, // 4: Fortran + { false,false,false,true, false,false,false }, // 5: VHDL + { false,false,false,false,false,false,true }, // 6: SLICE }; -static QString g_optimizeOptionNames[6] = +static QString g_optimizeOptionNames[7] = { STR_OPTIMIZE_OUTPUT_FOR_C, STR_OPTIMIZE_OUTPUT_JAVA, STR_OPTIMIZE_FOR_FORTRAN, STR_OPTIMIZE_OUTPUT_VHDL, STR_CPP_CLI_SUPPORT, - STR_HIDE_SCOPE_NAMES + STR_HIDE_SCOPE_NAMES, + STR_OPTIMIZE_OUTPUT_SLICE }; //========================================================================== @@ -107,7 +112,7 @@ static bool stringVariantToBool(const QVariant &v) { QString s = v.toString().toLower(); return s==QString::fromLatin1("yes") || s==QString::fromLatin1("true") || s==QString::fromLatin1("1"); -} +} static bool getBoolOption( const QHash<QString,Input*>&model,const QString &name) @@ -115,7 +120,7 @@ static bool getBoolOption( Input *option = model[name]; Q_ASSERT(option!=0); return stringVariantToBool(option->value()); -} +} static int getIntOption( const QHash<QString,Input*>&model,const QString &name) @@ -123,7 +128,7 @@ static int getIntOption( Input *option = model[name]; Q_ASSERT(option!=0); return option->value().toInt(); -} +} static QString getStringOption( const QHash<QString,Input*>&model,const QString &name) @@ -343,19 +348,19 @@ void ColorPicker::paintEvent(QPaintEvent*) QRect r(0, foff, w, height() - 2*foff); int wi = r.width() - 2; int hi = r.height() - 2; - if (!m_pix || m_pix->height() != hi || m_pix->width() != wi) + if (!m_pix || m_pix->height() != hi || m_pix->width() != wi) { delete m_pix; QImage img(wi, hi, QImage::Format_RGB32); int y; uint *pixel = (uint *) img.scanLine(0); - for (y = 0; y < hi; y++) + for (y = 0; y < hi; y++) { const uint *end = pixel + wi; int yh = y2hue(y+coff); int ys = y2sat(y+coff); int yg = y2gam(y+coff); - while (pixel < end) + while (pixel < end) { QColor c; c.setHsv(yh, ys, (int)(255*pow(0.7,yg/100.0))); @@ -372,7 +377,7 @@ void ColorPicker::paintEvent(QPaintEvent*) p.setPen(g.windowText().color()); p.setBrush(g.windowText()); QPolygon a; - int y = m_mode==Hue ? hue2y(m_hue) : + int y = m_mode==Hue ? hue2y(m_hue) : m_mode==Saturation ? sat2y(m_sat) : gam2y(m_gam); a.setPoints(3, w, y, w+5, y+5, w+5, y-5); @@ -382,14 +387,14 @@ void ColorPicker::paintEvent(QPaintEvent*) void ColorPicker::mouseMoveEvent(QMouseEvent *m) { - if (m_mode==Hue) setHue(y2hue(m->y())); + if (m_mode==Hue) setHue(y2hue(m->y())); else if (m_mode==Saturation) setSat(y2sat(m->y())); else setGam(y2gam(m->y())); } void ColorPicker::mousePressEvent(QMouseEvent *m) { - if (m_mode==Hue) setHue(y2hue(m->y())); + if (m_mode==Hue) setHue(y2hue(m->y())); else if (m_mode==Saturation) setSat(y2sat(m->y())); else setGam(y2gam(m->y())); } @@ -530,7 +535,7 @@ Step1::Step1(Wizard *wizard,const QHash<QString,Input*> &modelData) : m_wizard(w QFrame *f = new QFrame( this ); f->setFrameStyle( QFrame::HLine | QFrame::Sunken ); layout->addWidget(f); - + l = new QLabel(this); l->setText(tr("Specify the directory to scan for source code")); layout->addWidget(l); @@ -602,7 +607,7 @@ void Step1::selectProjectIcon() else { QFile Fout(iconName); - if(!Fout.exists()) + if(!Fout.exists()) { m_projIconLab->setText(tr("Sorry, cannot find file(")+iconName+QString::fromLatin1(");")); } @@ -711,7 +716,7 @@ void Step1::init() if (!iconName.isEmpty()) { QFile Fout(iconName); - if(!Fout.exists()) + if(!Fout.exists()) { m_projIconLab->setText(tr("Sorry, cannot find file(")+iconName+QString::fromLatin1(");")); } @@ -745,7 +750,7 @@ void Step1::init() //========================================================================== -Step2::Step2(Wizard *wizard,const QHash<QString,Input*> &modelData) +Step2::Step2(Wizard *wizard,const QHash<QString,Input*> &modelData) : m_wizard(wizard), m_modelData(modelData) { QRadioButton *r; @@ -770,7 +775,7 @@ Step2::Step2(Wizard *wizard,const QHash<QString,Input*> &modelData) // m_crossRef -> SOURCE_BROWSER = YES/NO gbox->addWidget(m_crossRef,3,0); layout->addWidget(m_extractMode); - + //--------------------------------------------------- QFrame *f = new QFrame( this ); f->setFrameStyle( QFrame::HLine | QFrame::Sunken ); @@ -779,8 +784,8 @@ Step2::Step2(Wizard *wizard,const QHash<QString,Input*> &modelData) m_optimizeLangGroup = new QButtonGroup(this); m_optimizeLang = new QGroupBox(this); m_optimizeLang->setTitle(tr("Select programming language to optimize the results for")); - gbox = new QGridLayout( m_optimizeLang ); - + gbox = new QGridLayout( m_optimizeLang ); + r = new QRadioButton(m_optimizeLang); r->setText(tr("Optimize for C++ output")); r->setChecked(true); @@ -791,6 +796,7 @@ Step2::Step2(Wizard *wizard,const QHash<QString,Input*> &modelData) // OPTIMIZE_OUTPUT_VHDL = NO // CPP_CLI_SUPPORT = NO // HIDE_SCOPE_NAMES = NO + // OPTIMIZE_OUTPUT_SLICE = NO gbox->addWidget(r,0,0); r = new QRadioButton(tr("Optimize for C++/CLI output")); gbox->addWidget(r,1,0); @@ -801,6 +807,7 @@ Step2::Step2(Wizard *wizard,const QHash<QString,Input*> &modelData) // OPTIMIZE_OUTPUT_VHDL = NO // CPP_CLI_SUPPORT = YES // HIDE_SCOPE_NAMES = NO + // OPTIMIZE_OUTPUT_SLICE = NO r = new QRadioButton(tr("Optimize for Java or C# output")); m_optimizeLangGroup->addButton(r, 2); // 2 -> OPTIMIZE_OUTPUT_FOR_C = NO @@ -809,6 +816,7 @@ Step2::Step2(Wizard *wizard,const QHash<QString,Input*> &modelData) // OPTIMIZE_OUTPUT_VHDL = NO // CPP_CLI_SUPPORT = NO // HIDE_SCOPE_NAMES = NO + // OPTIMIZE_OUTPUT_SLICE = NO gbox->addWidget(r,2,0); r = new QRadioButton(tr("Optimize for C or PHP output")); m_optimizeLangGroup->addButton(r, 3); @@ -818,6 +826,7 @@ Step2::Step2(Wizard *wizard,const QHash<QString,Input*> &modelData) // OPTIMIZE_OUTPUT_VHDL = NO // CPP_CLI_SUPPORT = NO // HIDE_SCOPE_NAMES = YES + // OPTIMIZE_OUTPUT_SLICE = NO gbox->addWidget(r,3,0); r = new QRadioButton(tr("Optimize for Fortran output")); m_optimizeLangGroup->addButton(r, 4); @@ -827,6 +836,7 @@ Step2::Step2(Wizard *wizard,const QHash<QString,Input*> &modelData) // OPTIMIZE_OUTPUT_VHDL = NO // CPP_CLI_SUPPORT = NO // HIDE_SCOPE_NAMES = NO + // OPTIMIZE_OUTPUT_SLICE = NO gbox->addWidget(r,4,0); r = new QRadioButton(tr("Optimize for VHDL output")); m_optimizeLangGroup->addButton(r, 5); @@ -836,7 +846,18 @@ Step2::Step2(Wizard *wizard,const QHash<QString,Input*> &modelData) // OPTIMIZE_OUTPUT_VHDL = YES // CPP_CLI_SUPPORT = NO // HIDE_SCOPE_NAMES = NO + // OPTIMIZE_OUTPUT_SLICE = NO gbox->addWidget(r,5,0); + r = new QRadioButton(tr("Optimize for SLICE output")); + m_optimizeLangGroup->addButton(r, 6); + // 5 -> OPTIMIZE_OUTPUT_FOR_C = NO + // OPTIMIZE_OUTPUT_JAVA = NO + // OPTIMIZE_FOR_FORTRAN = NO + // OPTIMIZE_OUTPUT_VHDL = NO + // CPP_CLI_SUPPORT = NO + // HIDE_SCOPE_NAMES = NO + // OPTIMIZE_OUTPUT_SLICE = YES + gbox->addWidget(r,6,0); layout->addWidget(m_optimizeLang); layout->addStretch(1); @@ -852,7 +873,7 @@ Step2::Step2(Wizard *wizard,const QHash<QString,Input*> &modelData) void Step2::optimizeFor(int choice) { - for (int i=0;i<6;i++) + for (int i=0;i<7;i++) { updateBoolOption(m_modelData, g_optimizeOptionNames[i], @@ -882,12 +903,13 @@ void Step2::init() else if (getBoolOption(m_modelData,STR_OPTIMIZE_OUTPUT_FOR_C)) x=3; else if (getBoolOption(m_modelData,STR_OPTIMIZE_FOR_FORTRAN)) x=4; else if (getBoolOption(m_modelData,STR_OPTIMIZE_OUTPUT_VHDL)) x=5; + else if (getBoolOption(m_modelData,STR_OPTIMIZE_OUTPUT_SLICE)) x=6; m_optimizeLangGroup->button(x)->setChecked(true); } //========================================================================== -Step3::Step3(Wizard *wizard,const QHash<QString,Input*> &modelData) +Step3::Step3(Wizard *wizard,const QHash<QString,Input*> &modelData) : m_wizard(wizard), m_modelData(modelData) { QVBoxLayout *vbox = 0; @@ -957,16 +979,20 @@ Step3::Step3(Wizard *wizard,const QHash<QString,Input*> &modelData) // GENERATE_RTF m_xmlEnabled=new QCheckBox(tr("XML")); // GENERATE_XML + m_docbookEnabled=new QCheckBox(tr("Docbook")); + // GENERATE_DOCBOOK gbox->addWidget(m_manEnabled,3,0); gbox->addWidget(m_rtfEnabled,4,0); gbox->addWidget(m_xmlEnabled,5,0); + gbox->addWidget(m_docbookEnabled,6,0); - gbox->setRowStretch(6,1); + gbox->setRowStretch(7,1); connect(m_htmlOptions,SIGNAL(toggled(bool)),SLOT(setHtmlEnabled(bool))); connect(m_texOptions,SIGNAL(toggled(bool)),SLOT(setLatexEnabled(bool))); connect(m_manEnabled,SIGNAL(stateChanged(int)),SLOT(setManEnabled(int))); connect(m_rtfEnabled,SIGNAL(stateChanged(int)),SLOT(setRtfEnabled(int))); connect(m_xmlEnabled,SIGNAL(stateChanged(int)),SLOT(setXmlEnabled(int))); + connect(m_docbookEnabled,SIGNAL(stateChanged(int)),SLOT(setDocbookEnabled(int))); connect(m_searchEnabled,SIGNAL(stateChanged(int)),SLOT(setSearchEnabled(int))); connect(m_htmlOptionsGroup,SIGNAL(buttonClicked(int)), SLOT(setHtmlOptions(int))); @@ -1014,6 +1040,11 @@ void Step3::setXmlEnabled(int state) updateBoolOption(m_modelData,STR_GENERATE_XML,state==Qt::Checked); } +void Step3::setDocbookEnabled(int state) +{ + updateBoolOption(m_modelData,STR_GENERATE_DOCBOOK,state==Qt::Checked); +} + void Step3::setSearchEnabled(int state) { updateBoolOption(m_modelData,STR_SEARCHENGINE,state==Qt::Checked); @@ -1064,6 +1095,7 @@ void Step3::init() m_manEnabled->setChecked(getBoolOption(m_modelData,STR_GENERATE_MAN)); m_rtfEnabled->setChecked(getBoolOption(m_modelData,STR_GENERATE_RTF)); m_xmlEnabled->setChecked(getBoolOption(m_modelData,STR_GENERATE_XML)); + m_docbookEnabled->setChecked(getBoolOption(m_modelData,STR_GENERATE_DOCBOOK)); m_searchEnabled->setChecked(getBoolOption(m_modelData,STR_SEARCHENGINE)); if (getBoolOption(m_modelData,STR_GENERATE_HTMLHELP)) { @@ -1093,7 +1125,7 @@ void Step3::init() //========================================================================== -Step4::Step4(Wizard *wizard,const QHash<QString,Input*> &modelData) +Step4::Step4(Wizard *wizard,const QHash<QString,Input*> &modelData) : m_wizard(wizard), m_modelData(modelData) { m_diagramModeGroup = new QButtonGroup(this); @@ -1116,7 +1148,7 @@ Step4::Step4(Wizard *wizard,const QHash<QString,Input*> &modelData) m_dotGroup = new QGroupBox(tr("Dot graphs to generate")); QVBoxLayout *vbox = new QVBoxLayout; - m_dotClass=new QCheckBox(tr("Class diagrams")); + m_dotClass=new QCheckBox(tr("Class graphs")); // CLASS_GRAPH m_dotCollaboration=new QCheckBox(tr("Collaboration diagrams")); // COLLABORATION_GRAPH @@ -1250,7 +1282,7 @@ void Step4::init() //========================================================================== -Wizard::Wizard(const QHash<QString,Input*> &modelData, QWidget *parent) : +Wizard::Wizard(const QHash<QString,Input*> &modelData, QWidget *parent) : QSplitter(parent), m_modelData(modelData) { m_treeWidget = new QTreeWidget; @@ -1303,7 +1335,7 @@ void Wizard::activateTopic(QTreeWidgetItem *item,QTreeWidgetItem *) { if (item) { - + QString label = item->text(0); if (label==tr("Project")) { diff --git a/addon/doxywizard/wizard.h b/addon/doxywizard/wizard.h index 8b877e1..d4fbba3 100644 --- a/addon/doxywizard/wizard.h +++ b/addon/doxywizard/wizard.h @@ -162,6 +162,7 @@ class Step3 : public QWidget void setManEnabled(int); void setRtfEnabled(int); void setXmlEnabled(int); + void setDocbookEnabled(int); void setSearchEnabled(int); void setHtmlOptions(int); void setLatexOptions(int); @@ -177,6 +178,7 @@ class Step3 : public QWidget QCheckBox *m_manEnabled = 0; QCheckBox *m_rtfEnabled = 0; QCheckBox *m_xmlEnabled = 0; + QCheckBox *m_docbookEnabled = 0; QCheckBox *m_searchEnabled = 0; QPushButton *m_tuneColor = 0; Wizard *m_wizard = 0; |