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 <KColorSchemeManager>
16
17#include <QByteArray>
18
19// #include "libkleo_debug.h"
20#ifdef Q_OS_WIN
21#include "windows.h"
22#endif
23
24#ifdef Q_OS_WIN
25namespace
26{
27bool win_isHighContrastModeActive()
28{
29 HIGHCONTRAST result;
30 result.cbSize = sizeof(HIGHCONTRAST);
31 if (SystemParametersInfo(SPI_GETHIGHCONTRAST, result.cbSize, &result, 0)) {
32 return (result.dwFlags & HCF_HIGHCONTRASTON);
33 }
34 return false;
35}
36}
37#endif
38
39bool Kleo::SystemInfo::isHighContrastModeActive()
40{
41 static bool forceHighContrastMode = qgetenv("KLEO_HIGH_CONTRAST_MODE").toInt();
42#ifdef Q_OS_WIN
43 return forceHighContrastMode || win_isHighContrastModeActive();
44#else
45 return forceHighContrastMode;
46#endif
47}
48
49bool Kleo::SystemInfo::isHighContrastColorSchemeInUse()
50{
51 return KColorSchemeManager::instance()->activeSchemeId().isEmpty() // the default scheme is in use
52 && isHighContrastModeActive();
53}
QString activeSchemeId() const
static KColorSchemeManager * instance()
bool isEmpty() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Apr 25 2025 11:49:04 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.