browser/ui/src/SplashView.cpp
changeset 0 c316ab048e9d
equal deleted inserted replaced
-1:000000000000 0:c316ab048e9d
       
     1 /*
       
     2  * Name        : SplashView.cpp
       
     3  * Description : 
       
     4  * Project     : This file is part of OpenMAR, an Open Mobile Augmented Reality browser
       
     5  * Website     : http://OpenMAR.org
       
     6  *
       
     7  * Copyright (c) 2010 David Caabeiro
       
     8  *
       
     9  * All rights reserved. This program and the accompanying materials are made available 
       
    10  * under the terms of the Eclipse Public License v1.0 which accompanies this 
       
    11  * distribution, and is available at http://www.eclipse.org/legal/epl-v10.html
       
    12  *
       
    13  */
       
    14 
       
    15 #include "SplashView.h"
       
    16 
       
    17 #include <AknUtils.h>
       
    18 #include <AknViewAppui.h>
       
    19 
       
    20 #include <OpenMAR_0x2002E1AB.rsg>
       
    21 
       
    22 #include "Application.hrh"
       
    23 #include "SettingManager.h"
       
    24 #include "SplashContainer.h"
       
    25 
       
    26 #include "Logger.h"
       
    27 
       
    28 CSplashView* CSplashView::NewL(CSettingManager& aSetting)
       
    29 {
       
    30     CSplashView* self = new(ELeave) CSplashView(aSetting);
       
    31     CleanupStack::PushL(self);
       
    32     self->ConstructL();
       
    33     CleanupStack::Pop(self);
       
    34 
       
    35     return self;
       
    36 }
       
    37 
       
    38 CSplashView::~CSplashView()
       
    39 {
       
    40     delete iContainer;
       
    41     delete iConnection;
       
    42 }
       
    43 
       
    44 CSplashView::CSplashView(CSettingManager& aSetting)
       
    45     : iSetting(aSetting)
       
    46 {}
       
    47 
       
    48 void CSplashView::ConstructL()
       
    49 {
       
    50     BaseConstructL(R_SPLASH_VIEW);
       
    51 
       
    52     LOGTXT("Initializing splash screen");
       
    53 
       
    54     // Set up connection which should be used by other components
       
    55     // (providers, etc) to enable faster connections
       
    56     iConnection = CConnectionManager::NewL(*this, iSetting);
       
    57 }
       
    58 
       
    59 void CSplashView::ConnectionStartedL(TInt aError)
       
    60 {
       
    61     LOGARG("Connection manager returned %d", aError);
       
    62 
       
    63     if (aError)
       
    64     {
       
    65         // TODO: Handle error condition. Some kind of 'offline mode' should be allowed,
       
    66         // thus enabling the use of the application in a restricted way 
       
    67 
       
    68 //        if (!AppUi()->IsAppShutterRunning())
       
    69 //            AppUi()->RunAppShutter();
       
    70     }
       
    71 
       
    72     // Perform other setup..
       
    73 
       
    74     // Initial set up complete. Switch to main view 
       
    75     AppUi()->ActivateLocalViewL(TUid::Uid(EARView));
       
    76 }
       
    77 
       
    78 TUid CSplashView::Id() const
       
    79 {
       
    80     return TUid::Uid(ESplashView);
       
    81 }
       
    82 
       
    83 void CSplashView::DoActivateL(const TVwsViewId& aPrevViewId, TUid aCustomMessageId, const TDesC8& aCustomMessage)
       
    84 {
       
    85     if (!iContainer)
       
    86     {
       
    87         // Make status pane invisible
       
    88         CEikStatusPane* statusPane = StatusPane();
       
    89         if (statusPane)
       
    90             statusPane->MakeVisible(EFalse);
       
    91 
       
    92         iContainer = new(ELeave) CSplashContainer(*this);
       
    93         iContainer->SetMopParent(this);
       
    94         iContainer->ConstructL(AppUi()->ApplicationRect(), 0);
       
    95 
       
    96         AppUi()->AddToStackL(*this, iContainer);
       
    97     }
       
    98 }
       
    99 
       
   100 void CSplashView::DoDeactivate()
       
   101 {
       
   102     if (iContainer)
       
   103     {
       
   104         AppUi()->RemoveFromViewStack(*this, iContainer);
       
   105 
       
   106         delete iContainer;
       
   107         iContainer = 0;
       
   108     }
       
   109 }
       
   110 
       
   111 void CSplashView::HandleCommandL(TInt aCommand)
       
   112 {
       
   113     AppUi()->HandleCommandL(aCommand);
       
   114 }