-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

Imagine this situation:
- - Someone has a very large history
- - wants to search the history for the word "annoying"
- - he types "a" ..... waits some seconds for the history to redraw
- - he types "n" ..... waits some seconds for the history to redraw
- - he types "n" ..... waits some seconds for the history to redraw
- - he types "o" ..... waits some seconds for the history to redraw
- - he types "y" ..... waits some seconds for the history to redraw

you know what i'm talking about, right?

So i wrote a patch that uses a timer for the history filter.
After applying my patch it will be possible to type in the complete word 
"annoying" without having the history redraw after each character. this is 
because the history waits exactly one second after a keypress, then it 
redraws it.
if the user types something within the second, the timer is beeing resetted 
and it starts from beginning waiting another second for the user being idle.

Hope you like it :-)

Thomas

- -- 
You are confused; but this is your normal state.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE9zV7g+83LmoKU5MARAqseAJ98/3RVeKPiB/ppnkqlGA/CyAMZmQCeKE6W
apkMpXUzMKFqfcjhdGjkYq4=
=wVQE
-----END PGP SIGNATURE-----
Index: licq/plugins/qt-gui/src/userinfodlg.cpp
===================================================================
RCS file: /cvsroot/licq/qt-gui/src/userinfodlg.cpp,v
retrieving revision 1.58
diff -u -3 -p -r1.58 userinfodlg.cpp
--- licq/plugins/qt-gui/src/userinfodlg.cpp	5 Nov 2002 06:26:02 -0000	1.58
+++ licq/plugins/qt-gui/src/userinfodlg.cpp	9 Nov 2002 19:08:03 -0000
@@ -36,6 +36,7 @@
 #include <qprogressbar.h>
 #include <qapplication.h>
 #include <qtextcodec.h>
+#include <qtimer.h>
 
 #include "licq_countrycodes.h"
 #include "licq_events.h"
@@ -132,6 +133,10 @@ UserInfoDlg::UserInfoDlg(CICQDaemon *s, 
   l->addWidget(btnMain4);
   btnMain4->setDefault(true);
 
+	// prepare the timer for the history filter
+	timer = new QTimer( this, "history_filterTimer");
+	connect( timer, SIGNAL(timeout()), this, SLOT(ShowHistory()));
+
   ICQUser *u = gUserManager.FetchUser(m_nUin, LOCK_R);
   if (u == NULL)
   {
@@ -969,9 +974,24 @@ void UserInfoDlg::CreateHistory()
   l->addWidget(lblFilter);
   l->addWidget(lneFilter, 1);
   l->addSpacing(50);
-  connect(lneFilter, SIGNAL(textChanged(const QString&)), this, SLOT(ShowHistory()));
+  connect(lneFilter, SIGNAL(textChanged(const QString&)), this, SLOT(slot_showHistoryTimer()));
   barFiltering = new QProgressBar(p);
   l->addWidget(barFiltering, 1);
+}
+
+/*!	\brief Resets and restarts the timeout for the History Filter
+ *	
+ *	Everytime this slot is called, the timer for the history filter 
+ *	is beeing restarted.
+ *	The timeout is set to 1000ms. 
+ *	This slot is called everytime the user changes the filter 
+ *	string in the history tab. After 1sec of being idle, the filter is beeing 
+ *	invoked because SIGNAL(timeout()) is connected to ShowHistory().
+*/
+void UserInfoDlg::slot_showHistoryTimer()
+{
+	timer->stop();
+	timer->start( 1000, true);
 }
 
 void UserInfoDlg::SetupHistory()
Index: licq/plugins/qt-gui/src/userinfodlg.h
===================================================================
RCS file: /cvsroot/licq/qt-gui/src/userinfodlg.h,v
retrieving revision 1.17
diff -u -3 -p -r1.17 userinfodlg.h
--- licq/plugins/qt-gui/src/userinfodlg.h	21 Aug 2002 00:06:56 -0000	1.17
+++ licq/plugins/qt-gui/src/userinfodlg.h	9 Nov 2002 19:08:03 -0000
@@ -160,6 +160,7 @@ protected slots:
   void doneFunction(ICQEvent*);
   void resetCaption();
   void ShowUsermenu() { gMainWindow->SetUserMenuUin(m_nUin); }
+	void slot_showHistoryTimer();
 
 signals:
   void finished(unsigned long);
@@ -167,6 +168,7 @@ signals:
 
 private:
   static bool chkContains(const char* text, const char* filter, int filterlen);
+	QTimer *timer;
 };
 
 #endif

Reply via email to