1 // checksum 0xfd0b version 0x20001
3 This file was generated by the Mobile Qt Application wizard of Qt Creator.
4 MainWindow is a convenience class containing mobile device specific code
5 such as screen orientation handling.
6 It is recommended not to modify this file, since newer versions of Qt Creator
7 may offer an updated version of it.
10 #include "mainwindow.h"
11 #include "ui_mainwindow.h"
13 #include <setupdialog.h>
15 #include <QtCore/QCoreApplication>
17 #if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK)
22 #endif // Q_OS_SYMBIAN && ORIENTATIONLOCK
24 MainWindow::MainWindow(QWidget *parent)
25 : QMainWindow(parent), ui(new Ui::MainWindow)
30 MainWindow::~MainWindow()
35 void MainWindow::setOrientation(ScreenOrientation orientation)
38 if (orientation != ScreenOrientationAuto) {
39 #if defined(ORIENTATIONLOCK)
40 const CAknAppUiBase::TAppUiOrientation uiOrientation =
41 (orientation == ScreenOrientationLockPortrait) ? CAknAppUi::EAppUiOrientationPortrait
42 : CAknAppUi::EAppUiOrientationLandscape;
43 CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi());
46 appUi->SetOrientationL(uiOrientation);
49 #else // ORIENTATIONLOCK
50 qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation.");
51 #endif // ORIENTATIONLOCK
53 #elif defined(Q_WS_MAEMO_5)
54 Qt::WidgetAttribute attribute;
55 switch (orientation) {
56 case ScreenOrientationLockPortrait:
57 attribute = Qt::WA_Maemo5PortraitOrientation;
59 case ScreenOrientationLockLandscape:
60 attribute = Qt::WA_Maemo5LandscapeOrientation;
62 case ScreenOrientationAuto:
64 attribute = Qt::WA_Maemo5AutoOrientation;
67 setAttribute(attribute, true);
69 Q_UNUSED(orientation);
70 #endif // Q_OS_SYMBIAN
73 void MainWindow::showExpanded()
77 #elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6)
84 void MainWindow::on_actionSetup_triggered()
88 if(dialog.exec() == QDialog::Accepted) {