21 #include <hbiconitem.h> |
21 #include <hbiconitem.h> |
22 #include <hbtextitem.h> |
22 #include <hbtextitem.h> |
23 #include <hbfontspec.h> |
23 #include <hbfontspec.h> |
24 #include <hbdeviceprofile.h> |
24 #include <hbdeviceprofile.h> |
25 #include <hbstyleloader.h> |
25 #include <hbstyleloader.h> |
26 #include <hbiconanimationmanager.h> |
|
27 #include <hbiconanimator.h> |
|
28 |
26 |
29 #include "bubbleheadingwidget.h" |
27 #include "bubbleheadingwidget.h" |
30 #include "bubblemanager2.h" |
28 #include "bubblemanager2.h" |
31 #include "bubbleutils.h" |
29 #include "bubbleutils.h" |
32 #include "bubbleheader.h" |
30 #include "bubbleheader.h" |
33 |
31 |
34 BubbleHeadingWidget::BubbleHeadingWidget(QGraphicsItem* item) |
32 BubbleHeadingWidget::BubbleHeadingWidget(QGraphicsItem* item) |
35 : HbWidget(item), mStatusIcon(0), mNumberTypeIcon(0), |
33 : HbWidget(item), mIndicator1(0), mIndicator2(0), |
36 mCipheringIcon(0), mText1(0), mText2(0), mText3(0) |
34 mText1(0), mText2(0), mText3(0) |
37 { |
35 { |
38 createPrimitives(); |
36 createPrimitives(); |
39 |
37 |
40 HbStyleLoader::registerFilePath(":/bubbleheadingwidget.css"); |
38 HbStyleLoader::registerFilePath( |
41 HbStyleLoader::registerFilePath(":/bubbleheadingwidget.widgetml"); |
39 QLatin1String(":/bubbleheadingwidget.css")); |
|
40 HbStyleLoader::registerFilePath( |
|
41 QLatin1String(":/bubbleheadingwidget.widgetml")); |
42 |
42 |
43 // font is update in code, because cli position is changing |
43 // font is update in code, because cli position is changing |
44 mCliFont = new HbFontSpec(HbFontSpec::Primary); |
44 mCliFont = new HbFontSpec(HbFontSpec::Primary); |
45 mTextFont = new HbFontSpec(HbFontSpec::Secondary); |
45 mTextFont = new HbFontSpec(HbFontSpec::Secondary); |
46 |
46 |
47 HbDeviceProfile profile; |
47 HbDeviceProfile profile; |
48 mCliFont->setTextHeight(4*HbDeviceProfile::current().unitValue()); |
48 mCliFont->setTextHeight(4*HbDeviceProfile::current().unitValue()); |
49 mTextFont->setTextHeight(4*HbDeviceProfile::current().unitValue()); |
49 mTextFont->setTextHeight(4*HbDeviceProfile::current().unitValue()); |
50 |
|
51 HbIconAnimationManager *mgr = HbIconAnimationManager::global(); |
|
52 mgr->addDefinitionFile(":/bubble_icon_anim.axml"); |
|
53 } |
50 } |
54 |
51 |
55 BubbleHeadingWidget::~BubbleHeadingWidget() |
52 BubbleHeadingWidget::~BubbleHeadingWidget() |
56 { |
53 { |
57 delete mCliFont; |
54 delete mCliFont; |
77 } |
72 } |
78 |
73 |
79 void BubbleHeadingWidget::createPrimitives() |
74 void BubbleHeadingWidget::createPrimitives() |
80 { |
75 { |
81 mText1 = new HbTextItem(this); |
76 mText1 = new HbTextItem(this); |
82 style()->setItemName( mText1, "text_line_1" ); |
77 style()->setItemName( mText1, QLatin1String("text_line_1")); |
83 |
78 |
84 mText2 = new HbTextItem(this); |
79 mText2 = new HbTextItem(this); |
85 style()->setItemName( mText2, "text_line_2" ); |
80 style()->setItemName( mText2, QLatin1String("text_line_2")); |
86 |
81 |
87 mText3 = new HbTextItem(this); |
82 mText3 = new HbTextItem(this); |
88 style()->setItemName( mText3, "text_line_3" ); |
83 style()->setItemName( mText3, QLatin1String("text_line_3")); |
89 |
84 |
90 //mStatusIcon = new BubbleAnimIconItem(BUBBLE_ICON_ANIM_INTERVAL, this); |
85 mIndicator1 = new HbIconItem(this); |
91 mStatusIcon = new HbIconItem(this); |
86 style()->setItemName( mIndicator1, QLatin1String("indicator_icon_1")); |
92 style()->setItemName( mStatusIcon, "status_icon" ); |
|
93 |
87 |
94 mNumberTypeIcon = new HbIconItem(this); |
88 mIndicator2 = new HbIconItem(this); |
95 style()->setItemName( mNumberTypeIcon, "number_type_icon" ); |
89 style()->setItemName( mIndicator2, QLatin1String("indicator_icon_2")); |
96 |
|
97 mCipheringIcon = new HbIconItem(this); |
|
98 style()->setItemName( mCipheringIcon, "ciphering_icon" ); |
|
99 } |
90 } |
100 |
91 |
101 void BubbleHeadingWidget::updatePrimitives() |
92 void BubbleHeadingWidget::updatePrimitives() |
102 { |
93 { |
103 if (mHeader!=0) { |
94 if (mHeader!=0) { |
104 BubbleUtils::setCallStatusIcon( |
95 BubbleUtils::setIndicators(mHeader->callState(), |
105 mHeader->callState(), mHeader->callFlags(), *mStatusIcon); |
96 mHeader->callFlags(), |
106 |
97 *mIndicator1, |
107 BubbleUtils::setNumberTypeIcon( |
98 *mIndicator2); |
108 mHeader->callState(), mHeader->callFlags(), *mNumberTypeIcon); |
|
109 |
|
110 BubbleUtils::setCipheringIcon( |
|
111 mHeader->callState(), mHeader->callFlags(), *mCipheringIcon); |
|
112 |
99 |
113 // update text lines |
100 // update text lines |
114 int cliLine = 0; |
101 int cliLine = 0; |
115 |
102 |
116 if (lines==3) { |
103 if (lines==3) { |
141 } |
128 } |
142 |
129 |
143 repolish(); |
130 repolish(); |
144 } |
131 } |
145 |
132 |
146 void BubbleHeadingWidget::polishEvent() |
133 void BubbleHeadingWidget::polish(HbStyleParameters ¶ms) |
147 { |
134 { |
|
135 QString layout; |
|
136 |
148 if (lines == 3) { |
137 if (lines == 3) { |
149 setLayout("three_lines"); |
138 layout = QLatin1String("three_lines"); |
150 mText1->setVisible(true); |
139 mText1->setVisible(true); |
151 mText2->setVisible(true); |
140 mText2->setVisible(true); |
152 mText3->setVisible(true); |
141 mText3->setVisible(true); |
153 } else if (lines == 2) { |
142 } else if (lines == 2) { |
154 setLayout("two_lines"); |
143 layout = QLatin1String("two_lines"); |
155 mText1->setVisible(true); |
144 mText1->setVisible(true); |
156 mText2->setVisible(true); |
145 mText2->setVisible(true); |
157 mText3->setVisible(false); |
146 mText3->setVisible(false); |
158 } else if (lines == 1) { |
147 } else if (lines == 1) { |
159 setLayout("one_line"); |
148 layout = QLatin1String("one_line"); |
160 mText1->setVisible(true); |
149 mText1->setVisible(true); |
161 mText2->setVisible(true); |
150 mText2->setVisible(true); |
162 mText3->setVisible(false); |
151 mText3->setVisible(false); |
163 } |
152 } |
164 |
153 |
165 HbWidget::polishEvent(); |
154 if (mIndicator2->isVisible()) { |
|
155 layout.append(QLatin1String("_2")); |
|
156 } else if (mIndicator1->isVisible()) { |
|
157 layout.append(QLatin1String("_1")); |
|
158 } |
|
159 |
|
160 setLayout(layout); |
|
161 |
|
162 HbWidget::polish(params); |
166 } |
163 } |
167 |
164 |
168 int BubbleHeadingWidget::lineCount() const |
165 int BubbleHeadingWidget::lineCount() const |
169 { |
166 { |
170 return lines; |
167 return lines; |