Qt: Add display information to the About dialog.

Add ColorUtils::themeIsDark and use it to report our dark / light mode
in the "About" dialog. Summarize the HiDPI capability of our displays as
well.

Change-Id: I242af1eb48017d49b90e71099bb753e67a8dd32b
Reviewed-on: https://code.wireshark.org/review/32115
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Gerald Combs <gerald@wireshark.org>
This commit is contained in:
Gerald Combs 2019-02-19 17:08:05 -08:00
parent f1c4a64caf
commit 781fb82045
3 changed files with 31 additions and 0 deletions

View File

@ -94,6 +94,7 @@
#include "caputils/capture-pcap-util.h"
#include <QMessageBox>
#include <QScreen>
#ifdef _WIN32
# include "caputils/capture-wpcap.h"
@ -239,6 +240,26 @@ get_gui_compiled_info(GString *str)
void
get_wireshark_runtime_info(GString *str)
{
if (wsApp) {
// Display information
const char *display_mode = ColorUtils::themeIsDark() ? "dark" : "light";
g_string_append_printf(str, ", with %s display mode", display_mode);
int hidpi_count = 0;
foreach (QScreen *screen, wsApp->screens()) {
if (screen->devicePixelRatio() > 1.0) {
hidpi_count++;
}
}
if (hidpi_count == wsApp->screens().count()) {
g_string_append(str, ", with HiDPI");
} else if (hidpi_count) {
g_string_append(str, ", with mixed DPI");
} else {
g_string_append(str, ", without HiDPI");
}
}
#ifdef HAVE_LIBPCAP
/* Capture libraries */
g_string_append(str, ", ");

View File

@ -9,6 +9,9 @@
#include <ui/qt/utils/color_utils.h>
#include <ui/qt/utils/tango_colors.h>
#include <ui/qt/wireshark_application.h>
#include <QPalette>
// Colors we use in various parts of the UI.
//
@ -138,6 +141,11 @@ QRgb ColorUtils::sequenceColor(int item)
return sequence_colors_[item % sequence_colors_.size()];
}
bool ColorUtils::themeIsDark()
{
return wsApp->palette().windowText().color().lightness() < wsApp->palette().text().color().lightness();
}
/*
* Editor modelines
*

View File

@ -45,6 +45,8 @@ public:
static QRgb graphColor(int item);
static QRgb sequenceColor(int item);
static bool themeIsDark();
signals:
public slots: