Skip to content

Commit dbd441d

Browse files
committed
Merge branch 'master' of github.com:doxygen/doxygen
2 parents 2b0c521 + c7b3768 commit dbd441d

7 files changed

Lines changed: 92 additions & 41 deletions

File tree

addon/doxywizard/CMakeLists.txt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,9 @@ file(GLOB DOXYWIZARD_TRANSLATION_FILES CONFIGURE_DEPENDS "${TRANSLATIONS_DIR}/do
156156

157157
find_package(Qt${QT_VERSION_MAJOR}LinguistTools QUIET)
158158
if(Qt${QT_VERSION_MAJOR}LinguistTools_FOUND)
159-
set_source_files_properties(${DOXYWIZARD_TRANSLATION_FILES} PROPERTIES OUTPUT_LOCATION ${CMAKE_CURRENT_BINARY_DIR})
159+
set(I18N_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/i18n)
160+
file(MAKE_DIRECTORY ${I18N_BINARY_DIR})
161+
set_source_files_properties(${DOXYWIZARD_TRANSLATION_FILES} PROPERTIES OUTPUT_LOCATION ${I18N_BINARY_DIR})
160162
qt_add_translation(doxywizard_QM_FILES ${DOXYWIZARD_TRANSLATION_FILES})
161163
get_target_property(QT_QMAKE_EXECUTABLE Qt${QT_VERSION_MAJOR}::qmake IMPORTED_LOCATION)
162164
execute_process(
@@ -171,18 +173,20 @@ if(Qt${QT_VERSION_MAJOR}LinguistTools_FOUND)
171173
foreach(ts_file ${DOXYWIZARD_TRANSLATION_FILES})
172174
get_filename_component(ts_name ${ts_file} NAME_WE)
173175
string(REGEX REPLACE "doxywizard_(.+)" "\\1" LOCALE "${ts_name}")
174-
set(qm_file "${CMAKE_CURRENT_BINARY_DIR}/${ts_name}.qm")
176+
set(qm_file "${I18N_BINARY_DIR}/${ts_name}.qm")
175177
list(APPEND doxywizard_QM_FILES_PATHS ${qm_file})
176178

177179
if (QT_TRANSLATIONS_DIR)
178180
if (EXISTS "${QT_TRANSLATIONS_DIR}/qtbase_${LOCALE}.qm")
179-
string(APPEND TRANSLATIONS_QRC_CONTENT " <file alias=\"qtbase_${LOCALE}.qm\">${QT_TRANSLATIONS_DIR}/qtbase_${LOCALE}.qm</file>\n")
181+
configure_file("${QT_TRANSLATIONS_DIR}/qtbase_${LOCALE}.qm" "${I18N_BINARY_DIR}/qtbase_${LOCALE}.qm" COPYONLY)
182+
string(APPEND TRANSLATIONS_QRC_CONTENT " <file alias=\"qtbase_${LOCALE}.qm\">i18n/qtbase_${LOCALE}.qm</file>\n")
180183
else()
181184
message(WARNING "Qt translation file ${QT_TRANSLATIONS_DIR}/qtbase_${LOCALE}.qm not found")
182185
endif()
183186
endif()
184-
string(APPEND TRANSLATIONS_QRC_CONTENT " <file alias=\"config_${LOCALE}.xml\">${PROJECT_SOURCE_DIR}/src/i18n/config_${LOCALE}.xml</file>\n")
185-
string(APPEND TRANSLATIONS_QRC_CONTENT " <file alias=\"${ts_name}.qm\">${qm_file}</file>\n")
187+
configure_file("${PROJECT_SOURCE_DIR}/src/i18n/config_${LOCALE}.xml" "${I18N_BINARY_DIR}/config_${LOCALE}.xml" COPYONLY)
188+
string(APPEND TRANSLATIONS_QRC_CONTENT " <file alias=\"config_${LOCALE}.xml\">i18n/config_${LOCALE}.xml</file>\n")
189+
string(APPEND TRANSLATIONS_QRC_CONTENT " <file alias=\"${ts_name}.qm\">i18n/${ts_name}.qm</file>\n")
186190
endforeach()
187191
string(APPEND TRANSLATIONS_QRC_CONTENT " </qresource>\n</RCC>\n")
188192

addon/doxywizard/doxywizard.cpp

Lines changed: 66 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -463,8 +463,7 @@ void MainWindow::switchLanguage()
463463
qDebug() << "selected language" << langCode;
464464
if (langCode!=DoxygenWizard::langCode)
465465
{
466-
m_settings.setValue(QString::fromLatin1("language/code"), langCode);
467-
m_settings.sync();
466+
setLanguage(langCode);
468467
quit();
469468
}
470469
}
@@ -891,6 +890,18 @@ void MainWindow::outputLogFinish()
891890
m_saveLog->setEnabled(true);
892891
}
893892

893+
#define TXT_ARGS QString::fromLatin1(argc > 2?"Too many arguments specified\n\n":"")
894+
static void usage(const char *exeName, const QString txt)
895+
{
896+
QMessageBox msgBox;
897+
QString fullText = txt;
898+
fullText += QString::fromLatin1("Usage: %1 [--debug] [--language [lang]] [config file]\n").arg(QString::fromLatin1(exeName));
899+
fullText += QString::fromLatin1("Usage: %1 --help\n").arg(QString::fromLatin1(exeName));
900+
fullText += QString::fromLatin1("Usage: %1 --version\n").arg(QString::fromLatin1(exeName));
901+
msgBox.setText(fullText);
902+
msgBox.exec();
903+
}
904+
894905
//-----------------------------------------------------------------------
895906
int main(int argc,char **argv)
896907
{
@@ -905,21 +916,27 @@ int main(int argc,char **argv)
905916
#endif
906917

907918
QApplication a(argc,argv);
908-
int locArgc = argc;
909919

910-
if (locArgc == 2)
920+
int optInd=1;
921+
bool langSet = false;
922+
QString langSel;
923+
while (optInd<argc && argv[optInd][0]=='-' && argv[optInd][1]=='-')
911924
{
912-
if (!qstrcmp(argv[1],"--help"))
925+
if (!qstrcmp(argv[optInd],"--help"))
913926
{
914-
QMessageBox msgBox;
915-
msgBox.setText(QString::fromLatin1("Usage: %1 [config file]").arg(QString::fromLatin1(argv[0])));
916-
msgBox.exec();
927+
usage(argv[0],TXT_ARGS);
928+
if (argc > 2) exit(1);
917929
exit(0);
918930
}
919-
else if (!qstrcmp(argv[1],"--version"))
931+
else if (!qstrcmp(argv[optInd],"--version"))
920932
{
921933
QMessageBox msgBox;
922-
if (!qstrcmp(qVersion(),QT_VERSION_STR))
934+
if (argc > 2)
935+
{
936+
usage(argv[0],TXT_ARGS);
937+
exit(1);
938+
}
939+
else if (!qstrcmp(qVersion(),QT_VERSION_STR))
923940
{
924941
msgBox.setText(QString::fromLatin1("Doxywizard version: %1, Qt version: %2").arg(QString::fromLatin1(getFullVersion().c_str())).arg(QString::fromLatin1(QT_VERSION_STR)));
925942
}
@@ -930,25 +947,48 @@ int main(int argc,char **argv)
930947
msgBox.exec();
931948
exit(0);
932949
}
933-
}
934-
if (!qstrcmp(argv[1],"--debug") && ((locArgc == 2) || (locArgc == 3)))
935-
{
936-
DoxygenWizard::debugFlag = true;
937-
locArgc--;
950+
else if (!qstrcmp(argv[optInd],"--debug"))
951+
{
952+
DoxygenWizard::debugFlag = true;
953+
}
954+
else if (!qstrcmp(argv[optInd],"--language"))
955+
{
956+
langSet = true;
957+
if (optInd+1>=argc || (argv[optInd+1][0]=='-' && argv[optInd+1][1]=='-'))
958+
{
959+
langSel = QString::fromLatin1("en");
960+
}
961+
else
962+
{
963+
langSel = QString::fromLatin1(argv[optInd+1]);
964+
optInd++;
965+
}
966+
if (!isLanguageCodeSupported(langSel))
967+
{
968+
usage(argv[0],QString::fromLatin1("Unknown language selected\n\n"));
969+
exit(1);
970+
}
971+
}
972+
optInd++;
938973
}
939974

940-
if (locArgc > 2)
975+
if (optInd+2<=argc)
941976
{
942-
QMessageBox msgBox;
943-
msgBox.setText(QString::fromLatin1("Too many arguments specified\n\nUsage: %1 [config file]").arg(QString::fromLatin1(argv[0])));
944-
msgBox.exec();
977+
usage(argv[0],TXT_ARGS);
945978
exit(1);
946979
}
947-
else
980+
948981
{
949982
qDebug() << "Starting doxywizard...";
950983

951-
DoxygenWizard::langCode = getStartupLanguageCode();
984+
if (langSet)
985+
{
986+
DoxygenWizard::langCode = langSel;
987+
}
988+
else
989+
{
990+
DoxygenWizard::langCode = getStartupLanguageCode();
991+
}
952992
QTranslator qtTranslator;
953993
if (!DoxygenWizard::langCode.isEmpty() &&
954994
qtTranslator.load(QString::fromLatin1(":/i18n/qtbase_%1.qm").arg(DoxygenWizard::langCode))
@@ -967,7 +1007,11 @@ int main(int argc,char **argv)
9671007
}
9681008

9691009
MainWindow &main = MainWindow::instance();
970-
if (locArgc==2 && argv[argc-1][0]!='-') // name of config file as an argument
1010+
if (langSet)
1011+
{
1012+
main.setLanguage(langSel);
1013+
}
1014+
if (optInd+1==argc && argv[argc-1][0]!='-') // name of config file as an argument
9711015
{
9721016
main.loadConfigFromFile(QString::fromLocal8Bit(argv[argc-1]));
9731017
}

addon/doxywizard/doxywizard.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ class MainWindow : public QMainWindow
4545
void outputLogStart();
4646
void outputLogText(QString text);
4747
void outputLogFinish();
48+
void setLanguage(const QString &langCode)
49+
{
50+
m_settings.setValue(QString::fromLatin1("language/code"), langCode);
51+
m_settings.sync();
52+
}
4853

4954
public slots:
5055
void manual();

doc/customize.dox

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,8 @@ files as one big DOM tree would not fit into memory.
468468
See <a href="https://github.com/breathe-doc/breathe">the Breathe project</a> for
469469
an example that uses Doxygen XML output from Python to bridge it with the
470470
<a href="http://www.sphinx-doc.org/en/stable/">Sphinx</a> document generator.
471+
See also <a href="https://0state.com/moxygen">Moxygen</a> for converting
472+
Doxygen XML output to Markdown for use with static documentation tools.
471473

472474
\htmlonly
473475
Go to the <a href="custcmd.html">next</a> section or return to the

src/doxygen.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11140,7 +11140,7 @@ static void readDir(FileInfo *fi,
1114011140
FileName *fn=nullptr;
1114111141
if (!name.empty())
1114211142
{
11143-
fn = fnMap->add(name,fullName);
11143+
fn = fnMap->add(name);
1114411144
fn->push_back(std::move(fd));
1114511145
}
1114611146
}
@@ -11228,7 +11228,7 @@ void readFileOrDirectory(const QCString &s,
1122811228
auto fd = createFileDef(dirPath+"/",name);
1122911229
if (!name.empty())
1123011230
{
11231-
FileName *fn = fnMap->add(name,filePath);
11231+
FileName *fn = fnMap->add(name);
1123211232
fn->push_back(std::move(fd));
1123311233
}
1123411234
}
@@ -12424,12 +12424,6 @@ void searchInputFiles()
1242412424
}
1242512425

1242612426
// Sort the FileDef objects by full path to get a predictable ordering over multiple runs
12427-
std::stable_sort(Doxygen::inputNameLinkedMap->begin(),
12428-
Doxygen::inputNameLinkedMap->end(),
12429-
[](const auto &f1,const auto &f2)
12430-
{
12431-
return qstricmp_sort(f1->fullName(),f2->fullName())<0;
12432-
});
1243312427
for (auto &fileName : *Doxygen::inputNameLinkedMap)
1243412428
{
1243512429
if (fileName->size()>1)
@@ -12440,6 +12434,12 @@ void searchInputFiles()
1244012434
});
1244112435
}
1244212436
}
12437+
std::stable_sort(Doxygen::inputNameLinkedMap->begin(),
12438+
Doxygen::inputNameLinkedMap->end(),
12439+
[](const auto &f1,const auto &f2)
12440+
{
12441+
return qstricmp_sort(f1->front()->absFilePath(),f2->front()->absFilePath())<0;
12442+
});
1244312443
if (Doxygen::inputNameLinkedMap->empty())
1244412444
{
1244512445
warn_uncond("No files to be processed, please check your settings, in particular INPUT, FILE_PATTERNS, and RECURSIVE\n");

src/filename.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,11 @@ class FileDef;
2929
class FileName : public std::vector< std::unique_ptr<FileDef> >
3030
{
3131
public:
32-
FileName(const QCString &nm,const QCString &fn) : m_name(nm), m_fName(fn), m_pathName("tmp") {}
32+
explicit FileName(const QCString &nm) : m_name(nm) {}
3333
QCString fileName() const { return m_name; }
34-
QCString fullName() const { return m_fName; }
35-
QCString path() const { return m_pathName; }
3634

3735
private:
3836
QCString m_name;
39-
QCString m_fName;
40-
QCString m_pathName;
4137
};
4238

4339
//! Custom combined key compare and hash functor that uses a lower case string in

src/tagreader.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1676,7 +1676,7 @@ void TagFileParser::buildLists(const std::shared_ptr<Entry> &root)
16761676
}
16771677
else
16781678
{
1679-
mn = Doxygen::inputNameLinkedMap->add(tfi->name,fullName);
1679+
mn = Doxygen::inputNameLinkedMap->add(tfi->name);
16801680
mn->push_back(std::move(fd));
16811681
}
16821682
buildMemberList(fe,tfi->members);

0 commit comments

Comments
 (0)