ui/views/viewsfactory/src/glxviewsfactory.cpp
author hgs
Thu, 14 Oct 2010 17:54:23 +0530
changeset 72 0a8e959402e5
parent 26 c499df2dbb33
permissions -rw-r--r--
201041

/*
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
* All rights reserved.
* This component and the accompanying materials are made available
* under the terms of "Eclipse Public License v1.0"
* which accompanies this distribution, and is available
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
*
* Initial Contributors:
* Nokia Corporation - initial contribution.
*
* Contributors:
*
* Description:   ?Description
*
*/


//Includes

//User Includes
#include "glxview.h"
#include "glxviewids.h"
#include "glxgridview.h"
#include "glxslideshowsettingsview.h"
#include "glxlistview.h"
#include "glxdetailsview.h"
#include "glxviewsfactory.h"
#include "glxviewdocloader.h"
#include "glxslideshowview.h"
#include "glxdocloaderdefs.h"
#include "glxfullscreenview.h"

GlxView * GlxViewsFactory::createView(qint32 viewId, HbMainWindow *window)
{
    switch ( viewId ) {
    case GLX_GRIDVIEW_ID :
    {
        GlxGridView *gridView = new GlxGridView( window );
        gridView->toolBar();
        return gridView;
    }

    case GLX_LISTVIEW_ID :
    {
        GlxListView *listView = new GlxListView ( window );
        listView->toolBar();
        return listView;
    }

    case GLX_FULLSCREENVIEW_ID :
	{
	    GlxFullScreenView *fullscreenView = NULL;
	    bool isloaded;
		
        GlxFullscreenViewDocLoader *docLoader = new GlxFullscreenViewDocLoader();
        // Load the   docml file.
        docLoader->load(GLXFULLSCREENDOCMLPATH, &isloaded);
                
        if(isloaded)
        {
        //retreive the full screen view
         fullscreenView  = static_cast<GlxFullScreenView *> (docLoader->findWidget(GLXFULLSCREEN_VIEW));
        }  
        return fullscreenView;
    }

   case GLX_DETAILSVIEW_ID :    
        return new GlxDetailsView( window );

    case GLX_SLIDESHOWVIEW_ID :
	{
	    GlxSlideShowView *slideShowView = NULL;
	    bool isloaded;
		
        GlxSlideShowViewDocLoader *docLoader = new GlxSlideShowViewDocLoader();
        // Load the   docml file.
       docLoader->load(GLXSLIDESHOW_PATH, &isloaded);
       if(isloaded)
	   {
	     //retreive the Slide show view
	     slideShowView  = static_cast<GlxSlideShowView *> (docLoader->findWidget(GLXSLIDESHOW_VIEW));
	   }  
        return slideShowView;
   }

    case GLX_SLIDESHOWSETTINGSVIEW_ID :
        return new GlxSlideShowSettingsView ( window );
    default :
        return 0;     
    }
}