summaryrefslogtreecommitdiffstats
path: root/helper.cpp
diff options
context:
space:
mode:
authorArno <am@disconnect.de>2010-12-30 16:47:46 +0100
committerArno <am@disconnect.de>2010-12-30 16:47:46 +0100
commit3fb9f6fdad018a4a150ef2739730e73e6ed8bf22 (patch)
tree2034348e29a5f31ec5d1a4af1db3c1184b59757d /helper.cpp
parent3c508cad0032f46be56279f3a3ab5a7df9128bef (diff)
downloadSheMov-3fb9f6fdad018a4a150ef2739730e73e6ed8bf22.tar.gz
SheMov-3fb9f6fdad018a4a150ef2739730e73e6ed8bf22.tar.bz2
SheMov-3fb9f6fdad018a4a150ef2739730e73e6ed8bf22.zip
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.
Diffstat (limited to 'helper.cpp')
-rw-r--r--helper.cpp13
1 files changed, 13 insertions, 0 deletions
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();
}