[prev in list] [next in list] [prev in thread] [next in thread]
List: licq-devel
Subject: [Licq-devel] [PATCH] Showing/reloading History speedup
From: Thomas Reitelbach <thomas () licq ! org>
Date: 2002-11-16 21:02:20
[Download RAW message or body]
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hello again,
the timer for the filter was a nice thing.
Here comes another speedup to the history :-)
The history is redrawn 50 times when it's reloaded/filtered because after each
processed event the text is appended to the visible view of the history.
My patch prepares the complete history into a temporary variable without
updating the visible view and when all events have been processed, the
complete thing is shown in one single step.
So we have the history window redraw only once and not 50 times, which will
make it _much_ faster :-)
Jon: If you decide to apply this patch, please be aware:
There is a line where i added a "<br>", this is no mistake! the append()
methods for QString and QMultilineEdit work differently, so this is needed,
otherwise we would mess up the empty lines between events. In QT2 it works
again differently, that's why i did not add the <br> there.
Hope you like it :)
Thomas
- --
Do something unusual today. Pay a bill.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
iD8DBQE91rJc+83LmoKU5MARAm5GAJ9MF1RtqmOgOHiroyNKa1H4aCmNwQCfcRmX
b74ZpWgOdhI8RPk/WzJEp9U=
=XjFR
-----END PGP SIGNATURE-----
["licq-historyspeedup.diff" (text/x-diff)]
Index: licq/plugins/qt-gui/src/userinfodlg.cpp
===================================================================
RCS file: /cvsroot/licq/qt-gui/src/userinfodlg.cpp,v
retrieving revision 1.61
diff -u -3 -p -r1.61 userinfodlg.cpp
--- licq/plugins/qt-gui/src/userinfodlg.cpp 12 Nov 2002 15:30:15 -0000 1.61
+++ licq/plugins/qt-gui/src/userinfodlg.cpp 16 Nov 2002 20:53:14 -0000
@@ -1107,7 +1107,6 @@ void UserInfoDlg::ShowHistory()
// Last check (should never be true)
if (m_lHistoryList.size() == 0) return;
HistoryListIter tempIter;
- mlvHistory->clear();
if(m_bHistoryReverse)
{
@@ -1119,6 +1118,7 @@ void UserInfoDlg::ShowHistory()
tempIter = m_iHistorySIter;
}
QString s;
+ QString tmp;
QDateTime date;
m_nHistoryShowing = 0;
QString contactName = tr("server");
@@ -1147,7 +1147,7 @@ void UserInfoDlg::ShowHistory()
#if QT_VERSION >= 300
const char *color = (*tempIter)->Direction() == D_RECEIVER ? "red" : "blue";
- s.sprintf("<font color=\"%s\"><b>%s<br>%s [%c%c%c%c]</b></font><br>",
+ s.sprintf("<font color=\"%s\"><b>%s<br>%s [%c%c%c%c]</b></font><br><br>",
color,
((*tempIter)->Direction() == D_RECEIVER ? tr("%1 from %2") : tr("%1 to %2"))
.arg(EventDescription(*tempIter)).arg(QStyleSheet::escape(contactName)).utf8().data(),
@@ -1157,15 +1157,15 @@ void UserInfoDlg::ShowHistory()
(*tempIter)->IsUrgent() ? 'U' : '-',
(*tempIter)->IsEncrypted() ? 'E' : '-'
);
- mlvHistory->append(s);
+ tmp.append(s);
// We break the paragraph here, since the history text
// could be in a different BiDi directionality than the
// header and timestamp text.
- s.sprintf("<font color=\"%s\">%s</font><br>",
+ s.sprintf("<font color=\"%s\">%s</font><br><br>",
color,
MLView::toRichText(messageText, true).utf8().data()
);
- mlvHistory->append(s);
+ tmp.append(s);
#else
// See CHistoryWidget::paintCell for reference on those Qt 2-only
// formatting escape codes.
@@ -1181,7 +1181,7 @@ void UserInfoDlg::ShowHistory()
(*tempIter)->IsEncrypted() ? 'E' : '-',
messageText.utf8().data()
);
- mlvHistory->append(s); // adds a paragraph break
+ tmp.append(s); // adds a paragraph break
#endif
m_nHistoryShowing++;
barFiltering->setProgress(m_nHistoryShowing);
@@ -1217,6 +1217,8 @@ void UserInfoDlg::ShowHistory()
.arg(COLOR_RECEIVED).arg(COLOR_SENT)
.arg(m_nHistoryShowing)
.arg(m_lHistoryList.size()));
+ mlvHistory->clear();
+ mlvHistory->append(tmp);
if(!m_bHistoryReverse)
mlvHistory->GotoEnd();
else
-------------------------------------------------------
This sf.net email is sponsored by: To learn the basics of securing
your web site with SSL, click here to get a FREE TRIAL of a Thawte
Server Certificate: http://www.gothawte.com/rd524.html
_______________________________________________
Licq-devel mailing list
Licq-devel@licq.org
https://lists.sourceforge.net/lists/listinfo/licq-devel
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic