Changeset View
Changeset View
Standalone View
Standalone View
src/kded/tablethandler.cpp
Show First 20 Lines • Show All 172 Lines • ▼ Show 20 Line(s) | 162 | if ( tbi && ti.getTabletSerial() == info.getTabletSerial() ) { | |||
---|---|---|---|---|---|
173 | delete pm; | 173 | delete pm; | ||
174 | 174 | | |||
175 | emit tabletRemoved(tabletId); | 175 | emit tabletRemoved(tabletId); | ||
176 | } | 176 | } | ||
177 | } | 177 | } | ||
178 | 178 | | |||
179 | 179 | | |||
180 | 180 | | |||
181 | void TabletHandler::onScreenRotated( const ScreenRotation& screenRotation ) | 181 | void TabletHandler::onScreenRotated( const Qt::ScreenOrientation &newScreenRotation ) | ||
182 | { | 182 | { | ||
183 | Q_D( TabletHandler ); | 183 | Q_D( TabletHandler ); | ||
184 | 184 | | |||
185 | dbgWacom << "Screen rotation changed: " << newScreenRotation; | ||||
186 | | ||||
185 | //for each connected tablet, do the rotation | 187 | //for each connected tablet, do the rotation | ||
186 | foreach(const QString &tabletId, d->tabletInformationList.keys()) { | 188 | foreach(const QString &tabletId, d->tabletInformationList.keys()) { | ||
187 | QString curProfile = d->currentProfileList.value(tabletId); | 189 | QString curProfile = d->currentProfileList.value(tabletId); | ||
188 | TabletProfile tabletProfile = d->profileManagerList.value(tabletId)->loadProfile(curProfile); | 190 | TabletProfile tabletProfile = d->profileManagerList.value(tabletId)->loadProfile(curProfile); | ||
191 | ScreenRotation screenRotation = ScreenRotation::NONE; | ||||
192 | | ||||
193 | switch (newScreenRotation) | ||||
194 | { | ||||
195 | case Qt::PrimaryOrientation: | ||||
196 | case Qt::LandscapeOrientation: | ||||
197 | screenRotation = ScreenRotation::NONE; | ||||
198 | break; | ||||
199 | case Qt::PortraitOrientation: | ||||
200 | screenRotation = ScreenRotation::CW; | ||||
201 | break; | ||||
202 | case Qt::InvertedLandscapeOrientation: | ||||
203 | screenRotation = ScreenRotation::HALF; | ||||
204 | break; | ||||
205 | case Qt::InvertedPortraitOrientation: | ||||
206 | screenRotation = ScreenRotation::CCW; | ||||
207 | break; | ||||
208 | } | ||||
189 | 209 | | |||
190 | // rotation has to be applied before screen mapping | 210 | // rotation has to be applied before screen mapping | ||
191 | autoRotateTablet(tabletId, screenRotation, tabletProfile); | 211 | autoRotateTablet(tabletId, screenRotation, tabletProfile); | ||
192 | 212 | | |||
193 | // when the rotation changes, the screen mapping has to be applied again | 213 | // when the rotation changes, the screen mapping has to be applied again | ||
194 | mapTabletToCurrentScreenSpace(tabletId, tabletProfile); | 214 | mapTabletToCurrentScreenSpace(tabletId, tabletProfile); | ||
195 | } | 215 | } | ||
196 | } | 216 | } | ||
197 | 217 | | |||
218 | void TabletHandler::onScreenAddedRemoved(QScreen *screen) | ||||
219 | { | ||||
220 | Q_D( TabletHandler ); | ||||
221 | | ||||
222 | Q_UNUSED(screen) | ||||
223 | dbgWacom << "Number of screens has changed"; | ||||
224 | | ||||
225 | foreach(const QString &tabletId, d->tabletInformationList.keys()) { | ||||
226 | QString curProfile = d->currentProfileList.value(tabletId); | ||||
227 | TabletProfile tabletProfile = d->profileManagerList.value(tabletId)->loadProfile(curProfile); | ||||
228 | | ||||
229 | mapTabletToCurrentScreenSpace(tabletId, tabletProfile); | ||||
230 | } | ||||
231 | } | ||||
232 | | ||||
233 | void TabletHandler::onScreenGeometryChanged(const QRect &geom) | ||||
xuetianweng: Then I would prefer you omit the geom argument here (signal slot will still work if argument is… | |||||
234 | { | ||||
235 | Q_D( TabletHandler ); | ||||
236 | | ||||
237 | Q_UNUSED(geom) | ||||
238 | dbgWacom << "Screen geometry has changed"; | ||||
239 | | ||||
240 | foreach(const QString &tabletId, d->tabletInformationList.keys()) { | ||||
241 | QString curProfile = d->currentProfileList.value(tabletId); | ||||
242 | TabletProfile tabletProfile = d->profileManagerList.value(tabletId)->loadProfile(curProfile); | ||||
243 | | ||||
244 | mapTabletToCurrentScreenSpace(tabletId, tabletProfile); | ||||
245 | } | ||||
246 | } | ||||
247 | | ||||
198 | 248 | | |||
199 | void TabletHandler::onTogglePenMode() | 249 | void TabletHandler::onTogglePenMode() | ||
200 | { | 250 | { | ||
201 | Q_D( TabletHandler ); | 251 | Q_D( TabletHandler ); | ||
202 | 252 | | |||
203 | foreach(const QString &tabletId, d->tabletInformationList.keys()) { | 253 | foreach(const QString &tabletId, d->tabletInformationList.keys()) { | ||
204 | if( !hasTablet(tabletId) || !hasDevice(tabletId, DeviceType::Stylus)) { | 254 | if( !hasTablet(tabletId) || !hasDevice(tabletId, DeviceType::Stylus)) { | ||
205 | continue; | 255 | continue; | ||
▲ Show 20 Lines • Show All 423 Lines • Show Last 20 Lines |
Then I would prefer you omit the geom argument here (signal slot will still work if argument is omitted.)
So we can avoid to use the scaled geom when some one thinks it's a good idea to use it. Or at least write some comment here.