void MainWindow::lockViewMode() { CAknAppUi *aknAppUi = dynamic_cast<CAknAppUi *>(CEikonEnv::Static()->AppUi()); if (!aknAppUi) return; if (m_isPortrait) aknAppUi->SetOrientationL(CAknAppUi::EAppUiOrientationPortrait); else aknAppUi->SetOrientationL(CAknAppUi::EAppUiOrientationLandscape); }
int main(int argc, char *argv[]) { QApplication app(argc, argv); #ifdef Q_OS_SYMBIAN // Lock S60 orientation // Req: LIBS += -lcone -leikcore -lavkon avkon cone eiksrv CAknAppUi* appUi = dynamic_cast<CAknAppUi*>(CEikonEnv::Static()->AppUi()); if(appUi) { QT_TRAP_THROWING(appUi->SetOrientationL(CAknAppUi::EAppUiOrientationLandscape)) } #endif app.setApplicationName("ChatMX"); app.setApplicationVersion("1.0.0"); QtChatMX window; #if defined(Q_WS_S60) window.showFullScreen(); #elif defined(Q_WS_SIMULATOR) window.showFullScreen(); #else window.show(); #endif return app.exec(); }
int main(int argc, char **argv) { QApplication app(argc, argv); #ifdef Q_OS_SYMBIAN // lock portrait mode for symbian CAknAppUi *akn = dynamic_cast<CAknAppUi*>(CEikonEnv::Static()->AppUi()); TRAPD(error, if (akn) akn->SetOrientationL(CAknAppUi::EAppUiOrientationLandscape); );
int main(int argc, char *argv[]) { QApplication app(argc, argv); // Lock orientation in Symbian #ifdef Q_OS_SYMBIAN CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); TRAP_IGNORE(if (appUi) { appUi->SetOrientationL(CAknAppUi::EAppUiOrientationLandscape); });
int main(int argc, char *argv[]) { QApplication app(argc, argv); CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); TRAP_IGNORE( if (appUi) { appUi->SetOrientationL(CAknAppUi::EAppUiOrientationLandscape); } );
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::EAppUiOrientationLandscape); } );
/*! Loads splash screen, also connects the splash screens hidden signal to this objects destroySplashScreen slot, so when the splash screen has animated away it will be destroyed. */ void MainLoader::load() { #ifdef Q_OS_SYMBIAN // Lock orientation in Symbian for the splash screen CAknAppUi* appUi = dynamic_cast<CAknAppUi*>( CEikonEnv::Static()->AppUi() ); TRAP_IGNORE( if ( appUi ) { appUi->SetOrientationL( CAknAppUi::EAppUiOrientationPortrait ); } );
QTM_USE_NAMESPACE int main(int argc, char *argv[]) { QApplication app(argc, argv); #ifdef Q_OS_SYMBIAN // Lock orientation to landscape in Symbian CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); TRAP_IGNORE( if (appUi) appUi->SetOrientationL(CAknAppUi::EAppUiOrientationLandscape); )
void HTML5FullScreenVideoHandler::exitFullScreen() { m_videoWidget->hide(); m_mediaPlayer->disconnect(m_videoWidget); m_mediaPlayer->disconnect(this); delete m_videoWidget; m_videoWidget = 0; if (m_mediaPlayer->state() == QMediaPlayer::PlayingState) m_mediaPlayer->pause(); m_fullScreen = false; CAknAppUi* appUi = dynamic_cast<CAknAppUi*>(CEikonEnv::Static()->AppUi()); if (appUi) appUi->SetOrientationL(m_savedOrientation); }
int main(int argc, char *argv[]) { // NOTE: set this value before creating MyApplication instance // http://doc.trolltech.com/qapplication.html#setGraphicsSystem QApplication::setGraphicsSystem("raster"); // NOTE: Seems that raster have to be enabled with Nokia N8 MyApplication a(argc, argv); // Lock Symbian orientation #ifdef Q_OS_SYMBIAN CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); TRAP_IGNORE( if (appUi) { appUi->SetOrientationL(CAknAppUi::EAppUiOrientationLandscape); } );
void QmlApplicationViewer::setOrientation(Orientation orientation) { #ifdef Q_OS_SYMBIAN if (orientation != Auto) { #if defined(ORIENTATIONLOCK) const CAknAppUiBase::TAppUiOrientation uiOrientation = (orientation == LockPortrait) ? CAknAppUi::EAppUiOrientationPortrait : CAknAppUi::EAppUiOrientationLandscape; CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); TRAPD(error, if (appUi) appUi->SetOrientationL(uiOrientation); ); #else // ORIENTATIONLOCK qWarning("'ORIENTATIONLOCK' needs to be defined on Symbian when locking the orientation."); #endif // ORIENTATIONLOCK }
int main(int argc, char *argv[]) { QApplication app(argc, argv); #ifndef Q_OS_SYMBIAN_1 app.setApplicationVersion(APP_VERSION); #endif // Lock orientation in Symbian #ifdef Q_OS_SYMBIAN CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); TRAP_IGNORE( if (appUi) { appUi->SetOrientationL(CAknAppUi::EAppUiOrientationPortrait); } );
QTM_USE_NAMESPACE #endif #ifdef Q_OS_SYMBIAN #include <eikenv.h> #include <eikappui.h> #include <aknenv.h> #include <aknappui.h> #endif void ApplicationItemPrivate::initializePlatform() { //QCoreApplication::setAttribute(Qt::AA_S60DontConstructApplicationPanes); CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); TRAPD(error, if (appUi) appUi->SetOrientationL(CAknAppUi::EAppUiOrientationPortrait); );
void HTML5FullScreenVideoHandler::enterFullScreen(QMediaPlayer *player) { if (!player) return; m_videoWidget = new HTML5VideoWidget(); if (!m_videoWidget) return; m_videoWidget->setDuration(player->duration() / 1000); CAknAppUi* appUi = dynamic_cast<CAknAppUi*>(CEikonEnv::Static()->AppUi()); if (appUi) { m_savedOrientation = appUi->Orientation(); appUi->SetOrientationL(CAknAppUi::EAppUiOrientationLandscape); } m_mediaPlayer = player; connect(m_mediaPlayer, SIGNAL(positionChanged(qint64)), m_videoWidget, SLOT(onPositionChanged(qint64))); connect(m_mediaPlayer, SIGNAL(durationChanged(qint64)), m_videoWidget, SLOT(setDuration(qint64))); connect(m_mediaPlayer, SIGNAL(stateChanged(QMediaPlayer::State)), this, SLOT(onPlayerStateChanged(QMediaPlayer::State))); connect(m_mediaPlayer, SIGNAL(error(QMediaPlayer::Error)), this, SLOT(onPlayerError(QMediaPlayer::Error))); connect(m_mediaPlayer, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)), this, SLOT(onMediaStatusChanged(QMediaPlayer::MediaStatus))); connect(m_videoWidget, SIGNAL(positionChangedByUser(qint64)), m_mediaPlayer, SLOT(setPosition(qint64))); connect(m_videoWidget, SIGNAL(closeClicked()), this, SIGNAL(fullScreenClosed())); connect(m_videoWidget, SIGNAL(muted(bool)), m_mediaPlayer, SLOT(setMuted(bool))); connect(m_videoWidget, SIGNAL(volumeChanged(int)), m_mediaPlayer, SLOT(setVolume(int))); connect(m_videoWidget, SIGNAL(pauseClicked()), m_mediaPlayer, SLOT(pause())); connect(m_videoWidget, SIGNAL(playClicked()), m_mediaPlayer, SLOT(play())); m_mediaPlayer->setVideoOutput(m_videoWidget); m_videoWidget->setVolume(m_mediaPlayer->volume()); m_videoWidget->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored); m_videoWidget->showFullScreen(); m_fullScreen = true; // Handle current Media Status and Media Player error. onMediaStatusChanged(m_mediaPlayer->mediaStatus()); onPlayerError(m_mediaPlayer->error()); }
QTM_USE_NAMESPACE #ifdef Q_OS_SYMBIAN // Lock orientation in Symbian #include <eikenv.h> #include <eikappui.h> #include <aknenv.h> #include <aknappui.h> #endif #include "screensize.h" int main(int argc, char *argv[]) { QApplication app(argc, argv); //*****sensor orientation #ifdef Q_OS_SYMBIAN // Lock orientation in Symbian CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); TRAP_IGNORE( if(appUi) { appUi->SetOrientationL(CAknAppUi::EAppUiOrientationPortrait); } );
int main(int argc, char *argv[]) { QCoreApplication::setOrganizationName(QSTR_DOMAIN); QCoreApplication::setOrganizationDomain(QSTR_DOMAIN); QCoreApplication::setApplicationName(QSTR_APPNAME); #if defined(RAWKBD_SUPPORT) RawKeybdApp a(argc, argv); #else QApplication a(argc, argv); #endif #if defined(Q_OS_LINUX) a.setWindowIcon(QIcon(":/vpiano/vmpk_32x32.png")); #endif //Q_OS_LINUX #if defined(Q_OS_SYMBIAN) // Lock orientation to portrait in Symbian CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); TRAP_IGNORE( if(appUi) { appUi->SetOrientationL(CAknAppUi::EAppUiOrientationLandscape); } );
int main(int argc, char *argv[]) { QFile logfile2("C:/i8910tuninglog.txt"); QTextStream log2(&logfile2); if (!logfile2.open(QIODevice::Append | QIODevice::WriteOnly)) return 1; #ifdef Q_OS_SYMBIAN QApplication::setGraphicsSystem("openvg"); #endif QApplication app(argc, argv); #ifdef Q_OS_SYMBIAN //LEAVES IF E: DRIVE IS BUSY (I.E. PHONE IS PLUGGED IN USB MASS STORAGE MODE) RFs fsSession; CleanupClosePushL(fsSession); User::LeaveIfError(fsSession.Connect()); TVolumeInfo volumeInfo; TInt err=fsSession.Volume(volumeInfo,EDriveE); if (err==KErrNotReady) { fsSession.Close(); CleanupStack::PopAndDestroy(); QPixmap pixmap(":/images/exitsplash.png"); QSplashScreen splash(pixmap); splash.showFullScreen(); User::After(5000000); app.quit(); } fsSession.Close(); CleanupStack::PopAndDestroy(); #endif QPixmap pixmap(":/images/splashscreen.png"); QSplashScreen splash(pixmap); splash.showFullScreen(); QFontDatabase fontdb; int bella = fontdb.addApplicationFont("E:/data/SymbianTuning/SegoeWP.ttf"); qDebug() << QString::number(bella); QFont fontnew = fontdb.font("Segoe WP", "Normal", 7); app.setFont(fontnew); QDeclarativeView view; #ifdef Q_OS_SYMBIAN //view.setAttribute(Qt::WA_NoSystemBackground); #endif view.rootContext()->setContextProperty("i8910tuning", new i8910tuning(0, &logfile2, &log2)); view.setSource(QUrl("qrc:/Page.qml")); QObject::connect((QObject*)view.engine(), SIGNAL(quit()), &app, SLOT(quit())); #ifdef Q_OS_SYMBIAN CAknAppUi* appUi = dynamic_cast<CAknAppUi*> (CEikonEnv::Static()->AppUi()); TRAPD(error, if (appUi) { // Lock application orientation into landscape appUi->SetOrientationL(CAknAppUi::EAppUiOrientationPortrait); } );
void tst_orientationchange::resizeEventOnOrientationChange() { // This will test that when orientation 'changes', then // at most one resize event is generated. TestWidget *normalWidget = new TestWidget(); TestWidget *fullScreenWidget = new TestWidget(); TestWidget *maximizedWidget = new TestWidget(); fullScreenWidget->showFullScreen(); maximizedWidget->showMaximized(); normalWidget->show(); QCoreApplication::sendPostedEvents(); QCoreApplication::sendPostedEvents(); QCOMPARE(fullScreenWidget->resizeEventCount, 1); QCOMPARE(fullScreenWidget->size(), fullScreenWidget->resizeEventSize); QCOMPARE(maximizedWidget->resizeEventCount, 1); QCOMPARE(maximizedWidget->size(), maximizedWidget->resizeEventSize); QCOMPARE(normalWidget->resizeEventCount, 1); QCOMPARE(normalWidget->size(), normalWidget->resizeEventSize); fullScreenWidget->reset(); maximizedWidget->reset(); normalWidget->reset(); // Assumes that Qt application is AVKON application. CAknAppUi *appUi = static_cast<CAknAppUi*>(CEikonEnv::Static()->EikAppUi()); // Determine 'opposite' orientation to the current orientation. CAknAppUi::TAppUiOrientation orientation = CAknAppUi::EAppUiOrientationLandscape; if (fullScreenWidget->size().width() > fullScreenWidget->size().height()) { orientation = CAknAppUi::EAppUiOrientationPortrait; } TRAPD(err, appUi->SetOrientationL(orientation)); QCoreApplication::sendPostedEvents(); QCoreApplication::sendPostedEvents(); // setOrientationL is not guaranteed to change orientation // (if emulator configured to support just portrait or landscape, then // setOrientationL call shouldn't do anything). // So let's ensure that we do not get resize event twice. QVERIFY(fullScreenWidget->resizeEventCount <= 1); if (fullScreenWidget->resizeEventCount) { QCOMPARE(fullScreenWidget->size(), fullScreenWidget->resizeEventSize); } QVERIFY(maximizedWidget->resizeEventCount <= 1); if (fullScreenWidget->resizeEventCount) { QCOMPARE(maximizedWidget->size(), maximizedWidget->resizeEventSize); } QCOMPARE(normalWidget->resizeEventCount, 0); QDesktopWidget desktop; QRect qtAvail = desktop.availableGeometry(normalWidget); TRect clientRect = static_cast<CEikAppUi*>(CCoeEnv::Static()-> AppUi())->ClientRect(); QRect symbianAvail = qt_TRect2QRect(clientRect); QCOMPARE(qtAvail, symbianAvail); // Switch orientation back to original orientation = orientation == CAknAppUi::EAppUiOrientationPortrait ? CAknAppUi::EAppUiOrientationLandscape : CAknAppUi::EAppUiOrientationPortrait; fullScreenWidget->reset(); maximizedWidget->reset(); normalWidget->reset(); TRAP(err, appUi->SetOrientationL(orientation)); QCoreApplication::sendPostedEvents(); QCoreApplication::sendPostedEvents(); // setOrientationL is not guaranteed to change orientation // (if emulator configured to support just portrait or landscape, then // setOrientationL call shouldn't do anything). // So let's ensure that we do not get resize event twice. QVERIFY(fullScreenWidget->resizeEventCount <= 1); if (fullScreenWidget->resizeEventCount) { QCOMPARE(fullScreenWidget->size(), fullScreenWidget->resizeEventSize); } QVERIFY(maximizedWidget->resizeEventCount <= 1); if (fullScreenWidget->resizeEventCount) { QCOMPARE(maximizedWidget->size(), maximizedWidget->resizeEventSize); } QCOMPARE(normalWidget->resizeEventCount, 0); qtAvail = desktop.availableGeometry(normalWidget); clientRect = static_cast<CEikAppUi*>(CCoeEnv::Static()-> AppUi())->ClientRect(); symbianAvail = qt_TRect2QRect(clientRect); QCOMPARE(qtAvail, symbianAvail); TRAP(err, appUi->SetOrientationL(CAknAppUi::EAppUiOrientationUnspecified)); delete normalWidget; delete fullScreenWidget; delete maximizedWidget; }
CCEGLView::CCEGLView(QWidget* parent): QWidget(parent), m_bCaptured(false), m_bOrientationReverted(false), m_bOrientationInitVertical(false), m_pDelegate(NULL), bIsInit(false), m_eInitOrientation(CCDeviceOrientationPortrait), m_eOrientation(CCDeviceOrientationPortrait), m_fScreenScaleFactor(1.0f), m_eglDisplay(NULL), m_eglConfig(NULL), m_eglSurface(NULL), m_eglContext(NULL) { m_sSizeInPoint.width = m_sSizeInPoint.height = 0; setAutoFillBackground(false); setAttribute(Qt::WA_OpaquePaintEvent); setAttribute(Qt::WA_NoSystemBackground); setAttribute(Qt::WA_NativeWindow); setAttribute(Qt::WA_PaintOnScreen, true); setAttribute(Qt::WA_StyledBackground, false); setAttribute(Qt::WA_PaintUnclipped); setAttribute(Qt::WA_InputMethodEnabled, true); setAttribute(Qt::WA_KeyboardFocusChange, true); setInputMethodHints(Qt::ImhNoPredictiveText); qApp->installEventFilter(this); #ifdef MS_USE_TOUCH_EVENTS setAttribute(Qt::WA_AcceptTouchEvents); for(int i = 0; i < MAX_TOUCH_POINTS; i++) m_pTouch[i] = NULL; #else m_pTouch = NULL; #endif #ifdef MEEGO_EDITION_HARMATTAN QMeeGoGraphicsSystemHelper::setSwitchPolicy(QMeeGoGraphicsSystemHelper::NoSwitch); QInputContext *ic = QInputContextFactory::create("MInputContext", 0); if (ic) { qApp->setInputContext(ic); } #endif // MEEGO_EDITION_HARMATTAN #if defined(Q_OS_SYMBIAN) CAknAppUiBase::TAppUiOrientation uiOrientation; switch(m_eInitOrientation) { case kCCDeviceOrientationPortrait: case kCCDeviceOrientationPortraitUpsideDown: uiOrientation = CAknAppUi::EAppUiOrientationPortrait; m_eOrientation = kCCDeviceOrientationPortrait; break; case kCCDeviceOrientationLandscapeLeft: case kCCDeviceOrientationLandscapeRight: uiOrientation = CAknAppUi::EAppUiOrientationLandscape; m_eOrientation = kCCDeviceOrientationLandscapeLeft; break; default: uiOrientation = CAknAppUi::EAppUiOrientationPortrait; m_eOrientation = kCCDeviceOrientationPortrait; } CAknAppUi *ui = dynamic_cast<CAknAppUi *>(CEikonEnv::Static()->AppUi()); TRAPD(error, if(ui) { ui->SetOrientationL(uiOrientation); } );