From 952da97e1338852c8d5eeba380d2244a1f433edf Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 21 May 2015 15:27:33 -0400 Subject: Add a few new functions to LuminaOS: 1) CPUTemperatures() 2) CPUUsagePercent() 3) MemoryUsagePercent() These functions have been filled out for the LuminaOS-FreeBSD implementation, but not for any of the others yet. The FreeBSD implementation has also not been tested yet. Also add a new "DisplayNumberToBytes()" function into LuminaUtils for converting sizes in a string format (50M or 50MB for example) into a double with the number of bytes for calculations. --- libLumina/LuminaUtils.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'libLumina/LuminaUtils.cpp') diff --git a/libLumina/LuminaUtils.cpp b/libLumina/LuminaUtils.cpp index cbf3b382..f1c007f0 100644 --- a/libLumina/LuminaUtils.cpp +++ b/libLumina/LuminaUtils.cpp @@ -146,6 +146,22 @@ void LUtils::LoadTranslation(QApplication *app, QString appname){ QTextCodec::setCodecForLocale( QTextCodec::codecForName(langEnc.toUtf8()) ); } +double LUtils::DisplaySizeToBytes(QString num){ + num = num.toLower().simplified(); + if(num.endsWith("b")){ num.chop(1); } //remove the "bytes" marker (if there is one) + QString lab = "b"; + if(!num[num.size()-1].isNumber()){ + lab = num.right(1); num.chop(1); + } + double N = num.toDouble(); + QStringList labs; labs <<"b"<<"k"<<"m"<<"g"<<"t"<<"p"; //go up to petabytes for now + for(int i=0; i