diff options
Diffstat (limited to 'libLumina')
-rw-r--r-- | libLumina/LuminaOS-Debian.cpp | 17 | ||||
-rw-r--r-- | libLumina/LuminaOS-Linux.cpp | 11 |
2 files changed, 25 insertions, 3 deletions
diff --git a/libLumina/LuminaOS-Debian.cpp b/libLumina/LuminaOS-Debian.cpp index aad65ece..f1048347 100644 --- a/libLumina/LuminaOS-Debian.cpp +++ b/libLumina/LuminaOS-Debian.cpp @@ -195,12 +195,25 @@ int LOS::batterySecondsLeft(){ //Returns: estimated number of seconds remaining //File Checksums QStringList LOS::Checksums(QStringList filepaths){ //Return: checksum of the input file - return QStringList(); + QStringList info = LUtils::getCmdOutput("md5sum \""+filepaths.join("\" \"")+"\""); + for(int i=0; i<info.length(); i++){ + // first: md5sum: = error ; second: there's always one empty entry generated by getCmdOutput + if( info[i].startsWith("md5sum:") || info[i].isEmpty()){ info.removeAt(i); i--; } + else{ + //Strip out the extra information + info[i] = info[i].section(" ",0,0); + } + } + return info; } //file system capacity QString LOS::FileSystemCapacity(QString dir) { //Return: percentage capacity as give by the df command - return QString; + QStringList mountInfo = LUtils::getCmdOutput("df -h " + dir); + QString::SectionFlag skipEmpty = QString::SectionSkipEmpty; + //output: 200G of 400G available on /mount/point + QString capacity = mountInfo[1].section(" ",3,3, skipEmpty) + " of " + mountInfo[1].section(" ",1,1, skipEmpty) + " available on " + mountInfo[1].section(" ",5,5, skipEmpty); + return capacity; } #endif diff --git a/libLumina/LuminaOS-Linux.cpp b/libLumina/LuminaOS-Linux.cpp index ecf0adeb..9b4048d1 100644 --- a/libLumina/LuminaOS-Linux.cpp +++ b/libLumina/LuminaOS-Linux.cpp @@ -192,7 +192,16 @@ int LOS::batterySecondsLeft(){ //Returns: estimated number of seconds remaining //File Checksums QStringList LOS::Checksums(QStringList filepaths){ //Return: checksum of the input file - return QStringList(); + QStringList info = LUtils::getCmdOutput("md5sum \""+filepaths.join("\" \"")+"\""); + for(int i=0; i<info.length(); i++){ + // first: md5sum: = error ; second: there's always one empty entry generated by getCmdOutput + if( info[i].startsWith("md5sum:") || info[i].isEmpty()){ info.removeAt(i); i--; } + else{ + //Strip out the extra information + info[i] = info[i].section(" ",0,0); + } + } + return info; } //file system capacity |