X-Git-Url: http://git.maemo.org/git/?p=jspeed;a=blobdiff_plain;f=src%2Fmainwindow.cpp;fp=src%2Fmainwindow.cpp;h=f67121d7f8fd73f7c317c56c892cccd2968a2cb7;hp=e08ab2cac9ee185baeca18f8fce0c7364dfebdb4;hb=e3f2858377ed1ecb7e35dd9af82597ab55ae935a;hpb=9fb36f56fc5255d0375e9233670da753572bc207 diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index e08ab2c..f67121d 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -32,11 +32,18 @@ #include "poialerts.h" #include "speedalarm.h" #include "mediaplayer.h" +#include "orientation.h" +#include +#include -MainWindow::MainWindow(): QMainWindow(0), menu_(0), themeLoader_(0), mainScreen_(0) + +MainWindow::MainWindow(): QMainWindow(0), menu_(0), themeLoader_(0), +mainScreen_(0), orientation_(0) { setWindowTitle(tr("jSpeed")); showFullScreen(); + orientation_ = new Orientation(this); + orientation_->start(); addScreens(); QTimer::singleShot(500, this, SLOT(loadServices())); } @@ -94,20 +101,20 @@ bool MainWindow::loadTheme() return false; } - if(mainScreen_->orientationEnabled(WidgetScreen::LANDSCAPE) && - mainScreen_->orientationEnabled(WidgetScreen::PORTRAIT)) - { - setAttribute(Qt::WA_Maemo5AutoOrientation, true); - } - else if(mainScreen_->orientationEnabled(WidgetScreen::PORTRAIT)) + int orientations = 0; + + if(mainScreen_->orientationEnabled(WidgetScreen::LANDSCAPE)) { - setAttribute(Qt::WA_Maemo5PortraitOrientation, true); + orientations |= Orientation::LANDSCAPE; } - else + if(mainScreen_->orientationEnabled(WidgetScreen::PORTRAIT)) { - setAttribute(Qt::WA_Maemo5LandscapeOrientation, true); + orientations |= Orientation::PORTRAIT; } + orientation_->setSupportedOrientations(orientations); + orientation_->update(); + return true; }