summaryrefslogtreecommitdiff
authorsimon <simon>2002-12-11 18:25:17 (UTC)
committer simon <simon>2002-12-11 18:25:17 (UTC)
commitf3d21af83a2846d1c20fc845cf88329ff1f2b1a9 (patch) (side-by-side diff)
tree2187152e0aa3c121c833d15060ab1aedcfae0a36
parentd9a6575f931b288086da701c3094b475c73d2efc (diff)
downloadopie-f3d21af83a2846d1c20fc845cf88329ff1f2b1a9.zip
opie-f3d21af83a2846d1c20fc845cf88329ff1f2b1a9.tar.gz
opie-f3d21af83a2846d1c20fc845cf88329ff1f2b1a9.tar.bz2
QBusyBar::~QBusyBar ( )
{ + delete [] m_fadecols;
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/unsupported/qpdf/qbusybar.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/noncore/unsupported/qpdf/qbusybar.cpp b/noncore/unsupported/qpdf/qbusybar.cpp
index f5c62fa..ce7ab8e 100644
--- a/noncore/unsupported/qpdf/qbusybar.cpp
+++ b/noncore/unsupported/qpdf/qbusybar.cpp
@@ -8,96 +8,97 @@
QBusyBar::QBusyBar ( QWidget *parent, const char *name, int flags ) : QWidget ( parent, name, flags | WRepaintNoErase )
{
m_busy = 0;
m_div = 0;
m_pos = 0;
m_fade = 0;
m_fadecols = 0;
m_speed = 500;
m_timer = new QTimer ( this );
connect ( m_timer, SIGNAL( timeout ( )), this, SLOT( slotTimeout ( )));
setParameters ( 12, 8, 200 );
}
void QBusyBar::setParameters ( int d, int s, int v )
{
bool running = m_timer-> isActive ( );
if ( running )
m_timer-> stop ( );
m_div = d;
m_speed = v;
delete [] m_fadecols;
m_fade = s;
m_fadecols = new QColor [m_fade];
int rt, gt, bt;
int rf, gf, bf;
colorGroup ( ). color ( QColorGroup::Highlight ). rgb ( &rf, &gf, &bf );
colorGroup ( ). color ( QColorGroup::Background ). rgb ( &rt, &gt, &bt );
for ( int i = 0; i < s; i++ )
m_fadecols [i]. setRgb ( rf + ( rt - rf ) * i / s, gf + ( gt - gf ) * i / s, bf + ( bt - bf ) * i / s );
if ( running ) {
m_pos = 0;
m_timer-> start ( m_speed );
}
}
QBusyBar::~QBusyBar ( )
{
+ delete [] m_fadecols;
}
bool QBusyBar::isBusy ( ) const
{
return m_busy;
}
void QBusyBar::beginBusy ( )
{
setBusy ( true );
}
void QBusyBar::endBusy ( )
{
setBusy ( false );
}
void QBusyBar::setBusy ( bool b )
{
int busy = m_busy + ( b ? 1 : -1 );
if ( busy < 0 )
busy = 0;
if (( m_busy == 0 ) && ( busy > 0 )) { // Changed state to on
m_pos = 0;
m_timer-> start ( m_speed );
update ( );
}
else if (( m_busy > 0 ) && ( busy == 0 )) { // Changed state to off
m_timer-> stop ( );
update ( );
}
m_busy = busy;
}
void QBusyBar::slotTimeout ( )
{
m_pos++;
m_pos %= ( 2 * ( m_fade + m_div ));
update ( );
}
void QBusyBar::paintEvent ( QPaintEvent *e )
{
QPainter p ( this );