Changed app to use Qt Mobility in screen rotation instead of default Qt screen rotation.
[jspeed] / src / widgetscreen.cpp
index 4695f06..120de24 100644 (file)
@@ -44,19 +44,39 @@ bool WidgetScreen::load(Orientation orientation, QDomNode const& data, Reader* r
 
     bool ret = screens_[orientation]->load(data, reader);
 
-    if(ret && screens_.size() == 1)
-    {
-        currentOrientation_ = orientation;
-    }
-
     if(ret)
     {
         loadedScreens_.insert(orientation);
+
+        if(loadedScreens_.size() == 1)
+        {
+            currentOrientation_ = orientation;
+            setCurrentWidget(screens_[orientation]);
+        }
     }
 
     return ret;
 }
 
+bool WidgetScreen::load(QDomNode const& data, Reader* reader)
+{
+    return load(LANDSCAPE, data, reader) && load(PORTRAIT, data, reader);
+}
+
+void WidgetScreen::setColor(Orientation orientation, QString const& color)
+{
+    if(screens_.find(orientation) != screens_.end())
+    {
+        screens_[orientation]->setColor(color);
+    }
+}
+
+void WidgetScreen::setColor(QString const& color)
+{
+    setColor(LANDSCAPE, color);
+    setColor(PORTRAIT, color);
+}
+
 void WidgetScreen::addScreen(ThemeScreen* screen, Orientation orientation)
 {
     if(screens_.find(orientation) != screens_.end())
@@ -99,10 +119,10 @@ void WidgetScreen::reArrange()
     {
         if(screens_.find(o) != screens_.end())
         {
-            setCurrentWidget(screens_[o]);
+            currentOrientation_ = o;
             screens_[o]->reArrange();
+            setCurrentWidget(screens_[o]);
             screens_[o]->forceRepaint();
-            currentOrientation_ = o;
         }
     }
 }
@@ -116,11 +136,6 @@ void WidgetScreen::flip()
     }
 }
 
-void WidgetScreen::setColor(QString const& color)
-{
-    Q_UNUSED(color);
-}
-
 void WidgetScreen::clear()
 {
     for(QMap<Orientation, ThemeScreen*>::iterator it = screens_.begin();