diff options
author | Tomas Junnonen <tomas.junnonen@nokia.com> | 2010-10-15 14:59:52 +0300 |
---|---|---|
committer | Tomas Junnonen <tomas.junnonen@nokia.com> | 2010-10-15 15:28:23 +0300 |
commit | 20df7432318f00540470864429b448bc6808936e (patch) | |
tree | 1c7b720e7b6987ea9cc2445c1a205436bdb6d10b | |
parent | 6f2ab1a102048ed7a6c0473ba2434449586bf0f8 (diff) |
Changes: Go to landscape mode when TV out is connected
RevBy: TrustMe
Details: Monitoring the video route context property and defaulting
to landscape when a TV connection is made.
-rw-r--r-- | src/corelib/events/morientationtracker.cpp | 27 | ||||
-rw-r--r-- | src/corelib/events/morientationtracker_p.h | 6 |
2 files changed, 27 insertions, 6 deletions
diff --git a/src/corelib/events/morientationtracker.cpp b/src/corelib/events/morientationtracker.cpp index 928d4bf3..96cf3fe1 100644 --- a/src/corelib/events/morientationtracker.cpp +++ b/src/corelib/events/morientationtracker.cpp @@ -35,9 +35,11 @@ MOrientationTracker *MOrientationTrackerPrivate::tracker = 0; MOrientationTrackerPrivate::MOrientationTrackerPrivate(MOrientationTracker *controller) : currentAngle(M::Angle0), - currentIsCovered(false) -#ifdef HAVE_CONTEXTSUBSCRIBER - , currentIsKeyboardOpen(MKeyboardStateTracker::instance()->isOpen()) + currentIsCovered(false), + currentIsTvConnected(false), + currentIsKeyboardOpen(MKeyboardStateTracker::instance()->isOpen()) + #ifdef HAVE_CONTEXTSUBSCRIBER + , videoRouteProperty("com.nokia.policy.video_route") , topEdgeProperty("Screen.TopEdge") , isCoveredProperty("Screen.IsCovered") #endif @@ -66,6 +68,8 @@ MOrientationTrackerPrivate::MOrientationTrackerPrivate(MOrientationTracker *cont this, SLOT(updateOrientationAngle())); connect(&isCoveredProperty, SIGNAL(valueChanged()), this, SLOT(isCoveredChanged())); + connect(&videoRouteProperty, SIGNAL(valueChanged()), + this, SLOT(videoRouteChanged())); connect(MKeyboardStateTracker::instance(), SIGNAL(stateChanged()), this, SLOT(updateOrientationAngle())); #endif @@ -86,10 +90,24 @@ void MOrientationTrackerPrivate::initContextSubscriber() //waiting for properties to synchronize topEdgeProperty.waitForSubscription(); isCoveredProperty.waitForSubscription(); + videoRouteProperty.waitForSubscription(); //initiating the variables to current orientation updateOrientationAngle(); isCoveredChanged(); + videoRouteChanged(); +#endif +} + +void MOrientationTrackerPrivate::videoRouteChanged() +{ +#ifdef HAVE_CONTEXTSUBSCRIBER + QString value = videoRouteProperty.value().toString(); + mDebug("MOrientationTracker") << "VideoRoute:" << value; + + currentIsTvConnected = (value == "tvout" || + value == "builtinandtvout"); + updateOrientationAngle(); #endif } @@ -131,7 +149,8 @@ void MOrientationTrackerPrivate::updateOrientationAngle() } currentIsKeyboardOpen = isKeyboardOpen; - if (edge == "top" && (MDeviceProfile::instance()->orientationAngleIsSupported(M::Angle0, isKeyboardOpen))) { + if (currentIsTvConnected || // TV forces landscape for now, no transformations + (edge == "top" && (MDeviceProfile::instance()->orientationAngleIsSupported(M::Angle0, isKeyboardOpen)))) { angle = M::Angle0; } else if (edge == "left" && (MDeviceProfile::instance()->orientationAngleIsSupported(M::Angle270, isKeyboardOpen))) { angle = M::Angle270; diff --git a/src/corelib/events/morientationtracker_p.h b/src/corelib/events/morientationtracker_p.h index a45c1cd3..471e5529 100644 --- a/src/corelib/events/morientationtracker_p.h +++ b/src/corelib/events/morientationtracker_p.h @@ -46,9 +46,10 @@ public: static MOrientationTracker *tracker; M::OrientationAngle currentAngle; bool currentIsCovered; - -#ifdef HAVE_CONTEXTSUBSCRIBER + bool currentIsTvConnected; bool currentIsKeyboardOpen; +#ifdef HAVE_CONTEXTSUBSCRIBER + ContextProperty videoRouteProperty; ContextProperty topEdgeProperty; ContextProperty isCoveredProperty; #endif @@ -66,6 +67,7 @@ public: public slots: void isCoveredChanged(); + void videoRouteChanged(); protected: MOrientationTracker *q_ptr; |