|
1 /*! |
|
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 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: BubbleManager widget. |
|
15 * |
|
16 */ |
|
17 |
|
18 // Bubble widget API |
|
19 |
|
20 #ifndef BUBBLEMANAGER2_H |
|
21 #define BUBBLEMANAGER2_H |
|
22 |
|
23 #include <QtCore> |
|
24 #include <hbwidget.h> |
|
25 #include "bubblemanagerif.h" |
|
26 |
|
27 #ifdef BUILD_BUBBLEMANAGER |
|
28 #define BUBBLEMANAGER_EXPORT Q_DECL_EXPORT |
|
29 #else |
|
30 #define BUBBLEMANAGER_EXPORT Q_DECL_IMPORT |
|
31 #endif |
|
32 |
|
33 class BubbleHeader; |
|
34 class BubbleConferenceHeader; |
|
35 class BubbleWidgetManager; |
|
36 class BubbleImageManager; |
|
37 class HbAction; |
|
38 class HbStackedLayout; |
|
39 class BubbleHandler; |
|
40 class BubbleEffectHandler; |
|
41 |
|
42 static const int BUBBLE_MAX_CALL_COUNT = 7; |
|
43 static const int BUBBLE_CONF_CALL_ID = 10; |
|
44 |
|
45 class BUBBLEMANAGER_EXPORT BubbleManager : public HbWidget, public BubbleManagerIF |
|
46 { |
|
47 Q_OBJECT |
|
48 |
|
49 public: |
|
50 explicit BubbleManager( QGraphicsItem *parent = 0 ); |
|
51 ~BubbleManager(); |
|
52 |
|
53 public: |
|
54 |
|
55 // ==================================================== |
|
56 // Must surround all the changes: |
|
57 // ==================================================== |
|
58 // |
|
59 |
|
60 /** |
|
61 * Before making any changes to bubble headers, call this function |
|
62 * so that manager can prapare for them properly. |
|
63 */ |
|
64 void startChanges(); |
|
65 |
|
66 /** |
|
67 * After the changes to bubble headers call this function so manager |
|
68 * can prepare bubbles to right places and check the drawing order. |
|
69 * Memory for arrays has been allocated beforehand. |
|
70 */ |
|
71 void endChanges(); |
|
72 |
|
73 |
|
74 // ==================================================== |
|
75 // For call headers and some for conference call |
|
76 // ==================================================== |
|
77 // |
|
78 |
|
79 /** |
|
80 * Takes a new call header in use. |
|
81 * Returns bubble idenfication number. |
|
82 */ |
|
83 int createCallHeader(); |
|
84 |
|
85 /** |
|
86 * Removes call header from use |
|
87 */ |
|
88 void removeCallHeader( int bubbleId ); |
|
89 |
|
90 /** |
|
91 * Sets call state to header. |
|
92 */ |
|
93 void setState( int bubbleId, |
|
94 PhoneCallState state ); |
|
95 |
|
96 /** |
|
97 * Sets text label to header. For conf also. |
|
98 * Text to be seen in bubble ( e.g. 'on hold' ) |
|
99 */ |
|
100 void setLabel( |
|
101 int bubbleId, |
|
102 const QString& text, |
|
103 Qt::TextElideMode clipDirection = Qt::ElideRight ); |
|
104 |
|
105 /** |
|
106 * Sets caller's line identification ( name or number) to header. |
|
107 * For conf also. Caller's CLI ( e.g. 'Mother' ) |
|
108 */ |
|
109 void setCli( int bubbleId, |
|
110 const QString& cliText, |
|
111 Qt::TextElideMode clipDirection ); |
|
112 |
|
113 /** |
|
114 * Updates caller's line identification ( name or number) to header. |
|
115 * Caller's CLI ( e.g. 'Daddy' )- |
|
116 */ |
|
117 void updateCLI( |
|
118 int bubbleId, |
|
119 const QString& cliText, |
|
120 Qt::TextElideMode clipDirection ); |
|
121 |
|
122 /** |
|
123 * Number or voip adress, when phonebook name takes Cli. |
|
124 */ |
|
125 void setSecondaryCli( |
|
126 int bubbleId, |
|
127 const QString& cliText, |
|
128 Qt::TextElideMode clipDirection = Qt::ElideLeft ); |
|
129 |
|
130 |
|
131 /** |
|
132 * Sets call time or cost text to header. For conf also. |
|
133 */ |
|
134 void setCallTime( |
|
135 int bubbleId, |
|
136 const QString& callTime ); |
|
137 |
|
138 /** |
|
139 * Updates call time or cost text to header. For conf also. |
|
140 * Timer or cost text ( e.g. '00:12:34' or '£01.23' ). |
|
141 */ |
|
142 void updateCallTime( |
|
143 int bubbleId, |
|
144 const QString& callTime ); |
|
145 |
|
146 /** |
|
147 * Attach a call image to header. |
|
148 */ |
|
149 void setCallObjectImage( int bubbleId, |
|
150 const QString& fileName ); |
|
151 |
|
152 /** |
|
153 * Attach the theme call image to header. |
|
154 */ |
|
155 void setCallObjectFromTheme( int bubbleId ); |
|
156 |
|
157 /** |
|
158 * Sets call flags to header. |
|
159 */ |
|
160 void setCallFlags( |
|
161 int bubbleId, |
|
162 int flags ); |
|
163 |
|
164 /** |
|
165 * Sets call flags to header. |
|
166 */ |
|
167 void setCallFlag( int bubbleId, |
|
168 PhoneCallFlags flag, |
|
169 bool set ); |
|
170 |
|
171 /** |
|
172 * Sets number type. |
|
173 */ |
|
174 void setNumberType( int bubbleId, |
|
175 PhoneNumberType type ); |
|
176 |
|
177 // ==================================================== |
|
178 // For all bubbles |
|
179 // ==================================================== |
|
180 // |
|
181 |
|
182 /** |
|
183 * Sets phone muted/unmuted. |
|
184 * @param aIsMuted ETrue if phone is muted. |
|
185 */ |
|
186 void setPhoneMuted( bool muted = true ); |
|
187 |
|
188 |
|
189 // ==================================================== |
|
190 // For conference call |
|
191 // ==================================================== |
|
192 // |
|
193 |
|
194 /** |
|
195 * Creates a conference call based upon two calls. Bubbles must be |
|
196 * created first. |
|
197 */ |
|
198 int createConference( int bubble1, |
|
199 int bubble2 ); |
|
200 |
|
201 /** |
|
202 * Splits conference call into invidual two calls. Call headers stays |
|
203 * in use. Headers' state will not be changed. |
|
204 */ |
|
205 void removeConference(); |
|
206 |
|
207 /** |
|
208 * Adds new call to conference call. |
|
209 */ |
|
210 void addRowToConference( int bubbleId ); |
|
211 |
|
212 /** |
|
213 * Takes specified call out of conference. Use RemoveConference if |
|
214 * conference has only two calls in it. Header's state is same as |
|
215 * before adding it to conference (if not changed inside the conf). |
|
216 */ |
|
217 void removeRowFromConference( int bubbleId ); |
|
218 |
|
219 /** |
|
220 * Counts calls in conference call. |
|
221 */ |
|
222 int conferenceRowCount() const; |
|
223 |
|
224 /** |
|
225 * Sets highlight to specified line in conference. |
|
226 */ |
|
227 void setSelectionInConference( int rowNumber ); |
|
228 |
|
229 /** |
|
230 * Sets highlight to specified bubble id in conference. |
|
231 */ |
|
232 void setSelectionIdInConference( int bubbleId ); |
|
233 |
|
234 /** |
|
235 * Gets highlighted item in conference. |
|
236 */ |
|
237 int selectionInConference() const; |
|
238 |
|
239 /** |
|
240 * Gets highlighted item in conference. |
|
241 */ |
|
242 int selectionIdInConference() const; |
|
243 |
|
244 /** |
|
245 * Moves highligh one up if possible |
|
246 */ |
|
247 void moveHighlightOneUpInConference(); |
|
248 |
|
249 /** |
|
250 * Moves highligh one down if possible |
|
251 */ |
|
252 void moveHighlightOneDownInConference(); |
|
253 |
|
254 /** |
|
255 * Use this function to expand or shrink conference bubble. |
|
256 */ |
|
257 void setExpandedConferenceCallHeader( |
|
258 bool expanded = true ); |
|
259 |
|
260 /** |
|
261 * Query: is conference expanded? |
|
262 */ |
|
263 bool isConferenceExpanded( ) const; |
|
264 |
|
265 /** |
|
266 * Number of headers shown on the screen. |
|
267 */ |
|
268 int shownHeaderCount() const; |
|
269 |
|
270 /** |
|
271 * Set CLI used in participant list (text or phonenumber). |
|
272 */ |
|
273 void setParticipantListCli( |
|
274 int aBubbleId, |
|
275 ParticipantListCli aParticipantCli ); |
|
276 |
|
277 |
|
278 // ==================================================== |
|
279 // Call bubble actions |
|
280 // ==================================================== |
|
281 // |
|
282 |
|
283 /** |
|
284 * Appends new action to call bubble |
|
285 */ |
|
286 void addAction ( int bubbleId, HbAction* action ); |
|
287 |
|
288 /** |
|
289 * Removes all actions from call bubble |
|
290 */ |
|
291 void clearActions( int bubbleId ); |
|
292 |
|
293 /** |
|
294 * Gets graphics widget for action |
|
295 */ |
|
296 QGraphicsWidget* graphicsWidgetForAction( |
|
297 HbAction* action ) const; |
|
298 |
|
299 /** |
|
300 * Appends new action to participant list in conference call bubble. |
|
301 */ |
|
302 void addParticipantListAction(HbAction *action); |
|
303 |
|
304 /** |
|
305 * Removes participant list actions from conference call bubble. |
|
306 */ |
|
307 void clearParticipantListActions(); |
|
308 |
|
309 |
|
310 // ==================================================== |
|
311 // Bubble state related (multicall) |
|
312 // ==================================================== |
|
313 // |
|
314 |
|
315 /** |
|
316 * Bubble shown in expanded position. |
|
317 */ |
|
318 int expandedBubble() const; |
|
319 |
|
320 /** |
|
321 * Sets action that is triggered when user taps collapsed |
|
322 * call bubble and it changes to expanded. Setting null |
|
323 * pointer removes expand action. |
|
324 */ |
|
325 void setExpandAction(int bubbleId, HbAction* action); |
|
326 |
|
327 /** |
|
328 * Bubble state (expanded/collapsed) cannot be changed when |
|
329 * disabled is set true. |
|
330 */ |
|
331 void setBubbleSelectionDisabled(bool disabled); |
|
332 |
|
333 public slots: |
|
334 void handleOrientationChange(Qt::Orientation orientation); |
|
335 |
|
336 private: |
|
337 QGraphicsWidget* selectView(); |
|
338 bool addToLayout(QGraphicsWidget* widget); |
|
339 void removeFromLayout(QGraphicsWidget* widget); |
|
340 void connectSignals(QGraphicsWidget* widget); |
|
341 void setViewData(QGraphicsWidget* view); |
|
342 |
|
343 bool findActiveHeader(int bubbleId, BubbleHeader*& header); |
|
344 void findNextDrawableHeader(int& index) const; |
|
345 void polishEvent(); |
|
346 void releaseImageIfNotUsed(const QString& imageFileName); |
|
347 void releaseNonCachedViews(); |
|
348 |
|
349 private slots: |
|
350 void showExpanded( int bubbleId ); |
|
351 |
|
352 private: |
|
353 QVector<BubbleHeader*> mCallHeaders; |
|
354 BubbleConferenceHeader* mConferenceHeader; |
|
355 QVector<BubbleHeader*> mActiveHeaders; |
|
356 QVector<BubbleHandler*> mActiveHandlers; |
|
357 |
|
358 int mIsReadyToDraw; |
|
359 bool mMuted; |
|
360 QGraphicsWidget* mMutedIcon; |
|
361 bool mSortHeaders; |
|
362 BubbleWidgetManager* mWidgetManager; |
|
363 BubbleImageManager* mBubbleImageManager; |
|
364 HbStackedLayout* mMainLayout; |
|
365 bool mInitialized; |
|
366 bool mBubbleSelectionDisabled; |
|
367 BubbleEffectHandler* mEffectHandler; |
|
368 }; |
|
369 |
|
370 #endif /* BUBBLEMANAGER2_H */ |
|
371 |
|
372 |
|
373 |
|
374 |
|
375 |
|
376 |
|
377 |
|
378 |
|
379 |
|
380 |
|
381 |
|
382 |
|
383 |
|
384 |
|
385 |
|
386 |
|
387 |
|
388 |
|
389 |