Libkleo

systeminfo.cpp
1/* -*- mode: c++; c-basic-offset:4 -*-
2 utils/systeminfo.cpp
3
4 This file is part of libkleopatra
5 SPDX-FileCopyrightText: 2022 g10 Code GmbH
6 SPDX-FileContributor: Ingo Klöcker <dev@ingo-kloecker.de>
7
8 SPDX-License-Identifier: GPL-2.0-or-later
9*/
10
11#include <config-libkleo.h>
12
13#include "systeminfo.h"
14
15#include <QByteArray>
16
17// #include "libkleo_debug.h"
18#ifdef Q_OS_WIN
19#include "windows.h"
20#endif
21
22#ifdef Q_OS_WIN
23namespace
24{
25bool win_isHighContrastModeActive()
26{
27 HIGHCONTRAST result;
28 result.cbSize = sizeof(HIGHCONTRAST);
29 if (SystemParametersInfo(SPI_GETHIGHCONTRAST, result.cbSize, &result, 0)) {
30 return (result.dwFlags & HCF_HIGHCONTRASTON);
31 }
32 return false;
33}
34}
35#endif
36
37bool Kleo::SystemInfo::isHighContrastModeActive()
38{
39 static bool forceHighContrastMode = qgetenv("KLEO_HIGH_CONTRAST_MODE").toInt();
40#ifdef Q_OS_WIN
41 static bool highContrastModeActive = forceHighContrastMode || win_isHighContrastModeActive();
42 return highContrastModeActive;
43#else
44 return forceHighContrastMode;
45#endif
46}
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:09:14 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.