diff -r 2a40e88564c8 -r 4e84c994a771 mpviewplugins/mpcollectionviewplugin/src/mpcollectioncontainerallsongs.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mpviewplugins/mpcollectionviewplugin/src/mpcollectioncontainerallsongs.cpp Fri Mar 19 09:28:13 2010 +0200 @@ -0,0 +1,96 @@ +/* +* 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: Music Player collection container definition - All Songs. +* +*/ + +#include + +#include +#include +#include + +#include "mpcollectioncontainerallsongs.h" +#include "mpmpxcollectiondata.h" +#include "mpcollectioninfobar.h" +#include "mptrace.h" + +/*! + \class MpCollectionContainerAllSongs + \brief Music Player collection container definition - All Songs. + + 'All Songs' collection container implements the interface specified + by MpCollectionContainer. It provides a layout and widgets for the + 'All Songs' view. + + \sa MpCollectionContainer +*/ + +/*! + Constructs the collection container. + */ +MpCollectionContainerAllSongs::MpCollectionContainerAllSongs( HbDocumentLoader *loader, QGraphicsItem *parent ) + : MpCollectionListContainer(loader, parent), + mInfoBar(0) +{ + TX_LOG +} + +/*! + Destructs the collection container. + */ +MpCollectionContainerAllSongs::~MpCollectionContainerAllSongs() +{ + TX_ENTRY + delete mInfoBar; + delete mList; + TX_EXIT +} + +/*! + Sets up the container by organizing widgets according to its layout. + + \reimp + */ +void MpCollectionContainerAllSongs::setupContainer() +{ + TX_ENTRY + bool ok = false; + mDocumentLoader->load(QString(":/docml/musiccollection.docml"), "allSongs", &ok); + if ( !ok ) { + TX_LOG_ARGS("Error: invalid xml file."); + Q_ASSERT_X(ok, "MpCollectionContainerAllSongs::setupContainer", "invalid xml file"); + } + + QString details; + if ( mViewMode == MpCommon::FetchView ) { + details = "Select a song"; + } + else { + int count = mCollectionData->count(); + details.setNum(count); + details.append(" songs"); + } + + QGraphicsWidget *widget; + widget = mDocumentLoader->findWidget(QString("allSongsDetail")); + mInfoBar = qobject_cast(widget); + mInfoBar->setText(details); + + widget = mDocumentLoader->findWidget(QString("allSongsList")); + mList = qobject_cast(widget); + initializeList(); + TX_EXIT +} +