diff options
-rw-r--r-- | libLumina/LuminaOS-Debian.cpp | 5 | ||||
-rw-r--r-- | libLumina/LuminaOS-DragonFly.cpp | 4 | ||||
-rw-r--r-- | libLumina/LuminaOS-FreeBSD.cpp | 5 | ||||
-rw-r--r-- | libLumina/LuminaOS-Linux.cpp | 5 | ||||
-rw-r--r-- | libLumina/LuminaOS-OpenBSD.cpp | 15 | ||||
-rw-r--r-- | libLumina/LuminaOS-kFreeBSD.cpp | 5 | ||||
-rw-r--r-- | libLumina/LuminaOS-template.cpp | 5 | ||||
-rw-r--r-- | libLumina/LuminaOS.h | 3 | ||||
-rw-r--r-- | lumina-fm/MainUI.cpp | 7 |
9 files changed, 50 insertions, 4 deletions
diff --git a/libLumina/LuminaOS-Debian.cpp b/libLumina/LuminaOS-Debian.cpp index 4f2032fa..aad65ece 100644 --- a/libLumina/LuminaOS-Debian.cpp +++ b/libLumina/LuminaOS-Debian.cpp @@ -198,4 +198,9 @@ QStringList LOS::Checksums(QStringList filepaths){ //Return: checksum of the inp return QStringList(); } +//file system capacity +QString LOS::FileSystemCapacity(QString dir) { //Return: percentage capacity as give by the df command + return QString; +} + #endif diff --git a/libLumina/LuminaOS-DragonFly.cpp b/libLumina/LuminaOS-DragonFly.cpp index 35bff04c..5fdd5e04 100644 --- a/libLumina/LuminaOS-DragonFly.cpp +++ b/libLumina/LuminaOS-DragonFly.cpp @@ -176,4 +176,8 @@ QStringList LOS::Checksums(QStringList filepaths){ //Return: checksum of the inp return QStringList(); } +//file system capacity +QString LOS::FileSystemCapacity(QString dir) { //Return: percentage capacity as give by the df command + return QString; +} #endif diff --git a/libLumina/LuminaOS-FreeBSD.cpp b/libLumina/LuminaOS-FreeBSD.cpp index d454ce22..c855d7a0 100644 --- a/libLumina/LuminaOS-FreeBSD.cpp +++ b/libLumina/LuminaOS-FreeBSD.cpp @@ -195,4 +195,9 @@ QStringList LOS::Checksums(QStringList filepaths){ //Return: checksum of the inp } return info; } + +//file system capacity +QString LOS::FileSystemCapacity(QString dir) { //Return: percentage capacity as give by the df command + return QString; +} #endif diff --git a/libLumina/LuminaOS-Linux.cpp b/libLumina/LuminaOS-Linux.cpp index 7587a29b..ab88b5d8 100644 --- a/libLumina/LuminaOS-Linux.cpp +++ b/libLumina/LuminaOS-Linux.cpp @@ -194,4 +194,9 @@ int LOS::batterySecondsLeft(){ //Returns: estimated number of seconds remaining QStringList LOS::Checksums(QStringList filepaths){ //Return: checksum of the input file return QStringList(); } + +//file system capacity +QString LOS::FileSystemCapacity(QString dir) { //Return: percentage capacity as give by the df command + return QString; +} #endif diff --git a/libLumina/LuminaOS-OpenBSD.cpp b/libLumina/LuminaOS-OpenBSD.cpp index b6996795..dc8df0a7 100644 --- a/libLumina/LuminaOS-OpenBSD.cpp +++ b/libLumina/LuminaOS-OpenBSD.cpp @@ -207,4 +207,19 @@ QStringList LOS::Checksums(QStringList filepaths){ //Return: checksum of the inp } return info; } + +//file system capacity +QString LOS::FileSystemCapacity(QString dir) { + // on OpenBSD, df has the following layout: + //>df /home/wi + //>Filesystem 512-blocks Used Avail Capacity Mounted on + //>/dev/sd2l 14334588 739900 12877960 5% /home + + QStringList mountInfo = LUtils::getCmdOutput("df " + dir); + QString::SectionFlag skipEmpty = QString::SectionSkipEmpty; + //we take the 5th word on the 2 line + QString capacity = mountInfo[1].section(" ",4,4, skipEmpty); + return capacity; +} + #endif diff --git a/libLumina/LuminaOS-kFreeBSD.cpp b/libLumina/LuminaOS-kFreeBSD.cpp index 16c8e6eb..b0c98abb 100644 --- a/libLumina/LuminaOS-kFreeBSD.cpp +++ b/libLumina/LuminaOS-kFreeBSD.cpp @@ -158,5 +158,10 @@ QStringList LOS::Checksums(QStringList filepaths){ //Return: checksum of the inp return QStringList(); } +//file system capacity +QString LOS::FileSystemCapacity(QString dir) { //Return: percentage capacity as give by the df command + return QString; +} + #endif #endif diff --git a/libLumina/LuminaOS-template.cpp b/libLumina/LuminaOS-template.cpp index c06b8b11..38e54816 100644 --- a/libLumina/LuminaOS-template.cpp +++ b/libLumina/LuminaOS-template.cpp @@ -106,4 +106,9 @@ QStringList LOS::Checksums(QStringList filepaths){ //Return: checksum of the inp return QStringList(); } +//file system capacity +QString LOS::FileSystemCapacity(QString dir) { //Return: percentage capacity as give by the df command + return QString; +} + #endif diff --git a/libLumina/LuminaOS.h b/libLumina/LuminaOS.h index 92a7dc7e..091a8d96 100644 --- a/libLumina/LuminaOS.h +++ b/libLumina/LuminaOS.h @@ -83,6 +83,9 @@ public: //Get the checksum for a file static QStringList Checksums(QStringList filepaths); //Return: checksum of each input file (same order) + + //Get the filesystem capacity + static QString FileSystemCapacity(QString dir) ; //Return: percentage capacity as give by the df command }; #endif diff --git a/lumina-fm/MainUI.cpp b/lumina-fm/MainUI.cpp index d445a9cd..1f5a65d0 100644 --- a/lumina-fm/MainUI.cpp +++ b/lumina-fm/MainUI.cpp @@ -469,12 +469,11 @@ void MainUI::setCurrentDir(QString dir){ if(isUserWritable){ ui->label_dir_stats->setText(""); } else{ ui->label_dir_stats->setText(tr("Limited Access Directory")); } + + //collect some statistics of dir and display them in statusbar QFileInfoList fileList = fsmod->rootDirectory().entryInfoList(); QString msgStatusBar = ItemsInstatusBar(fileList, tr("Items")); - //3 following lines should be in LOS - QStringList mountInfo = LUtils::getCmdOutput("df " + dir); - QString::SectionFlag skipEmpty = QString::SectionSkipEmpty; - QString capacity = mountInfo[1].section(" ",4,4, skipEmpty); + QString capacity = LOS::FileSystemCapacity(dir) ; if (msgStatusBar.isEmpty()) msgStatusBar += tr("Capacity: ") + capacity; else msgStatusBar += tr(", Capacity: ") + capacity; if (!msgStatusBar.isEmpty()) ui->statusbar->showMessage(msgStatusBar); |