1
/****************************************************************************
2
** busywidget.cpp - cool animating widget
3
** Copyright (C) 2001, 2002 Justin Karneges
5
** This program is free software; you can redistribute it and/or
6
** modify it under the terms of the GNU General Public License
7
** as published by the Free Software Foundation; either version 2
8
** of the License, or (at your option) any later version.
10
** This program is distributed in the hope that it will be useful,
11
** but WITHOUT ANY WARRANTY; without even the implied warranty of
12
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
** GNU General Public License for more details.
15
** You should have received a copy of the GNU General Public License
16
** along with this program; if not, write to the Free Software
17
** Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
19
****************************************************************************/
21
#include"busywidget.h"
24
BusyWidget::BusyWidget(QWidget *parent, const char *name)
25
:QWidget(parent, name)
35
setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
40
void BusyWidget::start()
47
connect(t, SIGNAL(timeout()), SLOT(animate()));
51
void BusyWidget::stop()
64
void BusyWidget::animate()
74
void BusyWidget::paintEvent(QPaintEvent *)
79
void BusyWidget::resizeEvent(QResizeEvent *)
84
void BusyWidget::render()
87
p.drawPixmap(0,0, pix);
90
void BusyWidget::renderPixmap()
92
pix.resize(width(), height());
96
p.setPen(v_isActive ? QColor("#FF00FF") : (Qt::gray));
99
int rep = width() / 12;
100
for(int n = -1; n < rep+1; ++n) {
102
for(int n2 = 0; n2 < 4; ++n2) {
103
p.drawLine(x+n2, 0, x+n2 + 8, a);
104
p.drawLine(x+n2, y-1, x+n2 + 8, a);
109
p.drawRect(0, 0, width(), height());