123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- /*
- * Copyright (c) 2011 Nokia Corporation.
- */
- #include <QtGui/QApplication>
- #include <QDesktopWidget>
- #include "mainwindow.h"
- // Lock S60 orientation
- #ifdef Q_OS_SYMBIAN
- #include <eikenv.h>
- #include <eikappui.h>
- #include <aknenv.h>
- #include <aknappui.h>
- #endif
- #ifndef QT_NO_OPENGL
- #include <QGLWidget>
- #endif
- int main(int argc, char *argv[])
- {
- QApplication a(argc, argv);
- // Lock S60 orientation
- #ifdef Q_OS_SYMBIAN
- CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi());
- TRAPD(error,
- if (appUi) {
- appUi->SetOrientationL(CAknAppUi::EAppUiOrientationPortrait);
- }
- );
- #endif
- MainWindow w;
- #ifndef QT_NO_OPENGL
- // Use QGLWidget to get the opengl support if available
- QGLFormat format = QGLFormat::defaultFormat();
- format.setSampleBuffers(false);
- QGLWidget *glWidget = new QGLWidget(format);
- glWidget->setAutoFillBackground(false);
- w.setViewport(glWidget); // ownership of glWidget is taken
- #endif
- QObject *rootObject = dynamic_cast<QObject*>(w.rootObject());
- // For Qt.exit() from QML
- QObject::connect((QObject*)w.engine(), SIGNAL(quit()), &a, SLOT(quit()));
- // Level activation signal from QML
- QObject::connect(rootObject, SIGNAL(levelActivated(int)), &w, SLOT(levelActivated(int)));
- #if defined (Q_OS_SYMBIAN) || defined (Q_WS_MAEMO_5)
- w.setGeometry(QApplication::desktop()->screenGeometry());
- w.showFullScreen();
- #else
- w.setGeometry(100,100,360,640);
- w.setFixedSize(360,640);
- w.show();
- #endif
- return a.exec();
- }
|