From 3fb9f6fdad018a4a150ef2739730e73e6ed8bf22 Mon Sep 17 00:00:00 2001 From: Arno Date: Thu, 30 Dec 2010 16:47:46 +0100 Subject: Enhance filters in SeriesTreeWidget a little more Allow operators in filter. Operators are only valid if it's a NumericQuery. Operators are <>=. Also allow postfixes for numbers: k, m, g for kilobytes, megabytes and gigabytes. Also fix a little usability bug when filtering. If the result set was empty, the root item was collapsed. On the next search with a result, the root item was still collapsed. Since it wasn't shown there was no way to expand it. --- helper.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'helper.cpp') diff --git a/helper.cpp b/helper.cpp index 6cb5cd2..26044fa 100644 --- a/helper.cpp +++ b/helper.cpp @@ -167,6 +167,19 @@ namespace Helper { return retval; } + QVariant bytesFromUnit(QVariant number, const QString unit){ + QString u = unit.toLower(); + quint64 retval = number.toULongLong(); + if(u == "k"){ + retval = retval * 1024; + }else if(u == "m"){ + retval = retval * 1024 * 1024; + }else if(u == "g"){ + retval = retval * 1024 * 1024 * 1024; + } + return retval; + } + bool SortFileInfoList::operator ()(const QFileInfo &lhs, const QFileInfo &rhs) const { return lhs.fileName().toLower() < rhs.fileName().toLower(); } -- cgit v1.2.3-70-g09d2