Changeset View
Changeset View
Standalone View
Standalone View
kcm/kcm.cpp
Show All 15 Lines | |||||
16 | *********************************************************************/ | 16 | *********************************************************************/ | ||
17 | #include "kcm.h" | 17 | #include "kcm.h" | ||
18 | 18 | | |||
19 | #include "config_handler.h" | 19 | #include "config_handler.h" | ||
20 | #include "kcm_screen_debug.h" | 20 | #include "kcm_screen_debug.h" | ||
21 | #include "output_identifier.h" | 21 | #include "output_identifier.h" | ||
22 | #include "output_model.h" | 22 | #include "output_model.h" | ||
23 | #include "../common/control.h" | 23 | #include "../common/control.h" | ||
24 | #include "../common/orientation_sensor.h" | ||||
24 | 25 | | |||
25 | #include <kscreen/config.h> | 26 | #include <kscreen/config.h> | ||
26 | #include <kscreen/getconfigoperation.h> | 27 | #include <kscreen/getconfigoperation.h> | ||
27 | #include <kscreen/log.h> | 28 | #include <kscreen/log.h> | ||
28 | #include <kscreen/output.h> | 29 | #include <kscreen/output.h> | ||
29 | #include <kscreen/setconfigoperation.h> | 30 | #include <kscreen/setconfigoperation.h> | ||
30 | 31 | | |||
31 | #include <KAboutData> | 32 | #include <KAboutData> | ||
Show All 33 Lines | 64 | about->addAuthor(i18n("Roman Gilg"), | |||
65 | QStringLiteral("subdiff@gmail.com")); | 66 | QStringLiteral("subdiff@gmail.com")); | ||
66 | setAboutData(about); | 67 | setAboutData(about); | ||
67 | setButtons(Apply); | 68 | setButtons(Apply); | ||
68 | 69 | | |||
69 | m_loadCompressor = new QTimer(this); | 70 | m_loadCompressor = new QTimer(this); | ||
70 | m_loadCompressor->setInterval(1000); | 71 | m_loadCompressor->setInterval(1000); | ||
71 | m_loadCompressor->setSingleShot(true); | 72 | m_loadCompressor->setSingleShot(true); | ||
72 | connect (m_loadCompressor, &QTimer::timeout, this, &KCMKScreen::load); | 73 | connect (m_loadCompressor, &QTimer::timeout, this, &KCMKScreen::load); | ||
74 | | ||||
75 | m_orientationSensor = new OrientationSensor(this); | ||||
76 | connect(m_orientationSensor, &OrientationSensor::validChanged, | ||||
77 | this, &KCMKScreen::orientationSensorAvailableChanged); | ||||
73 | } | 78 | } | ||
74 | 79 | | |||
75 | void KCMKScreen::configReady(ConfigOperation *op) | 80 | void KCMKScreen::configReady(ConfigOperation *op) | ||
76 | { | 81 | { | ||
77 | qCDebug(KSCREEN_KCM) << "Reading in config now."; | 82 | qCDebug(KSCREEN_KCM) << "Reading in config now."; | ||
78 | 83 | | |||
79 | if (op->hasError()) { | 84 | if (op->hasError()) { | ||
80 | m_config.reset(); | 85 | m_config.reset(); | ||
▲ Show 20 Lines • Show All 73 Lines • ▼ Show 20 Line(s) | 107 | { | |||
154 | // The 1000ms is a legacy value tested to work for randr having | 159 | // The 1000ms is a legacy value tested to work for randr having | ||
155 | // enough time to change configuration. | 160 | // enough time to change configuration. | ||
156 | QTimer::singleShot(1000, this, | 161 | QTimer::singleShot(1000, this, | ||
157 | [this] () { | 162 | [this] () { | ||
158 | if (!m_config) { | 163 | if (!m_config) { | ||
159 | setNeedsSave(false); | 164 | setNeedsSave(false); | ||
160 | return; | 165 | return; | ||
161 | } | 166 | } | ||
162 | m_config->updateInitialConfig(); | 167 | m_config->updateInitialData(); | ||
163 | } | 168 | } | ||
164 | ); | 169 | ); | ||
165 | } | 170 | } | ||
166 | 171 | | |||
167 | bool KCMKScreen::backendReady() const | 172 | bool KCMKScreen::backendReady() const | ||
168 | { | 173 | { | ||
169 | return m_backendReady; | 174 | return m_backendReady; | ||
170 | } | 175 | } | ||
▲ Show 20 Lines • Show All 63 Lines • ▼ Show 20 Line(s) | |||||
234 | { | 239 | { | ||
235 | if (!m_config || !m_config->config()) { | 240 | if (!m_config || !m_config->config()) { | ||
236 | return false; | 241 | return false; | ||
237 | } | 242 | } | ||
238 | return m_config->config()->supportedFeatures().testFlag(Config::Feature:: | 243 | return m_config->config()->supportedFeatures().testFlag(Config::Feature:: | ||
239 | OutputReplication); | 244 | OutputReplication); | ||
240 | } | 245 | } | ||
241 | 246 | | |||
247 | bool KCMKScreen::orientationSensorAvailable() const | ||||
248 | { | ||||
249 | return m_orientationSensor->isValid(); | ||||
250 | } | ||||
251 | | ||||
242 | void KCMKScreen::setScreenNormalized(bool normalized) | 252 | void KCMKScreen::setScreenNormalized(bool normalized) | ||
243 | { | 253 | { | ||
244 | if (m_screenNormalized == normalized) { | 254 | if (m_screenNormalized == normalized) { | ||
245 | return; | 255 | return; | ||
246 | } | 256 | } | ||
247 | m_screenNormalized = normalized; | 257 | m_screenNormalized = normalized; | ||
248 | Q_EMIT screenNormalizedChanged(); | 258 | Q_EMIT screenNormalizedChanged(); | ||
249 | } | 259 | } | ||
▲ Show 20 Lines • Show All 164 Lines • Show Last 20 Lines |