Пример #1
0
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();
}
Пример #2
0
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); );
Пример #3
0
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);
    });
Пример #4
0
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);
        }
    );
Пример #5
0
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);
    }
    );
Пример #6
0
/*!
  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 );
            }
    );
Пример #7
0
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);
}
Пример #8
0
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);
    )
Пример #9
0
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);
}
Пример #10
0
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);
    }
    );
// ============================ MEMBER FUNCTIONS ===============================
// -----------------------------------------------------------------------------
// CTestSDKWinSerEventObserver::TestWEMAddObserverL
// -----------------------------------------------------------------------------
//
TInt CTestSDKWinSerEventObserver::TestWEMAddObserverL( CStifItemParser& /*aItem*/ )
    {
    CAknAppUi* appUi = static_cast<CAknAppUi*>( CCoeEnv::Static()->AppUi() );
    
    CAknWsEventMonitor* monitor  = appUi->EventMonitor();
    
    CTestSDKEventObserver* observer = CTestSDKEventObserver::NewL();
    CleanupStack::PushL( observer );
    
    monitor->AddObserverL( observer );
    
    CleanupStack::PopAndDestroy( observer );
    
    return KErrNone;
    
    }
Пример #12
0
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
    }
Пример #13
0
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);
         );
Пример #15
0
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());
}
Пример #16
0
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);
        }
    );
Пример #17
0
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); } );
Пример #18
0
void QWidgetPrivate::show_sys()
{
    Q_Q(QWidget);

    if (q->testAttribute(Qt::WA_OutsideWSRange))
        return;

    Q_ASSERT(q->testAttribute(Qt::WA_WState_Created));

    q->setAttribute(Qt::WA_Mapped);

    if (q->testAttribute(Qt::WA_DontShowOnScreen)) {
        invalidateBuffer(q->rect());
        return;
    }

    if (q->internalWinId()) {
        if (!extra->activated)
             activateSymbianWindow();

         QSymbianControl *id = static_cast<QSymbianControl *>(q->internalWinId());
         const bool isFullscreen = q->windowState() & Qt::WindowFullScreen;
         const TBool cbaRequested = q->windowFlags() & Qt::WindowSoftkeysVisibleHint;

#ifdef Q_WS_S60
        // Lazily initialize the S60 screen furniture when the first window is shown.
        if (q->isWindow() && !QApplication::testAttribute(Qt::AA_S60DontConstructApplicationPanes)
                && !S60->buttonGroupContainer() && !S60->statusPane()) {

            if (!q->testAttribute(Qt::WA_DontShowOnScreen)) {

                // Create the status pane and CBA here
                CEikAppUi *ui = static_cast<CEikAppUi *>(S60->appUi());
                MEikAppUiFactory *factory = CEikonEnv::Static()->AppUiFactory();

                QT_TRAP_THROWING(
                    factory->CreateResourceIndependentFurnitureL(ui);

                    TRect boundingRect = static_cast<CEikAppUi*>(S60->appUi())->ClientRect();

                    CEikButtonGroupContainer *cba = CEikButtonGroupContainer::NewL(CEikButtonGroupContainer::ECba,
                        CEikButtonGroupContainer::EHorizontal,ui,R_AVKON_SOFTKEYS_EMPTY_WITH_IDS);
                    if (isFullscreen && !cbaRequested)
                        cba->MakeVisible(false);

                    CEikButtonGroupContainer *oldCba = factory->SwapButtonGroup(cba);
                    Q_ASSERT(!oldCba);
                    S60->setButtonGroupContainer(cba);

                    // If the creation of the first widget is delayed, for example by doing it
                    // inside the event loop, S60 somehow "forgets" to set the visibility of the
                    // toolbar (the three middle softkeys) when you flip the phone over, so we
                    // need to do it ourselves to avoid a "hole" in the application, even though
                    // Qt itself does not use the toolbar directly..
                    CAknAppUi *appui = dynamic_cast<CAknAppUi *>(CEikonEnv::Static()->AppUi());
                    if (appui) {
                        CAknToolbar *toolbar = appui->PopupToolbar();
                        if (toolbar && !toolbar->IsVisible())
                            toolbar->SetToolbarVisibility(ETrue);
                    }

                    CEikMenuBar *menuBar = new(ELeave) CEikMenuBar;
                    menuBar->ConstructL(ui, 0, R_AVKON_MENUPANE_EMPTY);
                    menuBar->SetMenuType(CEikMenuBar::EMenuOptions);
                    S60->appUi()->AddToStackL(menuBar,ECoeStackPriorityMenu,ECoeStackFlagRefusesFocus);

                    CEikMenuBar *oldMenu = factory->SwapMenuBar(menuBar);
                    Q_ASSERT(!oldMenu);
                )

                if (S60->statusPane()) {
                    // Use QDesktopWidget as the status pane observer to proxy for the AppUi.
                    // Can't use AppUi directly because it privately inherits from MEikStatusPaneObserver.
                    QSymbianControl *desktopControl = static_cast<QSymbianControl *>(QApplication::desktop()->winId());
                    S60->statusPane()->SetObserver(desktopControl);
                    if (isFullscreen) {
                        const bool cbaVisible = S60->buttonGroupContainer() && S60->buttonGroupContainer()->IsVisible();
                        S60->setStatusPaneAndButtonGroupVisibility(false, cbaVisible);
                    }
                }
            }
        }
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);
        }
    );
void Exit() {
  CAknAppUi* appui = (CAknAppUi*)CEikonEnv::Static()->AppUi();
  appui->Exit();
}
void CBCTestAppFrmAknAppUICase::TestPublicFunction()
    {
    /*********************************************************/
    /*CAknAppUi*/
    /*********************************************************/

    CAknAppUi* iAknAppUI = static_cast<CAknAppUi*>
                           ( CEikonEnv::Static()->EikAppUi() );
    iAknAppUI->Cba();
    _LIT( KCAknAppUiCba, "CAknAppUi::Cba() invoked" );
    AssertTrueL( ETrue, KCAknAppUiCba );

    iAknAppUI->CurrentPopupToolbar();
    _LIT( KCurrentPopupToolbar, "CAknAppUi::CurrentPopupToolbar() invoked" );
    AssertTrueL( ETrue, KCurrentPopupToolbar );

    TInt iErrCode = KErrNone;
    SExtendedError iExtErr;
    TBuf<16> iErrorText;
    TBuf<16> iContextText;
    iAknAppUI->HandleError( iErrCode, iExtErr, iErrorText, iContextText );
    _LIT( KCAknAppUiHandleError , "CAknAppUi::HandleError() invoked" );
    AssertTrueL( ETrue, KCAknAppUiHandleError);

    iAknAppUI->TouchPane();
    _LIT( KTouchPane ,"CAknAppUi::TouchPane() invoked" );
    AssertTrueL( ETrue, KTouchPane );

    iAknAppUI->PopupToolbar();
    _LIT( KPopupToolbar , "CAknAppUi::PopupToolbar() invoked" );
    AssertTrueL( ETrue, KPopupToolbar );

    iAknAppUI->HandleTouchPaneSizeChange();
    _LIT( KHandleTouchPaneSizeChange ,
    "CAknAppUi::HandleTouchPaneSizeChange() invoked" );
    AssertTrueL( ETrue, KHandleTouchPaneSizeChange );

    TBool iHide = ETrue;
    iAknAppUI->HideApplicationFromFSW( iHide );
    _LIT( KHideApplicationFromFSW ,
    "CAknAppUi::HideApplicationFromFSW() invoked" );
    AssertTrueL( ETrue, KHideApplicationFromFSW );

    iAknAppUI->IsAppShutterRunning();
    _LIT( KIsAppShutterRunning ,
    "CAknAppUi::IsAppShutterRunning() invoked" );
    AssertTrueL( ETrue, KIsAppShutterRunning);

    iAknAppUI->ProcessCommandL( 100 );
    _LIT( KProcessCommandL,"CAknAppUi::ProcessCommandL() invoked" );
    AssertTrueL( ETrue, KProcessCommandL);

    /*********************************************************/
    /*CAknAppUiBase*/
    /*********************************************************/

    CAknAppUiBase* iAknAppUIBase = static_cast<CAknAppUiBase*>
                                 ( CEikonEnv::Static()->EikAppUi() );

    iAknAppUIBase->IsFullScreenApp();
    _LIT( KIsFullScreenApp , "CAknAppUIBase::IsFullScreenApp() invoked" );
    AssertTrueL( ETrue, KIsFullScreenApp );

    iAknAppUIBase->IsPartialForeground();
    _LIT( KIsPartialForeground,
    "CAknAppUIBase::IsPartialForeground() invoked" );
    AssertTrueL( ETrue, KIsPartialForeground );

    iAknAppUIBase->LocalUiZoom();
    _LIT( KLocalUiZoom ,"CAknAppUIBase::LocalUiZoom() invoked" );
    AssertTrueL( ETrue, KLocalUiZoom );

    iAknAppUIBase->Orientation();
    _LIT( KOrientation , "CAknAppUIBase::Orientation() invoked" );
    AssertTrueL( ETrue, KOrientation );

    iAknAppUIBase->SetLayoutAwareApp( ETrue );
    _LIT( KSetLayoutAwareApp , "CAknAppUIBase::SetLayoutAwareApp() invoked" );
    AssertTrueL( ETrue, KSetLayoutAwareApp );

    iAknAppUIBase->SetLocalUiZoomL( EAknUiZoomNormal );
    _LIT( KSetLocalUiZoomL , "CAknAppUIBase::SetLocalUiZoomL() invoked" );
    AssertTrueL( ETrue, KSetLocalUiZoomL );

    iAknAppUIBase->HandleForegroundEventL( ETrue );
    _LIT( KHandleForegroundEventL,
    "CAknAppUIBase::HandleForegroundEventL() invoked" );
    AssertTrueL( ETrue, KHandleForegroundEventL );

    iAknAppUIBase->SetOrientationL( iAknAppUIBase->Orientation() );
    _LIT( KSetOrientationL, "CAknAppUIBase::SetOrientationL() invoked" );
    AssertTrueL( ETrue, KSetOrientationL);

    }
Пример #22
0
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;
}
Пример #23
0
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);
}
);