32 #include <hbpushbutton.h> |
32 #include <hbpushbutton.h> |
33 #include <hbdataformmodel.h> |
33 #include <hbdataformmodel.h> |
34 #include <hbdocumentloader.h> |
34 #include <hbdocumentloader.h> |
35 #include <hbdataformmodelitem.h> |
35 #include <hbdataformmodelitem.h> |
36 #include <hbdataformviewitem.h> |
36 #include <hbdataformviewitem.h> |
37 |
37 #include <hbparameterlengthlimiter.h> |
38 //-------------------------------------------------------------------------------------------------------------------------------------------- |
38 //-------------------------------------------------------------------------------------------------------------------------------------------- |
39 #include "glxviewids.h" |
39 #include "glxviewids.h" |
40 #include "glxicondefs.h" //Contains the icon names/Ids |
40 #include "glxicondefs.h" //Contains the icon names/Ids |
41 #include "glxmodelparm.h" |
41 #include "glxmodelparm.h" |
42 #include "glxmediamodel.h" |
42 #include "glxmediamodel.h" |
43 #include "glxdetailsview.h" |
43 #include "glxdetailsview.h" |
44 #include "glxfavmediamodel.h" |
44 #include "glxfavmediamodel.h" |
45 #include "glxdocloaderdefs.h" |
45 #include "glxdocloaderdefs.h" |
46 #include <glxcommandhandlers.hrh> |
46 #include <glxcommandhandlers.hrh> |
47 #include "glxdetailsdescriptionedit.h" |
47 #include "glxlocalisationstrings.h" |
48 #include "glxdetailsnamelabel.h" |
48 #include "glxdetailstextedit.h" |
|
49 #include "glxdetailsicon.h" |
49 |
50 |
50 |
51 |
51 #include "glxviewdocloader.h" |
52 #include "glxviewdocloader.h" |
52 #include <glxcollectionpluginalbums.hrh> |
53 #include <glxcollectionpluginalbums.hrh> |
53 |
54 |
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() |
100 { |
112 { |
101 OstTraceFunctionEntry0( GLXDETAILSVIEW_ACTIVATE_ENTRY ); |
113 OstTraceFunctionEntry0( GLXDETAILSVIEW_ACTIVATE_ENTRY ); |
102 //create and set the Favourite Model |
114 //create and set the Favourite Model |
103 setFavModel(); |
115 if(getSubState() != IMAGEVIEWER_DETAIL_S) { |
|
116 setFavModel(); |
|
117 } |
104 |
118 |
105 //fill the data |
119 //fill the data |
106 FillDetails(); |
120 FillDetails(); |
107 |
121 |
108 //Initialze the Model |
122 //Initialze the Model |
118 } |
132 } |
119 |
133 |
120 //-------------------------------------------------------------------------------------------------------------------------------------------- |
134 //-------------------------------------------------------------------------------------------------------------------------------------------- |
121 //initializeView |
135 //initializeView |
122 //-------------------------------------------------------------------------------------------------------------------------------------------- |
136 //-------------------------------------------------------------------------------------------------------------------------------------------- |
123 void GlxDetailsView::initializeView(QAbstractItemModel *model) |
137 void GlxDetailsView::initializeView( QAbstractItemModel *model, GlxView *preView) |
124 { |
138 { |
|
139 Q_UNUSED( preView ) |
125 OstTraceFunctionEntry0( GLXDETAILSVIEW_INITIALIZEVIEW_ENTRY ); |
140 OstTraceFunctionEntry0( GLXDETAILSVIEW_INITIALIZEVIEW_ENTRY ); |
126 bool loaded = false; |
141 bool loaded = false; |
127 |
142 |
128 if(!mDocLoader) |
143 if(!mDocLoader) |
129 { |
144 { |
130 mDocLoader = new GlxDetailsViewDocLoader(); |
145 mDocLoader = new GlxDetailsViewDocLoader(); |
131 } |
146 } |
132 |
147 |
133 //Load the docml |
148 //Load the docml |
134 mDocLoader->load(GLX_DETAILSVIEW_DOCMLPATH, &loaded); |
149 mDocLoader->load(GLX_DETAILSVIEW_DOCMLPATH, &loaded); |
135 |
150 |
136 HbView *mView = static_cast<HbView*> (mDocLoader->findWidget( |
151 HbView *mView = static_cast<HbView*> (mDocLoader->findWidget( |
137 GLX_DETAILSVIEW_VIEW)); |
152 GLX_DETAILSVIEW_VIEW)); |
138 |
153 |
139 HbWidget *mwidget = static_cast<HbWidget*> (mDocLoader->findWidget( |
|
140 "MainWidget")); |
|
141 |
|
142 mDetailsIcon = static_cast<HbLabel*> (mDocLoader->findWidget( |
154 mDetailsIcon = static_cast<HbLabel*> (mDocLoader->findWidget( |
143 GLX_DETAILSVIEW_IMAGE)); |
155 GLX_DETAILSVIEW_IMAGE)); |
144 mFavIcon = static_cast<HbPushButton*> (mDocLoader->findWidget( |
156 mFavIcon = static_cast<GlxDetailsIcon*> (mDocLoader->findWidget( |
145 GLX_DETAILSVIEW_FAVICON)); |
157 GLX_DETAILSVIEW_FAVICON)); |
146 |
158 |
147 mDescriptions = static_cast<GlxDetailsDescriptionEdit*> (mDocLoader->findWidget( |
159 |
|
160 mDescriptions = static_cast<GlxDetailsTextEdit*> (mDocLoader->findWidget( |
148 GLX_DETAILSVIEW_DESCRPTIONTEXT)); |
161 GLX_DETAILSVIEW_DESCRPTIONTEXT)); |
149 |
162 |
150 mImageName = static_cast<GlxDetailsNameLabel*> (mDocLoader->findWidget( |
163 mImageName = static_cast<GlxDetailsTextEdit*> (mDocLoader->findWidget( |
151 GLX_DETAILSVIEW_IMGNAME)); |
164 GLX_DETAILSVIEW_IMGNAME)); |
152 |
165 |
153 mDateLabel = static_cast<HbLabel*> (mDocLoader->findWidget( |
166 mDateLabel = static_cast<HbLabel*> (mDocLoader->findWidget( |
154 GLX_DETAILSVIEW_DATETEXT)); |
167 GLX_DETAILSVIEW_DATETEXT)); |
155 |
168 |
249 GlxModelParm modelParm; |
262 GlxModelParm modelParm; |
250 QString imagePath = (mModel->data(mModel->index(mModel->data( |
263 QString imagePath = (mModel->data(mModel->index(mModel->data( |
251 mModel->index(0, 0), GlxFocusIndexRole).value<int> (), 0), |
264 mModel->index(0, 0), GlxFocusIndexRole).value<int> (), 0), |
252 GlxUriRole)).value<QString> (); |
265 GlxUriRole)).value<QString> (); |
253 |
266 |
254 if (mFavModel == NULL) |
267 if (mFavModel == NULL) { |
255 { |
|
256 modelParm.setCollection(KGlxCollectionPluginFavoritesAlbumId); |
268 modelParm.setCollection(KGlxCollectionPluginFavoritesAlbumId); |
257 modelParm.setContextMode(GlxContextFavorite); |
269 modelParm.setContextMode(GlxContextFavorite); |
258 modelParm.setPath(imagePath); |
270 modelParm.setPath(imagePath); |
259 mFavModel = new GlxFavMediaModel(modelParm); |
271 mFavModel = new GlxFavMediaModel(modelParm); |
260 } |
272 } |
261 } |
273 } |
262 |
274 |
263 //-------------------------------------------------------------------------------------------------------------------------------------------- |
275 //-------------------------------------------------------------------------------------------------------------------------------------------- |
264 //initializeNewModel |
276 //initializeNewModel |
265 //-------------------------------------------------------------------------------------------------------------------------------------------- |
277 //-------------------------------------------------------------------------------------------------------------------------------------------- |
266 void GlxDetailsView::initializeNewModel() |
278 void GlxDetailsView::initializeNewModel() |
267 { |
279 { |
268 OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_INITIALIZENEWMODEL, "GlxDetailsView::initializeNewModel" ); |
280 OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_INITIALIZENEWMODEL, "GlxDetailsView::initializeNewModel" ); |
269 |
281 |
270 if (mModel) |
282 if (mModel) { |
271 { |
283 connect( mModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(rowsRemoved(QModelIndex,int,int))); |
272 connect(mModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, |
284 connect( mModel, SIGNAL( updateDetailsView() ), this, SLOT( FillDetails() )); |
273 SLOT(rowsRemoved(QModelIndex,int,int))); |
285 connect( mModel, SIGNAL( destroyed() ), this, SLOT( modelDestroyed() ) ); |
274 } |
286 } |
275 } |
287 } |
276 |
288 |
277 //-------------------------------------------------------------------------------------------------------------------------------------------- |
289 //-------------------------------------------------------------------------------------------------------------------------------------------- |
278 //clearCurrentModel |
290 //clearCurrentModel |
279 //-------------------------------------------------------------------------------------------------------------------------------------------- |
291 //-------------------------------------------------------------------------------------------------------------------------------------------- |
280 void GlxDetailsView::clearCurrentModel() |
292 void GlxDetailsView::clearCurrentModel() |
281 { |
293 { |
282 OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_CLEARCURRENTMODEL, "GlxDetailsView::clearCurrentModel" ); |
294 OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_CLEARCURRENTMODEL, "GlxDetailsView::clearCurrentModel" ); |
283 |
295 |
284 if (mModel) |
296 if (mModel) { |
285 { |
297 disconnect(mModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, SLOT(rowsRemoved(QModelIndex,int,int))); |
286 disconnect(mModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, |
298 disconnect(mModel, SIGNAL( updateDetailsView() ), this, SLOT( FillDetails() )); |
287 SLOT(rowsRemoved(QModelIndex,int,int))); |
299 disconnect( mModel, SIGNAL( destroyed() ), this, SLOT( modelDestroyed() ) ); |
288 mModel = NULL; |
300 mModel = NULL; |
289 } |
301 } |
290 } |
302 } |
291 |
303 |
292 //-------------------------------------------------------------------------------------------------------------------------------------------- |
304 //-------------------------------------------------------------------------------------------------------------------------------------------- |
293 //setConnections |
305 //setConnections |
294 //-------------------------------------------------------------------------------------------------------------------------------------------- |
306 //-------------------------------------------------------------------------------------------------------------------------------------------- |
295 void GlxDetailsView::setConnections() |
307 void GlxDetailsView::setConnections() |
296 { |
308 { |
297 connect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, |
309 connect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, |
298 SLOT(updateLayout(Qt::Orientation))); |
310 SLOT(updateLayout(Qt::Orientation))); |
299 connect(mFavIcon, SIGNAL(clicked()), this, SLOT(updateFavourites())); |
311 |
|
312 if(getSubState() != IMAGEVIEWER_DETAIL_S) { |
|
313 connect(mFavIcon, SIGNAL(updateFavourites()), this, SLOT(updateFavourites())); |
300 |
314 |
301 connect(mDescriptions, SIGNAL(labelPressed()), this, |
315 connect(mDescriptions, SIGNAL(labelPressed()), this, |
302 SLOT(UpdateDescription())); |
316 SLOT(UpdateDescription())); |
303 |
317 |
304 connect(mModel, SIGNAL( updateDetailsView() ), this, SLOT( FillDetails() )); |
|
305 |
|
306 connect(mFavModel, SIGNAL( dataChanged(QModelIndex,QModelIndex) ), |
318 connect(mFavModel, SIGNAL( dataChanged(QModelIndex,QModelIndex) ), |
307 this, SLOT( dataChanged(QModelIndex,QModelIndex) )); |
319 this, SLOT( dataChanged(QModelIndex,QModelIndex) )); |
308 } |
320 } |
|
321 } |
309 |
322 |
310 //-------------------------------------------------------------------------------------------------------------------------------------------- |
323 //-------------------------------------------------------------------------------------------------------------------------------------------- |
311 //clearConnections |
324 //clearConnections |
312 //-------------------------------------------------------------------------------------------------------------------------------------------- |
325 //-------------------------------------------------------------------------------------------------------------------------------------------- |
313 void GlxDetailsView::clearConnections() |
326 void GlxDetailsView::clearConnections() |
314 { |
327 { |
|
328 |
|
329 qDebug("GlxDetailsView:: clearConnections"); |
315 disconnect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, |
330 disconnect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, |
316 SLOT(updateLayout(Qt::Orientation))); |
331 SLOT(updateLayout(Qt::Orientation))); |
317 |
332 |
318 disconnect(mFavIcon, SIGNAL(clicked()), this, SLOT(updateFavourites())); |
333 if(mModel && getSubState() != IMAGEVIEWER_DETAIL_S) { |
319 |
334 disconnect(mFavIcon, SIGNAL(updateFavourites()), this, SLOT(updateFavourites())); |
320 disconnect(mDescriptions, SIGNAL(labelPressed()), this, |
335 disconnect(mDescriptions, SIGNAL(labelPressed()), this, |
321 SLOT(UpdateDescription())); |
336 SLOT(UpdateDescription())); |
322 |
|
323 disconnect(mModel, SIGNAL( updateDetailsView() ), this, SLOT( FillDetails() )); |
|
324 |
|
325 disconnect(mFavModel, SIGNAL( dataChanged(QModelIndex,QModelIndex) ), |
337 disconnect(mFavModel, SIGNAL( dataChanged(QModelIndex,QModelIndex) ), |
326 this, SLOT( dataChanged(QModelIndex,QModelIndex) )); |
338 this, SLOT( dataChanged(QModelIndex,QModelIndex) )); |
327 } |
339 } |
|
340 } |
328 |
341 |
329 //-------------------------------------------------------------------------------------------------------------------------------------------- |
342 //-------------------------------------------------------------------------------------------------------------------------------------------- |
330 //getAnimationItem |
343 //getAnimationItem |
331 //-------------------------------------------------------------------------------------------------------------------------------------------- |
344 //-------------------------------------------------------------------------------------------------------------------------------------------- |
332 QGraphicsItem * GlxDetailsView::getAnimationItem(GlxEffect transtionEffect) |
345 QGraphicsItem * GlxDetailsView::getAnimationItem(GlxEffect transtionEffect) |
419 } |
437 } |
420 //-------------------------------------------------------------------------------------------------------------------------------------------- |
438 //-------------------------------------------------------------------------------------------------------------------------------------------- |
421 //showImage |
439 //showImage |
422 //-------------------------------------------------------------------------------------------------------------------------------------------- |
440 //-------------------------------------------------------------------------------------------------------------------------------------------- |
423 void GlxDetailsView::showImage() |
441 void GlxDetailsView::showImage() |
424 { |
442 { |
425 OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_SHOWIMAGE, "GlxDetailsView::showImage" ); |
443 OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_SHOWIMAGE, "GlxDetailsView::showImage" ); |
426 |
444 |
427 QVariant variant = mModel->data(mModel->index(0, 0), GlxFocusIndexRole); |
445 QVariant variant = mModel->data(mModel->index(0, 0), GlxFocusIndexRole); |
428 if (variant.isValid() && variant.canConvert<int> ()) |
446 if (variant.isValid() && variant.canConvert<int> ()) |
429 { |
447 { |
430 mSelIndex = variant.value<int> (); |
448 mSelIndex = variant.value<int> (); |
431 } |
449 } |
432 |
450 |
433 variant = mModel->data(mModel->index(mSelIndex, 0), GlxFsImageRole); |
451 variant = mModel->data(mModel->index(mSelIndex, 0), GlxFsImageRole); |
|
452 |
434 if (variant.isValid() && variant.canConvert<HbIcon> ()) |
453 if (variant.isValid() && variant.canConvert<HbIcon> ()) |
435 { |
454 { |
436 QIcon itemIcon = variant.value<HbIcon> ().qicon(); |
455 mDetailsIcon->setIcon(variant.value<HbIcon> ()); |
437 QPixmap itemPixmap = itemIcon.pixmap(GLX_IMAGE_SIZE, GLX_IMAGE_SIZE); |
456 } |
438 QSize sz(GLX_IMAGE_SIZE, GLX_IMAGE_SIZE); |
457 } |
439 itemPixmap = itemPixmap.scaled(sz, Qt::IgnoreAspectRatio); |
|
440 |
|
441 HbIcon tmp = HbIcon(QIcon(itemPixmap)); |
|
442 mDetailsIcon->setIcon(tmp); |
|
443 } |
|
444 } |
|
445 |
458 |
446 //-------------------------------------------------------------------------------------------------------------------------------------------- |
459 //-------------------------------------------------------------------------------------------------------------------------------------------- |
447 //setImageName |
460 //setImageName |
448 //-------------------------------------------------------------------------------------------------------------------------------------------- |
461 //-------------------------------------------------------------------------------------------------------------------------------------------- |
449 void GlxDetailsView::setImageName() |
462 void GlxDetailsView::setImageName() |
450 { |
463 { |
451 OstTraceFunctionEntry0( GLXDETAILSVIEW_SETIMAGENAME_ENTRY ); |
464 OstTraceFunctionEntry0( GLXDETAILSVIEW_SETIMAGENAME_ENTRY ); |
452 QString temp = "<u>"; |
|
453 QString imagePath = (mModel->data(mModel->index(mModel->data( |
465 QString imagePath = (mModel->data(mModel->index(mModel->data( |
454 mModel->index(0, 0), GlxFocusIndexRole).value<int> (), 0), |
466 mModel->index(0, 0), GlxFocusIndexRole).value<int> (), 0), |
455 GlxUriRole)).value<QString> (); |
467 GlxUriRole)).value<QString> (); |
456 QString imageName = imagePath.section('\\', -1); |
468 QString imageName = imagePath.section('\\', -1); |
457 |
469 |
458 temp.append(imageName); |
470 mImageName->setItemText(imageName); |
459 temp.append("</u>"); |
|
460 mImageName->setItemText(temp); |
|
461 OstTraceFunctionExit0( GLXDETAILSVIEW_SETIMAGENAME_EXIT ); |
471 OstTraceFunctionExit0( GLXDETAILSVIEW_SETIMAGENAME_EXIT ); |
462 } |
472 } |
463 |
473 |
464 //-------------------------------------------------------------------------------------------------------------------------------------------- |
474 //-------------------------------------------------------------------------------------------------------------------------------------------- |
465 //setImageName |
475 //setImageName |
466 //-------------------------------------------------------------------------------------------------------------------------------------------- |
476 //-------------------------------------------------------------------------------------------------------------------------------------------- |
467 void GlxDetailsView::setDesc() |
477 void GlxDetailsView::setDesc() |
468 { |
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"); |
469 QString description = (mModel->data(mModel->index(mModel->data( |
484 QString description = (mModel->data(mModel->index(mModel->data( |
470 mModel->index(0, 0), GlxFocusIndexRole).value<int> (), 0), |
485 mModel->index(0, 0), GlxFocusIndexRole).value<int> (), 0), |
471 GlxDescRole)).value<QString> (); |
486 GlxDescRole)).value<QString> (); |
472 mDescriptions->setItemText(description); |
487 mDescriptions->setItemText(description); |
473 } |
488 } |
474 |
489 |
475 //-------------------------------------------------------------------------------------------------------------------------------------------- |
490 //-------------------------------------------------------------------------------------------------------------------------------------------- |
476 //setDate |
491 //setDate |
477 //-------------------------------------------------------------------------------------------------------------------------------------------- |
492 //-------------------------------------------------------------------------------------------------------------------------------------------- |
505 QString timestring; |
520 QString timestring; |
506 QString timeFormat("h:m ap"); |
521 QString timeFormat("h:m ap"); |
507 QTime timevalue = (mModel->data(mModel->index(mModel->data(mModel->index( |
522 QTime timevalue = (mModel->data(mModel->index(mModel->data(mModel->index( |
508 0, 0), GlxFocusIndexRole).value<int> (), 0), GlxTimeRole)).value< |
523 0, 0), GlxFocusIndexRole).value<int> (), 0), GlxTimeRole)).value< |
509 QTime> (); |
524 QTime> (); |
510 timestring = QString("Time: "); |
525 |
511 if (timevalue.isNull() == FALSE) |
526 if (timevalue.isNull() == FALSE) |
512 { |
527 { |
513 OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_SETDATE, "GlxDetailsView::setTime is not NULL" ); |
528 OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_SETDATE, "GlxDetailsView::setTime is not NULL" ); |
514 timestring.append(timevalue.toString(timeFormat)); |
529 QString timeStringValue = timevalue.toString(timeFormat); |
515 } |
530 timestring = hbTrId(GLX_DETAILS_TIME).arg(timeStringValue); |
516 mTimeLabel->setPlainText(timestring); |
531 } |
|
532 mTimeLabel->setPlainText(timestring); |
517 } |
533 } |
518 |
534 |
519 //-------------------------------------------------------------------------------------------------------------------------------------------- |
535 //-------------------------------------------------------------------------------------------------------------------------------------------- |
520 //setSize |
536 //setSize |
521 //-------------------------------------------------------------------------------------------------------------------------------------------- |
537 //-------------------------------------------------------------------------------------------------------------------------------------------- |
522 void GlxDetailsView::setSize() |
538 void GlxDetailsView::setSize() |
523 { |
539 { |
524 int size = 0; |
540 int size = 0; |
525 size = (mModel->data(mModel->index(mModel->data(mModel->index(0, 0), |
541 size = (mModel->data(mModel->index(mModel->data(mModel->index(0, 0), |
526 GlxFocusIndexRole).value<int> (), 0), GlxSizeRole)).value<int> (); |
542 GlxFocusIndexRole).value<int> (), 0), GlxSizeRole)).value<int> (); |
527 QString sizelabel; |
543 |
528 QString sizestring; |
544 QString sizeString; |
529 sizelabel = QString("Size : "); |
545 sizeString = sizeinStrings(size); |
530 sizestring = sizeinStrings(size); |
546 mSizeLabel->setPlainText(sizeString); |
531 sizelabel.append(sizestring); |
|
532 mSizeLabel->setPlainText(sizelabel); |
|
533 |
547 |
534 } |
548 } |
535 |
549 |
536 //-------------------------------------------------------------------------------------------------------------------------------------------- |
550 //-------------------------------------------------------------------------------------------------------------------------------------------- |
537 //dataChanged |
551 //dataChanged |
590 { |
604 { |
591 QString sizeString; |
605 QString sizeString; |
592 if (size >= KBytesInGB) |
606 if (size >= KBytesInGB) |
593 { |
607 { |
594 int gbSize = size / KBytesInGB; // Size in GB |
608 int gbSize = size / KBytesInGB; // Size in GB |
595 sizeString.setNum(gbSize); |
609 sizeString = HbParameterLengthLimiter(GLX_DETAILS_SIZE_GB, gbSize); |
596 sizeString.append("GB"); |
|
597 } |
610 } |
598 else if (size >= KBytesInMB) |
611 else if (size >= KBytesInMB) |
599 { |
612 { |
600 int mbSize = size / KBytesInMB; // Size in MB |
613 int mbSize = size / KBytesInMB; // Size in MB |
601 sizeString.setNum(mbSize); |
614 sizeString = HbParameterLengthLimiter(GLX_DETAILS_SIZE_MB, mbSize); |
602 sizeString.append("MB"); |
|
603 } |
615 } |
604 else if (size >= KBytesInKB) |
616 else if (size >= KBytesInKB) |
605 { |
617 { |
606 TInt kBsize = size / KBytesInKB; // bytes to kB |
618 int kbSize = size / KBytesInKB; // Size in KB |
607 sizeString.setNum(kBsize); |
619 sizeString = HbParameterLengthLimiter(GLX_DETAILS_SIZE_KB, kbSize); |
608 sizeString.append("KB"); |
|
609 } |
620 } |
610 else |
621 else |
611 { |
622 { |
612 sizeString.setNum(size); |
623 sizeString = HbParameterLengthLimiter(GLX_DETAILS_SIZE_BYTES, size); |
613 sizeString.append("Bytes"); |
|
614 } |
624 } |
615 return sizeString; |
625 return sizeString; |
616 } |
626 } |
|
627 |
|
628 //-------------------------------------------------------------------------------------------------------------------------------------------- |
|
629 //getSubState |
|
630 //-------------------------------------------------------------------------------------------------------------------------------------------- |
|
631 int GlxDetailsView::getSubState() |
|
632 { |
|
633 int substate = NO_DETAIL_S; |
|
634 |
|
635 if (mModel) { |
|
636 QVariant variant = mModel->data(mModel->index(0, 0), GlxSubStateRole); |
|
637 |
|
638 if (variant.isValid() && variant.canConvert<int> ()) { |
|
639 substate = variant.value<int> (); |
|
640 } |
|
641 } |
|
642 return substate; |
|
643 } |