author | hgs |
Wed, 06 Oct 2010 14:49:39 +0530 | |
changeset 71 | 27f2d7aec52a |
parent 65 | ccee5c4b0de4 |
child 72 | 0a8e959402e5 |
permissions | -rw-r--r-- |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
1 |
/* |
40 | 2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
3 |
* All rights reserved. |
|
4 |
* This component and the accompanying materials are made available |
|
5 |
* under the terms of "Eclipse Public License v1.0" |
|
6 |
* which accompanies this distribution, and is available |
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 |
* Initial Contributors: |
|
9 |
* Nokia Corporation - initial contribution. |
|
10 |
* |
|
11 |
* Contributors: |
|
12 |
* |
|
13 |
* Description: ?Description |
|
14 |
* |
|
15 |
*/ |
|
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
16 |
|
62 | 17 |
//Includes Qt |
44 | 18 |
|
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
19 |
#include <QModelIndex> |
44 | 20 |
#include <QDebug> |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
21 |
|
62 | 22 |
//Includes Orbit |
40 | 23 |
#include <hblabel.h> |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
24 |
#include <hbinstance.h> |
62 | 25 |
#include <hblistview.h> |
44 | 26 |
#include <hbpushbutton.h> |
54 | 27 |
#include <hbparameterlengthlimiter.h> |
62 | 28 |
|
29 |
//User Includes |
|
30 |
#include "glxlog.h" //contains the declaration of GLX LOGS |
|
31 |
#include "glxviewids.h" //contains view ids used here |
|
40 | 32 |
#include "glxicondefs.h" //Contains the icon names/Ids |
62 | 33 |
#include "glxmodelparm.h" //contains the declaration of GlxModelParm used to check for favourites |
34 |
#include "shareuidialog.h" //contains the declaration for share ui/send dialogs |
|
35 |
#include "glxdetailsicon.h" //contains the declaration of glxdetailsicon to show the image |
|
36 |
#include "glxdetailsview.h" //contains the declaration of this file/class |
|
37 |
#include "glxviewdocloader.h" //contains the declaration of GlxDetailsViewDocLoader |
|
38 |
#include "glxfavmediamodel.h" //contains the declaration of GlxFavMediaModel,used to check for favourites |
|
39 |
#include "glxdocloaderdefs.h" //contains the #define/constants of docml constants |
|
40 |
#include "glxcommandhandlers.hrh" //contains the declaration of rename and description command |
|
41 |
#include "glxlocalisationstrings.h" //contains the localisation strings |
|
42 |
#include "glxdetailsviewmodelwrapper.h" //contains the model wrapper for the media model of list widget |
|
43 |
#include "glxdetailsviewitemprototype.h" //contains the custom widgets prototype decalaration |
|
44 |
#include "glxcollectionpluginalbums.hrh" //contains declaration of KGlxCollectionPluginFavoritesAlbumId |
|
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
45 |
#include "OstTraceDefinitions.h" |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
46 |
#ifdef OST_TRACE_COMPILER_IN_USE |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
47 |
#include "glxdetailsviewTraces.h" |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
48 |
#endif |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
49 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
50 |
//-------------------------------------------------------------------------------------------------------------------------------------------- |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
51 |
//GlxDetailsView |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
52 |
//-------------------------------------------------------------------------------------------------------------------------------------------- |
62 | 53 |
GlxDetailsView::GlxDetailsView(HbMainWindow *window) : |
54 |
GlxView(GLX_DETAILSVIEW_ID), mImageBackGround(NULL), mDetailsIcon(NULL), mView(NULL), mFavIcon( |
|
55 |
NULL), mModel(NULL), mFavModel(NULL), mWindow(window), mSelIndex(0), mDocLoader(NULL), |
|
56 |
mListView(NULL), mListModel(NULL), mShareButton(NULL) |
|
52 | 57 |
{ |
44 | 58 |
GLX_LOG_INFO("GlxDetailsView::GlxDetailsView"); |
59 |
OstTraceFunctionEntry0( GLXDETAILSVIEW_GLXDETAILSVIEW_ENTRY ); |
|
60 |
setContentFullScreen(true);//for smooth transtion between grid to full screen and vice versa |
|
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
61 |
OstTraceFunctionExit0( GLXDETAILSVIEW_GLXDETAILSVIEW_EXIT ); |
52 | 62 |
} |
44 | 63 |
|
64 |
//-------------------------------------------------------------------------------------------------------------------------------------------- |
|
65 |
//~GlxDetailsView |
|
66 |
//-------------------------------------------------------------------------------------------------------------------------------------------- |
|
67 |
GlxDetailsView::~GlxDetailsView() |
|
52 | 68 |
{ |
44 | 69 |
OstTrace0( TRACE_IMPORTANT, GLXDETAILSVIEW_GLXDETAILSVIEW, "GlxDetailsView::~GlxDetailsView" ); |
62 | 70 |
|
71 |
delete mDetailsIcon; |
|
72 |
mDetailsIcon = NULL; |
|
73 |
||
74 |
delete mImageBackGround; |
|
75 |
mImageBackGround = NULL; |
|
76 |
||
77 |
delete mView; |
|
78 |
mView = NULL; |
|
79 |
||
80 |
mDocLoader->reset(); |
|
44 | 81 |
delete mDocLoader; |
62 | 82 |
mDocLoader = NULL; |
83 |
||
84 |
} |
|
85 |
||
86 |
//-------------------------------------------------------------------------------------------------------------------------------------------- |
|
87 |
//initializeView |
|
88 |
//-------------------------------------------------------------------------------------------------------------------------------------------- |
|
89 |
void GlxDetailsView::initializeView(QAbstractItemModel *model, GlxView *preView) |
|
90 |
{ |
|
91 |
Q_UNUSED( preView ) |
|
92 |
OstTraceFunctionEntry0( GLXDETAILSVIEW_INITIALIZEVIEW_ENTRY ); |
|
93 |
bool loaded = false; |
|
94 |
||
95 |
if (!mDocLoader) { |
|
96 |
mDocLoader = new GlxDetailsViewDocLoader(); |
|
97 |
} |
|
65 | 98 |
|
99 |
if ( mDocLoader ) { |
|
100 |
mDocLoader->load(GLX_DETAILSVIEW_DOCMLPATH, &loaded); |
|
62 | 101 |
|
65 | 102 |
if (!mView) { |
62 | 103 |
|
65 | 104 |
mView = static_cast<HbView*> (mDocLoader->findWidget(GLX_DETAILSVIEW_VIEW)); |
105 |
mImageBackGround = static_cast<HbLabel*> (mDocLoader->findWidget( |
|
106 |
GLX_DETAILSVIEW_IMGBCKGROUND)); |
|
107 |
mDetailsIcon = static_cast<HbLabel*> (mDocLoader->findWidget(GLX_DETAILSVIEW_IMAGE)); |
|
108 |
} |
|
62 | 109 |
|
65 | 110 |
mFavIcon = static_cast<GlxDetailsIcon*> (mDocLoader->findWidget(GLX_DETAILSVIEW_FAVICON)); |
111 |
mShareButton = static_cast<HbPushButton*> (mDocLoader->findWidget(GLX_DETAILSVIEW_SHAREBUTTON)); |
|
112 |
mListView = static_cast<HbListView*> (mDocLoader->findWidget(GLX_DETAILSVIEW_LISTWIDGET)); |
|
113 |
} |
|
62 | 114 |
|
115 |
//Set the Model |
|
116 |
mModel = model; |
|
117 |
||
118 |
//Set the Layout Correspondingly. |
|
119 |
updateLayout(mWindow->orientation()); |
|
120 |
||
121 |
GlxDetailsViewItemProtoType *prototype = new GlxDetailsViewItemProtoType(mListView); |
|
122 |
mListView->setItemPrototype(prototype); |
|
123 |
mListModel = new GlxDetailsViewModelWrapper(mModel); |
|
124 |
mListView->setModel(mListModel); |
|
125 |
||
126 |
mImageBackGround->show(); |
|
127 |
mDetailsIcon->show(); |
|
44 | 128 |
|
65 | 129 |
setWidget(mView); |
62 | 130 |
|
131 |
OstTraceFunctionExit0( GLXDETAILSVIEW_INITIALIZEVIEW_EXIT ); |
|
52 | 132 |
} |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
133 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
134 |
//-------------------------------------------------------------------------------------------------------------------------------------------- |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
135 |
//activate |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
136 |
//-------------------------------------------------------------------------------------------------------------------------------------------- |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
137 |
void GlxDetailsView::activate() |
62 | 138 |
{ |
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
139 |
OstTraceFunctionEntry0( GLXDETAILSVIEW_ACTIVATE_ENTRY ); |
62 | 140 |
|
141 |
mFavIconEnabled = HbIcon(GLXICON_ADD_TO_FAV); |
|
142 |
mFavIconDisabled = HbIcon(GLXICON_REMOVE_FAV); |
|
143 |
||
144 |
if (getSubState() != IMAGEVIEWER_DETAIL_S) { |
|
145 |
//set the favorite model to check if this image is in favourites folder or not |
|
146 |
setFavModel(); |
|
147 |
mFavIcon->setItemIcon(mFavIconDisabled); |
|
50 | 148 |
} |
62 | 149 |
else { |
150 |
mFavIcon->hide(); |
|
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
151 |
} |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
152 |
|
62 | 153 |
//Initialze the Model |
154 |
initializeNewModel(); |
|
50 | 155 |
|
62 | 156 |
//make the connections |
157 |
setConnections(); |
|
50 | 158 |
|
62 | 159 |
//Set context mode to fetch descriptions |
160 |
mModel->setData(QModelIndex(), (int) GlxContextComment, GlxContextRole); |
|
71 | 161 |
|
162 |
//Set the Layout Correspondingly. |
|
163 |
updateLayout(mWindow->orientation()); |
|
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
164 |
|
62 | 165 |
OstTraceFunctionExit0( GLXDETAILSVIEW_ACTIVATE_EXIT ); |
166 |
} |
|
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
167 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
168 |
//-------------------------------------------------------------------------------------------------------------------------------------------- |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
169 |
//resetView |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
170 |
//-------------------------------------------------------------------------------------------------------------------------------------------- |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
171 |
void GlxDetailsView::resetView() |
62 | 172 |
{ |
44 | 173 |
GLX_LOG_INFO("GlxDetailsView::resetView"); |
62 | 174 |
|
175 |
//Remove the context created to update details |
|
176 |
if (mModel) { |
|
177 |
mModel->setData(QModelIndex(), (int) GlxContextComment, GlxRemoveContextRole); |
|
178 |
} |
|
179 |
||
180 |
//clear the connections |
|
181 |
clearConnections(); |
|
182 |
//clear the model |
|
183 |
clearCurrentModel(); |
|
184 |
||
185 |
delete mFavIcon; |
|
186 |
mFavIcon = NULL; |
|
187 |
||
188 |
delete mFavModel; |
|
189 |
mFavModel = NULL; |
|
190 |
||
191 |
delete mShareButton; |
|
192 |
mShareButton = NULL; |
|
193 |
||
44 | 194 |
OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_RESETVIEW, "GlxDetailsView::resetView" ); |
62 | 195 |
} |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
196 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
197 |
//-------------------------------------------------------------------------------------------------------------------------------------------- |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
198 |
//deActivate |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
199 |
//-------------------------------------------------------------------------------------------------------------------------------------------- |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
200 |
void GlxDetailsView::deActivate() |
62 | 201 |
{ |
44 | 202 |
GLX_LOG_INFO("GlxDetailsView::deActivate"); |
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
203 |
OstTraceFunctionEntry0( GLXDETAILSVIEW_DEACTIVATE_ENTRY ); |
44 | 204 |
|
62 | 205 |
mImageBackGround->hide(); |
206 |
mDetailsIcon->hide(); |
|
44 | 207 |
cleanUp(); |
62 | 208 |
|
40 | 209 |
OstTraceFunctionExit0( GLXDETAILSVIEW_DEACTIVATE_EXIT ); |
62 | 210 |
} |
211 |
||
212 |
//-------------------------------------------------------------------------------------------------------------------------------------------- |
|
213 |
//setModel |
|
214 |
//-------------------------------------------------------------------------------------------------------------------------------------------- |
|
215 |
void GlxDetailsView::setModel(QAbstractItemModel *model) |
|
216 |
{ |
|
217 |
OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_SETMODEL, "GlxDetailsView::setModel" ); |
|
218 |
if (mModel == model) { |
|
219 |
return; |
|
40 | 220 |
} |
62 | 221 |
clearCurrentModel(); |
222 |
mModel = model; |
|
223 |
initializeNewModel(); |
|
224 |
} |
|
225 |
||
226 |
//-------------------------------------------------------------------------------------------------------------------------------------------- |
|
227 |
//getAnimationItem |
|
228 |
//-------------------------------------------------------------------------------------------------------------------------------------------- |
|
229 |
QGraphicsItem * GlxDetailsView::getAnimationItem(GlxEffect transtionEffect) |
|
230 |
{ |
|
231 |
OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_GETANIMATIONITEM, "GlxDetailsView::getAnimationItem" ); |
|
232 |
if (transtionEffect == FULLSCREEN_TO_DETAIL || transtionEffect == DETAIL_TO_FULLSCREEN) { |
|
233 |
return this; |
|
234 |
} |
|
235 |
return NULL; |
|
236 |
} |
|
40 | 237 |
|
238 |
//-------------------------------------------------------------------------------------------------------------------------------------------- |
|
239 |
//cleanUp |
|
240 |
//-------------------------------------------------------------------------------------------------------------------------------------------- |
|
241 |
void GlxDetailsView::cleanUp() |
|
62 | 242 |
{ |
243 |
delete mListModel; |
|
244 |
mListModel = NULL; |
|
245 |
||
246 |
delete mListView; |
|
247 |
mListView = NULL; |
|
40 | 248 |
|
62 | 249 |
takeWidget(); |
250 |
} |
|
40 | 251 |
|
62 | 252 |
//-------------------------------------------------------------------------------------------------------------------------------------------- |
253 |
//showImage |
|
254 |
//-------------------------------------------------------------------------------------------------------------------------------------------- |
|
255 |
void GlxDetailsView::showImage() |
|
256 |
{ |
|
257 |
QVariant variant = mModel->data(mModel->index(0, 0), GlxFocusIndexRole); |
|
258 |
if (variant.isValid() && variant.canConvert<int> ()) { |
|
259 |
mSelIndex = variant.value<int> (); |
|
40 | 260 |
} |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
261 |
|
62 | 262 |
variant = mModel->data(mModel->index(mSelIndex, 0), GlxFsImageRole); |
263 |
||
264 |
if (variant.isValid() && variant.canConvert<HbIcon> ()) { |
|
265 |
mDetailsIcon->setIcon(variant.value<HbIcon> ()); |
|
266 |
mImageBackGround->setIcon(HbIcon(":/data/details.svg")); |
|
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
267 |
} |
62 | 268 |
} |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
269 |
|
40 | 270 |
//-------------------------------------------------------------------------------------------------------------------------------------------- |
44 | 271 |
//setFavModel |
272 |
//-------------------------------------------------------------------------------------------------------------------------------------------- |
|
273 |
void GlxDetailsView::setFavModel() |
|
274 |
{ |
|
275 |
GlxModelParm modelParm; |
|
62 | 276 |
QString imagePath = (mModel->data(mModel->index(mModel->data(mModel->index(0, 0), |
277 |
GlxFocusIndexRole).value<int> (), 0), GlxUriRole)).value<QString> (); |
|
44 | 278 |
|
52 | 279 |
if (mFavModel == NULL) { |
44 | 280 |
modelParm.setCollection(KGlxCollectionPluginFavoritesAlbumId); |
281 |
modelParm.setContextMode(GlxContextFavorite); |
|
282 |
modelParm.setPath(imagePath); |
|
283 |
mFavModel = new GlxFavMediaModel(modelParm); |
|
52 | 284 |
} |
44 | 285 |
} |
286 |
||
287 |
//-------------------------------------------------------------------------------------------------------------------------------------------- |
|
288 |
//initializeNewModel |
|
289 |
//-------------------------------------------------------------------------------------------------------------------------------------------- |
|
290 |
void GlxDetailsView::initializeNewModel() |
|
52 | 291 |
{ |
44 | 292 |
OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_INITIALIZENEWMODEL, "GlxDetailsView::initializeNewModel" ); |
62 | 293 |
|
52 | 294 |
if (mModel) { |
62 | 295 |
connect(mModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, |
296 |
SLOT(rowsRemoved(QModelIndex,int,int))); |
|
297 |
connect(mModel, SIGNAL( updateDetailsView() ), this, SLOT( refreshDetailsview() )); |
|
298 |
connect(mModel, SIGNAL( destroyed() ), this, SLOT( modelDestroyed() )); |
|
44 | 299 |
} |
52 | 300 |
} |
44 | 301 |
|
302 |
//-------------------------------------------------------------------------------------------------------------------------------------------- |
|
303 |
//clearCurrentModel |
|
304 |
//-------------------------------------------------------------------------------------------------------------------------------------------- |
|
305 |
void GlxDetailsView::clearCurrentModel() |
|
52 | 306 |
{ |
44 | 307 |
OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_CLEARCURRENTMODEL, "GlxDetailsView::clearCurrentModel" ); |
308 |
||
52 | 309 |
if (mModel) { |
62 | 310 |
disconnect(mModel, SIGNAL(rowsRemoved(QModelIndex,int,int)), this, |
311 |
SLOT(rowsRemoved(QModelIndex,int,int))); |
|
312 |
disconnect(mModel, SIGNAL( updateDetailsView() ), this, SLOT( refreshDetailsview() )); |
|
313 |
disconnect(mModel, SIGNAL( destroyed() ), this, SLOT( modelDestroyed() )); |
|
44 | 314 |
mModel = NULL; |
315 |
} |
|
52 | 316 |
} |
44 | 317 |
|
318 |
//-------------------------------------------------------------------------------------------------------------------------------------------- |
|
319 |
//setConnections |
|
320 |
//-------------------------------------------------------------------------------------------------------------------------------------------- |
|
321 |
void GlxDetailsView::setConnections() |
|
52 | 322 |
{ |
62 | 323 |
|
44 | 324 |
connect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, |
62 | 325 |
SLOT(updateLayout(Qt::Orientation))); |
326 |
||
327 |
connect(mShareButton, SIGNAL(clicked()), this, SLOT(launchShareDialog())); |
|
328 |
||
329 |
if (getSubState() != IMAGEVIEWER_DETAIL_S) { |
|
330 |
||
331 |
connect(mFavIcon, SIGNAL(updateFavourites()), this, SLOT(updateFavourites())); |
|
332 |
||
333 |
connect(mFavModel, SIGNAL( dataChanged(QModelIndex,QModelIndex) ), this, |
|
334 |
SLOT( dataChanged(QModelIndex,QModelIndex) )); |
|
335 |
||
336 |
//Connect the signals only in case of details view launched from photos app |
|
337 |
// and dont connect the signals if the details view is launched from MMS,File Manager |
|
338 |
// or other apps. |
|
339 |
connect((mListView->itemPrototypes()).at(0), SIGNAL(signalFromCustomWidget(int)), this, |
|
340 |
SLOT(triggerTheCommand(int))); |
|
341 |
||
50 | 342 |
} |
52 | 343 |
} |
44 | 344 |
|
345 |
//-------------------------------------------------------------------------------------------------------------------------------------------- |
|
346 |
//clearConnections |
|
347 |
//-------------------------------------------------------------------------------------------------------------------------------------------- |
|
348 |
void GlxDetailsView::clearConnections() |
|
52 | 349 |
{ |
62 | 350 |
GLX_LOG_INFO("GlxDetailsView::clearConnections "); |
351 |
||
44 | 352 |
disconnect(mWindow, SIGNAL(orientationChanged(Qt::Orientation)), this, |
62 | 353 |
SLOT(updateLayout(Qt::Orientation))); |
354 |
||
355 |
if (mModel && getSubState() != IMAGEVIEWER_DETAIL_S) { |
|
356 |
||
357 |
disconnect((mListView->itemPrototypes()).at(0), SIGNAL(signalFromCustomWidget(int)), this, |
|
358 |
SLOT(triggerTheCommand(int))); |
|
359 |
||
360 |
disconnect(mShareButton, SIGNAL(released()), this, SLOT(launchShareDialog())); |
|
361 |
||
362 |
disconnect(mFavIcon, SIGNAL(updateFavourites()), this, SLOT(updateFavourites())); |
|
363 |
||
364 |
disconnect(mFavModel, SIGNAL( dataChanged(QModelIndex,QModelIndex) ), this, |
|
365 |
SLOT( dataChanged(QModelIndex,QModelIndex) )); |
|
50 | 366 |
} |
52 | 367 |
} |
44 | 368 |
|
369 |
//-------------------------------------------------------------------------------------------------------------------------------------------- |
|
62 | 370 |
//getSubState |
40 | 371 |
//-------------------------------------------------------------------------------------------------------------------------------------------- |
62 | 372 |
int GlxDetailsView::getSubState() |
373 |
{ |
|
374 |
int substate = NO_DETAIL_S; |
|
375 |
||
376 |
if (mModel) { |
|
377 |
QVariant variant = mModel->data(mModel->index(0, 0), GlxSubStateRole); |
|
378 |
||
379 |
if (variant.isValid() && variant.canConvert<int> ()) { |
|
380 |
substate = variant.value<int> (); |
|
44 | 381 |
} |
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
382 |
} |
62 | 383 |
return substate; |
384 |
} |
|
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
385 |
|
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
386 |
//-------------------------------------------------------------------------------------------------------------------------------------------- |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
387 |
//updateLayout |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
388 |
//-------------------------------------------------------------------------------------------------------------------------------------------- |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
389 |
void GlxDetailsView::updateLayout(Qt::Orientation orient) |
62 | 390 |
{ |
44 | 391 |
GLX_LOG_INFO("GlxDetailsView::updateLayout "); |
392 |
bool loaded = false; |
|
393 |
QString section; |
|
40 | 394 |
|
44 | 395 |
//Load the widgets accroding to the current Orientation |
62 | 396 |
if (orient == Qt::Horizontal) { |
44 | 397 |
section = GLX_DETAILSVIEW_LSSECTION; |
62 | 398 |
} |
399 |
else { |
|
44 | 400 |
section = GLX_DETAILSVIEW_PTSECTION; |
62 | 401 |
} |
40 | 402 |
|
44 | 403 |
//Load the Sections |
404 |
mDocLoader->load(GLX_DETAILSVIEW_DOCMLPATH, section, &loaded); |
|
405 |
||
52 | 406 |
showImage(); |
71 | 407 |
updateGeometry(); |
62 | 408 |
|
44 | 409 |
GLX_LOG_INFO1("GlxDetailsView::updateLayout =%d\n",loaded); |
62 | 410 |
} |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
411 |
|
40 | 412 |
//-------------------------------------------------------------------------------------------------------------------------------------------- |
413 |
//rowsRemoved |
|
414 |
//-------------------------------------------------------------------------------------------------------------------------------------------- |
|
62 | 415 |
void GlxDetailsView::rowsRemoved(const QModelIndex &parent, int start, int end) |
416 |
{ |
|
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
417 |
Q_UNUSED(parent); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
418 |
Q_UNUSED(start); |
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
419 |
Q_UNUSED(end); |
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
420 |
OstTrace0( TRACE_NORMAL, GLXDETAILSVIEW_ROWSREMOVED, "GlxDetailsView::rowsRemoved" ); |
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
421 |
|
62 | 422 |
if (mModel->rowCount() <= 0) { |
44 | 423 |
return emit actionTriggered(EGlxCmdEmptyData); |
23
74c9f037fd5d
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
diff
changeset
|
424 |
} |
24
99ad1390cd33
Revision: 201011
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
23
diff
changeset
|
425 |
|
62 | 426 |
if (start <= mSelIndex && end >= mSelIndex) { |
427 |
return emit actionTriggered(EGlxCmdBack); |
|
428 |
} |
|
429 |
} |
|
430 |
||
431 |
//-------------------------------------------------------------------------------------------------------------------------------------------- |
|
432 |
//modelDestroyed |
|
433 |
//-------------------------------------------------------------------------------------------------------------------------------------------- |
|
52 | 434 |
void GlxDetailsView::modelDestroyed() |
435 |
{ |
|
436 |
mModel = NULL; |
|
437 |
} |
|
438 |
||
44 | 439 |
//-------------------------------------------------------------------------------------------------------------------------------------------- |
40 | 440 |
//dataChanged |
441 |
//-------------------------------------------------------------------------------------------------------------------------------------------- |
|
442 |
void GlxDetailsView::dataChanged(QModelIndex startIndex, QModelIndex endIndex) |
|
62 | 443 |
{ |
44 | 444 |
Q_UNUSED(endIndex); |
445 |
||
446 |
QVariant variant = mFavModel->data(startIndex, GlxFavorites); |
|
62 | 447 |
if (variant.isValid() && variant.canConvert<bool> ()) { |
448 |
if (variant.value<bool> ()) { |
|
52 | 449 |
mFavIcon->setItemIcon(mFavIconEnabled); |
62 | 450 |
} |
451 |
else { |
|
52 | 452 |
mFavIcon->setItemIcon(mFavIconDisabled); |
40 | 453 |
} |
454 |
} |
|
62 | 455 |
} |
456 |
||
457 |
//-------------------------------------------------------------------------------------------------------------------------------------------- |
|
458 |
//refreshDetailsview |
|
459 |
//-------------------------------------------------------------------------------------------------------------------------------------------- |
|
460 |
void GlxDetailsView::refreshDetailsview() |
|
461 |
{ |
|
462 |
GLX_LOG_INFO("GlxDetailsView::refreshDetailsview "); |
|
463 |
mListModel->refreshCustomWidget(); |
|
464 |
} |
|
40 | 465 |
|
466 |
//-------------------------------------------------------------------------------------------------------------------------------------------- |
|
62 | 467 |
//triggerTheCommand |
44 | 468 |
//-------------------------------------------------------------------------------------------------------------------------------------------- |
62 | 469 |
void GlxDetailsView::triggerTheCommand(int row) |
470 |
{ |
|
471 |
GLX_LOG_INFO("GlxDetailsView::triggerTheCommand "); |
|
472 |
||
473 |
if (row == GlxDetailsViewItemProtoType::widgetNameIndex) { |
|
474 |
emit actionTriggered(EGlxCmdRenameFile); |
|
44 | 475 |
} |
62 | 476 |
else { |
477 |
emit actionTriggered(EGlxCmdComment); |
|
478 |
} |
|
479 |
} |
|
44 | 480 |
|
481 |
//-------------------------------------------------------------------------------------------------------------------------------------------- |
|
40 | 482 |
//updateFavourites |
483 |
//-------------------------------------------------------------------------------------------------------------------------------------------- |
|
484 |
void GlxDetailsView::updateFavourites() |
|
62 | 485 |
{ |
44 | 486 |
QVariant variant = mFavModel->data(mFavModel->index(0, 0), GlxFavorites); |
62 | 487 |
if (variant.isValid() && variant.canConvert<bool> ()) { |
488 |
if (variant.value<bool> ()) { |
|
44 | 489 |
emit actionTriggered(EGlxCmdRemoveFromFav); |
62 | 490 |
} |
491 |
else { |
|
40 | 492 |
emit actionTriggered(EGlxCmdAddToFav); |
493 |
} |
|
494 |
} |
|
62 | 495 |
} |
44 | 496 |
|
497 |
//-------------------------------------------------------------------------------------------------------------------------------------------- |
|
62 | 498 |
//launchShareDialog |
44 | 499 |
//-------------------------------------------------------------------------------------------------------------------------------------------- |
62 | 500 |
void GlxDetailsView::launchShareDialog() |
501 |
{ |
|
502 |
GLX_LOG_INFO("GlxDetailsView::launchShareDialog "); |
|
503 |
emit actionTriggered(EGlxCmdSend); |
|
504 |
} |
|
50 | 505 |