changeset 216:3045ced14a59

modify the animation in the WaitingWidget class
author benoitrigolleau
date Thu, 07 Feb 2008 15:15:52 +0000
parents a10eb984374f
children c24fafc45d50
files widgets/QueryResultsWidget.cpp widgets/WaitingWidget.cpp widgets/WaitingWidget.h
diffstat 3 files changed, 30 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/widgets/QueryResultsWidget.cpp	Wed Feb 06 16:45:36 2008 +0000
+++ b/widgets/QueryResultsWidget.cpp	Thu Feb 07 15:15:52 2008 +0000
@@ -207,6 +207,7 @@
 
 	labelTitleArtist->setToolTip(title);
 	connect(labelTitleArtist, SIGNAL(linkActivated(QString)), MainWindow::instance(), SLOT(importEasaierFile(QString)));
+	connect(labelTitleArtist, SIGNAL(linkActivated(QString)), MainWindow::instance(), SLOT(lockWindow()));
 	m_resultsLayout->addWidget(labelTitleArtist,m_currentRow,4,1,1);
 
 	//add the confidence
--- a/widgets/WaitingWidget.cpp	Wed Feb 06 16:45:36 2008 +0000
+++ b/widgets/WaitingWidget.cpp	Thu Feb 07 15:15:52 2008 +0000
@@ -20,6 +20,14 @@
 
 WaitingWidget::WaitingWidget(QWidget *parent):QWidget(parent){
 	m_ind=0;
+	colors[0]=QRgb(0xffddf756);
+	colors[1]=QRgb(0xffccf756);
+	colors[2]=QRgb(0xffbbf756);
+	colors[3]=QRgb(0xffaaf756);
+	colors[4]=QRgb(0xff99f756);
+	colors[5]=QRgb(0xff88f756);
+	colors[6]=QRgb(0xff77f756);
+	colors[7]=QRgb(0xff66f756); 
 }
 
 void WaitingWidget::paintEvent(QPaintEvent *event){
@@ -32,35 +40,24 @@
 	}
 }
 void WaitingWidget::draw(QPainter *painter){
-	QColor color1(QRgb(0xffdbf756));
-	QColor color2 = color1;
-	color1.setAlpha(80);
-	painter->setPen(QPen(palette().foreground(),1,Qt::NoPen,Qt::RoundCap));
 
-	int rectsize = this->width()/20;
-	for(int i=0;i<=20;i++){
-		if((i+m_ind)%2){
-			painter->setBrush(QBrush(color1, Qt::SolidPattern));
-		}
-		else{
-			painter->setBrush(QBrush(Qt::white, Qt::SolidPattern));	
-		}
-		painter->drawRect(i*rectsize,0,this->width(), this->height());
+	QColor color1(QRgb(0x000000));
+	color1.setAlpha(60);
+	painter->setBrush(QBrush(color1, Qt::SolidPattern));
+	painter->drawRect(0,0,this->width(), this->height());
+
+
+	int xm = this->width()/2;
+	int ym = this->height()/2;
+	painter->translate(xm,ym);
+	for(int i=0; i < 8; i++){
+		QColor penColor(colors[(m_ind+i)%8]);
+		penColor.setAlpha(180);
+		painter->setPen(QPen(penColor,8,Qt::SolidLine,Qt::RoundCap));
+		float angle = (360.0f/8.0f);
+		painter->rotate(-angle);
+		painter->drawLine(20,0,35,0);
 	}
-
-	/*QLinearGradient rectRadian(0,0,this->width(),0);
-
-	for(int i=0;i<10;i++){
-		if((i+m_ind)%2){
-			rectRadian.setColorAt(0.1*i,color1);
-		}
-		else{
-			rectRadian.setColorAt(0.1*i,color2);	
-		}
-	}
-	painter->setPen(QPen(palette().foreground(),1,Qt::NoPen,Qt::RoundCap));
-	painter->setBrush(rectRadian);
-	painter->drawRect(0,0,this->width(), this->height());*/
 }
 
 
@@ -68,14 +65,14 @@
 {
     timer.stop();
     if (animate)
-        timer.start(200, this);
+        timer.start(50, this);
 }
 
 void WaitingWidget::timerEvent(QTimerEvent *e)
 {
     if (e->timerId() == timer.timerId()) {
         setUpdatesEnabled(false);
-		m_ind++;
+		m_ind = (m_ind+1)%8;
         setUpdatesEnabled(true);
         update();
     }
--- a/widgets/WaitingWidget.h	Wed Feb 06 16:45:36 2008 +0000
+++ b/widgets/WaitingWidget.h	Thu Feb 07 15:15:52 2008 +0000
@@ -33,10 +33,11 @@
 	void paintEvent(QPaintEvent *event);
 	void draw(QPainter *painter);
     void timerEvent(QTimerEvent *e);
-
-private:
+	
+private :
 	int m_ind;
 	QBasicTimer timer;
+	QRgb colors[8];
 
 };