[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kopete-devel
Subject:    [kopete-devel] patch: Movies in the chat window
From:       Aleix <aleixpol () gmail ! com>
Date:       2008-09-20 13:53:58
Message-ID: 757d9a550809200653kc4a9f7s1d6324b8b4255053 () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hi list,
there was a toolbar icon that tells the user if the message has arrived
properly.

I was checking the code and looked like it was not ported to qt/kde4 so i've
removed the #if 0 and changed it back again.

I wanted to commit but I thought I'd better show it to you before :P

Thanks,
Aleix

[Attachment #5 (text/html)]

<div dir="ltr">Hi list,<br>there was a toolbar icon that tells the user if the \
message has arrived properly.<br><br>I was checking the code and looked like it was \
not ported to qt/kde4 so i&#39;ve removed the #if 0 and changed it back again.<br> \
<br>I wanted to commit but I thought I&#39;d better show it to you before \
:P<br><br>Thanks,<br>Aleix<br></div>


["chatwindowmovies-kopete.patch" (text/x-patch)]

Index: kopete/chatwindow/kopetechatwindow.cpp
===================================================================
--- kopete/chatwindow/kopetechatwindow.cpp	(revision 862959)
+++ kopete/chatwindow/kopetechatwindow.cpp	(working copy)
@@ -319,6 +319,7 @@
 
 	delete backgroundFile;
 	delete anim;
+	delete animIcon;
 }
 
 void KopeteChatWindow::windowListChanged()
@@ -476,20 +477,15 @@
 
 	//The Sending movie
 	normalIcon = QPixmap( BarIcon( QLatin1String( "kopete" ) ) );
-#if 0
-	animIcon = KGlobal::iconLoader()->loadMovie( QLatin1String( "newmessage" ), KIconLoader::Toolbar);
 
-	// Pause the animation because otherwise it's running even when we're not
-	// showing it. This eats resources, and also triggers a pixmap leak in
-	// QMovie in at least Qt 3.1, Qt 3.2 and the current Qt 3.3 beta
-	if( !animIcon.isNull() )  //and another QT bug:  it crash if we pause a null movie
-		animIcon.pause();
-#endif
 	// we can't set the tool bar as parent, if we do, it will be deleted when we configure toolbars
 	anim = new QLabel( QString::null, 0L );	//krazy:exclude=nullstrassign for old broken gcc
 	anim->setObjectName( QLatin1String("kde toolbar widget") );
 	anim->setMargin(5);
 	anim->setPixmap( normalIcon );
+	
+	animIcon = KIconLoader::global()->loadMovie( QLatin1String( "newmessage" ), KIconLoader::Toolbar);
+	animIcon->setPaused(true);
 
 	KAction *animAction = new KAction( i18n("Toolbar Animation"), coll );
         coll->addAction( "toolbar_animation", animAction );
@@ -519,8 +515,8 @@
 	if( view == m_activeView )
 	{
 		anim->setPixmap( normalIcon );
-		if( animIcon.state() == QMovie::Running )
-			animIcon.setPaused( true );
+		if( animIcon->state() == QMovie::Running )
+			animIcon->setPaused( true );
 	}
 }
 
@@ -918,19 +914,18 @@
 	//Update icons to match
 	slotUpdateCaptionIcons( m_activeView );
 
-#if 0
-	if ( m_activeView->sendInProgress() && !animIcon.isNull() )
+	if ( m_activeView->sendInProgress() && animIcon )
 	{
-		anim->setMovie( &animIcon );
-		animIcon.unpause();
+		anim->setMovie( animIcon );
+		animIcon->setPaused(false);
 	}
 	else
 	{
 		anim->setPixmap( normalIcon );
-		if( !animIcon.isNull() )
-			animIcon.pause();
+		if( animIcon )
+			animIcon->setPaused(true);
 	}
-#endif
+	
 	if ( m_alwaysShowTabs || chatViewList.count() > 1 )
 	{
 		if( !m_tabBar )
@@ -1003,13 +998,11 @@
 {
 	if ( m_activeView && m_activeView->canSend() )
 	{
-#if 0
-		if( !animIcon.isNull() )
+		if( animIcon )
 		{
-			anim->setMovie( &animIcon );
-			animIcon.unpause();
+			anim->setMovie( animIcon );
+			animIcon->setPaused(false);
 		}
-#endif
 		m_activeView->sendMessage();
 	}
 }
Index: kopete/chatwindow/kopetechatwindow.h
===================================================================
--- kopete/chatwindow/kopetechatwindow.h	(revision 862959)
+++ kopete/chatwindow/kopetechatwindow.h	(working copy)
@@ -147,7 +147,7 @@
 	QVBoxLayout *mainLayout;
 	QFrame *mainArea;
 	QLabel *anim;
-	QMovie animIcon;
+	QMovie* animIcon;
 	QPixmap normalIcon;
 
 	KAction *chatSend;


_______________________________________________
kopete-devel mailing list
kopete-devel@kde.org
https://mail.kde.org/mailman/listinfo/kopete-devel


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic