From b8ec3199abebdfe170e4a5165ebe68d41af2f269 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Valverde?= Date: Wed, 27 Jul 2022 13:05:08 +0100 Subject: [PATCH] Convert Acknowledgements to markdown and update GUI Move Acknowledgements to a separate file to enable some code simplification and improve maintenance and discoverability for acknowlegements. Convert the Acknowledgements file to Github flavored markdown and display it in rich text using QTextBrowser. Add Acknowledgements.md to NSIS installer --- AUTHORS | 27 -------------- AUTHORS.src | 26 ------------- Acknowledgements.md | 23 ++++++++++++ CMakeLists.txt | 1 + packaging/nsis/logray.nsi | 1 + packaging/nsis/uninstall-logray.nsi | 1 + packaging/nsis/uninstall-wireshark.nsi | 1 + packaging/nsis/wireshark.nsi | 1 + tools/generate_authors.py | 8 +--- ui/qt/about_dialog.cpp | 51 ++++++++++++++------------ ui/qt/about_dialog.h | 5 --- ui/qt/about_dialog.ui | 10 +---- 12 files changed, 59 insertions(+), 96 deletions(-) create mode 100644 Acknowledgements.md diff --git a/AUTHORS b/AUTHORS index 848c48caf6..e2d319a10b 100644 --- a/AUTHORS +++ b/AUTHORS @@ -5144,30 +5144,3 @@ zhudewen Øyvind Rønningstad Đorđije Manojlović Дмитрий Цветцих - - -= Acknowledgements = - -Dan Lasley gave permission for his dumpit() hex-dump routine to be used. - -We use the exception module from Kazlib, a C library written by Kaz Kylheku . Thanks go to him for his well-written library. The Kazlib home page can be found at http://www.kylheku.com/~kaz/kazlib.html - -We use Lua to extend Wireshark APIs with scripting capabilities. Lua is a powerful, efficient, lightweight, embeddable scripting language developed and maintained by a team at PUC-Rio. - -We use Lua BitOp, written by Mike Pall, for bitwise operations on numbers in Lua. The Lua BitOp home page can be found at https://bitop.luajit.org - -Snax gave permission to use the weak key detection code from Airsnort. - -IANA gave permission for their port-numbers file to be used. - -We use the natural order string comparison algorithm, written by Martin Pool . - -Emanuel Eichhammer granted permission to use QCustomPlot. - -Some icons made by Freepik, http://www.freepik.com from https://www.flaticon.com - -Insecure.Com LLC ("The Nmap Project") has granted the Wireshark Foundation permission to distribute Npcap with our Windows installers. - -We use the overflow-safe math functions from the portable snippets repository (https://github.com/nemequ/portable-snippets). - -We use the Lrexlib Lua library, specifically the PCRE2 flavour, to provide a regular expression API for Lua. The Lrexlib repository is hosted at https://github.com/rrthomas/lrexlib. diff --git a/AUTHORS.src b/AUTHORS.src index a00cfbe093..570cb45983 100644 --- a/AUTHORS.src +++ b/AUTHORS.src @@ -4005,29 +4005,3 @@ Håkon Øye Amundsen Jeffrey Wildman Jan Schiefer Triton Circonflexe - -= Acknowledgements = - -Dan Lasley gave permission for his dumpit() hex-dump routine to be used. - -We use the exception module from Kazlib, a C library written by Kaz Kylheku . Thanks go to him for his well-written library. The Kazlib home page can be found at http://www.kylheku.com/~kaz/kazlib.html - -We use Lua to extend Wireshark APIs with scripting capabilities. Lua is a powerful, efficient, lightweight, embeddable scripting language developed and maintained by a team at PUC-Rio. - -We use Lua BitOp, written by Mike Pall, for bitwise operations on numbers in Lua. The Lua BitOp home page can be found at https://bitop.luajit.org - -Snax gave permission to use the weak key detection code from Airsnort. - -IANA gave permission for their port-numbers file to be used. - -We use the natural order string comparison algorithm, written by Martin Pool . - -Emanuel Eichhammer granted permission to use QCustomPlot. - -Some icons made by Freepik, http://www.freepik.com from https://www.flaticon.com - -Insecure.Com LLC ("The Nmap Project") has granted the Wireshark Foundation permission to distribute Npcap with our Windows installers. - -We use the overflow-safe math functions from the portable snippets repository (https://github.com/nemequ/portable-snippets). - -We use the Lrexlib Lua library, specifically the PCRE2 flavour, to provide a regular expression API for Lua. The Lrexlib repository is hosted at https://github.com/rrthomas/lrexlib. diff --git a/Acknowledgements.md b/Acknowledgements.md new file mode 100644 index 0000000000..079420f4bb --- /dev/null +++ b/Acknowledgements.md @@ -0,0 +1,23 @@ +Dan Lasley gave permission for his `dumpit()` hex-dump routine to be used. + +We use the exception module from [Kazlib](http://www.kylheku.com/~kaz/kazlib.html), a C library written by Kaz Kylheku . Thanks go to him for his well-written library. + +We use [Lua](https://www.lua.org/about.html) to extend Wireshark APIs with scripting capabilities. Lua is a powerful, efficient, lightweight, embeddable scripting language developed and maintained by a team at PUC-Rio. + +We use [Lua BitOp](https://bitop.luajit.org), written by Mike Pall, for bitwise operations on numbers in Lua. + +Snax gave permission to use the weak key detection code from [Airsnort](http://airsnort.shmoo.com). + +IANA gave permission for their port-numbers file to be used. + +We use the natural order string comparison algorithm, written by Martin Pool . + +Emanuel Eichhammer granted permission to use [QCustomPlot](https://www.qcustomplot.com). + +Some icons made by [Freepik](http://www.freepik.com) from . + +Insecure.Com LLC ("The Nmap Project") has granted the Wireshark Foundation permission to distribute [Npcap](https://npcap.com) with our Windows installers. + +We use the overflow-safe math functions from the [portable snippets](https://github.com/nemequ/portable-snippets) repository. + +We use the [Lrexlib](https://github.com/rrthomas/lrexlib) Lua library, specifically the PCRE2 flavour, to provide a regular expression API for Lua. diff --git a/CMakeLists.txt b/CMakeLists.txt index c2f69af20e..af77d11668 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1965,6 +1965,7 @@ set(INSTALL_DIRS # Installed into ${DATAFILE_DIR} set(INSTALL_FILES + Acknowledgements.md docbook/ws.css enterprises.tsv gpl-2.0-standalone.html diff --git a/packaging/nsis/logray.nsi b/packaging/nsis/logray.nsi index 42603e3b4a..b261f4ae95 100644 --- a/packaging/nsis/logray.nsi +++ b/packaging/nsis/logray.nsi @@ -468,6 +468,7 @@ File "${STAGING_DIR}\dumpcap.html" File "${STAGING_DIR}\extcap.html" File "${STAGING_DIR}\ipmap.html" File "${STAGING_DIR}\gpl-2.0-standalone.html" +File "${STAGING_DIR}\Acknowledgements.md" ; C-runtime redistributable ; vc_redist.x64.exe or vc_redist.x86.exe - copy and execute the redistributable installer diff --git a/packaging/nsis/uninstall-logray.nsi b/packaging/nsis/uninstall-logray.nsi index 80b450711a..a77627fd67 100644 --- a/packaging/nsis/uninstall-logray.nsi +++ b/packaging/nsis/uninstall-logray.nsi @@ -150,6 +150,7 @@ Delete "$INSTDIR\audio\*.*" Delete "$INSTDIR\bearer\*.*" Delete "$INSTDIR\diameter\*.*" Delete "$INSTDIR\gpl-2.0-standalone.html" +Delete "$INSTDIR\Acknowledgements.md" Delete "$INSTDIR\help\*.*" Delete "$INSTDIR\iconengines\*.*" Delete "$INSTDIR\imageformats\*.*" diff --git a/packaging/nsis/uninstall-wireshark.nsi b/packaging/nsis/uninstall-wireshark.nsi index 0e72522556..8e3397ac6c 100644 --- a/packaging/nsis/uninstall-wireshark.nsi +++ b/packaging/nsis/uninstall-wireshark.nsi @@ -192,6 +192,7 @@ Delete "$INSTDIR\extcap\ciscodump.*" Delete "$INSTDIR\extcap\udpdump.*" Delete "$INSTDIR\extcap\wifidump.*" Delete "$INSTDIR\gpl-2.0-standalone.html" +Delete "$INSTDIR\Acknowledgements.md" Delete "$INSTDIR\help\*.*" Delete "$INSTDIR\iconengines\*.*" Delete "$INSTDIR\imageformats\*.*" diff --git a/packaging/nsis/wireshark.nsi b/packaging/nsis/wireshark.nsi index ccf7339691..8ebd69b9bb 100644 --- a/packaging/nsis/wireshark.nsi +++ b/packaging/nsis/wireshark.nsi @@ -513,6 +513,7 @@ File "${STAGING_DIR}\dumpcap.html" File "${STAGING_DIR}\extcap.html" File "${STAGING_DIR}\ipmap.html" File "${STAGING_DIR}\gpl-2.0-standalone.html" +File "${STAGING_DIR}\Acknowledgements.md" ; C-runtime redistributable ; vc_redist.x64.exe or vc_redist.x86.exe - copy and execute the redistributable installer diff --git a/tools/generate_authors.py b/tools/generate_authors.py index 44bf552927..6d020d954c 100755 --- a/tools/generate_authors.py +++ b/tools/generate_authors.py @@ -48,7 +48,6 @@ def get_git_authors(): def extract_contributors(authors_content): # Extract names and email addresses from the AUTHORS file Contributors contributors_content = authors_content.split("= Contributors =", 1)[1] - contributors_content = contributors_content.split("= Acknowledgements =", 1)[0] CONTRIBUTOR_LINE_REGEX = r"^([\w\.\-\'\x80-\xff]+(\s*[\w+\.\-\'\x80-\xff])*)\s+<([^>]*)>" contributors = [] state = "" @@ -126,11 +125,8 @@ def main(): git_contributors_text = generate_git_contributors_text(contributors_emails, git_authors_emails) # Now we can write our output: - acknowledgements_start = author_content.find("\n\n= Acknowledgements =") - before_acknowledgements = author_content[:acknowledgements_start] - acknowledgements = author_content[acknowledgements_start:] - git_contributor_header = '\n\n\n= From git log =\n\n' - output = before_acknowledgements + git_contributor_header + git_contributors_text + '\n' + acknowledgements + git_contributor_header = '\n\n= From git log =\n\n' + output = author_content + git_contributor_header + git_contributors_text + '\n' stdoutu8.write(output) diff --git a/ui/qt/about_dialog.cpp b/ui/qt/about_dialog.cpp index 2fa0130a99..047611a6d7 100644 --- a/ui/qt/about_dialog.cpp +++ b/ui/qt/about_dialog.cpp @@ -63,11 +63,11 @@ #include #include #include +#include AuthorListModel::AuthorListModel(QObject * parent) : AStringListListModel(parent) { - bool readAck = false; QFile f_authors; f_authors.setFileName(get_datafile_path("AUTHORS-SHORT")); @@ -80,27 +80,18 @@ AStringListListModel(parent) #endif QRegularExpression rx("(.*)[<(]([\\s'a-zA-Z0-9._%+-]+(\\[[Aa][Tt]\\])?[a-zA-Z0-9._%+-]+)[>)]"); - acknowledgement_.clear(); while (!ReadFile_authors.atEnd()) { QString line = ReadFile_authors.readLine(); - if (! readAck && line.trimmed().length() == 0) + if (line.trimmed().length() == 0) continue; if (line.startsWith("------")) continue; - if (line.contains("Acknowledgements")) { - readAck = true; - continue; + QRegularExpressionMatch match = rx.match(line); + if (match.hasMatch()) { + appendRow(QStringList() << match.captured(1).trimmed() << match.captured(2).trimmed()); } - else if (!readAck) { - QRegularExpressionMatch match = rx.match(line); - if (match.hasMatch()) - appendRow(QStringList() << match.captured(1).trimmed() << match.captured(2).trimmed()); - } - - if (readAck && (!line.isEmpty() || !acknowledgement_.isEmpty())) - acknowledgement_.append(QString("%1\n").arg(line)); } f_authors.close(); @@ -108,11 +99,6 @@ AStringListListModel(parent) AuthorListModel::~AuthorListModel() { } -QString AuthorListModel::acknowledgment() const -{ - return acknowledgement_; -} - QStringList AuthorListModel::headerColumns() const { return QStringList() << tr("Name") << tr("Email"); @@ -278,6 +264,7 @@ AboutDialog::AboutDialog(QWidget *parent) : { ui->setupUi(this); setAttribute(Qt::WA_DeleteOnClose, true); + QFile f_acknowledgements; QFile f_license; AuthorListModel * authorModel = new AuthorListModel(this); @@ -288,10 +275,6 @@ AboutDialog::AboutDialog(QWidget *parent) : proxyAuthorModel->setColumnToFilter(1); ui->tblAuthors->setModel(proxyAuthorModel); ui->tblAuthors->setRootIsDecorated(false); - ui->pte_Authors->clear(); - ui->pte_Authors->appendPlainText(authorModel->acknowledgment()); - ui->pte_Authors->moveCursor(QTextCursor::Start); - ui->tblAuthors->setContextMenuPolicy(Qt::CustomContextMenu); connect(ui->tblAuthors, &QTreeView::customContextMenuRequested, this, &AboutDialog::handleCopyMenu); connect(ui->searchAuthors, &QLineEdit::textChanged, proxyAuthorModel, &AStringListListSortFilterProxyModel::setFilter); @@ -375,6 +358,28 @@ AboutDialog::AboutDialog(QWidget *parent) : connect(ui->tblShortcuts, &QTreeView::customContextMenuRequested, this, &AboutDialog::handleCopyMenu); connect(ui->searchShortcuts, &QLineEdit::textChanged, shortcutProxyModel, &AStringListListSortFilterProxyModel::setFilter); + /* Acknowledgements */ + f_acknowledgements.setFileName(get_datafile_path("Acknowledgements.md")); + + f_acknowledgements.open(QFile::ReadOnly | QFile::Text); + QTextStream ReadFile_acks(&f_acknowledgements); + + /* QTextBrowser markdown support added in 5.14. */ +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) + QTextBrowser *textBrowserAcks = new QTextBrowser(); + textBrowserAcks->setMarkdown(ReadFile_acks.readAll()); + textBrowserAcks->setReadOnly(true); + textBrowserAcks->setOpenExternalLinks(true); + textBrowserAcks->moveCursor(QTextCursor::Start); + ui->ackVerticalLayout->addWidget(textBrowserAcks); +#else + QPlainTextEdit *pte = new QPlainTextEdit(); + pte->setPlainText(ReadFile_acks.readAll()); + pte->setReadOnly(true); + pte->moveCursor(QTextCursor::Start); + ui->ackVerticalLayout->addWidget(pte); +#endif + /* License */ f_license.setFileName(get_datafile_path("gpl-2.0-standalone.html")); diff --git a/ui/qt/about_dialog.h b/ui/qt/about_dialog.h index 6ce3879a1b..ea5cfdd26b 100644 --- a/ui/qt/about_dialog.h +++ b/ui/qt/about_dialog.h @@ -33,14 +33,9 @@ public: explicit AuthorListModel(QObject * parent = Q_NULLPTR); virtual ~AuthorListModel(); - QString acknowledgment() const; - protected: virtual QStringList headerColumns() const; -private: - QString acknowledgement_; - }; class PluginListModel : public AStringListListModel diff --git a/ui/qt/about_dialog.ui b/ui/qt/about_dialog.ui index bc73123443..5a0037bc18 100644 --- a/ui/qt/about_dialog.ui +++ b/ui/qt/about_dialog.ui @@ -261,15 +261,7 @@ Acknowledgments - - - - - true - - - - +