53 err = connect(this, SIGNAL(iconAvailable(int, HbIcon*, GlxTBContextType)), this, SLOT(updateItemIcon(int, HbIcon*, GlxTBContextType))); |
51 err = connect(this, SIGNAL(iconAvailable(int, HbIcon*, GlxTBContextType)), this, SLOT(updateItemIcon(int, HbIcon*, GlxTBContextType))); |
54 qDebug("iconAvailable() connection status %d", err); |
52 qDebug("iconAvailable() connection status %d", err); |
55 err = connect( mMLWrapper, SIGNAL(updateAlbumTitle(QString)), this, SLOT(albumTitleUpdated(QString))); |
53 err = connect( mMLWrapper, SIGNAL(updateAlbumTitle(QString)), this, SLOT(albumTitleUpdated(QString))); |
56 qDebug("updateAlbumTitle() connection status %d", err); |
54 qDebug("updateAlbumTitle() connection status %d", err); |
57 err = connect(mMLWrapper, SIGNAL(populated()), this, SLOT(modelpopulated())); |
55 err = connect(mMLWrapper, SIGNAL(populated()), this, SLOT(modelpopulated())); |
58 //itemadded.resize(mMLWrapper->getItemCount()); |
56 err = connect(mMLWrapper, SIGNAL(updateDetails()), this, SLOT(updateDetailItems())); |
59 |
57 |
60 itemIconCache.setMaxCost(20); //Changed While Doing Media Wall |
58 itemIconCache.setMaxCost(20); //Changed While Doing Media Wall |
61 itemFsIconCache.setMaxCost(5); |
59 itemFsIconCache.setMaxCost(5); |
62 itemExternalIconCache.setMaxCost(0); |
60 itemExternalIconCache.setMaxCost(0); |
63 |
61 |
71 |
69 |
72 GlxMediaModel::~GlxMediaModel() |
70 GlxMediaModel::~GlxMediaModel() |
73 { |
71 { |
74 //itemadded.clear(); |
72 //itemadded.clear(); |
75 qDebug("GlxMediaModel::~GlxMediaModel"); |
73 qDebug("GlxMediaModel::~GlxMediaModel"); |
76 int freeMemory = 0; |
|
77 int err1 = HAL::Get( HALData::EMemoryRAMFree, freeMemory ); |
|
78 qDebug("####mediaModel : Memory available before cache cleanup = %d and error is = %d ", freeMemory , err1 ); |
|
79 itemIconCache.clear(); |
74 itemIconCache.clear(); |
80 itemFsIconCache.clear(); |
75 itemFsIconCache.clear(); |
81 delete m_DefaultIcon; |
76 delete m_DefaultIcon; |
82 m_DefaultIcon = NULL; |
77 m_DefaultIcon = NULL; |
83 clearExternalItems(); |
78 clearExternalItems(); |
84 err1 = HAL::Get( HALData::EMemoryRAMFree, freeMemory ); |
79 int err = disconnect(mMLWrapper, SIGNAL(updateItem(int, GlxTBContextType)), this, SLOT(itemUpdated1(int, GlxTBContextType))); |
85 qDebug("####mediaModel : Memory available after cache cleanup = %d and error is = %d ", freeMemory , err1 ); |
|
86 int err = disconnect(mMLWrapper, SIGNAL(updateItem(int, GlxTBContextType)), this, SLOT(itemUpdated1(int, GlxTBContextType))); |
|
87 err = disconnect(mMLWrapper, SIGNAL(itemCorrupted(int)), this, SLOT(itemCorrupted(int))); |
80 err = disconnect(mMLWrapper, SIGNAL(itemCorrupted(int)), this, SLOT(itemCorrupted(int))); |
88 err = disconnect(mMLWrapper, SIGNAL(insertItems(int, int)), this, SLOT(itemsAdded(int, int))); |
81 err = disconnect(mMLWrapper, SIGNAL(insertItems(int, int)), this, SLOT(itemsAdded(int, int))); |
89 err = disconnect(mMLWrapper, SIGNAL(removeItems(int, int)), this, SLOT(itemsRemoved(int, int))); |
82 err = disconnect(mMLWrapper, SIGNAL(removeItems(int, int)), this, SLOT(itemsRemoved(int, int))); |
90 err = disconnect(this, SIGNAL(iconAvailable(int, HbIcon*, GlxTBContextType)), this, SLOT(updateItemIcon(int, HbIcon*, GlxTBContextType))); |
83 err = disconnect(this, SIGNAL(iconAvailable(int, HbIcon*, GlxTBContextType)), this, SLOT(updateItemIcon(int, HbIcon*, GlxTBContextType))); |
91 err = disconnect(mMLWrapper, SIGNAL(updateAlbumTitle(QString)), this, SLOT(albumTitleUpdated(QString))); |
84 err = disconnect(mMLWrapper, SIGNAL(updateAlbumTitle(QString)), this, SLOT(albumTitleUpdated(QString))); |
92 err = disconnect(mMLWrapper, SIGNAL(populated()), this, SLOT(modelpopulated())); |
85 err = disconnect(mMLWrapper, SIGNAL(populated()), this, SLOT(modelpopulated())); |
|
86 err = disconnect(mMLWrapper, SIGNAL(updateDetails()), this, SLOT(updateDetailItems())); |
93 delete mMLWrapper; |
87 delete mMLWrapper; |
94 |
88 |
95 } |
89 } |
96 |
90 |
|
91 //------------------------------------------------------------------------------------------------------------ |
|
92 //setContextMode |
|
93 //------------------------------------------------------------------------------------------------------------ |
97 void GlxMediaModel::setContextMode(GlxContextMode contextMode) |
94 void GlxMediaModel::setContextMode(GlxContextMode contextMode) |
98 { |
95 { |
99 if(mContextMode != contextMode) { |
96 if(contextMode == GlxContextComment) |
|
97 { |
|
98 mMLWrapper->setContextMode(contextMode); |
|
99 } |
|
100 else |
|
101 { |
|
102 if(mContextMode != contextMode) { |
|
103 |
100 itemFsIconCache.clear(); |
104 itemFsIconCache.clear(); |
101 mMLWrapper->setContextMode(contextMode); |
105 mMLWrapper->setContextMode(contextMode); |
102 mContextMode = contextMode; |
106 mContextMode = contextMode; |
103 if ( mContextMode == GlxContextLsGrid || mContextMode == GlxContextPtGrid ) { |
107 if ( mContextMode == GlxContextLsGrid || mContextMode == GlxContextPtGrid ) { |
104 itemIconCache.clear(); |
108 itemIconCache.clear(); |
105 //emit dataChanged( index( 0, 0), index( rowCount() - 1, 0) ); // Not Needed for HgWidget |
109 //emit dataChanged( index( 0, 0), index( rowCount() - 1, 0) ); // Not Needed for HgWidget |
106 } |
110 } |
107 } |
111 } |
108 } |
112 } |
|
113 } |
|
114 |
|
115 //------------------------------------------------------------------------------------------------------------ |
|
116 //removeContextMode |
|
117 //------------------------------------------------------------------------------------------------------------ |
|
118 void GlxMediaModel::removeContextMode(GlxContextMode contextMode) |
|
119 { |
|
120 mMLWrapper->removeContextMode(contextMode); |
|
121 } |
109 |
122 |
110 //to add external data to the model |
123 //to add external data to the model |
111 void GlxMediaModel::addExternalItems(GlxExternalData* externalItems) |
124 void GlxMediaModel::addExternalItems(GlxExternalData* externalItems) |
112 { |
125 { |
113 externalDataCount = externalItems->count(); |
126 externalDataCount = externalItems->count(); |