diff options
author | Guy Harris <gharris@sonic.net> | 2020-10-02 19:17:00 -0700 |
---|---|---|
committer | Guy Harris <gharris@sonic.net> | 2020-10-02 20:13:42 -0700 |
commit | e013c5ec7f175f4e12f20f201d639e64609960de (patch) | |
tree | 4eab00bd869dc44e1898e228d5fdcc42db2d8417 /ui | |
parent | 22e7ddb63789ff603641be116ee24834ca7631f9 (diff) |
Clean up URLs.
Add ui/urls.h to define some URLs on various of our websites. Use the
GitLab URL for the wiki. Add a macro to generate wiki URLs.
Update wiki URLs in comments etc.
Use the #defined URL for the docs page in
WelcomePage::on_helpLabel_clicked; that removes the last user of
topic_online_url(), so get rid of it and swallow it up into
topic_action_url().
Diffstat (limited to 'ui')
-rw-r--r-- | ui/capture.c | 7 | ||||
-rw-r--r-- | ui/help_url.c | 96 | ||||
-rw-r--r-- | ui/help_url.h | 7 | ||||
-rw-r--r-- | ui/qt/main.cpp | 3 | ||||
-rw-r--r-- | ui/qt/main_window_slots.cpp | 6 | ||||
-rw-r--r-- | ui/qt/proto_tree.cpp | 5 | ||||
-rw-r--r-- | ui/qt/welcome_page.cpp | 4 | ||||
-rw-r--r-- | ui/qt/welcome_page.ui | 2 | ||||
-rw-r--r-- | ui/urls.h | 23 |
9 files changed, 82 insertions, 71 deletions
diff --git a/ui/capture.c b/ui/capture.c index 5d89ad1ec4..0113c68298 100644 --- a/ui/capture.c +++ b/ui/capture.c @@ -27,6 +27,7 @@ #include "ui/capture_info.h" #include "ui/capture_ui_utils.h" #include "ui/util.h" +#include "ui/urls.h" #include "caputils/capture-pcap-util.h" #include <epan/prefs.h> @@ -258,6 +259,8 @@ capture_input_read_all(capture_session *cap_session, gboolean is_tempfile, return FALSE; } +#define BITEME "https://gitlab.com/wireshark/wireshark/-/wikis" + /* if we didn't capture even a single packet, close the file again */ if(cap_session->count == 0 && !capture_opts->restart) { simple_dialog(ESD_TYPE_INFO, ESD_BTN_OK, @@ -268,7 +271,7 @@ capture_input_read_all(capture_session *cap_session, gboolean is_tempfile, "\n" "Help about capturing can be found at\n" "\n" - " https://wiki.wireshark.org/CaptureSetup" + " " WS_WIKI_URL("CaptureSetup") #ifdef _WIN32 "\n\n" "Wireless (Wi-Fi/WLAN):\n" @@ -731,7 +734,7 @@ capture_input_closed(capture_session *cap_session, gchar *msg) "\n" "Help about capturing can be found at\n" "\n" - " https://wiki.wireshark.org/CaptureSetup" + " " WS_WIKI_URL("CaptureSetup") #ifdef _WIN32 "\n\n" "Wireless (Wi-Fi/WLAN):\n" diff --git a/ui/help_url.c b/ui/help_url.c index 37699748c1..1f0da61404 100644 --- a/ui/help_url.c +++ b/ui/help_url.c @@ -16,6 +16,7 @@ #include <glib.h> #include "help_url.h" +#include "urls.h" #include "wsutil/filesystem.h" #ifdef HHC_DIR @@ -28,54 +29,6 @@ // - Automatically generate part or all of this, e.g. by parsing // the DocBook XML or the chunked HTML. -const char * -topic_online_url(topic_action_e action) -{ - switch(action) { - case(ONLINEPAGE_HOME): - return "https://www.wireshark.org"; - break; - case(ONLINEPAGE_WIKI): - return "https://wiki.wireshark.org"; - break; - case(ONLINEPAGE_DOWNLOAD): - return "https://www.wireshark.org/download.html"; - break; - case(ONLINEPAGE_DOCS): - return "https://www.wireshark.org/docs/"; - break; - case(ONLINEPAGE_USERGUIDE): - return "https://www.wireshark.org/docs/wsug_html_chunked/"; - break; - case(ONLINEPAGE_FAQ): - return "https://www.wireshark.org/faq.html"; - break; - case(ONLINEPAGE_ASK): - return "https://ask.wireshark.org"; - break; - case(ONLINEPAGE_SAMPLE_FILES): - return "https://wiki.wireshark.org/SampleCaptures"; - break; - case(ONLINEPAGE_CAPTURE_SETUP): - return "https://wiki.wireshark.org/CaptureSetup"; - break; - case(ONLINEPAGE_NETWORK_MEDIA): - return "https://wiki.wireshark.org/CaptureSetup/NetworkMedia"; - break; - case(ONLINEPAGE_SAMPLE_CAPTURES): - return "https://wiki.wireshark.org/SampleCaptures"; - break; - case(ONLINEPAGE_SECURITY): - return "https://wiki.wireshark.org/Security"; - break; - case(ONLINEPAGE_CHIMNEY): - return "https://wiki.wireshark.org/CaptureSetup/Offloading#chimney"; - break; - default: - return NULL; - } -} - /* * Open the help dialog and show a specific HTML help page. */ @@ -111,7 +64,7 @@ user_guide_url(const gchar *page) { } else { #endif /* ifdef DOC_DIR */ /* try to open the HTML page from wireshark.org instead */ - g_string_printf(url, "https://www.wireshark.org/docs/wsug_html_chunked/%s", page); + g_string_printf(url, WS_DOCS_URL "/wsug_html_chunked/%s", page); #ifdef DOC_DIR } #endif /* ifdef DOC_DIR */ @@ -125,13 +78,48 @@ topic_action_url(topic_action_e action) { gchar *url; + switch(action) { /* pages online at www.wireshark.org */ - url = g_strdup(topic_online_url(action)); - if(url != NULL) { - return url; - } + case(ONLINEPAGE_HOME): + return WS_HOME_PAGE_URL; + break; + case(ONLINEPAGE_WIKI): + return WS_WIKI_HOME_URL; + break; + case(ONLINEPAGE_DOWNLOAD): + return WS_DOWNLOAD_URL; + break; + case(ONLINEPAGE_DOCS): + return WS_DOCS_URL; + break; + case(ONLINEPAGE_USERGUIDE): + return WS_DOCS_URL "/wsug_html_chunked/"; + break; + case(ONLINEPAGE_FAQ): + return WS_FAQ_URL; + break; + case(ONLINEPAGE_ASK): + return WS_Q_AND_A_URL; + break; + case(ONLINEPAGE_SAMPLE_FILES): + return WS_WIKI_URL("SampleCaptures"); + break; + case(ONLINEPAGE_CAPTURE_SETUP): + return WS_WIKI_URL("CaptureSetup"); + break; + case(ONLINEPAGE_NETWORK_MEDIA): + return WS_WIKI_URL("CaptureSetup/NetworkMedia"); + break; + case(ONLINEPAGE_SAMPLE_CAPTURES): + return WS_WIKI_URL("SampleCaptures"); + break; + case(ONLINEPAGE_SECURITY): + return WS_WIKI_URL("Security"); + break; + case(ONLINEPAGE_CHIMNEY): + return WS_WIKI_URL("CaptureSetup/Offloading#chimney"); + break; - switch(action) { /* local manual pages */ case(LOCALPAGE_MAN_WIRESHARK): url = data_file_url("wireshark.html"); diff --git a/ui/help_url.h b/ui/help_url.h index c6dab1789f..ab8248534a 100644 --- a/ui/help_url.h +++ b/ui/help_url.h @@ -109,13 +109,6 @@ typedef enum { HELP_TELEPHONY_RTP_PLAYER_DIALOG } topic_action_e; -/** Given a topic action return its online (www.wireshark.org) URL or NULL. - * - * @param action Topic action, e.g. ONLINEPAGE_HOME or ONLINEPAGE_ASK. - * @return A static URL or NULL. MUST NOT be freed. - */ -const char *topic_online_url(topic_action_e action); - /** Given a page in the Wireshark User's Guide return its URL. On Windows * an attempt will be made to open User Guide URLs with HTML Help. If * the attempt succeeds NULL will be returned. diff --git a/ui/qt/main.cpp b/ui/qt/main.cpp index 489c1d3ccf..c6bd5a129c 100644 --- a/ui/qt/main.cpp +++ b/ui/qt/main.cpp @@ -30,6 +30,7 @@ #include <ui/clopts_common.h> #include <ui/cmdarg_err.h> +#include <ui/urls.h> #include <wsutil/filesystem.h> #include <wsutil/privileges.h> #include <wsutil/socket.h> @@ -336,7 +337,7 @@ check_and_warn_user_startup() "This could be dangerous.\n\n" "If you're running Wireshark this way in order to perform live capture, " "you may want to be aware that there is a better way documented at\n" - "https://wiki.wireshark.org/CaptureSetup/CapturePrivileges", cur_user, cur_group); + WS_WIKI_URL("CaptureSetup/CapturePrivileges"), cur_user, cur_group); g_free(cur_user); g_free(cur_group); } diff --git a/ui/qt/main_window_slots.cpp b/ui/qt/main_window_slots.cpp index db9be1db94..716674ed25 100644 --- a/ui/qt/main_window_slots.cpp +++ b/ui/qt/main_window_slots.cpp @@ -37,6 +37,8 @@ DIAG_ON(frame-larger-than=) #include "ui/commandline.h" +#include "ui/urls.h" + #include "epan/color_filters.h" #include "epan/export_object.h" @@ -3917,7 +3919,7 @@ void MainWindow::on_actionContextWikiProtocolPage_triggered() if (ret != QMessageBox::Yes) return; - QUrl wiki_url = QString("https://wiki.wireshark.org/Protocols/%1").arg(proto_abbrev); + QUrl wiki_url = QString(WS_WIKI_HOME_URL "/" "/Protocols/%1").arg(proto_abbrev); QDesktopServices::openUrl(wiki_url); } @@ -3932,7 +3934,7 @@ void MainWindow::on_actionContextFilterFieldReference_triggered() const QString proto_abbrev = proto_registrar_get_abbrev(field_id); - QUrl dfref_url = QString("https://www.wireshark.org/docs/dfref/%1/%2") + QUrl dfref_url = QString(WS_DOCS_URL "/dfref/%1/%2") .arg(proto_abbrev[0]) .arg(proto_abbrev); QDesktopServices::openUrl(dfref_url); diff --git a/ui/qt/proto_tree.cpp b/ui/qt/proto_tree.cpp index 1864cd83e9..95add43eb2 100644 --- a/ui/qt/proto_tree.cpp +++ b/ui/qt/proto_tree.cpp @@ -27,6 +27,7 @@ #include <ui/qt/filter_action.h> #include <ui/all_files_wildcard.h> #include <ui/alert_box.h> +#include <ui/urls.h> #include "wireshark_application.h" #include <QApplication> @@ -216,11 +217,11 @@ void ProtoTree::ctxOpenUrlWiki() if (ret != QMessageBox::Yes) return; - url = QString("https://wiki.wireshark.org/Protocols/%1").arg(proto_abbrev); + url = QString(WS_WIKI_HOME_URL "/Protocols/%1").arg(proto_abbrev); } else { - url = QString("https://www.wireshark.org/docs/dfref/%1/%2") + url = QString(WS_DOCS_URL "/dfref/%1/%2") .arg(proto_abbrev[0]) .arg(proto_abbrev); } diff --git a/ui/qt/welcome_page.cpp b/ui/qt/welcome_page.cpp index 7a49984cd1..8db18899b2 100644 --- a/ui/qt/welcome_page.cpp +++ b/ui/qt/welcome_page.cpp @@ -14,7 +14,7 @@ #include <epan/prefs.h> #include "ui/capture_globals.h" -#include "ui/help_url.h" +#include "ui/urls.h" #include "version_info.h" @@ -416,7 +416,7 @@ void WelcomePage::on_captureLabel_clicked() void WelcomePage::on_helpLabel_clicked() { - QDesktopServices::openUrl(QUrl(topic_online_url(ONLINEPAGE_DOCS))); + QDesktopServices::openUrl(QUrl(WS_DOCS_URL)); } void WelcomePage::updateStyleSheets() diff --git a/ui/qt/welcome_page.ui b/ui/qt/welcome_page.ui index 366efb39be..86d36cc532 100644 --- a/ui/qt/welcome_page.ui +++ b/ui/qt/welcome_page.ui @@ -270,7 +270,7 @@ a:hover { <td style="padding-left: 8px; padding-right: 8px;">·</td> -<th><a href="https://wiki.wireshark.org/">Wiki</a></th> +<th><a href="https://gitlab.com/wireshark/wireshark/-/wikis/">Wiki</a></th> <td style="padding-left: 8px; padding-right: 8px;">·</td> diff --git a/ui/urls.h b/ui/urls.h new file mode 100644 index 0000000000..eb2cdbf841 --- /dev/null +++ b/ui/urls.h @@ -0,0 +1,23 @@ +/* urls.h + * + * Define URLs for various Wireshark sites, so that if they move, we only + * have to change the URLs here. + * + * Wireshark - Network traffic analyzer + * By Gerald Combs <gerald@wireshark.org> + * Copyright 2000 Gerald Combs + * + * SPDX-License-Identifier: GPL-2.0-or-later + */ + +#define WS_HOME_PAGE_URL "https://www.wireshark.org"; +#define WS_DOWNLOAD_URL "https://www.wireshark.org/download.html" +#define WS_DOCS_URL "https://www.wireshark.org/docs/" +#define WS_FAQ_URL "https://www.wireshark.org/faq.html" +#define WS_Q_AND_A_URL "https://ask.wireshark.org" +#define WS_WIKI_HOME_URL "https://gitlab.com/wireshark/wireshark/-/wikis" + +/* + * Construct a wiki URL given the path to the wiki page. + */ +#define WS_WIKI_URL(path) WS_WIKI_HOME_URL "/" path |