diff -r dec420019252 -r 4f111d64a341 videocollection/videocollectionview/src/videocollectionviewplugin.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/videocollection/videocollectionview/src/videocollectionviewplugin.cpp Thu Apr 01 22:38:49 2010 +0300 @@ -0,0 +1,168 @@ +/* +* 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: VideoCollectionViewPlugin class implementation +* +*/ + +// INCLUDE FILES +#include +#include +#include +#include + +#include "videocollectionviewplugin.h" +#include "videolistview.h" +#include "videocollectionuiloader.h" + +// --------------------------------------------------------------------------- +// Constructor +// --------------------------------------------------------------------------- +// +VideoCollectionViewPlugin::VideoCollectionViewPlugin() + : mUiLoader(0), + mView(0), + mActivated(false) +{ +} + +// --------------------------------------------------------------------------- +// Destructor +// --------------------------------------------------------------------------- +// +VideoCollectionViewPlugin::~VideoCollectionViewPlugin() +{ + destroyView(); +} + +// --------------------------------------------------------------------------- +// Create view +// --------------------------------------------------------------------------- +// +void VideoCollectionViewPlugin::createView() +{ + mActivated = false; + if ( !mView ) { + + if(!mUiLoader) + { + mUiLoader = new VideoCollectionUiLoader(); + } + + mUiLoader->reset(); + + bool ok(false); + + QList objects = mUiLoader->load(DOCML_VIDEOCOLLECTIONVIEW_FILE, &ok); + + if (!ok) + { + return; + } + + mView = mUiLoader->findObject( DOCML_NAME_VIEW ); + + if(!mView) + { + // TODO: handle error: creating view + return; + } + + if(!connect( mView, SIGNAL(command(int)), this, SIGNAL(command(int)) ) ) { + // TODO: handle error: connecting signal + delete mView; + mView = 0; + return; + } + + mView->initializeView(); + + } +} + +// --------------------------------------------------------------------------- +// Destroy view +// --------------------------------------------------------------------------- +// +void VideoCollectionViewPlugin::destroyView() +{ + deactivateView(); + disconnect(); + + delete mView; + mView = 0; + delete mUiLoader; + mUiLoader = 0; +} + +// --------------------------------------------------------------------------- +// Activate view +// --------------------------------------------------------------------------- +// +void VideoCollectionViewPlugin::activateView() +{ + if ( !mActivated ) { + HbMainWindow *wnd = mView->mainWindow(); + if(wnd) + { + mView->activateView(); + mActivated = true; + } + } +} + +// --------------------------------------------------------------------------- +// Deactivate view +// --------------------------------------------------------------------------- +// +void VideoCollectionViewPlugin::deactivateView() +{ + if ( mActivated ) { + mView->deactivateView(); + mActivated = false; + } +} + +// --------------------------------------------------------------------------- +// Get view +// --------------------------------------------------------------------------- +// +QGraphicsWidget* VideoCollectionViewPlugin::getView() +{ + return mView; +} + +// --------------------------------------------------------------------------- +// Slot: Orientation change +// // TODO: can be removed +// --------------------------------------------------------------------------- +// +void VideoCollectionViewPlugin::orientationChange( Qt::Orientation /* orientation */ ) +{ + // view handles orientation individually +} + +// --------------------------------------------------------------------------- +// Slot: back +// --------------------------------------------------------------------------- +// +void VideoCollectionViewPlugin::back() +{ + if ( mActivated ) { + mView->back(); + } +} + +XQ_EXPORT_PLUGIN2( videocollectionview, VideoCollectionViewPlugin ); + +// end of file