--- a/ui/uiengine/model/mediamodel/src/glxmediamodel.cpp Fri May 28 21:11:54 2010 +0530
+++ b/ui/uiengine/model/mediamodel/src/glxmediamodel.cpp Fri Jun 11 17:53:15 2010 +0530
@@ -23,8 +23,6 @@
#include <glxmodelparm.h>
#include <QCache>
#include <QDebug>
-#include <hal.h>
-#include <hal_data.h>
#include <glxmlwrapper.h>
#include <glxfiltergeneraldefs.h>
@@ -55,7 +53,7 @@
err = connect( mMLWrapper, SIGNAL(updateAlbumTitle(QString)), this, SLOT(albumTitleUpdated(QString)));
qDebug("updateAlbumTitle() connection status %d", err);
err = connect(mMLWrapper, SIGNAL(populated()), this, SLOT(modelpopulated()));
- //itemadded.resize(mMLWrapper->getItemCount());
+ err = connect(mMLWrapper, SIGNAL(updateDetails()), this, SLOT(updateDetailItems()));
itemIconCache.setMaxCost(20); //Changed While Doing Media Wall
itemFsIconCache.setMaxCost(5);
@@ -73,40 +71,55 @@
{
//itemadded.clear();
qDebug("GlxMediaModel::~GlxMediaModel");
- int freeMemory = 0;
- int err1 = HAL::Get( HALData::EMemoryRAMFree, freeMemory );
- qDebug("####mediaModel : Memory available before cache cleanup = %d and error is = %d ", freeMemory , err1 );
itemIconCache.clear();
itemFsIconCache.clear();
delete m_DefaultIcon;
m_DefaultIcon = NULL;
clearExternalItems();
- err1 = HAL::Get( HALData::EMemoryRAMFree, freeMemory );
- qDebug("####mediaModel : Memory available after cache cleanup = %d and error is = %d ", freeMemory , err1 );
- int err = disconnect(mMLWrapper, SIGNAL(updateItem(int, GlxTBContextType)), this, SLOT(itemUpdated1(int, GlxTBContextType)));
+ int err = disconnect(mMLWrapper, SIGNAL(updateItem(int, GlxTBContextType)), this, SLOT(itemUpdated1(int, GlxTBContextType)));
err = disconnect(mMLWrapper, SIGNAL(itemCorrupted(int)), this, SLOT(itemCorrupted(int)));
err = disconnect(mMLWrapper, SIGNAL(insertItems(int, int)), this, SLOT(itemsAdded(int, int)));
err = disconnect(mMLWrapper, SIGNAL(removeItems(int, int)), this, SLOT(itemsRemoved(int, int)));
err = disconnect(this, SIGNAL(iconAvailable(int, HbIcon*, GlxTBContextType)), this, SLOT(updateItemIcon(int, HbIcon*, GlxTBContextType)));
err = disconnect(mMLWrapper, SIGNAL(updateAlbumTitle(QString)), this, SLOT(albumTitleUpdated(QString)));
err = disconnect(mMLWrapper, SIGNAL(populated()), this, SLOT(modelpopulated()));
+ err = disconnect(mMLWrapper, SIGNAL(updateDetails()), this, SLOT(updateDetailItems()));
delete mMLWrapper;
}
+//------------------------------------------------------------------------------------------------------------
+//setContextMode
+//------------------------------------------------------------------------------------------------------------
void GlxMediaModel::setContextMode(GlxContextMode contextMode)
{
- if(mContextMode != contextMode) {
+ if(contextMode == GlxContextComment)
+ {
+ mMLWrapper->setContextMode(contextMode);
+ }
+ else
+ {
+ if(mContextMode != contextMode) {
+
itemFsIconCache.clear();
mMLWrapper->setContextMode(contextMode);
mContextMode = contextMode;
if ( mContextMode == GlxContextLsGrid || mContextMode == GlxContextPtGrid ) {
itemIconCache.clear();
//emit dataChanged( index( 0, 0), index( rowCount() - 1, 0) ); // Not Needed for HgWidget
- }
- }
+ }
+ }
+ }
}
+//------------------------------------------------------------------------------------------------------------
+//removeContextMode
+//------------------------------------------------------------------------------------------------------------
+void GlxMediaModel::removeContextMode(GlxContextMode contextMode)
+ {
+ mMLWrapper->removeContextMode(contextMode);
+ }
+
//to add external data to the model
void GlxMediaModel::addExternalItems(GlxExternalData* externalItems)
{
@@ -314,7 +327,18 @@
if (role == GlxHdmiBitmap) {
return mMLWrapper->RetrieveBitmap(itemIndex);
}
-
+
+ if (role == GlxTimeRole) {
+ return mMLWrapper->retrieveItemTime(itemIndex);
+ }
+
+ if (role == GlxSizeRole) {
+ return mMLWrapper->retrieveItemSize(itemIndex);
+ }
+
+ if (role == GlxDescRole) {
+ return mMLWrapper->retrieveListDesc(itemIndex);
+ }
return QVariant();
}
@@ -386,6 +410,15 @@
emit populated();
}
+//------------------------------------------------------------------------------------------------------------
+//updateDetailItems
+//------------------------------------------------------------------------------------------------------------
+void GlxMediaModel::updateDetailItems()
+{
+ qDebug("GlxMediaModel::updateDetailItems");
+ emit updateDetailsView();
+}
+
void GlxMediaModel::itemsAdded(int startIndex, int endIndex)
{
qDebug("GlxMediaModel::itemsAdded %d %d", startIndex, endIndex);
@@ -486,6 +519,14 @@
}
}
+ if ( GlxRemoveContextRole == role ) {
+ if ( value.isValid() && value.canConvert <int> () ) {
+ removeContextMode( (GlxContextMode) value.value <int> () );
+ return TRUE;
+ }
+ }
+
+
if ( GlxFocusIndexRole == role ) {
if ( value.isValid() && value.canConvert <int> () ) {
setFocusIndex( index( value.value <int> (), 0) );