67 else { |
65 else { |
68 drawer.setFrameGraphicsName("qtg_fr_progbar_v_mask"); |
66 drawer.setFrameGraphicsName("qtg_fr_progbar_v_mask"); |
69 drawer.setFrameType(HbFrameDrawer::ThreePiecesVertical); |
67 drawer.setFrameType(HbFrameDrawer::ThreePiecesVertical); |
70 } |
68 } |
71 drawer.setFillWholeRect(true); |
69 drawer.setFillWholeRect(true); |
72 if (m_mask) |
70 m_mask.reset(new QPixmap(m_target->rect().size())); |
73 delete m_mask; |
|
74 m_mask = new QPixmap(m_target->rect().size()); |
|
75 m_mask->fill(Qt::transparent); |
71 m_mask->fill(Qt::transparent); |
76 QPainter p(m_mask); |
72 QPainter p(m_mask.data()); |
77 drawer.paint(&p, m_target->rect()); |
73 drawer.paint(&p, m_target->rect()); |
78 p.end(); |
74 p.end(); |
79 |
75 |
80 //Create animated icon |
76 //Create animated icon |
81 QString iconName; |
77 QString iconName; |
90 default: |
86 default: |
91 break; |
87 break; |
92 } |
88 } |
93 |
89 |
94 if (!iconName.isNull() && !m_target->rect().isEmpty()) { |
90 if (!iconName.isNull() && !m_target->rect().isEmpty()) { |
95 HbIcon* icon = q_check_ptr(new HbIcon(iconName)); |
91 HbIcon* icon = new HbIcon(iconName); |
96 if(orientation == Qt::Horizontal) |
92 if(orientation == Qt::Horizontal) |
97 icon->setSize(QSize(icon->width(), m_target->rect().height())); |
93 icon->setSize(QSize(icon->width(), m_target->rect().height())); |
98 else |
94 else |
99 icon->setSize(QSize(m_target->rect().width(), icon->height())); |
95 icon->setSize(QSize(m_target->rect().width(), icon->height())); |
100 |
96 |
101 const qreal rectWidth = m_target->rect().width(); |
97 const qreal rectWidth = m_target->rect().width(); |
102 const qreal iconWidth = icon->width(); |
98 const qreal iconWidth = icon->width(); |
103 const qreal rectHeight = m_target->rect().height(); |
99 const qreal rectHeight = m_target->rect().height(); |
104 const qreal iconHeight = icon->height(); |
100 const qreal iconHeight = icon->height(); |
105 |
101 |
106 if (m_animationIcon) |
|
107 delete m_animationIcon; |
|
108 |
|
109 const int animationWidth = (orientation == Qt::Horizontal) ? int(rectWidth + iconWidth) : int(rectWidth); |
102 const int animationWidth = (orientation == Qt::Horizontal) ? int(rectWidth + iconWidth) : int(rectWidth); |
110 const int animationHeight = (orientation == Qt::Horizontal) ? int(rectHeight) : int(rectHeight + iconHeight); |
103 const int animationHeight = (orientation == Qt::Horizontal) ? int(rectHeight) : int(rectHeight + iconHeight); |
111 |
104 |
112 m_animationIcon = q_check_ptr(new QPixmap(animationWidth, animationHeight)); |
105 m_animationIcon.reset(new QPixmap(animationWidth, animationHeight)); |
113 m_animationIcon->fill(Qt::transparent); |
106 m_animationIcon->fill(Qt::transparent); |
114 QPainter p(m_animationIcon); |
107 QPainter p(m_animationIcon.data()); |
115 |
108 |
116 if (orientation == Qt::Horizontal) { |
109 if (orientation == Qt::Horizontal) { |
117 if (iconWidth > 0) |
110 if (iconWidth > 0) |
118 for (qreal i = 0 ; i < (rectWidth + iconWidth); i += iconWidth) |
111 for (qreal i = 0 ; i < (rectWidth + iconWidth); i += iconWidth) |
119 icon->paint(&p, QRectF(i, 0, iconWidth, iconHeight), Qt::IgnoreAspectRatio, Qt::AlignCenter, QIcon::Normal, QIcon::On); |
112 icon->paint(&p, QRectF(i, 0, iconWidth, iconHeight), Qt::IgnoreAspectRatio, Qt::AlignCenter, QIcon::Normal, QIcon::On); |