Wireshark 4.7.0
The Wireshark network protocol analyzer
Loading...
Searching...
No Matches
Classes | Public Types | Signals | Public Member Functions | List of all members
SystemThemeDetector Class Reference

#include <system_theme_detector.h>

Inheritance diagram for SystemThemeDetector:

Classes

struct  Impl
 

Public Types

enum class  Scheme { Unknown , Light , Dark , Invalid }
 

Signals

void schemeChanged (Scheme scheme)
 

Public Member Functions

 SystemThemeDetector (QObject *parent=nullptr)
 
Scheme currentScheme () const
 

Detailed Description

Platform-native detector for the OS-level light/dark preference.

Owned and operated exclusively by ThemeManager. No other component in Wireshark should construct, query, or connect to a detector instance; everything outside the theme subsystem asks ThemeManager::isDark() instead.

The detector begins observing the system setting in its constructor and tears the observer down in its destructor (RAII). There is deliberately no start()/stop() pair.

The actual observation mechanism is platform-specific. A concrete Impl is provided per platform in ui/qt/utils/themes/system_theme_detector_mac.mm (macOS) ui/qt/utils/themes/system_theme_detector_win.cpp (Windows) ui/qt/utils/themes/system_theme_detector_unix.cpp (Linux/BSD) ui/qt/utils/themes/system_theme_detector_stub.cpp (all other builds)

CMake selects exactly one of those for the build.

Member Enumeration Documentation

◆ Scheme

enum class SystemThemeDetector::Scheme
strong
Enumerator
Unknown 

The platform could not determine a preference (stub back-end, or a native query that returned no value); ThemeManager then classifies the OS palette luminance. The Unix back-end resolves the desktop's "default"/ no-preference scheme to a concrete Light/Dark value internally, so it does not surface Unknown for that.

Invalid 

A particular detection source could not be read, so the next source should be tried. Internal to the platform back-ends; currentScheme() never returns it.

Member Function Documentation

◆ currentScheme()

SystemThemeDetector::Scheme SystemThemeDetector::currentScheme ( ) const

Current OS-level preference. Cached value returned synchronously; safe to call from any thread that can touch the detector.

◆ schemeChanged

void SystemThemeDetector::schemeChanged ( Scheme  scheme)
signal

Emitted when the OS preference transitions between Light and Dark. Suppressed for no-op re-reads. Always delivered on the main (GUI) thread.


The documentation for this class was generated from the following files: