51
51
void CShareBox::Init()
53
m_bg_brush.setStyle(Qt::SolidPattern);
54
m_bg_brush.setColor(Qt::black);
56
m_highlight_pen.setColor(QColor(63, 63, 255));
57
m_highlight_pen.setWidth(2);
59
m_text_font.setPixelSize(20);
53
/* Load the background image for the share box and the icon. */
54
m_bg.load(":/images/sharebox.png");
55
m_icon.load(":/images/network.png");
57
/* Set the colors and fonts. */
58
m_text_font.setPixelSize(18);
59
m_text_normal.setRgb(215, 215, 215);
60
m_text_highlight.setRgb(127, 127, 255);
61
m_border_highlight.setRgb(127, 127, 215);
62
64
void CShareBox::Position()
142
144
QPainter painter(this);
143
145
painter.setRenderHint(QPainter::Antialiasing, true);
144
painter.setBrush(m_bg_brush);
146
/* First draw the rectangle without any pen. */
147
painter.setPen(Qt::NoPen);
148
painter.drawRoundedRect(0, 0, 139, 139, 24.0f, 24.0f);
150
/* If we are drawing the highlight, then set the appropriate
151
color and draw the border inside the frame. */
147
/* First draw the background. */
148
painter.drawPixmap(0, 0, 139, 139, m_bg);
150
/* Then draw the blue border if applicable. */
154
painter.setPen(m_highlight_pen);
155
painter.drawRoundedRect(3, 3, 133, 133, 22.0f, 22.0f);
153
painter.setPen(m_border_highlight);
154
painter.drawRoundedRect(6, 6, 127, 127, 4.0f, 4.0f);
158
painter.setPen(QColor(95, 95, 95));
160
/* Draw the caption centered in the text box. */
161
157
painter.setFont(m_text_font);
162
painter.drawText(QRect(0, 0, 139, 139), Qt::AlignHCenter | Qt::AlignVCenter, "Share Box");
159
/* Draw the shadow for the text. */
160
painter.setPen(Qt::black);
161
painter.drawText(QRect(1, 21, 139, 139), Qt::AlignHCenter | Qt::AlignVCenter, "Share Box");
163
/* Draw the actual text. */
164
painter.setPen(m_highlight?m_text_highlight:m_text_normal);
165
painter.drawText(QRect(0, 20, 139, 139), Qt::AlignHCenter | Qt::AlignVCenter, "Share Box");
167
/* Draw the progress bar. */
168
painter.setBrush(QBrush(QColor(63, 63, 63)));
169
painter.drawRoundedRect(14, 110, 114, 10, 5.0f, 5.0f);
171
painter.setPen(Qt::NoPen);
172
painter.setBrush(QBrush(m_text_normal));
173
painter.drawRoundedRect(15, 111, 43, 8, 4.0f, 4.0f);
175
painter.drawPixmap(46, 10, 48, 48, m_icon);