X-Git-Url: http://git.maemo.org/git/?p=jspeed;a=blobdiff_plain;f=src%2Fmainwindow.cpp;h=f8e9185812074e9f573b209873a3bf7eb9bd1fc5;hp=f67121d7f8fd73f7c317c56c892cccd2968a2cb7;hb=36d7905fbbcc49571fef5b7769707441f344d179;hpb=5cc39ab8c690baf4e2b189ec189890834e63badc diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index f67121d..f8e9185 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -33,6 +33,7 @@ #include "speedalarm.h" #include "mediaplayer.h" #include "orientation.h" +#include "settings.h" #include #include @@ -113,6 +114,7 @@ bool MainWindow::loadTheme() } orientation_->setSupportedOrientations(orientations); + onOrientationChanged(); orientation_->update(); return true; @@ -137,6 +139,7 @@ void MainWindow::openMenu() connect(menu_, SIGNAL(flip()), stack_, SLOT(flip())); connect(menu_, SIGNAL(themeChanged()), this, SLOT(loadTheme())); connect(menu_, SIGNAL(unitChanged()), &(Odometer::instance()), SLOT(updateUnit())); + connect(menu_, SIGNAL(orientationChanged()), this, SLOT(onOrientationChanged())); } menu_->show(); @@ -160,3 +163,21 @@ void MainWindow::keepBacklightOn() connection.call(msg); } + +void MainWindow::onOrientationChanged() +{ + QString value = Settings::instance().value("orientation").toString(); + + if(value == "auto") + { + orientation_->setOrientationType(Orientation::TYPE_AUTO); + } + else if(value == "landscape") + { + orientation_->setOrientationType(Orientation::TYPE_LANDSCAPE); + } + else if(value == "portrait") + { + orientation_->setOrientationType(Orientation::TYPE_PORTRAIT); + } +}