Debian Codegraph @

src/imports/SystemInfo/lomiridisplayinfo.cpp

raw
1 /****************************************************************************
2 **
3 ** Copyright (C) 2018 The Qt Company Ltd and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtSystems module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and The Qt Company. For licensing terms
14 ** and conditions see https://www.qt.io/terms-conditions. For further
15 ** information use the contact form at https://www.qt.io/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 3 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL3 included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 3 requirements
23 ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
24 **
25 ** GNU General Public License Usage
26 ** Alternatively, this file may be used under the terms of the GNU
27 ** General Public License version 2.0 or (at your option) the GNU General
28 ** Public license version 3 or any later version approved by the KDE Free
29 ** Qt Foundation. The licenses are as published by the Free Software
30 ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
31 ** included in the packaging of this file. Please review the following
32 ** information to ensure the GNU General Public License requirements will
33 ** be met: https://www.gnu.org/licenses/gpl-2.0.html and
34 ** https://www.gnu.org/licenses/gpl-3.0.html.
35 **
36 ** $QT_END_LICENSE$
37 **
38 ****************************************************************************/
39
40 #include "lomiridisplayinfo_p.h"
41
42 QT_BEGIN_NAMESPACE
43
44 /*!
45 \qmltype DisplayInfo
46 \instantiates LomiriDisplayInfo
47 \inqmlmodule QtSystemInfo
48 \ingroup qml-systeminfo
49 \brief The DisplayInfo element provides information about the display of the device.
50 */
51
52 /*!
53 \internal
54 */
55 LomiriDeclarativeDisplayInfo::LomiriDeclarativeDisplayInfo(QObject *parent)
56 : QObject(parent), displayInfo(new LomiriDisplayInfo(this))
57 {
58 connect(displayInfo, SIGNAL(backlightStateChanged(int,LomiriDisplayInfo::BacklightState)),
59 this, SLOT(_q_backlightStateChanged(int,LomiriDisplayInfo::BacklightState)));
60 }
61
62 /*!
63 \internal
64 */
65 LomiriDeclarativeDisplayInfo::~LomiriDeclarativeDisplayInfo()
66 {
67 }
68
69 /*!
70 \qmlmethod int DisplayInfo::brightness(int screen)
71
72 Returns the display brightness of the given \a screen, in 0 - 100 scale. In case of error or
73 the information is not available, -1 is returned.
74 */
75 int LomiriDeclarativeDisplayInfo::brightness(int screen) const
76 {
77 return displayInfo->brightness(screen);
78 }
79
80 /*!
81 \qmlmethod int DisplayInfo::colorDepth(int screen)
82
83 Returns the color depth of the given \a screen, in bits per pixel. -1 is returned if not
84 available or on error.
85 */
86 int LomiriDeclarativeDisplayInfo::colorDepth(int screen) const
87 {
88 return displayInfo->colorDepth(screen);
89 }
90
91 /*!
92 \qmlmethod int DisplayInfo::contrast(int screen)
93
94 Returns the contrast of the given \a screen, in 0 - 100 scale. -1 is returned if not available
95 or on error.
96 */
97 int LomiriDeclarativeDisplayInfo::contrast(int screen) const
98 {
99 return displayInfo->contrast(screen);
100 }
101
102 /*!
103 \qmlmethod int DisplayInfo::dpiX(int screen)
104
105 Returns the horizontal resolution of the given \a screen in terms of the number of dots per inch.
106 -1 is returned if not available or on error.
107 */
108 int LomiriDeclarativeDisplayInfo::dpiX(int screen) const
109 {
110 return displayInfo->dpiX(screen);
111 }
112
113 /*!
114 \qmlmethod int DisplayInfo::dpiY(int screen)
115
116 Returns the vertical resolution of the given \a screen in terms of the number of dots per inch.
117 -1 is returned if not available or on error.
118 */
119 int LomiriDeclarativeDisplayInfo::dpiY(int screen) const
120 {
121 return displayInfo->dpiY(screen);
122 }
123
124 /*!
125 \qmlmethod int DisplayInfo::physicalHeight(int screen)
126
127 Returns the physical height of the \a screen in millimeters. -1 is returned if not available
128 or on error.
129 */
130 int LomiriDeclarativeDisplayInfo::physicalHeight(int screen) const
131 {
132 return displayInfo->physicalHeight(screen);
133 }
134
135 /*!
136 \qmlmethod int DisplayInfo::physicalWidth(int screen)
137
138 Returns the physical width of \a screen in millimeters. -1 is returned if not available or
139 on error.
140 */
141 int LomiriDeclarativeDisplayInfo::physicalWidth(int screen) const
142 {
143 return displayInfo->physicalWidth(screen);
144 }
145
146 /*!
147 \qmlmethod BacklightState DisplayInfo::backlightState(int screen)
148
149 Returns the backlight state of the given \a screen. Possible values are:
150 \list
151 \li DisplayInfo.BacklightUnknown - The state of the backlight is unkown.
152 \li DisplayInfo.BacklightOff - Backlight is turned off.
153 \li DisplayInfo.BacklightDimmed - Backlight has been dimmed.
154 \li DisplayInfo.BacklightOn - Backlight is on.
155 \endlist
156 */
157 int LomiriDeclarativeDisplayInfo::backlightState(int screen) const
158 {
159 return displayInfo->backlightState(screen);
160 }
161
162 /*!
163 \qmlsignal DisplayInfo::onBacklightStateChanged(int screen, BacklightState state)
164
165 This handler is called whenever the state of \a screen has been changed to \a state.
166 */
167 void LomiriDeclarativeDisplayInfo::_q_backlightStateChanged(int screen, LomiriDisplayInfo::BacklightState state)
168 {
169 Q_EMIT backlightStateChanged(screen, static_cast<BacklightState>(state));
170 }
171
172 QT_END_NAMESPACE