[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[vidalia-svn] r1403: Sorting log messages by timestamp is good. Keying a list off (trunk/src/gui/log)
Author: edmanm
Date: 2006-10-26 20:52:38 -0400 (Thu, 26 Oct 2006)
New Revision: 1403
Modified:
trunk/src/gui/log/logtreeitem.cpp
trunk/src/gui/log/logtreeitem.h
trunk/src/gui/log/logtreewidget.cpp
Log:
Sorting log messages by timestamp is good. Keying a list off it is not so good.
Modified: trunk/src/gui/log/logtreeitem.cpp
===================================================================
--- trunk/src/gui/log/logtreeitem.cpp 2006-10-26 19:36:20 UTC (rev 1402)
+++ trunk/src/gui/log/logtreeitem.cpp 2006-10-27 00:52:38 UTC (rev 1403)
@@ -122,3 +122,10 @@
return text(COL_MESG);
}
+/** Compare the given LogTreeItem to this object based on timestamp. */
+bool
+LogTreeItem::operator<(const QTreeWidgetItem &other) const
+{
+ return (this->timestamp() < ((LogTreeItem *)&other)->timestamp());
+}
+
Modified: trunk/src/gui/log/logtreeitem.h
===================================================================
--- trunk/src/gui/log/logtreeitem.h 2006-10-26 19:36:20 UTC (rev 1402)
+++ trunk/src/gui/log/logtreeitem.h 2006-10-27 00:52:38 UTC (rev 1403)
@@ -57,6 +57,8 @@
/** Returns a printable string representation of the item's contents.*/
QString toString();
+ /** Compare the given LogTreeItem to this object based on timestamp. */
+ virtual bool operator<(const QTreeWidgetItem &other) const;
};
#endif
Modified: trunk/src/gui/log/logtreewidget.cpp
===================================================================
--- trunk/src/gui/log/logtreewidget.cpp 2006-10-26 19:36:20 UTC (rev 1402)
+++ trunk/src/gui/log/logtreewidget.cpp 2006-10-27 00:52:38 UTC (rev 1403)
@@ -72,9 +72,9 @@
QList<LogTreeItem *>
LogTreeWidget::qlist_sort(QList<LogTreeItem *> inlist)
{
- QMap<QDateTime, LogTreeItem *> outlist;
+ QMap<LogTreeItem, LogTreeItem *> outlist;
foreach (LogTreeItem *item, inlist) {
- outlist.insert(item->timestamp(), item);
+ outlist.insert(*item, item);
}
return outlist.values();
}