Function mosaic::session_entry_newer#
Defined in File session_name.hpp
Function Documentation#
-
bool mosaic::session_entry_newer(const QDateTime &aStart, const QString &aName, const QDateTime &bStart, const QString &bName)#
“Newest first”, for SessionInfo::list_all() and the two places that merge several directories’ worth of sessions together.
Sessions were previously ordered by folder name reversed, which was only ever accidentally chronological: “yyyy-MM-dd_hh-mm-ss” happens to sort lexicographically the same way it sorts in time. A “sub-” prefix destroys that coincidence and would silently reorder both browsers by subject, so ordering now uses the recorded start time, which is what “newest first” always meant.
Takes the two fields it compares rather than a SessionInfo, because session_info.hpp must include this header to call it — passing the struct would close that into an include cycle.
A session whose start time is missing or unparseable sorts last: it is a damaged session, and burying it beats interleaving it at an arbitrary point. Ties break on name descending so the order is total and stable — std::sort with an inconsistent comparator is undefined behaviour, not just a wrong order.