[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/KDE/3.5/kdenetwork/kopete/kopete/chatwindow
From: Engin Aydogan <engin () bzzzt ! biz>
Date: 2005-09-25 13:17:39
Message-ID: 1127654259.682643.32767.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 463823 by engin:
Emoticon selector now pauses the QMovies in it when it is not shown. When user have \
many animated emoticons the emoticon selector was starting consuming CPU power once \
it's initiated untill the chatwindow is closed. Now emoticon selector only consumes \
CPU power when it's shown.
M +23 -0 emoticonselector.cpp
M +6 -1 emoticonselector.h
--- branches/KDE/3.5/kdenetwork/kopete/kopete/chatwindow/emoticonselector.cpp \
#463822:463823 @@ -28,6 +28,7 @@
#include <qlayout.h>
#include <qobjectlist.h>
#include <qtooltip.h>
+#include <qobjectlist.h>
#include <kdebug.h>
@@ -83,9 +84,11 @@
}
lay = new QGridLayout(this, 0, 0, 4, 4, "emoticonLayout");
+ movieList.clear();
for (QMap<QString, QString>::Iterator it = list.begin(); it != list.end(); ++it )
{
QWidget *w = new EmoticonLabel(it.key(), it.data(), this);
+ movieList.push_back( ((QLabel*)w)->movie() );
connect(w, SIGNAL(clicked(const QString&)), this, SLOT(emoticonClicked(const \
QString&))); // kdDebug(14000) << "adding Emoticon to row=" << row << ", col=" << \
col << "." << endl; lay->addWidget(w, row, col);
@@ -112,6 +115,26 @@
}
}
+void EmoticonSelector::hideEvent( QHideEvent* )
+{
+ kdDebug( 14000 ) << k_funcinfo << endl;
+ MovieList::iterator it;
+ for( it = movieList.begin(); it != movieList.end(); ++it )
+ {
+ (*it)->pause();
+ }
+}
+
+void EmoticonSelector::showEvent( QShowEvent* )
+{
+ kdDebug( 14000 ) << k_funcinfo << endl;
+ MovieList::iterator it;
+ for( it = movieList.begin(); it != movieList.end(); ++it )
+ {
+ (*it)->unpause();
+ }
+}
+
#include "emoticonselector.moc"
// vim: set noet ts=4 sts=4 sw=4:
--- branches/KDE/3.5/kdenetwork/kopete/kopete/chatwindow/emoticonselector.h \
#463822:463823 @@ -23,6 +23,8 @@
#include <qlabel.h>
#include <qwidget.h>
class QGridLayout;
+class QHideEvent;
+class QShowEvent;
class EmoticonLabel : public QLabel
{
@@ -40,7 +42,6 @@
QString mText;
};
-
class EmoticonSelector : public QWidget
{
Q_OBJECT
@@ -50,6 +51,7 @@
EmoticonSelector ( QWidget *parent = 0, const char *name = 0 );
// ~EmoticonSelector();
+ typedef QValueList<QMovie*> MovieList;
signals:
/**
* gets emitted when an emoticon has been selected from the list
@@ -61,6 +63,9 @@
void prepareList();
protected:
+ virtual void hideEvent( QHideEvent* );
+ virtual void showEvent( QShowEvent* );
+ MovieList movieList;
QGridLayout *lay;
protected slots:
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic