GUI: Ship authors as a Qt resource file

This commit is contained in:
João Valverde 2023-01-20 09:01:27 +00:00
parent be51acfffb
commit c66fc43e5b
11 changed files with 52 additions and 53 deletions

1
.gitignore vendored
View File

@ -81,7 +81,6 @@ epan/dissectors/dcerpc/*-stamp
########
doc/*.html
doc/*.[14]
doc/AUTHORS-SHORT
doc/ws.css
docbook/developer-guide*.xml
docbook/user-guide*.xml

View File

@ -1952,9 +1952,6 @@ if (BUILD_logray)
endif()
if (ASCIIDOCTOR_FOUND)
list(APPEND INSTALL_FILES
${CMAKE_BINARY_DIR}/doc/AUTHORS-SHORT
)
list(APPEND DOC_FILES
${CMAKE_BINARY_DIR}/doc/androiddump.html
${CMAKE_BINARY_DIR}/doc/udpdump.html

4
doc/.gitignore vendored
View File

@ -4,7 +4,3 @@
*.html
*.tmp
wireshark.pod
# Misc #
########
AUTHORS-SHORT-FORMAT

View File

@ -9,17 +9,6 @@
find_package( Asciidoctor 1.5 )
add_custom_command(
OUTPUT AUTHORS-SHORT
COMMAND ${PYTHON_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/make-authors-short.py
< ${CMAKE_SOURCE_DIR}/AUTHORS
> ${CMAKE_CURRENT_BINARY_DIR}/AUTHORS-SHORT
DEPENDS
${CMAKE_CURRENT_SOURCE_DIR}/make-authors-short.py
${CMAKE_SOURCE_DIR}/AUTHORS
)
set(MAN1_SOURCE_FILES)
set(MAN4_SOURCE_FILES)
set(MAN1_INSTALL_FILES)
@ -110,7 +99,6 @@ endif()
add_custom_target(
docs ALL
DEPENDS
${CMAKE_CURRENT_BINARY_DIR}/AUTHORS-SHORT
${MAN1_INSTALL_FILES}
${MAN4_INSTALL_FILES}
${HTML_INSTALL_FILES}

View File

@ -455,7 +455,6 @@ File "${STAGING_DIR}\COPYING.txt"
File "${STAGING_DIR}\NEWS.txt"
File "${STAGING_DIR}\README.txt"
File "${STAGING_DIR}\README.windows.txt"
File "${STAGING_DIR}\AUTHORS-SHORT"
File "${STAGING_DIR}\manuf"
File "${STAGING_DIR}\wka"
File "${STAGING_DIR}\services"

View File

@ -509,7 +509,6 @@ File "${STAGING_DIR}\COPYING.txt"
File "${STAGING_DIR}\NEWS.txt"
File "${STAGING_DIR}\README.txt"
File "${STAGING_DIR}\README.windows.txt"
File "${STAGING_DIR}\AUTHORS-SHORT"
File "${STAGING_DIR}\manuf"
File "${STAGING_DIR}\wka"
File "${STAGING_DIR}\services"

View File

@ -39,9 +39,6 @@
<Component Id="cmpREADME_windows_txt" Guid="*">
<File Id="filREADME_windows_txt" KeyPath="yes" Source="$(var.Staging.Dir)\README.windows.txt" />
</Component>
<Component Id="cmpAUTHORS_SHORT" Guid="*">
<File Id="filAUTHORS_SHORT" KeyPath="yes" Source="$(var.Staging.Dir)\AUTHORS-SHORT" />
</Component>
<Component Id="cmpManuf" Guid="*">
<File Id="filManuf" KeyPath="yes" Source="$(var.Staging.Dir)\manuf" />
</Component>
@ -86,7 +83,6 @@
<ComponentRef Id="cmpNEWS_txt" />
<ComponentRef Id="cmpREADME_txt" />
<ComponentRef Id="cmpREADME_windows_txt" />
<ComponentRef Id="cmpAUTHORS_SHORT" />
<ComponentRef Id="cmpManuf" />
<ComponentRef Id="cmpWka" />
<ComponentRef Id="cmpServices" />

View File

@ -1,9 +1,6 @@
#!/usr/bin/env python3
#
# Generate the AUTHORS-SHORT file.
# Ported from make-authors-short.pl, copyright 2004 Ulf Lamping <ulf.lamping@web.de>
#
# By Gerald Combs <gerald@wireshark.org
# Generate the authors.csv file.
#
# SPDX-License-Identifier: GPL-2.0-or-later
#
@ -16,11 +13,10 @@ import io
import re
import sys
def main():
stdinu8 = io.TextIOWrapper(sys.stdin.buffer, encoding='utf8')
stdoutu8 = io.TextIOWrapper(sys.stdout.buffer, encoding='utf8')
stderru8 = io.TextIOWrapper(sys.stderr.buffer, encoding='utf8')
def remove_tasks(stdinu8):
in_subinfo = False
all_lines = []
# Assume the first line is blank and skip it. make-authors-short.pl
# skipped over the UTF-8 BOM as well. Do we need to do that here?
@ -32,18 +28,36 @@ def main():
sub_m = re.search(r'(.*?)\s*\{', line)
if sub_m:
in_subinfo = True
stdoutu8.write(sub_m.group(1) + '\n')
all_lines.append(sub_m.group(1))
elif '}' in line:
in_subinfo = False
nextline = next(stdinu8)
if not re.match('^\s*$', nextline):
if '{' in nextline:
stderru8.write("No blank line after '}', found " + nextline)
stdoutu8.write(nextline)
# if '{' in nextline:
# stderru8.write("No blank line after '}', found " + nextline)
all_lines.append(nextline)
elif in_subinfo:
continue
else:
stdoutu8.write(line)
all_lines.append(line)
return all_lines
def main():
stdinu8 = io.TextIOWrapper(sys.stdin.buffer, encoding='utf8')
stdoutu8 = io.TextIOWrapper(sys.stdout.buffer, encoding='utf8')
stderru8 = io.TextIOWrapper(sys.stderr.buffer, encoding='utf8')
lines = remove_tasks(stdinu8)
patt = re.compile("(.*)[<(]([\\s'a-zA-Z0-9._%+-]+(\\[[Aa][Tt]\\])?[a-zA-Z0-9._%+-]+)[>)]")
for line in lines:
match = patt.match(line)
if match:
name = match.group(1).strip()
mail = match.group(2).strip().replace("[AT]", "@")
stdoutu8.write("{},{}\n".format(name, mail))
if __name__ == '__main__':
main()

View File

@ -655,6 +655,24 @@ foreach(_file ${WIRESHARK_QT_TS})
endforeach()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/i18n.qrc.in ${CMAKE_CURRENT_BINARY_DIR}/i18n.qrc)
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/authors.qrc"
"<RCC>\n"
" <qresource prefix=\"/about\">\n"
" <file compress-algo=\"zstd\">authors.csv</file>\n"
" </qresource>\n"
"</RCC>\n"
)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/authors.csv
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/tools/make-authors-csv.py
< ${CMAKE_SOURCE_DIR}/AUTHORS
> ${CMAKE_CURRENT_BINARY_DIR}/authors.csv
DEPENDS
${CMAKE_SOURCE_DIR}/tools/make-authors-csv.py
${CMAKE_SOURCE_DIR}/AUTHORS
)
set(WIRESHARK_QT_QRC
../../resources/about.qrc
../../resources/languages/languages.qrc
@ -662,6 +680,8 @@ set(WIRESHARK_QT_QRC
../../resources/stock_icons.qrc
../../resources/wsicon.qrc
${CMAKE_CURRENT_BINARY_DIR}/i18n.qrc
${CMAKE_CURRENT_BINARY_DIR}/authors.qrc
${CMAKE_CURRENT_BINARY_DIR}/authors.csv
)
if(NOT Qt${qtver}Widgets_VERSION VERSION_LESS "5.9")

View File

@ -69,7 +69,7 @@ AStringListListModel(parent)
{
QFile f_authors;
f_authors.setFileName(get_datafile_path("AUTHORS-SHORT"));
f_authors.setFileName(":/about/authors.csv");
f_authors.open(QFile::ReadOnly | QFile::Text);
QTextStream ReadFile_authors(&f_authors);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
@ -78,18 +78,11 @@ AStringListListModel(parent)
ReadFile_authors.setCodec("UTF-8");
#endif
QRegularExpression rx("(.*)[<(]([\\s'a-zA-Z0-9._%+-]+(\\[[Aa][Tt]\\])?[a-zA-Z0-9._%+-]+)[>)]");
while (!ReadFile_authors.atEnd()) {
QString line = ReadFile_authors.readLine();
QStringList entry = ReadFile_authors.readLine().split(",", Qt::SkipEmptyParts);
if (line.trimmed().length() == 0)
continue;
if (line.startsWith("------"))
continue;
QRegularExpressionMatch match = rx.match(line);
if (match.hasMatch()) {
appendRow(QStringList() << match.captured(1).trimmed() << match.captured(2).trimmed());
if (entry.size() == 2) {
appendRow(entry);
}
}
f_authors.close();

View File

@ -2115,9 +2115,7 @@ get_persconffile_path(const char *filename, gboolean from_profile)
char *
get_datafile_path(const char *filename)
{
if (running_in_build_directory_flag &&
(!strcmp(filename, "AUTHORS-SHORT") ||
!strcmp(filename, "hosts"))) {
if (running_in_build_directory_flag && !strcmp(filename, "hosts")) {
/* We're running in the build directory and the requested file is a
* generated (or a test) file. Return the file name in the build
* directory (not in the source/data directory).