@@ -46,7 +46,6 @@ namespace hal {
4646 BusyIndicator::BusyIndicator (QWidget* parent)
4747 : AbstractBusyIndicator(parent)
4848 {
49- mMutex = new QMutex;
5049 QVBoxLayout* layout = new QVBoxLayout (this );
5150 layout->setAlignment (Qt::AlignHCenter);
5251 layout->addWidget (mLabel = new QLabel (this ));
@@ -61,32 +60,23 @@ namespace hal {
6160 BusyIndicator::~BusyIndicator ()
6261 {
6362 mTimer ->stop ();
64- delete mMutex ;
6563 }
6664
6765 BusyAnimation::BusyAnimation (QWidget* parent)
68- : QWidget(parent), mImage (QImage(" :/icons/hal9000" ," PNG" )), mAngle (0 ), mMutex ( new QMutex)
66+ : QWidget(parent), mImage (QImage(" :/icons/hal9000" ," PNG" )), mAngle (0 )
6967 {;}
7068
71- BusyAnimation::~BusyAnimation ()
72- {
73- delete mMutex ;
74- }
75-
7669 void BusyAnimation::handleTimeout ()
7770 {
7871 mAngle += 5 ;
7972 update ();
80- qApp->processEvents ();
8173 }
8274
8375 void BusyAnimation::paintEvent (QPaintEvent* event)
8476 {
8577 Q_UNUSED (event);
86- if (mMutex ->try_lock ())
87- {
88- QPainter p (this );
89- p.setRenderHint (QPainter::Antialiasing);
78+ QPainter p (this );
79+ p.setRenderHint (QPainter::Antialiasing);
9080
9181 int rw = rect ().width ();
9282 int rh = rect ().height ();
@@ -116,25 +106,20 @@ namespace hal {
116106 }
117107 }
118108
119- p.drawImage (rimg,img);
120- mMutex ->unlock ();
121- }
109+ p.drawImage (rimg,img);
122110 }
123111
124112 void BusyIndicator::setValue (int percent)
125113 {
126- if (mProgressBar ->value () == percent) return ; // nothing to do
127- QMutexLocker lock (mMutex );
114+ if (mProgressBar ->value () == percent) return ;
128115 mProgressBar ->setValue (percent);
129116 update ();
130- qApp->processEvents ();
131117 }
132118
133119 void BusyIndicator::setText (const QString &txt)
134120 {
135- if (mLabel ->text () == txt) return ; // nothing to do
136- QMutexLocker lock (mMutex );
121+ if (mLabel ->text () == txt) return ;
137122 mLabel ->setText (txt);
138- qApp-> processEvents ();
123+ update ();
139124 }
140125}
0 commit comments