diff options
author | Ken Moore <ken@pcbsd.org> | 2015-05-21 15:27:33 -0400 |
---|---|---|
committer | Ken Moore <ken@pcbsd.org> | 2015-05-21 15:27:33 -0400 |
commit | 952da97e1338852c8d5eeba380d2244a1f433edf (patch) | |
tree | 00296866beb820d6491abc6f33f1d2b0bba151b9 /libLumina/LuminaUtils.cpp | |
parent | Remove the extra painting check/update routine for the system tray - send it ... (diff) | |
download | lumina-952da97e1338852c8d5eeba380d2244a1f433edf.tar.gz lumina-952da97e1338852c8d5eeba380d2244a1f433edf.tar.bz2 lumina-952da97e1338852c8d5eeba380d2244a1f433edf.zip |
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.
Diffstat (limited to 'libLumina/LuminaUtils.cpp')
-rw-r--r-- | libLumina/LuminaUtils.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
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<labs.length(); i++){ + if(lab==labs[i]){ break; }//already at the right units - break out + N = N*1024.0; //Move to the next unit of measurement + } + return N; +} + QStringList LUtils::listFavorites(){ static QStringList fav; static QDateTime lastRead; |