13 * |
13 * |
14 * Description: Conference call bubble handler. |
14 * Description: Conference call bubble handler. |
15 * |
15 * |
16 */ |
16 */ |
17 |
17 |
18 #include <QtGui> |
18 #include <QTimer> |
|
19 |
19 #include <hbaction.h> |
20 #include <hbaction.h> |
20 #include <hbtextitem.h> |
21 #include <hbtextitem.h> |
21 #include <hblabel.h> |
22 #include <hblabel.h> |
22 #include <hblistview.h> |
23 #include <hblistview.h> |
23 #include <hbcolorscheme.h> |
|
24 |
24 |
25 #include "bubblemanager2.h" |
25 #include "bubblemanager2.h" |
26 #include "bubbleconferencehandler.h" |
26 #include "bubbleconferencehandler.h" |
27 #include "bubbleconferenceheader.h" |
27 #include "bubbleconferenceheader.h" |
28 #include "bubbleutils.h" |
28 #include "bubbleutils.h" |
29 #include "bubbleparticipantlistitem.h" |
29 #include "bubbleparticipantlistitem.h" |
30 #include "bubbleparticipantlistmodel.h" |
30 #include "bubbleparticipantlistmodel.h" |
31 #include "bubblebutton.h" |
31 #include "bubblebutton.h" |
|
32 #include "bubbleheadingwidget.h" |
32 |
33 |
33 static const int BUBBLE_SELECTION_TIMEOUT = 3000; |
34 static const int BUBBLE_SELECTION_TIMEOUT = 3000; |
34 |
35 |
35 BubbleConferenceHandler::BubbleConferenceHandler( |
36 BubbleConferenceHandler::BubbleConferenceHandler( |
36 BubbleWidgetManager& widgetManager, |
37 BubbleWidgetManager& widgetManager, |
37 BubbleWidgetManager::View view, |
38 BubbleWidgetManager::View view, |
38 BubbleWidgetManager::Container container, |
39 BubbleWidgetManager::Container container, |
39 QObject* parent ) |
40 QObject* parent ) |
40 : BubbleHandler(widgetManager,view,container,parent) |
41 : BubbleHandler(widgetManager,view,container,parent) |
41 { |
42 { |
42 mTimerLabel = |
43 mHeading = |
43 qobject_cast<HbLabel*>(widget(BubbleWidgetManager::ConferenceTimer)); |
44 qobject_cast<BubbleHeadingWidget*>(widget(BubbleWidgetManager::Heading)); |
44 Q_ASSERT(mTimerLabel); |
45 Q_ASSERT(mHeading); |
45 HbDeviceProfile profile; |
|
46 HbFontSpec spec(HbFontSpec::Secondary); |
|
47 spec.setTextHeight(4*HbDeviceProfile::current().unitValue()); |
|
48 mTimerLabel->setFontSpec(spec); |
|
49 mTimerLabel->setAlignment(Qt::AlignLeft); |
|
50 |
46 |
51 mButtonCenter = |
47 mButtonCenter = |
52 qobject_cast<BubbleButton*>(widget(BubbleWidgetManager::CenterButton)); |
48 qobject_cast<BubbleButton*>(widget(BubbleWidgetManager::CenterButton)); |
53 Q_ASSERT(mButtonCenter); |
49 Q_ASSERT(mButtonCenter); |
54 mButtonLeft = |
50 mButtonLeft = |
61 mList = |
57 mList = |
62 qobject_cast<HbListView*>(widget(BubbleWidgetManager::ParticipantList)); |
58 qobject_cast<HbListView*>(widget(BubbleWidgetManager::ParticipantList)); |
63 Q_ASSERT(mList); |
59 Q_ASSERT(mList); |
64 mModel = new BubbleParticipantListModel(); |
60 mModel = new BubbleParticipantListModel(); |
65 mList->setModel(mModel); |
61 mList->setModel(mModel); |
|
62 |
|
63 HbAbstractItemView::ItemAnimations noCreationAndRemovalAnimations = HbAbstractItemView::All; |
|
64 noCreationAndRemovalAnimations ^= HbAbstractItemView::Appear; |
|
65 noCreationAndRemovalAnimations ^= HbAbstractItemView::Disappear; |
|
66 mList->setEnabledAnimations(noCreationAndRemovalAnimations); |
66 |
67 |
67 mPrototype = |
68 mPrototype = |
68 qobject_cast<BubbleParticipantListItem*>( |
69 qobject_cast<BubbleParticipantListItem*>( |
69 widgetManager.createParticipantListItem()); |
70 widgetManager.createParticipantListItem()); |
70 Q_ASSERT(mPrototype); |
71 Q_ASSERT(mPrototype); |
123 participant->cli(), |
124 participant->cli(), |
124 (int)participant->callState(), |
125 (int)participant->callState(), |
125 !(mHeader->callFlags()&BubbleManagerIF::NoCiphering)); |
126 !(mHeader->callFlags()&BubbleManagerIF::NoCiphering)); |
126 } |
127 } |
127 |
128 |
128 if (header.timerCost().length()) { |
129 mHeading->readBubbleHeader(header); |
129 QColor color; |
|
130 color = HbColorScheme::color("list_item_title_normal"); |
|
131 if (color.isValid()) { |
|
132 mTimerLabel->setTextColor(color); |
|
133 } |
|
134 mTimerLabel->setPlainText(header.timerCost()); |
|
135 mTimerLabel->show(); |
|
136 } |
|
137 |
130 |
138 setButtons(mHeader->actions()); |
131 setButtons(mHeader->actions()); |
139 |
132 |
140 clearSelection(); |
133 clearSelection(); |
141 } |
134 } |
145 if ( actions.count()==1 && mButtonCenter ) { |
138 if ( actions.count()==1 && mButtonCenter ) { |
146 HbAction* action = actions.at(0); |
139 HbAction* action = actions.at(0); |
147 mButtonCenter->setIcon( action->icon() ); |
140 mButtonCenter->setIcon( action->icon() ); |
148 BubbleUtils::setButtonStyleForAction(*mButtonCenter,*action); |
141 BubbleUtils::setButtonStyleForAction(*mButtonCenter,*action); |
149 connect(mButtonCenter, SIGNAL( clicked() ), |
142 connect(mButtonCenter, SIGNAL( clicked() ), |
|
143 action, SLOT( trigger() ) ); |
|
144 connect(mButtonCenter, SIGNAL( longPress(QPointF)), |
150 action, SLOT( trigger() ) ); |
145 action, SLOT( trigger() ) ); |
151 mButtonCenter->show(); |
146 mButtonCenter->show(); |
152 } else if (actions.count()==2 && mButtonLeft && mButtonRight ) { |
147 } else if (actions.count()==2 && mButtonLeft && mButtonRight ) { |
153 // Left button |
148 // Left button |
154 HbAction* action1 = actions.at(0); |
149 HbAction* action1 = actions.at(0); |
155 mButtonLeft->setIcon( action1->icon() ); |
150 mButtonLeft->setIcon( action1->icon() ); |
156 BubbleUtils::setButtonStyleForAction(*mButtonLeft,*action1); |
151 BubbleUtils::setButtonStyleForAction(*mButtonLeft,*action1); |
157 connect( mButtonLeft, SIGNAL( clicked() ), |
152 connect( mButtonLeft, SIGNAL( clicked() ), |
158 action1, SLOT( trigger() ) ); |
153 action1, SLOT( trigger() ) ); |
|
154 connect(mButtonLeft, SIGNAL( longPress(QPointF)), |
|
155 action1, SLOT( trigger() ) ); |
159 mButtonLeft->show(); |
156 mButtonLeft->show(); |
160 // Right button |
157 // Right button |
161 HbAction* action2 = actions.at(1); |
158 HbAction* action2 = actions.at(1); |
162 mButtonRight->setIcon( action2->icon() ); |
159 mButtonRight->setIcon( action2->icon() ); |
163 BubbleUtils::setButtonStyleForAction(*mButtonRight,*action2); |
160 BubbleUtils::setButtonStyleForAction(*mButtonRight,*action2); |
164 connect( mButtonRight, SIGNAL( clicked() ), |
161 connect( mButtonRight, SIGNAL( clicked() ), |
165 action2, SLOT( trigger() ) ); |
162 action2, SLOT( trigger() ) ); |
|
163 connect(mButtonRight, SIGNAL( longPress(QPointF)), |
|
164 action2, SLOT( trigger() ) ); |
166 mButtonRight->show(); |
165 mButtonRight->show(); |
167 } |
166 } |
168 } |
167 } |
169 |
168 |
170 QGraphicsWidget* BubbleConferenceHandler::graphicsWidgetForAction( |
169 QGraphicsWidget* BubbleConferenceHandler::graphicsWidgetForAction( |