Changeset View
Changeset View
Standalone View
Standalone View
daemon/backends/upower/backlighthelper.cpp
Show All 20 Lines | |||||
21 | 21 | | |||
22 | #include <powerdevil_debug.h> | 22 | #include <powerdevil_debug.h> | ||
23 | 23 | | |||
24 | #include <QDir> | 24 | #include <QDir> | ||
25 | #include <QDebug> | 25 | #include <QDebug> | ||
26 | 26 | | |||
27 | #include <KLocalizedString> | 27 | #include <KLocalizedString> | ||
28 | 28 | | |||
29 | #include <algorithm> | ||||
29 | #include <sys/utsname.h> | 30 | #include <sys/utsname.h> | ||
30 | 31 | | |||
31 | #ifdef Q_OS_FREEBSD | 32 | #ifdef Q_OS_FREEBSD | ||
32 | #define USE_SYSCTL | 33 | #define USE_SYSCTL | ||
33 | #endif | 34 | #endif | ||
34 | 35 | | |||
35 | #ifdef USE_SYSCTL | 36 | #ifdef USE_SYSCTL | ||
36 | #include <sys/types.h> | 37 | #include <sys/types.h> | ||
▲ Show 20 Lines • Show All 131 Lines • ▼ Show 20 Line(s) | 129 | #ifdef USE_SYSCTL | |||
168 | } | 169 | } | ||
169 | // acpi_video(4) supports only some predefined brightness levels. | 170 | // acpi_video(4) supports only some predefined brightness levels. | ||
170 | int nlevels = len / sizeof(int); | 171 | int nlevels = len / sizeof(int); | ||
171 | for (int i = 0; i < nlevels; i++) { | 172 | for (int i = 0; i < nlevels; i++) { | ||
172 | m_sysctlBrightnessLevels << levels[i]; | 173 | m_sysctlBrightnessLevels << levels[i]; | ||
173 | } | 174 | } | ||
174 | free(levels); | 175 | free(levels); | ||
175 | // Sorting helps when finding max value and when scanning for the nearest level in setbrightness(). | 176 | // Sorting helps when finding max value and when scanning for the nearest level in setbrightness(). | ||
176 | qSort(m_sysctlBrightnessLevels.begin(), m_sysctlBrightnessLevels.end()); | 177 | std::sort(m_sysctlBrightnessLevels.begin(), m_sysctlBrightnessLevels.end()); | ||
177 | #endif | 178 | #endif | ||
178 | } | 179 | } | ||
179 | 180 | | |||
180 | ActionReply BacklightHelper::brightness(const QVariantMap &args) | 181 | ActionReply BacklightHelper::brightness(const QVariantMap &args) | ||
181 | { | 182 | { | ||
182 | Q_UNUSED(args); | 183 | Q_UNUSED(args); | ||
183 | 184 | | |||
184 | ActionReply reply; | 185 | ActionReply reply; | ||
▲ Show 20 Lines • Show All 154 Lines • Show Last 20 Lines |