59 #ifdef OST_TRACE_COMPILER_IN_USE |
60 #ifdef OST_TRACE_COMPILER_IN_USE |
60 #include "glxdetailsviewTraces.h" |
61 #include "glxdetailsviewTraces.h" |
61 #endif |
62 #endif |
62 |
63 |
63 //SIZE OF THE IMAGE , LAYOUTS TEAM NEED TO GIVER THE SIZE IN UNITS |
64 //SIZE OF THE IMAGE , LAYOUTS TEAM NEED TO GIVER THE SIZE IN UNITS |
64 #define GLX_IMAGE_SIZE 215 |
65 #define GLX_IMAGE_WIDTH 333 |
|
66 #define GLX_IMAGE_HEIGHT 215 |
65 const int KBytesInKB = 1024; |
67 const int KBytesInKB = 1024; |
66 const int KBytesInMB = 1024 * 1024; |
68 const int KBytesInMB = 1024 * 1024; |
67 const int KBytesInGB = 1024 * 1024 * 1024; |
69 const int KBytesInGB = 1024 * 1024 * 1024; |
68 |
70 |
69 //-------------------------------------------------------------------------------------------------------------------------------------------- |
71 //-------------------------------------------------------------------------------------------------------------------------------------------- |
70 //GlxDetailsView |
72 //GlxDetailsView |
71 //-------------------------------------------------------------------------------------------------------------------------------------------- |
73 //-------------------------------------------------------------------------------------------------------------------------------------------- |
72 GlxDetailsView::GlxDetailsView(HbMainWindow *window) : |
74 GlxDetailsView::GlxDetailsView(HbMainWindow *window) |
73 GlxView(GLX_DETAILSVIEW_ID), mDetailsIcon(NULL), mFavIcon(NULL), mModel( |
75 : GlxView( GLX_DETAILSVIEW_ID ), |
74 NULL), mFavModel(NULL), mWindow(window), |
76 mDetailsIcon( NULL ), |
75 mSelIndex(0),mDocLoader(NULL),mImageName(NULL),mDescriptions(NULL),mDateLabel(NULL),mSizeLabel(NULL),mTimeLabel(NULL) |
77 mFavIcon( NULL ), |
76 { |
78 mModel( NULL ), |
|
79 mFavModel( NULL ), |
|
80 mWindow( window ), |
|
81 mSelIndex( 0 ), |
|
82 mDocLoader( NULL ), |
|
83 mImageName( NULL ), |
|
84 mDescriptions( NULL ), |
|
85 mDateLabel( NULL ), |
|
86 mSizeLabel( NULL ), |
|
87 mTimeLabel( NULL ) |
|
88 { |
77 GLX_LOG_INFO("GlxDetailsView::GlxDetailsView"); |
89 GLX_LOG_INFO("GlxDetailsView::GlxDetailsView"); |
78 OstTraceFunctionEntry0( GLXDETAILSVIEW_GLXDETAILSVIEW_ENTRY ); |
90 OstTraceFunctionEntry0( GLXDETAILSVIEW_GLXDETAILSVIEW_ENTRY ); |
79 setContentFullScreen(true);//for smooth transtion between grid to full screen and vice versa |
91 setContentFullScreen(true);//for smooth transtion between grid to full screen and vice versa |
80 OstTraceFunctionExit0( GLXDETAILSVIEW_GLXDETAILSVIEW_EXIT ); |
92 OstTraceFunctionExit0( GLXDETAILSVIEW_GLXDETAILSVIEW_EXIT ); |
81 } |
93 } |
82 |
94 |
83 //-------------------------------------------------------------------------------------------------------------------------------------------- |
95 //-------------------------------------------------------------------------------------------------------------------------------------------- |
84 //~GlxDetailsView |
96 //~GlxDetailsView |
85 //-------------------------------------------------------------------------------------------------------------------------------------------- |
97 //-------------------------------------------------------------------------------------------------------------------------------------------- |
86 GlxDetailsView::~GlxDetailsView() |
98 GlxDetailsView::~GlxDetailsView() |
87 { |
99 { |
88 OstTrace0( TRACE_IMPORTANT, GLXDETAILSVIEW_GLXDETAILSVIEW, "GlxDetailsView::~GlxDetailsView" ); |
100 OstTrace0( TRACE_IMPORTANT, GLXDETAILSVIEW_GLXDETAILSVIEW, "GlxDetailsView::~GlxDetailsView" ); |
89 |
101 |
90 delete mDocLoader; |
102 delete mDocLoader; |
91 mDocLoader = NULL; |
103 mDocLoader = NULL; |
92 |
104 |
93 cleanUp(); |
105 cleanUp(); |
94 } |
106 } |
95 |
107 |
96 //-------------------------------------------------------------------------------------------------------------------------------------------- |
108 //-------------------------------------------------------------------------------------------------------------------------------------------- |
97 //activate |
109 //activate |
98 //-------------------------------------------------------------------------------------------------------------------------------------------- |
110 //-------------------------------------------------------------------------------------------------------------------------------------------- |
99 void GlxDetailsView::activate() |
111 void GlxDetailsView::activate() |
260 GlxModelParm modelParm; |
262 GlxModelParm modelParm; |
261 QString imagePath = (mModel->data(mModel->index(mModel->data( |
263 QString imagePath = (mModel->data(mModel->index(mModel->data( |
262 mModel->index(0, 0), GlxFocusIndexRole).value<int> (), 0), |
264 mModel->index(0, 0), GlxFocusIndexRole).value<int> (), 0), |
263 GlxUriRole)).value<QString> (); |
265 GlxUriRole)).value<QString> (); |
264 |
266 |
265 if (mFavModel == NULL) |
267 if (mFavModel == NULL) { |
266 { |
|
267 modelParm.setCollection(KGlxCollectionPluginFavoritesAlbumId); |
268 modelParm.setCollection(KGlxCollectionPluginFavoritesAlbumId); |
268 modelParm.setContextMode(GlxContextFavorite); |
269 modelParm.setContextMode(GlxContextFavorite); |
269 modelParm.setPath(imagePath); |
270 modelParm.setPath(imagePath); |
270 mFavModel = new GlxFavMediaModel(modelParm); |
271 mFavModel = new GlxFavMediaModel(modelParm); |
271 } |
272 } |
272 } |
273 } |
273 |
274 |
274 //-------------------------------------------------------------------------------------------------------------------------------------------- |
275 //-------------------------------------------------------------------------------------------------------------------------------------------- |
275 //initializeNewModel |
276 //initializeNewModel |
276 //-------------------------------------------------------------------------------------------------------------------------------------------- |
277 //-------------------------------------------------------------------------------------------------------------------------------------------- |
277 void GlxDetailsView::initializeNewModel() |
278 void GlxDetailsView::initializeNewModel() |
278 { |
279 { |
279 OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_INITIALIZENEWMODEL, "GlxDetailsView::initializeNewModel" ); |
280 OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_INITIALIZENEWMODEL, "GlxDetailsView::initializeNewModel" ); |
280 |
281 |
281 if (mModel) |
282 if (mModel) { |
282 { |
283 connect( mModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(rowsRemoved(QModelIndex,int,int))); |
283 connect(mModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, |
284 connect( mModel, SIGNAL( updateDetailsView() ), this, SLOT( FillDetails() )); |
284 SLOT(rowsRemoved(QModelIndex,int,int))); |
285 connect( mModel, SIGNAL( destroyed() ), this, SLOT( modelDestroyed() ) ); |
285 } |
286 } |
286 } |
287 } |
287 |
288 |
288 //-------------------------------------------------------------------------------------------------------------------------------------------- |
289 //-------------------------------------------------------------------------------------------------------------------------------------------- |
289 //clearCurrentModel |
290 //clearCurrentModel |
290 //-------------------------------------------------------------------------------------------------------------------------------------------- |
291 //-------------------------------------------------------------------------------------------------------------------------------------------- |
291 void GlxDetailsView::clearCurrentModel() |
292 void GlxDetailsView::clearCurrentModel() |
292 { |
293 { |
293 OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_CLEARCURRENTMODEL, "GlxDetailsView::clearCurrentModel" ); |
294 OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_CLEARCURRENTMODEL, "GlxDetailsView::clearCurrentModel" ); |
294 |
295 |
295 if (mModel) |
296 if (mModel) { |
296 { |
297 disconnect(mModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(rowsRemoved(QModelIndex,int,int))); |
297 disconnect(mModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, |
298 disconnect(mModel, SIGNAL( updateDetailsView() ), this, SLOT( FillDetails() )); |
298 SLOT(rowsRemoved(QModelIndex,int,int))); |
299 disconnect( mModel, SIGNAL( destroyed() ), this, SLOT( modelDestroyed() ) ); |
299 mModel = NULL; |
300 mModel = NULL; |
300 } |
301 } |
301 } |
302 } |
302 |
303 |
303 //-------------------------------------------------------------------------------------------------------------------------------------------- |
304 //-------------------------------------------------------------------------------------------------------------------------------------------- |
304 //setConnections |
305 //setConnections |
305 //-------------------------------------------------------------------------------------------------------------------------------------------- |
306 //-------------------------------------------------------------------------------------------------------------------------------------------- |
306 void GlxDetailsView::setConnections() |
307 void GlxDetailsView::setConnections() |
307 { |
308 { |
308 connect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, |
309 connect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, |
309 SLOT(updateLayout(Qt::Orientation))); |
310 SLOT(updateLayout(Qt::Orientation))); |
310 |
311 |
311 |
|
312 if(getSubState() != IMAGEVIEWER_DETAIL_S) { |
312 if(getSubState() != IMAGEVIEWER_DETAIL_S) { |
313 connect(mFavIcon, SIGNAL(clicked()), this, SLOT(updateFavourites())); |
313 connect(mFavIcon, SIGNAL(updateFavourites()), this, SLOT(updateFavourites())); |
314 |
314 |
315 connect(mDescriptions, SIGNAL(labelPressed()), this, |
315 connect(mDescriptions, SIGNAL(labelPressed()), this, |
316 SLOT(UpdateDescription())); |
316 SLOT(UpdateDescription())); |
317 |
317 |
318 connect(mFavModel, SIGNAL( dataChanged(QModelIndex,QModelIndex) ), |
318 connect(mFavModel, SIGNAL( dataChanged(QModelIndex,QModelIndex) ), |
319 this, SLOT( dataChanged(QModelIndex,QModelIndex) )); |
319 this, SLOT( dataChanged(QModelIndex,QModelIndex) )); |
320 } |
320 } |
321 |
321 } |
322 connect(mModel, SIGNAL( updateDetailsView() ), this, SLOT( FillDetails() )); |
|
323 |
|
324 |
|
325 } |
|
326 |
322 |
327 //-------------------------------------------------------------------------------------------------------------------------------------------- |
323 //-------------------------------------------------------------------------------------------------------------------------------------------- |
328 //clearConnections |
324 //clearConnections |
329 //-------------------------------------------------------------------------------------------------------------------------------------------- |
325 //-------------------------------------------------------------------------------------------------------------------------------------------- |
330 void GlxDetailsView::clearConnections() |
326 void GlxDetailsView::clearConnections() |
331 { |
327 { |
332 |
328 |
333 qDebug("GlxDetailsView:: clearConnections"); |
329 qDebug("GlxDetailsView:: clearConnections"); |
334 disconnect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, |
330 disconnect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, |
335 SLOT(updateLayout(Qt::Orientation))); |
331 SLOT(updateLayout(Qt::Orientation))); |
336 |
332 |
337 if(mModel && getSubState() != IMAGEVIEWER_DETAIL_S) { |
333 if(mModel && getSubState() != IMAGEVIEWER_DETAIL_S) { |
338 disconnect(mFavIcon, SIGNAL(clicked()), this, SLOT(updateFavourites())); |
334 disconnect(mFavIcon, SIGNAL(updateFavourites()), this, SLOT(updateFavourites())); |
339 disconnect(mDescriptions, SIGNAL(labelPressed()), this, |
335 disconnect(mDescriptions, SIGNAL(labelPressed()), this, |
340 SLOT(UpdateDescription())); |
336 SLOT(UpdateDescription())); |
341 disconnect(mFavModel, SIGNAL( dataChanged(QModelIndex,QModelIndex) ), |
337 disconnect(mFavModel, SIGNAL( dataChanged(QModelIndex,QModelIndex) ), |
342 this, SLOT( dataChanged(QModelIndex,QModelIndex) )); |
338 this, SLOT( dataChanged(QModelIndex,QModelIndex) )); |
343 } |
339 } |
344 |
340 } |
345 disconnect(mModel, SIGNAL( updateDetailsView() ), this, SLOT( FillDetails() )); |
|
346 |
|
347 |
|
348 } |
|
349 |
341 |
350 //-------------------------------------------------------------------------------------------------------------------------------------------- |
342 //-------------------------------------------------------------------------------------------------------------------------------------------- |
351 //getAnimationItem |
343 //getAnimationItem |
352 //-------------------------------------------------------------------------------------------------------------------------------------------- |
344 //-------------------------------------------------------------------------------------------------------------------------------------------- |
353 QGraphicsItem * GlxDetailsView::getAnimationItem(GlxEffect transtionEffect) |
345 QGraphicsItem * GlxDetailsView::getAnimationItem(GlxEffect transtionEffect) |
440 } |
437 } |
441 //-------------------------------------------------------------------------------------------------------------------------------------------- |
438 //-------------------------------------------------------------------------------------------------------------------------------------------- |
442 //showImage |
439 //showImage |
443 //-------------------------------------------------------------------------------------------------------------------------------------------- |
440 //-------------------------------------------------------------------------------------------------------------------------------------------- |
444 void GlxDetailsView::showImage() |
441 void GlxDetailsView::showImage() |
445 { |
442 { |
446 OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_SHOWIMAGE, "GlxDetailsView::showImage" ); |
443 OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_SHOWIMAGE, "GlxDetailsView::showImage" ); |
447 |
444 |
448 QVariant variant = mModel->data(mModel->index(0, 0), GlxFocusIndexRole); |
445 QVariant variant = mModel->data(mModel->index(0, 0), GlxFocusIndexRole); |
449 if (variant.isValid() && variant.canConvert<int> ()) |
446 if (variant.isValid() && variant.canConvert<int> ()) |
450 { |
447 { |
451 mSelIndex = variant.value<int> (); |
448 mSelIndex = variant.value<int> (); |
452 } |
449 } |
453 |
450 |
454 variant = mModel->data(mModel->index(mSelIndex, 0), GlxFsImageRole); |
451 variant = mModel->data(mModel->index(mSelIndex, 0), GlxFsImageRole); |
|
452 |
455 if (variant.isValid() && variant.canConvert<HbIcon> ()) |
453 if (variant.isValid() && variant.canConvert<HbIcon> ()) |
456 { |
454 { |
457 QIcon itemIcon = variant.value<HbIcon> ().qicon(); |
455 mDetailsIcon->setIcon(variant.value<HbIcon> ()); |
458 QPixmap itemPixmap = itemIcon.pixmap(GLX_IMAGE_SIZE, GLX_IMAGE_SIZE); |
456 } |
459 QSize sz(GLX_IMAGE_SIZE, GLX_IMAGE_SIZE); |
457 } |
460 itemPixmap = itemPixmap.scaled(sz, Qt::IgnoreAspectRatio); |
|
461 |
|
462 HbIcon tmp = HbIcon(QIcon(itemPixmap)); |
|
463 mDetailsIcon->setIcon(tmp); |
|
464 } |
|
465 } |
|
466 |
458 |
467 //-------------------------------------------------------------------------------------------------------------------------------------------- |
459 //-------------------------------------------------------------------------------------------------------------------------------------------- |
468 //setImageName |
460 //setImageName |
469 //-------------------------------------------------------------------------------------------------------------------------------------------- |
461 //-------------------------------------------------------------------------------------------------------------------------------------------- |
470 void GlxDetailsView::setImageName() |
462 void GlxDetailsView::setImageName() |
471 { |
463 { |
472 OstTraceFunctionEntry0( GLXDETAILSVIEW_SETIMAGENAME_ENTRY ); |
464 OstTraceFunctionEntry0( GLXDETAILSVIEW_SETIMAGENAME_ENTRY ); |
473 QString temp = "<u>"; |
|
474 QString imagePath = (mModel->data(mModel->index(mModel->data( |
465 QString imagePath = (mModel->data(mModel->index(mModel->data( |
475 mModel->index(0, 0), GlxFocusIndexRole).value<int> (), 0), |
466 mModel->index(0, 0), GlxFocusIndexRole).value<int> (), 0), |
476 GlxUriRole)).value<QString> (); |
467 GlxUriRole)).value<QString> (); |
477 QString imageName = imagePath.section('\\', -1); |
468 QString imageName = imagePath.section('\\', -1); |
478 |
469 |
479 temp.append(imageName); |
470 mImageName->setItemText(imageName); |
480 temp.append("</u>"); |
|
481 mImageName->setItemText(temp); |
|
482 OstTraceFunctionExit0( GLXDETAILSVIEW_SETIMAGENAME_EXIT ); |
471 OstTraceFunctionExit0( GLXDETAILSVIEW_SETIMAGENAME_EXIT ); |
483 } |
472 } |
484 |
473 |
485 //-------------------------------------------------------------------------------------------------------------------------------------------- |
474 //-------------------------------------------------------------------------------------------------------------------------------------------- |
486 //setImageName |
475 //setImageName |
487 //-------------------------------------------------------------------------------------------------------------------------------------------- |
476 //-------------------------------------------------------------------------------------------------------------------------------------------- |
488 void GlxDetailsView::setDesc() |
477 void GlxDetailsView::setDesc() |
489 { |
478 { |
|
479 |
|
480 //This is a hack , Initialize to some characters and then set the text |
|
481 //as of know if the description text is Null , we cant see the Description edit box |
|
482 //The issue has been informed to Application designer team. |
|
483 mDescriptions->setItemText("a"); |
490 QString description = (mModel->data(mModel->index(mModel->data( |
484 QString description = (mModel->data(mModel->index(mModel->data( |
491 mModel->index(0, 0), GlxFocusIndexRole).value<int> (), 0), |
485 mModel->index(0, 0), GlxFocusIndexRole).value<int> (), 0), |
492 GlxDescRole)).value<QString> (); |
486 GlxDescRole)).value<QString> (); |
493 mDescriptions->setItemText(description); |
487 mDescriptions->setItemText(description); |
494 } |
488 } |
495 |
489 |
496 //-------------------------------------------------------------------------------------------------------------------------------------------- |
490 //-------------------------------------------------------------------------------------------------------------------------------------------- |
497 //setDate |
491 //setDate |
498 //-------------------------------------------------------------------------------------------------------------------------------------------- |
492 //-------------------------------------------------------------------------------------------------------------------------------------------- |