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"
16 #include <QtCore/QCoreApplication>
18 #if defined(Q_OS_SYMBIAN) && defined(ORIENTATIONLOCK)
23 #endif // Q_OS_SYMBIAN && ORIENTATIONLOCK
25 MainWindow::MainWindow(QWidget *parent)
26 : QMainWindow(parent), ui(new Ui::MainWindow)
31 MainWindow::~MainWindow()
36 void MainWindow::setOrientation(ScreenOrientation orientation)
39 if (orientation != ScreenOrientationAuto) {
40 #if defined(ORIENTATIONLOCK)
41 const CAknAppUiBase::TAppUiOrientation uiOrientation =
42 (orientation == ScreenOrientationLockPortrait) ? CAknAppUi::EAppUiOrientationPortrait
43 : CAknAppUi::EAppUiOrientationLandscape;
44 CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi());
47 appUi->SetOrientationL(uiOrientation);
50 #else // ORIENTATIONLOCK
51 qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation.");
52 #endif // ORIENTATIONLOCK
54 #elif defined(Q_WS_MAEMO_5)
55 Qt::WidgetAttribute attribute;
56 switch (orientation) {
57 case ScreenOrientationLockPortrait:
58 attribute = Qt::WA_Maemo5PortraitOrientation;
60 case ScreenOrientationLockLandscape:
61 attribute = Qt::WA_Maemo5LandscapeOrientation;
63 case ScreenOrientationAuto:
65 attribute = Qt::WA_Maemo5AutoOrientation;
68 setAttribute(attribute, true);
70 Q_UNUSED(orientation);
71 #endif // Q_OS_SYMBIAN
74 void MainWindow::showExpanded()
78 #elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6)
85 void MainWindow::on_actionSetup_triggered()
89 if(dialog.exec() == QDialog::Accepted) {