64 connect( this, SIGNAL( stepZoom() ), this, SLOT( animateDoubleTap() ), Qt::QueuedConnection ); |
64 connect( this, SIGNAL( stepZoom() ), this, SLOT( animateDoubleTap() ), Qt::QueuedConnection ); |
65 } |
65 } |
66 |
66 |
67 GlxZoomWidget::~GlxZoomWidget() |
67 GlxZoomWidget::~GlxZoomWidget() |
68 { |
68 { |
69 //disconnect all existing signals |
69 |
70 disconnect(this,SIGNAL( pinchGestureReceived(int) ), this, SLOT( sendDecodeRequest(int) ) ); |
|
71 //AA |
70 //AA |
72 disconnect( this, SIGNAL( stepZoom() ), this, SLOT( animateDoubleTap())); |
71 disconnect( this, SIGNAL( stepZoom() ), this, SLOT( animateDoubleTap())); |
73 //no Null checks required |
72 //no Null checks required |
74 delete mZoomItem; |
73 delete mZoomItem; |
75 // delete mZoomWidget; //as this is a content widegt it will automatically be deleted |
74 // delete mZoomWidget; //as this is a content widegt it will automatically be deleted |
76 delete mBlackBackgroundItem; |
75 delete mBlackBackgroundItem; |
77 //reset the decoder to cancel pending tasks |
76 //reset the decoder to cancel pending tasks |
78 if(mImageDecoder) { |
77 if(mImageDecoder) { |
|
78 resetDecoder(); |
|
79 delete mImageDecoder; |
|
80 } |
|
81 } |
|
82 void GlxZoomWidget::resetDecoder() |
|
83 { |
79 mImageDecoder->resetDecoder(); |
84 mImageDecoder->resetDecoder(); |
80 delete mImageDecoder; |
85 mImageDecodeRequestSend = false; |
81 } |
86 mDecodedImageAvailable = false; |
82 } |
87 } |
83 |
88 |
84 void GlxZoomWidget::setModel (QAbstractItemModel *model) |
89 void GlxZoomWidget::setModel (QAbstractItemModel *model) |
85 { |
90 { |
86 if(model) |
91 if(model) |
111 setZValue(mMinZValue); |
116 setZValue(mMinZValue); |
112 mZoomOngoing = false; |
117 mZoomOngoing = false; |
113 emit zoomWidgetMovedBackground(mFocusIndex); |
118 emit zoomWidgetMovedBackground(mFocusIndex); |
114 //this actually resets the ZoomWidget and decoder |
119 //this actually resets the ZoomWidget and decoder |
115 if(mImageDecoder) { |
120 if(mImageDecoder) { |
116 mImageDecoder->resetDecoder(); |
121 resetDecoder(); |
117 } |
122 } |
118 retreiveFocusedImage(); |
123 retreiveFocusedImage(); |
119 |
124 |
120 } |
125 } |
121 |
126 |
122 void GlxZoomWidget::indexChanged(int index) |
127 void GlxZoomWidget::indexChanged(int index) |
123 { |
128 { |
124 if(mFocusIndex != index) { |
129 if(mFocusIndex != index) { |
125 mImageDecoder->resetDecoder();//reset the decoder first to cancel pending tasks |
130 resetDecoder(); //reset the decoder first to cancel pending tasks |
126 mImageDecodeRequestSend = false; |
|
127 mDecodedImageAvailable = false; |
|
128 retreiveFocusedImage(); //Update mZoomItem with focused Image |
131 retreiveFocusedImage(); //Update mZoomItem with focused Image |
129 } |
132 } |
130 } |
133 } |
131 |
134 |
132 void GlxZoomWidget::cleanUp() |
135 void GlxZoomWidget::cleanUp() |
133 { |
136 { |
|
137 disconnect(this,SIGNAL( pinchGestureReceived(int) ), this, SLOT( sendDecodeRequest(int) ) ); |
134 if(mModel) { |
138 if(mModel) { |
135 disconnect( mModel, SIGNAL( dataChanged(QModelIndex,QModelIndex) ), this, SLOT( dataChanged(QModelIndex,QModelIndex) ) ); |
139 disconnect( mModel, SIGNAL( dataChanged(QModelIndex,QModelIndex) ), this, SLOT( dataChanged(QModelIndex,QModelIndex) ) ); |
136 disconnect( mModel, SIGNAL( destroyed() ), this, SLOT( modelDestroyed() ) ); |
140 disconnect( mModel, SIGNAL( destroyed() ), this, SLOT( modelDestroyed() ) ); |
137 mModel = NULL; |
141 mModel = NULL; |
138 } |
142 } |
139 if(mImageDecoder) { |
143 if(mImageDecoder) { |
140 mImageDecoder->resetDecoder(); |
144 resetDecoder(); |
141 } |
145 } |
142 mZoomItem->setPixmap(QPixmap()); |
146 mZoomItem->setPixmap(QPixmap()); |
143 } |
147 } |
144 |
148 |
145 void GlxZoomWidget::activate() |
149 void GlxZoomWidget::activate() |
220 |
224 |
221 } |
225 } |
222 if (pinchG->state() == Qt::GestureStarted) { |
226 if (pinchG->state() == Qt::GestureStarted) { |
223 emit pinchGestureReceived(mFocusIndex); |
227 emit pinchGestureReceived(mFocusIndex); |
224 //bring the zoom widget to foreground |
228 //bring the zoom widget to foreground |
|
229 if(zValue()!=mMaxZValue) |
|
230 { |
225 setZValue(mMaxZValue); |
231 setZValue(mMaxZValue); |
226 //show the black background |
232 //show the black background |
227 mBlackBackgroundItem->setParentItem(parentItem()); |
233 mBlackBackgroundItem->setParentItem(parentItem()); |
228 mBlackBackgroundItem->setZValue(mMaxZValue - 1); |
234 mBlackBackgroundItem->setZValue(mMaxZValue - 1); |
229 mBlackBackgroundItem->show(); |
235 mBlackBackgroundItem->show(); |
|
236 } |
230 } |
237 } |
231 |
238 |
232 if (pinchG->state() == Qt::GestureFinished) { |
239 if (pinchG->state() == Qt::GestureFinished) { |
233 //For giving a spring effect when user has zoomed more than normal. |
240 //For giving a spring effect when user has zoomed more than normal. |
234 if(mStepCurrentSize.width() > mMaxScaleDecSize.width()) { |
241 if(mStepCurrentSize.width() > mMaxScaleDecSize.width()) { |