X-Git-Url: http://git.maemo.org/git/?a=blobdiff_plain;f=src%2Fmainwindow.cpp;h=f67121d7f8fd73f7c317c56c892cccd2968a2cb7;hb=ee3a321d1b32837483443f62a701f77d4a27161b;hp=3ccacaf5cce8286182937d71b8a5a36e02973e7e;hpb=fe73fefc68cf21bdafe136a24b6712080b79f8fb;p=jspeed diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 3ccacaf..f67121d 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -31,13 +31,21 @@ #include "widgetscreen.h" #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(800, this, SLOT(loadServices())); + QTimer::singleShot(500, this, SLOT(loadServices())); } MainWindow::~MainWindow() @@ -49,11 +57,13 @@ void MainWindow::loadServices() { Odometer::instance().start(); QApplication::processEvents(); + startBacklight(); + QApplication::processEvents(); PoiAlerts::instance().start(); QApplication::processEvents(); SpeedAlarm::instance().start(); QApplication::processEvents(); - startBacklight(); + MediaPlayer::init(); } void MainWindow::addScreens() @@ -91,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; }